LuaSQLite3

Check-in [a4478aa43c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix C99ism
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a4478aa43c32adc914481217610f227eb76aeabb
User & Date: e 2013-10-18 21:56:59
References
2013-10-18
21:59 Fixed ticket [77e34ea2fd]: Won't compile with VS2012 - sqlite 3.7.17 and lua 5.2.2 plus 5 other changes artifact: 5ca9244859 user: e
Context
2015-01-04
22:13
Updated for Lua 5.3. Use sqlite3_prepare_v2. check-in: d59e31d19c user: e tags: trunk
2013-10-18
21:56
Fix C99ism check-in: a4478aa43c user: e tags: trunk
2013-05-06
20:45
Update rockspec to indicate compatibility with Lua 5.1 and 5.2 but not Lua 5.3 check-in: 89c917f576 user: e tags: fsl_9t, trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to lsqlite3.c.

1258
1259
1260
1261
1262
1263
1264

1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
** Params: userdata, {one of SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE}, 
**          database name, table name (containing the affected row), rowid of the row
*/
static void db_update_hook_callback(void *user, int op, char const *dbname, char const *tblname, sqlite3_int64 rowid) {
    sdb *db = (sdb*)user;
    lua_State *L = db->L;
    int top = lua_gettop(L);


    /* setup lua callback call */
    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_cb);    /* get callback */
    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_udata); /* get callback user data */
    lua_pushnumber(L, (lua_Number )op);
    lua_pushstring(L, dbname); /* update_hook database name */
    lua_pushstring(L, tblname); /* update_hook database name */
    lua_Number n = (lua_Number)rowid;
    if (n == rowid)
        lua_pushnumber(L, n);
    else
        lua_pushfstring(L, "%ll", rowid);

    /* call lua function */
    lua_pcall(L, 5, 0, 0);







>







|







1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
** Params: userdata, {one of SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE}, 
**          database name, table name (containing the affected row), rowid of the row
*/
static void db_update_hook_callback(void *user, int op, char const *dbname, char const *tblname, sqlite3_int64 rowid) {
    sdb *db = (sdb*)user;
    lua_State *L = db->L;
    int top = lua_gettop(L);
    lua_Number n;

    /* setup lua callback call */
    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_cb);    /* get callback */
    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_udata); /* get callback user data */
    lua_pushnumber(L, (lua_Number )op);
    lua_pushstring(L, dbname); /* update_hook database name */
    lua_pushstring(L, tblname); /* update_hook database name */
    n = (lua_Number)rowid;
    if (n == rowid)
        lua_pushnumber(L, n);
    else
        lua_pushfstring(L, "%ll", rowid);

    /* call lua function */
    lua_pcall(L, 5, 0, 0);