Manos Chorianopoulos

fix db select errors

......@@ -709,6 +709,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
}
@catch (NSException *exception) {
NSLog(@"SELECT accessToken error: %@", exception.reason);
accessToken = @"";
}
@finally {
// NSLog(@"Finally condition");
......@@ -724,36 +725,81 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
};
- (NSString*)getRefreshToken {
NSString *refreshToken = [NSString alloc];
// NSString *refreshToken = [NSString alloc];
NSString *refreshToken = @"";
if ([_db tableExists:@"requestVariables"] == YES) {
@try {
FMResultSet *refreshTokenSet = [_db executeQuery:@"SELECT refresh_token FROM requestVariables WHERE id = 1;"];
while ([refreshTokenSet next]) {
refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
}
}
@catch (NSException *exception) {
NSLog(@"SELECT refreshToken error: %@", exception.reason);
refreshToken = @"";
}
@finally {
// NSLog(@"Finally condition");
}
// FMResultSet *refreshTokenSet = [_db executeQuery:@"SELECT refresh_token FROM requestVariables WHERE id = 1;"];
// while ([refreshTokenSet next]) {
// refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
// }
return refreshToken;
}
return @"";
}
- (NSString*)getClientId {
NSString *clientId = [NSString alloc];
// NSString *clientId = [NSString alloc];
NSString *clientId = @"";
if ([_db tableExists:@"requestVariables"] == YES) {
@try {
FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
while ([clientIdSet next]) {
clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
}
}
@catch (NSException *exception) {
NSLog(@"SELECT clientId error: %@", exception.reason);
clientId = @"";
}
@finally {
// NSLog(@"Finally condition");
}
// FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
// while ([clientIdSet next]) {
// clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
// }
return clientId;
}
return @"";
}
- (NSString*)getClientSecret {
NSString *clientSecret = [NSString alloc];
// NSString *clientSecret = [NSString alloc];
NSString *clientSecret = @"";
if ([_db tableExists:@"requestVariables"] == YES) {
@try {
FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"];
while ([clientSecretSet next]) {
clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
}
}
@catch (NSException *exception) {
NSLog(@"SELECT clientSecret error: %@", exception.reason);
clientSecret = @"";
}
@finally {
// NSLog(@"Finally condition");
}
// FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"];
// while ([clientSecretSet next]) {
// clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
// }
return clientSecret;
}
return @"";
......