* Fix a few typos.

This commit is contained in:
Justin Maggard 2010-08-06 17:18:37 +00:00
parent c97d359fe2
commit 09ac5263a7
2 changed files with 10 additions and 8 deletions

12
sql.c
View File

@ -124,7 +124,7 @@ sql_get_int_field(sqlite3 *db, const char *fmt, ...)
} }
char * char *
sql_get_text_field(void *dbh, const char *fmt, ...) sql_get_text_field(void *db, const char *fmt, ...)
{ {
va_list ap; va_list ap;
int counter, result, len; int counter, result, len;
@ -134,9 +134,9 @@ sql_get_text_field(void *dbh, const char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
if (dbh == NULL) if (db == NULL)
{ {
DPRINTF(E_WARN, L_DB_SQL, "%s: dbh is NULL", __func__); DPRINTF(E_WARN, L_DB_SQL, "%s: db is NULL", __func__);
return NULL; return NULL;
} }
@ -144,12 +144,12 @@ sql_get_text_field(void *dbh, const char *fmt, ...)
//DPRINTF(E_DEBUG, L_DB_SQL, "sql: %s\n", sql); //DPRINTF(E_DEBUG, L_DB_SQL, "sql: %s\n", sql);
switch (sqlite3_prepare_v2(dbh, sql, -1, &stmt, NULL)) switch (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL))
{ {
case SQLITE_OK: case SQLITE_OK:
break; break;
default: default:
DPRINTF(E_ERROR, L_DB_SQL, "prepare failed: %s\n%s\n", sqlite3_errmsg, sql); DPRINTF(E_ERROR, L_DB_SQL, "prepare failed: %s\n%s\n", sqlite3_errmsg(db), sql);
sqlite3_free(sql); sqlite3_free(sql);
return NULL; return NULL;
} }
@ -190,7 +190,7 @@ sql_get_text_field(void *dbh, const char *fmt, ...)
break; break;
default: default:
DPRINTF(E_WARN, L_DB_SQL, "%s: step failed: %s", __func__, sqlite3_errmsg); DPRINTF(E_WARN, L_DB_SQL, "%s: step failed: %s", __func__, sqlite3_errmsg(db));
str = NULL; str = NULL;
break; break;
} }

View File

@ -957,10 +957,12 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
else else
{ {
ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS" ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS"
"where OBJECT_ID in ('1$%s', '2$%s', '3$%s')", " where OBJECT_ID in ('1$%s', '2$%s', '3$%s')",
ObjectId, ObjectId, ObjectId); ObjectId, ObjectId, ObjectId);
if( ptr ) if( ptr )
ObjectId = ptr; ObjectId = ptr;
else
ObjectId = sqlite3_mprintf("%s", ObjectId);
} }
} }
DPRINTF(E_DEBUG, L_HTTP, "Browsing ContentDirectory:\n" DPRINTF(E_DEBUG, L_HTTP, "Browsing ContentDirectory:\n"
@ -1132,7 +1134,7 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
else else
{ {
ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS" ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS"
"where OBJECT_ID in ('1$%s', '2$%s', '3$%s')", " where OBJECT_ID in ('1$%s', '2$%s', '3$%s')",
ContainerID, ContainerID, ContainerID); ContainerID, ContainerID, ContainerID);
if( ptr ) if( ptr )
ContainerID = ptr; ContainerID = ptr;