Commit 0651fff2 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Merge pull request #11 from groleo/for-upstream

sqlite3 fixes
parents 5108504d c6ff8b13
...@@ -421,7 +421,7 @@ fi ...@@ -421,7 +421,7 @@ fi
if test "$f_sqlite3" = YES; then if test "$f_sqlite3" = YES; then
printf " Checking for sqlite3 ... " printf " Checking for sqlite3 ... "
sqlite3_hdr_dir="/usr/include /usr/local/include /opt/local/include" sqlite3_hdr_dir="/usr/include /usr/local/include /opt/local/include"
sqlite3_lib_dir="/usr/lib /usr/local/lib /opt/local/lib" sqlite3_lib_dir="/usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu"
sqlite3_lib_name="libsqlite3.so libsqlite3.dylib libsqlite3.a" sqlite3_lib_name="libsqlite3.so libsqlite3.dylib libsqlite3.a"
sqlite3_hdr=NO sqlite3_hdr=NO
sqlite3_lib=NO sqlite3_lib=NO
...@@ -435,7 +435,7 @@ if test "$f_sqlite3" = YES; then ...@@ -435,7 +435,7 @@ if test "$f_sqlite3" = YES; then
for i in $sqlite3_lib_dir; do for i in $sqlite3_lib_dir; do
if test "$sqlite3_lib" = NO; then if test "$sqlite3_lib" = NO; then
for j in $sqlite3_lib_name; do for j in $sqlite3_lib_name; do
if test -f "$i/$j"; then if test -e "$i/$j"; then
sqlite3_lib="$i/$j" sqlite3_lib="$i/$j"
sqlite3_link="-L $i -lsqlite3" sqlite3_link="-L $i -lsqlite3"
break break
...@@ -445,6 +445,7 @@ if test "$f_sqlite3" = YES; then ...@@ -445,6 +445,7 @@ if test "$f_sqlite3" = YES; then
done done
if test "$sqlite3_hdr" = NO -o "$sqlite3_lib" = NO; then if test "$sqlite3_hdr" = NO -o "$sqlite3_lib" = NO; then
echo "not found!"; echo "not found!";
exit 1
else else
echo "using header $sqlite3_hdr and library $sqlite3_lib..."; echo "using header $sqlite3_hdr and library $sqlite3_lib...";
fi fi
......
...@@ -240,7 +240,7 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def); ...@@ -240,7 +240,7 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def);
static void bindTextParameter(sqlite3_stmt *stmt,const char *name,const char *value) static void bindTextParameter(sqlite3_stmt *stmt,const char *name,const char *value)
{ {
int idx = sqlite3_bind_parameter_index(stmt, name); int idx = sqlite3_bind_parameter_index(stmt, name);
sqlite3_bind_text(id_s_files, idx, value, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, idx, value, -1, SQLITE_STATIC);
} }
static void bindIntParameter(sqlite3_stmt *stmt,const char *name,int value) static void bindIntParameter(sqlite3_stmt *stmt,const char *name,int value)
...@@ -255,7 +255,7 @@ static int step(sqlite3 *db, sqlite3_stmt *stmt,bool getRowId=FALSE) ...@@ -255,7 +255,7 @@ static int step(sqlite3 *db, sqlite3_stmt *stmt,bool getRowId=FALSE)
int rc = sqlite3_step(stmt); int rc = sqlite3_step(stmt);
if (rc!=SQLITE_DONE && rc!=SQLITE_ROW) if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
{ {
msg("failed count files: %s\n", sqlite3_errmsg(db)); msg("sqlite3_step failed: %s\n", sqlite3_errmsg(db));
} }
if (getRowId) id = sqlite3_column_int(stmt, 0); if (getRowId) id = sqlite3_column_int(stmt, 0);
sqlite3_reset(stmt); sqlite3_reset(stmt);
...@@ -278,10 +278,10 @@ static int insertFile(sqlite3 *db, const char* name) ...@@ -278,10 +278,10 @@ static int insertFile(sqlite3 *db, const char* name)
{ {
int id=-1; int id=-1;
if (name==0) return -1; if (name==0) return -1;
// see if it's already in DB
// see if it's already in DB
bindTextParameter(id_s_files,":name",name); bindTextParameter(id_s_files,":name",name);
id=step(db,i_s_files,TRUE); id=step(db,id_s_files,TRUE);
if (id==0) if (id==0)
{ {
// insert it // insert it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment