We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table 'Installed" has only one indexea key "app_id" Exception when I trying to do next
ZIMSqlUpsertStatement *sql = [[ZIMSqlUpsertStatement alloc] init]; [sql into: [Installed table]]; [sql column: @"app_id" value: [app_id valueForKey:@"app_id"]]; [sql matching:[NSArray arrayWithObject:@"app_id"]]; NSString *statement = [sql statement]; [self.connection execute:statement];
I make some fix in file ZIMSqlUpsertStatement.m
- (NSString *) statement { // Note: Because "INSERT OR REPLACE" requires prior knowledge of the table's columns to properly update a record, // this method for mimicing an upsert statement was chosen. Therefore, always match against either the primary key // or a unique key. NSMutableString *sql = [[NSMutableString alloc] init]; [sql appendFormat: @"UPDATE OR IGNORE %@ SET ", _table]; NSMutableArray *set = [[NSMutableArray alloc] init]; NSMutableArray *where = [[NSMutableArray alloc] init]; for (NSString *column in _column) { if ([_compositeKey containsObject: column]) { /////// MY FIX START /////// if( [_column count] == 1 ) { [set addObject: [NSString stringWithFormat: @"%@ = %@", column, [_column objectForKey: column]]]; } /////// MY FIX END /////// [where addObject: [NSString stringWithFormat: @"%@ = %@", column, [_column objectForKey: column]]]; } else { [set addObject: [NSString stringWithFormat: @"%@ = %@", column, [_column objectForKey: column]]]; } } [sql appendString: [set componentsJoinedByString: @", "]]; [sql appendString: @" WHERE "]; [sql appendString: [where componentsJoinedByString: @" AND "]]; [sql appendString: @"; "]; [sql appendFormat: @"INSERT OR IGNORE INTO %@ ", _table]; [sql appendFormat: @"(%@) VALUES (%@)", [[_column allKeys] componentsJoinedByString: @", "], [[_column allValues] componentsJoinedByString: @", "]]; [sql appendString: @";"]; return sql; }
The text was updated successfully, but these errors were encountered:
Adding fix (Issue #31).
6c56469
Thanks!
Sorry, something went wrong.
No branches or pull requests
Table 'Installed" has only one indexea key "app_id"
Exception when I trying to do next
I make some fix in file ZIMSqlUpsertStatement.m
The text was updated successfully, but these errors were encountered: