-
Notifications
You must be signed in to change notification settings - Fork 36
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
DOC-8272-C4-Apple --Swift/ObjC N1QL Code Snippets #534
Conversation
NSString *n1qlstr = "SELECT * FROM _ WHERE type = $type"; // <.> | ||
|
||
CBLQuery* thisQuery = [db createQuery: n1qlstr]; | ||
|
||
CBLQueryParameters* n1qlparams = [[CBLQueryParameters alloc] init]; | ||
[params setString: @"hotel" forName: @"type"]; // <.> | ||
|
||
thisQuery.parameters = n1qlparams; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think this is correct!
But something like the below is a way to set a dynamic variable value to a N1QL query.
NSString* typeVar = @"hotel";
NSString *n1qlstr = [NSString stringWithFormat: @"SELECT * FROM dbName WHERE type = %@", typeVar];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Neat trick. Not sure Jay. I thought that we were supposed to use the Query parameters ... maybe both work, but which do we want people using? I'll follow this up and change asap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibsoln I don't think this code will work, using QueryParams!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check the comments.
https://issues.couchbase.com/browse/DOC-8272 DOC-8272-C4-Apple --Swift/ObjC N1QL Code Snippets https://issues.couchbase.com/browse/DOC-8272 DOC-9047-C4-Code
caf9e13
to
221e342
Compare
221e342
to
edd5e20
Compare
https://issues.couchbase.com/browse/DOC-8272
DOC-9047-C4-Code