Howdy!

As you probably know, rendering engines are bundling SQLite to provide
the HTML5 Database API to webpages and widgets.
Then 3rd party webpages would access the database API to write data.
There should be a way for the user agent to control quotas. I was told
on IRC that currently such feature is not supported.

The sqlite api would be something like:
sqlite3_set_quota_handling(sqlite3 *db, sqlite3_quota_handling*);
sqlite3_set_quota_listener(sqlite3 *db, sqlite3_quota_handling*
(*listener_fn)(void* args, sqlite3_quota_warning* sqllite3_args), void
*args)

where:
 - sqlite3_quota_warning would be a struct with info about current
size of database, size of quota, new size of database after DML
exceeds quota
 - sqlite3_quota_handling would be a struct which specifies quota
handling, like limit in bytes, flag to tell if quota should increase
or not.

sqlite3_set_quota_handling would be called by the host codebase to set
quota policies.
sqlite3_set_quota_listener would be called by the host codebase to set
a quota exceeding listener.
 - is during some DML the quota is exceeded, SQLite halts everything
and calls the listener function to tell the host that quota will
exceed and ask if a new quota policy should be defined. If the host
returns a new quota policy which tells to expand to a new size then
things continue normally. If there is no quota exceed listener, or the
listener returns a policy of NOT increasing quota, then the SQLite
function which executes statements returns QUOTA_EXCEEDED_ERROR which
would be similar to an out-of-disk error, and the whole transaction
should be rolled back.

This API of course is just a raw definition I came up when writing this email.
There might be some cases I forgot, but this kind of handling enabled
the user to tell if he/she allows the database to increase.

So, what do you think ?

Bye.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to