Skip to content
New issue

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

iOS WCDB 字段更新 #61

Closed
LongTimeNoSeee opened this issue Jun 21, 2017 · 9 comments
Closed

iOS WCDB 字段更新 #61

LongTimeNoSeee opened this issue Jun 21, 2017 · 9 comments
Labels

Comments

@LongTimeNoSeee
Copy link

在更新一条记录的某几个字段的时候,使用这个方法

  • (BOOL)updateTable:(NSString *)tableName
    onProperties:(const WCTPropertyList &)propertyList
    withRow:(WCTOneRow *)row
    where:(const WCTCondition &)condition
    请问这个propertyList应该是以怎样的格式,比如下面这个方法:
    [database updateTable:story onProperties:@[] withRow:@[value1,value2,value3] where:Story.id == storyId];
    这个onProperties对应的属性应该以怎样的格式写,在API里面没有看到相应的注释,不太懂c++,见谅。
@312362115
Copy link

{Model.key1, Model.key2}
Model你定的的模型, key模型中WCDB_PROPERTY的字段

@RingoD
Copy link
Collaborator

RingoD commented Jun 21, 2017

可以参考 基础类、CRUD与TransactionSample-convenience 的代码。

我晚些时候也在注释上加上教程的链接。

@LongTimeNoSeee
Copy link
Author

好的,谢谢,还有,请问一下,用这些封装好的方法后,在哪能打印出SQL语句呢

@RingoD
Copy link
Collaborator

RingoD commented Jun 21, 2017

目前没有提供打印SQL的方法。只在SQL执行出错时,在SetGlobalErrorReport中会打出来。

你的具体需求是怎么样?是希望打印某一个操作的SQL,还是将所有执行的SQL都统一打印出来?能否用代码示例一下?

@LongTimeNoSeee
Copy link
Author

希望能打印某一个操作的SQL,比如对某一行记录的几个字段进行更新的时候,希望看到相应的update操作的SQL

@RingoD
Copy link
Collaborator

RingoD commented Jun 21, 2017

debug mode下的全局的SQL log接口,类似

[WCTStatistics SetGlobalSQLTrace:^(NSString* sql) {
	NSLog(@"%@", sql);
}

trace会在每一次执行SQL时触发。

是否满足需求?

@zx1988
Copy link

zx1988 commented Jun 27, 2017

{Model.key1, Model.key2}这是iOS的什么格式

@RingoD
Copy link
Collaborator

RingoD commented Jun 27, 2017

@zx1988 这是C++的代码

@ihewro
Copy link

ihewro commented Dec 1, 2021

SQL

打印sql,能否把参数也打印出来呢,或者增加一个新的列表参数来存储参数列表,就是下面的问号地方。
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants