1515#import < objc/runtime.h>
1616
1717@interface FLEXSQLCommandExecutionViewController ()
18- @property (nonatomic ) UITextView* textView;
19- @property (nonatomic ) UIButton* submitButton;
20- @property (nonatomic ) UILabel* statusLabel;
18+ @property (nonatomic ) UITextView * textView;
19+ @property (nonatomic ) UIButton * submitButton;
20+ @property (nonatomic ) UILabel * statusLabel;
2121@end
2222
2323@implementation FLEXSQLCommandExecutionViewController
@@ -39,30 +39,30 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
3939- (void )addOtherUIElementsAndPositionThem {
4040 if (textView == nil ) {
4141 textView = [UITextView new ];
42- textView.backgroundColor = [UIColor colorWithWhite: 0.9 alpha: 1.0 ];
42+ textView.backgroundColor = [UIColor colorWithWhite: 0.9 alpha: 1.0 ];
4343 textView.textColor = [UIColor blackColor ];
4444
45- [self .view addSubview: textView];
45+ [self .view addSubview: textView];
4646 }
4747
4848 if (submitButton == nil ) {
4949 submitButton = [UIButton new ];
5050
51- [submitButton setTitleColor: [UIColor blueColor ] forState: UIControlStateNormal];
52- [submitButton setBackgroundColor: [UIColor colorWithWhite: 0.9 alpha: 1.0 ]];
51+ [submitButton setTitleColor: [UIColor blueColor ] forState: UIControlStateNormal];
52+ [submitButton setBackgroundColor: [UIColor colorWithWhite: 0.9 alpha: 1.0 ]];
5353
54- [submitButton setTitle: @" Submit" forState: UIControlStateNormal];
55- [submitButton addTarget: self action: @selector (submitPressed ) forControlEvents: UIControlEventTouchUpInside];
54+ [submitButton setTitle: @" Submit" forState: UIControlStateNormal];
55+ [submitButton addTarget: self action: @selector (submitPressed ) forControlEvents: UIControlEventTouchUpInside];
5656
57- [self .view addSubview: submitButton];
57+ [self .view addSubview: submitButton];
5858 }
5959
6060 if (statusLabel == nil ) {
6161 statusLabel = [UILabel new ];
6262
6363 statusLabel.textAlignment = NSTextAlignmentCenter;
6464 statusLabel.textColor = [UIColor blackColor ];
65- [self .view addSubview: statusLabel];
65+ [self .view addSubview: statusLabel];
6666 }
6767
6868 self.view .backgroundColor = [UIColor whiteColor ];
@@ -83,25 +83,25 @@ - (void)submitPressed {
8383 NSString * text = textView.text == nil ? @" " : textView.text ;
8484
8585 if (isSelectionType) {
86- NSString * errorString;
87- NSArray <NSDictionary <NSString *, id > *> *responce = [self . dbManager executeSelectionQuery: text and: &errorString];
86+ NSString * errorString;
87+ NSArray <NSDictionary <NSString *, id > *> *responce = [dbManager executeSelectionQuery: text error: &errorString];
8888
8989 if (responce == nil ) {
90- [self presentOnErrorAlert: errorString];
90+ [self presentOnErrorAlert: errorString];
9191 return ;
9292 }
9393
9494 NSMutableArray <NSString *> *tables = [NSMutableArray <NSString *> new];
9595
9696 for (NSDictionary <NSString *, id > *dict in responce) {
9797 for (NSString *key in [dict allKeys ]) {
98- if ([tables containsObject: key] == false ) {
99- [tables addObject: key];
98+ if ([tables containsObject: key] == false ) {
99+ [tables addObject: key];
100100 }
101101 }
102102 }
103103
104- FLEXTableContentViewController *contentViewController = [[ FLEXTableContentViewController alloc ] init ];
104+ FLEXTableContentViewController *contentViewController = [FLEXTableContentViewController new ];
105105
106106 contentViewController.contentsArray = responce;
107107 contentViewController.columnsArray = [tables copy ];
@@ -110,7 +110,7 @@ - (void)submitPressed {
110110
111111 [self .navigationController pushViewController: contentViewController animated: YES ];
112112 } else {
113- NSString * errorMessage = [self .dbManager executeNonSelectQuery: text];
113+ NSString * errorMessage = [self .dbManager executeNonSelectQuery: text];
114114
115115 statusLabel.text = errorMessage == nil ? @" SUCCESS" : errorMessage;
116116 }
@@ -119,15 +119,15 @@ - (void)submitPressed {
119119
120120- (void )presentOnErrorAlert : (NSString *)message
121121{
122- UIAlertController * alert = [UIAlertController
122+ UIAlertController *alert = [UIAlertController
123123 alertControllerWithTitle: @" SQL Execution error !!!"
124- message: message
124+ message: message
125125 preferredStyle: UIAlertControllerStyleAlert];
126126
127- UIAlertAction* okButton = [UIAlertAction
127+ UIAlertAction * okButton = [UIAlertAction
128128 actionWithTitle: @" Ok"
129129 style: UIAlertActionStyleDestructive
130- handler: nil ];
130+ handler: nil ];
131131
132132 [alert addAction: okButton];
133133 [self presentViewController: alert animated: YES completion: nil ];
0 commit comments