summaryrefslogtreecommitdiffstats
path: root/source4/lib/ldb/ldb_sqlite3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-09-22 04:16:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:41 -0500
commitd78ea3e34abd30fb388c4cc39e12611e211416a6 (patch)
tree4c111134a0850a7cd11283df50afd9484df8c8f3 /source4/lib/ldb/ldb_sqlite3
parentede8415d61b6791114c65de1c283a4e8c11f1585 (diff)
downloadsamba-d78ea3e34abd30fb388c4cc39e12611e211416a6.tar.gz
samba-d78ea3e34abd30fb388c4cc39e12611e211416a6.tar.xz
samba-d78ea3e34abd30fb388c4cc39e12611e211416a6.zip
r10406: added --nosync option to all ldb tools, so that you can control if
transactions are synchronous or not on the command line. add LDB_FLG_NOSYNC flag to ldb_connect() so we can make our temporary ldb databases non-synchronous (This used to be commit dba41164e0c52f1e4351bd9057b16661cee3a822)
Diffstat (limited to 'source4/lib/ldb/ldb_sqlite3')
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index 8742b53962..ac706291ef 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -1522,7 +1522,7 @@ static int lsqlite3_end_trans(struct ldb_module *module, int status)
*/
static int initialize(struct lsqlite3_private *lsqlite3,
- struct ldb_context *ldb, const char *url)
+ struct ldb_context *ldb, const char *url, int flags)
{
TALLOC_CTX *local_ctx;
long long queryInt;
@@ -1648,14 +1648,16 @@ static int initialize(struct lsqlite3_private *lsqlite3,
goto failed;
}
- /* DANGEROUS */
- ret = sqlite3_exec(lsqlite3->sqlite, "PRAGMA synchronous = OFF;", NULL, NULL, &errmsg);
- if (ret != SQLITE_OK) {
- if (errmsg) {
- printf("lsqlite3 initializaion error: %s\n", errmsg);
- free(errmsg);
+ if (flags & LDB_FLG_NOSYNC) {
+ /* DANGEROUS */
+ ret = sqlite3_exec(lsqlite3->sqlite, "PRAGMA synchronous = OFF;", NULL, NULL, &errmsg);
+ if (ret != SQLITE_OK) {
+ if (errmsg) {
+ printf("lsqlite3 initializaion error: %s\n", errmsg);
+ free(errmsg);
+ }
+ goto failed;
}
- goto failed;
}
/* */
@@ -1836,7 +1838,7 @@ int lsqlite3_connect(struct ldb_context *ldb,
lsqlite3->options = NULL;
lsqlite3->trans_count = 0;
- ret = initialize(lsqlite3, ldb, url);
+ ret = initialize(lsqlite3, ldb, url, flags);
if (ret != SQLITE_OK) {
goto failed;
}