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

can set SQL computed value to a field #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

can set SQL computed value to a field #33

wants to merge 1 commit into from

Conversation

iamyellow
Copy link

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