File libvpd.async.patch of Package libvpd2
---
src/vpddbenv.cpp | 16 ++++++++++++++++
src/vpddbenv_c.c | 9 +++++++++
2 files changed, 25 insertions(+)
Index: libvpd-2.2.2/src/vpddbenv.cpp
===================================================================
--- libvpd-2.2.2.orig/src/vpddbenv.cpp
+++ libvpd-2.2.2/src/vpddbenv.cpp
@@ -77,6 +77,22 @@ namespace lsvpd
goto CON_ERR;
}
+ {
+ sqlite3_stmt *pstmt;
+ const char *out;
+ ostringstream sql;
+ sql << "PRAGMA synchronous = OFF;";
+ string stmt = sql.str( );
+ rc = SQLITE3_PREPARE( mpVpdDb, stmt.c_str( ),
+ stmt.length( ) + 1, &pstmt, &out );
+ if( rc != SQLITE_OK )
+ {
+ message << "SQLITE Error setting pragma " << rc << ": " <<
+ sqlite3_errmsg( mpVpdDb ) << endl;
+ }
+ sqlite3_finalize( pstmt );
+ }
+
if( !dbExists )
{
sqlite3_stmt *pstmt;
Index: libvpd-2.2.2/src/vpddbenv_c.c
===================================================================
--- libvpd-2.2.2.orig/src/vpddbenv_c.c
+++ libvpd-2.2.2/src/vpddbenv_c.c
@@ -28,6 +28,9 @@
struct vpddbenv * new_vpddbenv( const char *dir, const char *file )
{
+ sqlite3_stmt *pstmt = NULL;
+ const char *out;
+ char sql[ QUERY_BUF_LENGTH ];
struct vpddbenv *ret = NULL;
int rc = 0;
@@ -55,6 +58,12 @@ struct vpddbenv * new_vpddbenv( const ch
if( rc != SQLITE_OK )
goto newerr;
+ memset( sql, 0, QUERY_BUF_LENGTH );
+ snprintf(sql, QUERY_BUF_LENGTH, "PRAGMA synchronous = OFF;");
+ rc = SQLITE3_PREPARE(&(ret->db), sql, strlen(sql)+1, &pstmt, &out);
+ if( rc != SQLITE_OK )
+ fprintf( stderr, "sqlite pragma async %d '%s'\n",rc, sqlite3_errmsg( ret->db ) );
+ sqlite3_finalize( pstmt );
return ret;
newerr: