5

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?

3
  • +1: Hmm, I've had a damn good look and I can't see any documentation. Worked examples of basic functionality, yes. Full API docs, no. It doesn't help that it seems that WHATWG are not sure whether this should be something that they endorse and Apple are saying “look over there for docs”. This stuff needs to be brought out into the open! Commented May 17, 2010 at 20:00
  • @Donal - Can you send me any examples of working code...perhaps as an answer to my question? Commented May 18, 2010 at 0:17
  • No. :-( Or at least not in javascript, as I don't have any. (I could google, but you could too.) Commented May 18, 2010 at 9:32

1 Answer 1

3

From surfing the web, it seems like Apple is the only company offering any kind of documentation of the SQLite interface through Webkit. It is at apsw.googlecode.com.

In this document they show how to use the Javascript API to open & close databases, run queries, and manipulate results. However, there is no documentation on the Javascript equivalent of sqlite3_create_function. However, I sent a question to them about this and hope to get an answer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.