How to write custom SQLite functions in Javascript inside a Webkit browser?
Posted
by Jay Godse
on Stack Overflow
See other posts from Stack Overflow
or by Jay Godse
Published on 2010-05-17T06:41:40Z
Indexed on
2010/05/18
9:30 UTC
Read the original article
Hit count: 207
JavaScript
|sqlite
I have just learned how to use the SQLite database for local storage in a Webkit web browser (e.g. Google Chrome or Apple Safari) using the Javascript API. For example the "Sticky Notes" application.
However, I know that SQLite has a function called sqlite_create_function() that lets you add custom functions to your instance of SQLite on the fly which can then be used inside SQL queries. This function is described at sqlite.org.
I also know that you can call an equivalent of this API in Ruby as described here.
QUESTION: Can anybody show me how to do this in Javascript - i.e. write a custom function in Javascript that can be bound into the SQLite database at run time to be called by the SQLite engine, and all inside a Webkit browser?
© Stack Overflow or respective owner