static void _mapcache_cache_sqlite_set(mapcache_context *ctx, mapcache_tile *tile) { struct sqlite_conn *conn = _sqlite_get_conn(ctx, tile, 0); GC_CHECK_ERROR(ctx); sqlite3_exec(conn->handle, "BEGIN TRANSACTION", 0, 0, 0); _single_sqlitetile_set(ctx,tile,conn); if (GC_HAS_ERROR(ctx)) { sqlite3_exec(conn->handle, "ROLLBACK TRANSACTION", 0, 0, 0); } else { sqlite3_exec(conn->handle, "END TRANSACTION", 0, 0, 0); } _sqlite_release_conn(ctx, tile, conn); }
static void _mapcache_cache_sqlite_multi_set(mapcache_context *ctx, mapcache_tile *tiles, int ntiles) { struct sqlite_conn *conn = _sqlite_get_conn(ctx, &tiles[0], 0); int i; GC_CHECK_ERROR(ctx); sqlite3_exec(conn->handle, "BEGIN TRANSACTION", 0, 0, 0); for (i = 0; i < ntiles; i++) { mapcache_tile *tile = &tiles[i]; _single_sqlitetile_set(ctx,tile,conn); if(GC_HAS_ERROR(ctx)) break; } if (GC_HAS_ERROR(ctx)) { sqlite3_exec(conn->handle, "ROLLBACK TRANSACTION", 0, 0, 0); } else { sqlite3_exec(conn->handle, "END TRANSACTION", 0, 0, 0); } _sqlite_release_conn(ctx, &tiles[0], conn); }
static void _mapcache_cache_sqlite_set(mapcache_context *ctx, mapcache_cache *pcache, mapcache_tile *tile) { mapcache_cache_sqlite *cache = (mapcache_cache_sqlite*)pcache; struct sqlite_conn *conn; mapcache_pooled_connection *pc = mapcache_sqlite_get_conn(ctx,cache,tile,0); if (GC_HAS_ERROR(ctx)) { mapcache_sqlite_release_conn(ctx, pc); return; } conn = SQLITE_CONN(pc); sqlite3_exec(conn->handle, "BEGIN TRANSACTION", 0, 0, 0); _single_sqlitetile_set(ctx,cache, tile,conn); if (GC_HAS_ERROR(ctx)) { sqlite3_exec(conn->handle, "ROLLBACK TRANSACTION", 0, 0, 0); } else { sqlite3_exec(conn->handle, "END TRANSACTION", 0, 0, 0); } mapcache_sqlite_release_conn(ctx, pc); }
static void _mapcache_cache_sqlite_multi_set(mapcache_context *ctx, mapcache_cache *pcache, mapcache_tile *tiles, int ntiles) { mapcache_cache_sqlite *cache = (mapcache_cache_sqlite*)pcache; int i; struct sqlite_conn *conn; mapcache_pooled_connection *pc = mapcache_sqlite_get_conn(ctx,cache,&tiles[0],0); if (GC_HAS_ERROR(ctx)) { mapcache_sqlite_release_conn(ctx, pc); return; } conn = SQLITE_CONN(pc); sqlite3_exec(conn->handle, "BEGIN TRANSACTION", 0, 0, 0); for (i = 0; i < ntiles; i++) { mapcache_tile *tile = &tiles[i]; _single_sqlitetile_set(ctx,cache, tile,conn); if(GC_HAS_ERROR(ctx)) break; } if (GC_HAS_ERROR(ctx)) { sqlite3_exec(conn->handle, "ROLLBACK TRANSACTION", 0, 0, 0); } else { sqlite3_exec(conn->handle, "END TRANSACTION", 0, 0, 0); } mapcache_sqlite_release_conn(ctx, pc); }