Hi all,

In a web-based application I developed, I have a table that holds SQL for
various statement used in the application.  It's simple and looks something
like this:

    create table if not exists StmtSQL (
        StmtName        TEXT NOT NULL UNIQUE,
        SQL                  TEXT NOT NULL);

That table is populated with several hundred different SQL statements that
perform various tasks in the application.  You know, create a table if it doesn't
exist, get data from one or more tables, etc, etc.

The obvious benefit is that the SQL isn't hard-coded into the application,
I can make changes to the application without having to recompile, even on
the fly, etc.  All the application developer has to do is get a new sqlite3_statement
and execute it:

    sqlite3_statement* pAddWidgetsStmt = db->GetPreparedStmt("AddWidgets", ... add'l params here ...);
    ExecuteStmt(pAddWidgetStmt);

The GetPreparedStmt() function retrieves the SQL from table, creates a new
sqlite3_statement object (or retrieves this from a cache).

It  strikes me that this would be nicer if sqlite offered this as an intrinsic capability. If it was easy to dump or load this statement table, people might find it easier to
share collections of SQL statements designed for various tasks.

Thoughts?  Maybe someone has already developed a tool or extension like this?

Thanks,

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

Reply via email to