Manos Chorianopoulos

possible fix for db crash

......@@ -4771,14 +4771,15 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
_httpClient.requestSerializer = [AFJSONRequestSerializer serializer];
[_httpClient.requestSerializer setTimeoutInterval:30];
[self createDBIfNeeded];
[self initDBIfNeeded];
[self restore];
// [self createDBIfNeeded];
// [self initDBIfNeeded];
// [self restore];
//Set HTTP Headers
time_t timestamp = (time_t) [[NSDate date] timeIntervalSince1970];
// NSString *accessToken = [NSString alloc];
NSString *accessToken = @"";
if ([_db tableExists:@"requestVariables"] == YES) {
if (([_db open] == YES) && ([_db tableExists:@"requestVariables"] == YES)) {
// FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"];
// while ([accessTokenSet next]) {
// accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue];
......@@ -4932,14 +4933,15 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
_httpClient.requestSerializer = [AFJSONRequestSerializer serializer];
[_httpClient.requestSerializer setTimeoutInterval:30];
[self createDBIfNeeded];
[self initDBIfNeeded];
[self restore];
// [self createDBIfNeeded];
// [self initDBIfNeeded];
// [self restore];
//Set HTTP Headers
time_t timestamp = (time_t) [[NSDate date] timeIntervalSince1970];
// NSString *accessToken = [NSString alloc];
NSString *accessToken = @"";
if ([_db tableExists:@"requestVariables"] == YES) {
if (([_db open] == YES) && ([_db tableExists:@"requestVariables"] == YES)) {
@try {
@synchronized (_DatabaseLock) {
FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"];
......