-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSQLUtility.m
More file actions
40 lines (31 loc) · 1.42 KB
/
SQLUtility.m
File metadata and controls
40 lines (31 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// utility.m
// PTE_Mac
//
// Created by Paul Freshney on 19/07/2017.
//
//
#import <Foundation/Foundation.h>
#import "SQLUtility.h"
@implementation SQLUtility
+ (NSString *) getSQLFind:(NSInteger)criteria with:(NSString *)filter {
switch (criteria)
{
case 0:
return [NSString stringWithFormat:@"SELECT pteWord, pteLink, pteTitle, pteType FROM pteIndex WHERE (pteWord LIKE \"%%%@%%\");", filter];
break;
case 1:
return [NSString stringWithFormat:@"SELECT pteName, pteFormulaF, pteFormula, pteCAS, pteOther1, pteOther2, pteOther3, pteOther4, pteOther5, pteOther6 FROM pteCompound WHERE (pteName LIKE \"%%%@%%\") OR (pteFormula LIKE \"%%%@%%\") OR (pteOther1 LIKE \"%%%@%%\") OR (pteOther2 LIKE \"%%%@%%\") OR (pteOther3 LIKE \"%%%@%%\") OR (pteOther4 LIKE \"%%%@%%\") OR (pteOther5 LIKE \"%%%@%%\") OR (pteOther6 LIKE \"%%%@%%\");", filter, filter, filter, filter, filter, filter, filter, filter];
break;
case 2:
return [NSString stringWithFormat:@"SELECT pteName, pteSymbol, pteValue, pteUnits, pteUncer FROM pteContants WHERE pteName LIKE \"%%%@%%\";", filter];
break;
case 3:
return [NSString stringWithFormat:@"SELECT pteName, pteTitle FROM pteEquation WHERE (pteTitle LIKE \"%%%@%%\");", filter];
break;
default:
return @"";
break;
}
}
@end