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
建表的时候,如果用jq_createTable创建表,会先转为dict再去创建sql。 如果model里有pkid, 并且转后的dict里,pkid在最后的话,会从continue走掉,建表的括号无法闭合。生成的sql如下:
CREATE TABLE device (pkid INTEGER PRIMARY KEY, udid TEXT, account_id INTEGER, server_id INTEGER, login_at INTEGER,
代码如下: NSMutableString *fieldStr = [[NSMutableString alloc] initWithFormat:@"CREATE TABLE %@ (pkid INTEGER PRIMARY KEY,", tableName];
int keyCount = 0; for (NSString *key in dic) { keyCount++; if ((nameArr && [nameArr containsObject:key]) || [key isEqualToString:@"pkid"]) { continue;//问题出在这里,这里如果pkid是最后一个字段,就跳出去了,无法闭合括号 } if (keyCount == dic.count) { [fieldStr appendFormat:@" %@ %@)", key, dic[key]]; break; } [fieldStr appendFormat:@" %@ %@,", key, dic[key]]; }
The text was updated successfully, but these errors were encountered:
大兄弟你解决了吗?
Sorry, something went wrong.
if ([fieldStr hasSuffix:@","]) { [fieldStr replaceCharactersInRange:NSMakeRange(fieldStr.length-1, 1) withString:@")"]; }
No branches or pull requests
建表的时候,如果用jq_createTable创建表,会先转为dict再去创建sql。
如果model里有pkid, 并且转后的dict里,pkid在最后的话,会从continue走掉,建表的括号无法闭合。生成的sql如下:
CREATE TABLE device (pkid INTEGER PRIMARY KEY, udid TEXT, account_id INTEGER, server_id INTEGER, login_at INTEGER,
代码如下:
NSMutableString *fieldStr = [[NSMutableString alloc] initWithFormat:@"CREATE TABLE %@ (pkid INTEGER PRIMARY KEY,", tableName];
The text was updated successfully, but these errors were encountered: