Manos Chorianopoulos

logout db drop table issue fixed

...@@ -719,6 +719,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -719,6 +719,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
719 while ([accessTokenSet next]) { 719 while ([accessTokenSet next]) {
720 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue]; 720 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue];
721 } 721 }
722 + [accessTokenSet close];
722 } 723 }
723 } 724 }
724 @catch (NSException *exception) { 725 @catch (NSException *exception) {
...@@ -739,27 +740,28 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -739,27 +740,28 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
739 }; 740 };
740 741
741 - (NSString*)getAccessToken2 { 742 - (NSString*)getAccessToken2 {
742 - BOOL tableExist = NO; 743 +// BOOL tableExist = NO;
743 - @try { 744 +// @try {
744 - @synchronized (_DatabaseLock) { 745 +// @synchronized (_DatabaseLock) {
745 - tableExist = [_db tableExists:@"requestVariables"]; 746 +// tableExist = [_db tableExists:@"requestVariables"];
746 - } 747 +// }
747 - } 748 +// }
748 - @catch (NSException *exception) { 749 +// @catch (NSException *exception) {
749 - NSLog(@"tableExists error: %@", exception.reason); 750 +// NSLog(@"tableExists error: %@", exception.reason);
750 - } 751 +// }
751 - @finally { 752 +// @finally {
752 -// NSLog(@"Finally condition"); 753 +// // NSLog(@"Finally condition");
753 - } 754 +// }
754 // NSString *accessToken = [NSString alloc]; 755 // NSString *accessToken = [NSString alloc];
755 NSString *accessToken = @""; 756 NSString *accessToken = @"";
756 - if (tableExist == YES) { 757 + // if (tableExist == YES) {
757 @try { 758 @try {
758 @synchronized (_DatabaseLock) { 759 @synchronized (_DatabaseLock) {
759 FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"]; 760 FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"];
760 while ([accessTokenSet next]) { 761 while ([accessTokenSet next]) {
761 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue]; 762 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue];
762 } 763 }
764 + [accessTokenSet close];
763 } 765 }
764 } 766 }
765 @catch (NSException *exception) { 767 @catch (NSException *exception) {
...@@ -775,33 +777,34 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -775,33 +777,34 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
775 // accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue]; 777 // accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue];
776 // } 778 // }
777 return accessToken; 779 return accessToken;
778 - } 780 + // }
779 - return @""; 781 + // return @"";
780 }; 782 };
781 783
782 - (NSString*)getRefreshToken { 784 - (NSString*)getRefreshToken {
783 785
784 - BOOL tableExist = NO; 786 +// BOOL tableExist = NO;
785 - @try { 787 +// @try {
786 - @synchronized (_DatabaseLock) { 788 +// @synchronized (_DatabaseLock) {
787 - tableExist = [_db tableExists:@"requestVariables"]; 789 +// tableExist = [_db tableExists:@"requestVariables"];
788 - } 790 +// }
789 - } 791 +// }
790 - @catch (NSException *exception) { 792 +// @catch (NSException *exception) {
791 - NSLog(@"tableExists error: %@", exception.reason); 793 +// NSLog(@"tableExists error: %@", exception.reason);
792 - } 794 +// }
793 - @finally { 795 +// @finally {
794 -// NSLog(@"Finally condition"); 796 +// // NSLog(@"Finally condition");
795 - } 797 +// }
796 // NSString *refreshToken = [NSString alloc]; 798 // NSString *refreshToken = [NSString alloc];
797 NSString *refreshToken = @""; 799 NSString *refreshToken = @"";
798 - if (tableExist == YES) { 800 + // if (tableExist == YES) {
799 @try { 801 @try {
800 @synchronized (_DatabaseLock) { 802 @synchronized (_DatabaseLock) {
801 FMResultSet *refreshTokenSet = [_db executeQuery:@"SELECT refresh_token FROM requestVariables WHERE id = 1;"]; 803 FMResultSet *refreshTokenSet = [_db executeQuery:@"SELECT refresh_token FROM requestVariables WHERE id = 1;"];
802 while ([refreshTokenSet next]) { 804 while ([refreshTokenSet next]) {
803 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue]; 805 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
804 } 806 }
807 + [refreshTokenSet close];
805 } 808 }
806 } 809 }
807 @catch (NSException *exception) { 810 @catch (NSException *exception) {
...@@ -817,33 +820,34 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -817,33 +820,34 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
817 // refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue]; 820 // refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
818 // } 821 // }
819 return refreshToken; 822 return refreshToken;
820 - } 823 + // }
821 - return @""; 824 + // return @"";
822 } 825 }
823 826
824 - (NSString*)getClientId { 827 - (NSString*)getClientId {
825 828
826 - BOOL tableExist = NO; 829 +// BOOL tableExist = NO;
827 - @try { 830 +// @try {
828 - @synchronized (_DatabaseLock) { 831 +// @synchronized (_DatabaseLock) {
829 - tableExist = [_db tableExists:@"requestVariables"]; 832 +// tableExist = [_db tableExists:@"requestVariables"];
830 - } 833 +// }
831 - } 834 +// }
832 - @catch (NSException *exception) { 835 +// @catch (NSException *exception) {
833 - NSLog(@"tableExists error: %@", exception.reason); 836 +// NSLog(@"tableExists error: %@", exception.reason);
834 - } 837 +// }
835 - @finally { 838 +// @finally {
836 -// NSLog(@"Finally condition"); 839 +// // NSLog(@"Finally condition");
837 - } 840 +// }
838 // NSString *clientId = [NSString alloc]; 841 // NSString *clientId = [NSString alloc];
839 NSString *clientId = @""; 842 NSString *clientId = @"";
840 - if (tableExist == YES) { 843 + // if (tableExist == YES) {
841 @try { 844 @try {
842 @synchronized (_DatabaseLock) { 845 @synchronized (_DatabaseLock) {
843 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"]; 846 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
844 while ([clientIdSet next]) { 847 while ([clientIdSet next]) {
845 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue]; 848 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
846 } 849 }
850 + [clientIdSet close];
847 } 851 }
848 } 852 }
849 @catch (NSException *exception) { 853 @catch (NSException *exception) {
...@@ -859,34 +863,35 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -859,34 +863,35 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
859 // clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue]; 863 // clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
860 // } 864 // }
861 return clientId; 865 return clientId;
862 - } 866 + // }
863 - return @""; 867 + // return @"";
864 } 868 }
865 869
866 - (NSString*)getClientSecret { 870 - (NSString*)getClientSecret {
867 871
868 - BOOL tableExist = NO; 872 +// BOOL tableExist = NO;
869 - @try { 873 +// @try {
870 - @synchronized (_DatabaseLock) { 874 +// @synchronized (_DatabaseLock) {
871 - tableExist = [_db tableExists:@"requestVariables"]; 875 +// tableExist = [_db tableExists:@"requestVariables"];
872 - } 876 +// }
873 - } 877 +// }
874 - @catch (NSException *exception) { 878 +// @catch (NSException *exception) {
875 - NSLog(@"tableExists error: %@", exception.reason); 879 +// NSLog(@"tableExists error: %@", exception.reason);
876 - } 880 +// }
877 - @finally { 881 +// @finally {
878 -// NSLog(@"Finally condition"); 882 +// // NSLog(@"Finally condition");
879 - } 883 +// }
880 884
881 // NSString *clientSecret = [NSString alloc]; 885 // NSString *clientSecret = [NSString alloc];
882 NSString *clientSecret = @""; 886 NSString *clientSecret = @"";
883 - if (tableExist == YES) { 887 + // if (tableExist == YES) {
884 @try { 888 @try {
885 @synchronized (_DatabaseLock) { 889 @synchronized (_DatabaseLock) {
886 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"]; 890 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"];
887 while ([clientSecretSet next]) { 891 while ([clientSecretSet next]) {
888 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue]; 892 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
889 } 893 }
894 + [clientSecretSet close];
890 } 895 }
891 } 896 }
892 @catch (NSException *exception) { 897 @catch (NSException *exception) {
...@@ -902,8 +907,8 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -902,8 +907,8 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
902 // clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue]; 907 // clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
903 // } 908 // }
904 return clientSecret; 909 return clientSecret;
905 - } 910 + // }
906 - return @""; 911 + // return @"";
907 } 912 }
908 913
909 - (void)getProductsWithSuccessBlock:(NSString*)filter :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure 914 - (void)getProductsWithSuccessBlock:(NSString*)filter :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure
...@@ -1156,24 +1161,24 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1156,24 +1161,24 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1156 "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjMyMjI4ODYsImlhdCI6MTcxMDE2ODIwMiwiZXhwIjoxNzEwMTcwMDAyLCJIT1NUIjoiaHR0cHM6Ly9lbmdhZ2Utc3RhZ2Uud2FycC5seSJ9.8W9x4uuEsZiL8NNtJmpA1I3JsMtx8j3jePAnGekNkAM"} 1161 "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjMyMjI4ODYsImlhdCI6MTcxMDE2ODIwMiwiZXhwIjoxNzEwMTcwMDAyLCJIT1NUIjoiaHR0cHM6Ly9lbmdhZ2Utc3RhZ2Uud2FycC5seSJ9.8W9x4uuEsZiL8NNtJmpA1I3JsMtx8j3jePAnGekNkAM"}
1157 */ 1162 */
1158 1163
1159 - BOOL tableExist = NO; 1164 +// BOOL tableExist = NO;
1160 - @try { 1165 +// @try {
1161 - @synchronized (_DatabaseLock) { 1166 +// @synchronized (_DatabaseLock) {
1162 - tableExist = [_db tableExists:@"requestVariables"]; 1167 +// tableExist = [_db tableExists:@"requestVariables"];
1163 - } 1168 +// }
1164 - } 1169 +// }
1165 - @catch (NSException *exception) { 1170 +// @catch (NSException *exception) {
1166 - NSLog(@"tableExists error: %@", exception.reason); 1171 +// NSLog(@"tableExists error: %@", exception.reason);
1167 - if (failure) { 1172 +// if (failure) {
1168 - NSError *error = nil; 1173 +// NSError *error = nil;
1169 - failure(error); 1174 +// failure(error);
1170 - } 1175 +// }
1171 - } 1176 +// }
1172 - @finally { 1177 +// @finally {
1173 -// NSLog(@"Finally condition"); 1178 +// // NSLog(@"Finally condition");
1174 - } 1179 +// }
1175 1180
1176 - if (tableExist == YES) { 1181 +// if (tableExist == YES) {
1177 NSString *accessToken = @""; 1182 NSString *accessToken = @"";
1178 NSString *refreshToken = @""; 1183 NSString *refreshToken = @"";
1179 NSString *clientId = @""; 1184 NSString *clientId = @"";
...@@ -1205,11 +1210,16 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1205,11 +1210,16 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1205 if (success) { 1210 if (success) {
1206 // success(contextResponse); 1211 // success(contextResponse);
1207 1212
1213 + // @synchronized (_DatabaseLock) {
1214 + // [_db executeUpdate:@"DROP TABLE requestVariables"];
1215 + // }
1208 @synchronized (_DatabaseLock) { 1216 @synchronized (_DatabaseLock) {
1209 - [_db executeUpdate:@"DROP TABLE requestVariables"]; 1217 + [_db closeOpenResultSets]; // Clean up any open result sets
1218 + [_db executeUpdate:@"DROP TABLE IF EXISTS requestVariables"];
1210 } 1219 }
1211 NSDictionary *successResponse = @{@"result": @"success", @"status":@1}; 1220 NSDictionary *successResponse = @{@"result": @"success", @"status":@1};
1212 NSLog(@"**************** WARPLY Logout *****************" ); 1221 NSLog(@"**************** WARPLY Logout *****************" );
1222 +
1213 success(successResponse); 1223 success(successResponse);
1214 } 1224 }
1215 NSLog(@"**************** WARPLY Response *****************" ); 1225 NSLog(@"**************** WARPLY Response *****************" );
...@@ -1222,7 +1232,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1222,7 +1232,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1222 } 1232 }
1223 NSLog(@"Error at logout %@", error ); 1233 NSLog(@"Error at logout %@", error );
1224 }]; 1234 }];
1225 - } 1235 + // }
1226 1236
1227 // @synchronized (_DatabaseLock) { 1237 // @synchronized (_DatabaseLock) {
1228 // [_db executeUpdate:@"DROP TABLE requestVariables"]; 1238 // [_db executeUpdate:@"DROP TABLE requestVariables"];
...@@ -1411,6 +1421,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1411,6 +1421,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1411 while ([refreshTokenSet next]) { 1421 while ([refreshTokenSet next]) {
1412 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue]; 1422 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
1413 } 1423 }
1424 + [refreshTokenSet close];
1414 } 1425 }
1415 @synchronized (_DatabaseLock) { 1426 @synchronized (_DatabaseLock) {
1416 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"]; 1427 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
...@@ -1419,6 +1430,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1419,6 +1430,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1419 while ([clientIdSet next]) { 1430 while ([clientIdSet next]) {
1420 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue]; 1431 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
1421 } 1432 }
1433 + [clientIdSet close];
1422 } 1434 }
1423 @synchronized (_DatabaseLock) { 1435 @synchronized (_DatabaseLock) {
1424 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"]; 1436 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"];
...@@ -1427,6 +1439,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1427,6 +1439,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1427 while ([clientSecretSet next]) { 1439 while ([clientSecretSet next]) {
1428 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue]; 1440 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
1429 } 1441 }
1442 + [clientSecretSet close];
1430 } 1443 }
1431 } 1444 }
1432 @catch (NSException *exception) { 1445 @catch (NSException *exception) {
...@@ -1543,6 +1556,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1543,6 +1556,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1543 while ([refreshTokenSet next]) { 1556 while ([refreshTokenSet next]) {
1544 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue]; 1557 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
1545 } 1558 }
1559 + [refreshTokenSet close];
1546 } 1560 }
1547 @synchronized (_DatabaseLock) { 1561 @synchronized (_DatabaseLock) {
1548 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"]; 1562 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
...@@ -1551,6 +1565,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1551,6 +1565,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1551 while ([clientIdSet next]) { 1565 while ([clientIdSet next]) {
1552 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue]; 1566 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
1553 } 1567 }
1568 + [clientIdSet close];
1554 } 1569 }
1555 @synchronized (_DatabaseLock) { 1570 @synchronized (_DatabaseLock) {
1556 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"]; 1571 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"];
...@@ -1559,6 +1574,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1559,6 +1574,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1559 while ([clientSecretSet next]) { 1574 while ([clientSecretSet next]) {
1560 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue]; 1575 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
1561 } 1576 }
1577 + [clientSecretSet close];
1562 } 1578 }
1563 } 1579 }
1564 @catch (NSException *exception) { 1580 @catch (NSException *exception) {
...@@ -1674,6 +1690,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1674,6 +1690,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1674 while ([refreshTokenSet next]) { 1690 while ([refreshTokenSet next]) {
1675 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue]; 1691 refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
1676 } 1692 }
1693 + [refreshTokenSet close];
1677 } 1694 }
1678 @synchronized (_DatabaseLock) { 1695 @synchronized (_DatabaseLock) {
1679 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"]; 1696 FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
...@@ -1682,6 +1699,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1682,6 +1699,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1682 while ([clientIdSet next]) { 1699 while ([clientIdSet next]) {
1683 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue]; 1700 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
1684 } 1701 }
1702 + [clientIdSet close];
1685 } 1703 }
1686 @synchronized (_DatabaseLock) { 1704 @synchronized (_DatabaseLock) {
1687 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"]; 1705 FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"];
...@@ -1690,6 +1708,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1690,6 +1708,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1690 while ([clientSecretSet next]) { 1708 while ([clientSecretSet next]) {
1691 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue]; 1709 clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
1692 } 1710 }
1711 + [clientSecretSet close];
1693 } 1712 }
1694 } 1713 }
1695 @catch (NSException *exception) { 1714 @catch (NSException *exception) {
...@@ -3838,6 +3857,7 @@ return appIsRegisteredWithWarply; ...@@ -3838,6 +3857,7 @@ return appIsRegisteredWithWarply;
3838 return true; 3857 return true;
3839 } 3858 }
3840 } 3859 }
3860 + [result close];
3841 } 3861 }
3842 3862
3843 return false; 3863 return false;
...@@ -4738,6 +4758,7 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) ...@@ -4738,6 +4758,7 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
4738 while ([accessTokenSet next]) { 4758 while ([accessTokenSet next]) {
4739 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue]; 4759 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue];
4740 } 4760 }
4761 + [accessTokenSet close];
4741 } 4762 }
4742 } 4763 }
4743 @catch (NSException *exception) { 4764 @catch (NSException *exception) {
...@@ -4921,6 +4942,7 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) ...@@ -4921,6 +4942,7 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
4921 while ([accessTokenSet next]) { 4942 while ([accessTokenSet next]) {
4922 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue]; 4943 accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue];
4923 } 4944 }
4945 + [accessTokenSet close];
4924 } 4946 }
4925 } 4947 }
4926 @catch (NSException *exception) { 4948 @catch (NSException *exception) {
...@@ -6935,6 +6957,7 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg ...@@ -6935,6 +6957,7 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg
6935 return YES; 6957 return YES;
6936 } 6958 }
6937 } 6959 }
6960 + [priorityEvents close];
6938 } 6961 }
6939 @synchronized (_DatabaseLock) { 6962 @synchronized (_DatabaseLock) {
6940 FMResultSet *rs = [_db executeQuery:@"SELECT COUNT(*) FROM events;"]; 6963 FMResultSet *rs = [_db executeQuery:@"SELECT COUNT(*) FROM events;"];
...@@ -6945,6 +6968,7 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg ...@@ -6945,6 +6968,7 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg
6945 return YES; 6968 return YES;
6946 } 6969 }
6947 } 6970 }
6971 + [rs close];
6948 } 6972 }
6949 return NO; 6973 return NO;
6950 } 6974 }
...@@ -6962,6 +6986,7 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg ...@@ -6962,6 +6986,7 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg
6962 [mutableEventDict setObject:[rs objectForColumnName:@"_id"] forKey:@"_id"]; 6986 [mutableEventDict setObject:[rs objectForColumnName:@"_id"] forKey:@"_id"];
6963 [events addObject:mutableEventDict]; 6987 [events addObject:mutableEventDict];
6964 } 6988 }
6989 + [rs close];
6965 } 6990 }
6966 return events; 6991 return events;
6967 } 6992 }
......