8000
Skip to content

can set SQL computed value to a field#33

Open
iamyellow wants to merge 1 commit intoxavierlacot:masterfrom
iamyellow:master
Open

can set SQL computed value to a field#33
iamyellow wants to merge 1 commit intoxavierlacot:masterfrom
iamyellow:master

Conversation

@iamyellow
Copy link
Copy Markdown

Maybe others find interesting some changes I made to joli.js in order to (for example) create a new record setting its properties with SQL statements. Well, I think an example will explain this better than me:

var data = this.newRecord({
  id: "SQL(strftime('%Y%m%d%H%M%f', 'now'))",
  userId: 33,
  message: 'hi',
  flag: 0
});

In this example the 'id' field will be a timestamp generated using SQLite time functions. Then:

data.save();
Ti.API.info(data.get('id')); // this prints something like '20121019070437.809'

Hope you find useful enough :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0