(fix) added debugging to table creation code

pull/229/merge
Ludovic Marcotte 2018-08-24 08:48:41 -04:00
parent 7e0f0c2c95
commit ef172b36bb
1 changed files with 11 additions and 6 deletions

View File

@ -191,6 +191,7 @@ static BOOL debugLeaks;
NSString *tableName, *fileSuffix, *tableScript; NSString *tableName, *fileSuffix, *tableScript;
EOAdaptorChannel *tc; EOAdaptorChannel *tc;
NSURL *channelURL; NSURL *channelURL;
NSException *ex;
channelURL = [NSURL URLWithString: url]; channelURL = [NSURL URLWithString: url];
fileSuffix = [channelURL scheme]; fileSuffix = [channelURL scheme];
@ -205,8 +206,10 @@ static BOOL debugLeaks;
tableScript = [self _sqlScriptForTable: tableName tableScript = [self _sqlScriptForTable: tableName
withType: tableType withType: tableType
andFileSuffix: fileSuffix]; andFileSuffix: fileSuffix];
if (![tc evaluateExpressionX: tableScript]) if (!(ex = [tc evaluateExpressionX: tableScript]))
[self logWithFormat: @"table '%@' successfully created!", tableName]; [self logWithFormat: @"table '%@' successfully created!", tableName];
else
[self logWithFormat: @"table '%@' creation failed! Reason: %@", tableName, ex];
} }
else else
[tc cancelFetch]; [tc cancelFetch];
@ -218,10 +221,10 @@ static BOOL debugLeaks;
withCm: (GCSChannelManager *) cm withCm: (GCSChannelManager *) cm
tableURL: (NSString *) url tableURL: (NSString *) url
{ {
GCSFolderType *type;
NSString *sql;
NSString *tableName;
EOAdaptorChannel *channel; EOAdaptorChannel *channel;
NSString *tableName, *sql;
GCSFolderType *type;
NSException *ex;
channel = [cm acquireOpenChannelForURL: [NSURL URLWithString: url]]; channel = [cm acquireOpenChannelForURL: [NSURL URLWithString: url]];
@ -234,9 +237,11 @@ static BOOL debugLeaks;
if (type) if (type)
{ {
sql = [type sqlQuickCreateWithTableName: tableName]; sql = [type sqlQuickCreateWithTableName: tableName];
if (![channel evaluateExpressionX: sql]) if (!(ex = [channel evaluateExpressionX: sql]))
[self logWithFormat: @"sogo quick table %@ successfully created!", [self logWithFormat: @"sogo quick table '%@' successfully created!",
tableName]; tableName];
else
[self logWithFormat: @"sogo quick table '%@' creation failed! Reason: %@", tableName, ex];
} }
} }
else else