-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability to run sql queries on sqlite files #294
Conversation
There's a lot of changes here. so when I have time, I'm going to review this on my machine and clean up the commit history a bit. I do want to merge this eventually though! |
Great |
Edit: I have access to |
e33308b
to
993c84e
Compare
Okay, I got everything squashed into a single commit on master and properly rebased. After looking over your code, it doesn't match our coding conventions. Can you go through each of the files you've added or changed and make sure you're following the style set out in this codebase? Some examples:
Also, what's |
Ok - I'll fix code style |
62d8526
to
ac00197
Compare
return error; | ||
} | ||
|
||
- (NSArray<NSDictionary<NSString *, id> *> *)executeSelectionQuery: (NSString *)sql and: (NSString **)error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- (NSArray<NSDictionary<NSString *, id> *> *)executeSelectionQuery: (NSString *)sql and: (NSString **)error { | |
- (NSArray<NSDictionary<NSString *, id> *> *)executeSelectionQuery:(NSString *)sql and:(NSString **)error { |
Make sure you correct the spacing of method declarations
} | ||
return self; | ||
} | ||
|
||
- (void)viewWillAppear: (BOOL)animated { | ||
[super viewWillAppear: animated]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[super viewWillAppear: animated]; | |
[super viewWillAppear:animated]; |
|
||
[alertController addAction: executeAction]; | ||
[alertController addAction: selectAction]; | ||
[alertController addAction: cancelAction]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[alertController addAction: cancelAction]; | |
[alertController addAction:cancelAction]; |
Spacing on all three of these lines
|
||
- (void)submitPressed | ||
{ | ||
NSString *text = self.textView.text == nil ? @"" : self.textView.text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NSString *text = self.textView.text == nil ? @"" : self.textView.text; | |
NSString *text = self.textView.text ?: @""; |
Shorthand ternary syntax is preferred for clarity; it's similar to Swift's ??
nil coalescing operator
NSMutableDictionary<NSString *, id> *dict = [NSMutableDictionary dictionaryWithCapacity:num_cols]; | ||
|
||
int columnCount = sqlite3_column_count(pstmt); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid excess whitespace, group lines together logically
actionWithTitle: @"Execute SQL" | ||
style: UIAlertActionStyleDefault | ||
handler: ^(UIAlertAction *action) { | ||
FLEXSQLCommandExecutionViewController* controller = [FLEXSQLCommandExecutionViewController new]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FLEXSQLCommandExecutionViewController* controller = [FLEXSQLCommandExecutionViewController new]; | |
FLEXSQLCommandExecutionViewController *controller = [FLEXSQLCommandExecutionViewController new]; |
There are still a lot of these
NSString *columnName = [NSString stringWithUTF8String:sqlite3_column_name(pstmt, columnIdx)]; | ||
id objectValue = [self objectForColumnIndex:columnIdx stmt:pstmt]; | ||
|
||
[dict setObject:objectValue forKey:columnName]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[dict setObject:objectValue forKey:columnName]; | |
dict[columnName] = objectValue; |
Use subscripting syntax wherever possible
I left some comments, there's a lot you missed 😅 I didn't mark them all, just a bunch I found. Also, before you go any further, make sure your HEAD is at |
Fixed comments you made - fixed, were could found. |
@revolter Can you tell me what this macro and code segment is for? 😅I'm trying to decipher some of this old code, I've never used the sqlite APIs |
That macro is set by the SQLCipher pod and the code is used to decrypt a crypted database after opening it, or else any query would fail. |
Thanks! I'm trying to add comments to these files |
@LesykMelnychuk Can I ask why you added I've read the code more thoroughly now and there seems to be a lot of duplication now. At the very least, would you be able to make those two methods call into |
@NSExceptional Hi, cause |
Your |
Understud, - fixed. |
Hello @NSExceptional , can you please merge this pull ? |
Hey @LesykMelnychuk, This PR isn't in a state where I'm ready to merge it. I have a fork of your branch I started working on a while back but I got sidetracked and it fell off my todo list. I will try to get it done and merged this week. (At the moment I don't even remember what I was working on specifically, probably adding comments or something.) |
@revolter @LesykMelnychuk I'm currently in the process of rebasing and resolving conflicts between this branch and the 4.0 branch, should have it done tomorrow sometime |
Accidentally named the branch |
Are you saying @LesykMelnychuk somehow included #305 in this original PR, and that I unknowingly discarded it when I made my changes and merged this just now? |
Oooh, it was probably incorrectly rebased. Now it's ok, sorry I didn't check again, today. So it's all good 👍 |
I'm so confused :P What's wrong? |
I am what's wrong 😆 Sorry for the confusion, and completely disregard this conversation. As I said, everything is ok 😃 |
Added ability to run execution and selection sql queries during sqlite db exploration.