mirror of
https://github.com/lxsang/ant-http
synced 2024-11-17 17:08:20 +01:00
allow fields select in dbhelpder
This commit is contained in:
parent
fc2daeb620
commit
f251e0ac14
@ -132,10 +132,10 @@ dbrecord dball(sqlite3* db,const char* table)
|
||||
{
|
||||
return dbselect(db,table,"1=%d",1);
|
||||
}
|
||||
dbrecord dbselect(sqlite3* db, const char* table,const char* fstring,...)
|
||||
dbrecord dbselect(sqlite3* db, const char* table, const char* fname,const char* fstring,...)
|
||||
{
|
||||
char* sql;
|
||||
char* prefix = "SELECT * FROM %s WHERE %s";
|
||||
char* prefix = "SELECT (%s) FROM %s WHERE %s";
|
||||
char* cond;
|
||||
va_list arguments;
|
||||
int dlen;
|
||||
@ -149,7 +149,7 @@ dbrecord dbselect(sqlite3* db, const char* table,const char* fstring,...)
|
||||
va_start(arguments, fstring);
|
||||
vsnprintf(cond, dlen, fstring, arguments);
|
||||
va_end(arguments);
|
||||
sql = __s(prefix,table,cond);
|
||||
sql = __s(prefix, fname,table,cond);
|
||||
|
||||
if(sqlite3_prepare_v2(db, sql, -1, &statement, 0) == SQLITE_OK)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ int dbquery(sqlite3*,const char*, int (*)());
|
||||
int dbinsert(sqlite3*,const char*,const dbfield);
|
||||
int hastable(sqlite3*,const char*);
|
||||
int dbupdate(sqlite3*,const char*,const dbfield,const char*,...);
|
||||
dbrecord dbselect(sqlite3*, const char*,const char*,...);
|
||||
dbrecord dbselect(sqlite3*, const char*, const char*,const char*,...);
|
||||
dbrecord dball(sqlite3*,const char*);
|
||||
int dbdelete(sqlite3*,const char*,const char*,...);
|
||||
dbfield __field();
|
||||
|
Loading…
Reference in New Issue
Block a user