Sqlite3 JSP Custom Tags
If for whatever reason you work with Sqlite3 database from a JSP you deal with issues related to Sqlite3 limitations. These limitations are mostly related to updates going to DB (SQL update, insert and delete). In general, there are two issues:1. Only one thread can update the DB at a time;
2. To get the row ID of the just inserted record a special pseudo-SQL statement should be executed right after the insertion was committed.
The Sqlite3 JSP Custom Tags product exists to resolve both issues. It makes all calls to Sqlite3 synchronously, and puts the last inserted rowid into the variable you specify.
The sqlite3:update tag was stress-tested to ensure that is produced correct results under any load that Sqlite3 JDBC driver can handle, you can take a look at the stress test results.
Usage
Grab the Sqlite3Tags from the download section and put it to your webapp's WEB-INF/lib folder. Alternatively you may get the sources and build your own jar with Maven2. To use it in JSP put this to JSP header:<%@taglib prefix="sqlite3" uri="http://dusystems.org/sqlite3" %>then you can use the tags, e.g.
<sqlite3:update dataSource="jdbc/myDb" sql="insert into message(msg_text) values('${param.text}')" varRowid="rowid"/>Starting with 0.0.2 you can use nested parameters too, like this:
<sqlite3:update dataSource="jdbc/myDb" sql="insert into message(msg_text) values(?,?,?)" varRowid="rowid"> <sqlite3:param>someValue</sqlite3:param> <sqlite3:param>${someValue}</sqlite3:param> <sqlite3:param value="${someValue}"></sqlite3:param> </sqlite3:update>
Download
Please note: this software is provided 'as-is' and DuSystems is not responsible for any damage it may cause.Please direct your comments to bornmw (a_t) dusystems.com
License: LGPL v.3
Binary: sqlite3tags-0.0.4.jar
Sources:Sqlite3Tags-0.0.4.tar.gz