[asterisk-commits] twilson: branch twilson/sqlite_astdb r323455 - /team/twilson/sqlite_astdb/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 14 15:25:06 CDT 2011
Author: twilson
Date: Tue Jun 14 15:25:04 2011
New Revision: 323455
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=323455
Log:
Make tilghman happy, cause if tilghman ain't happy nobody's happy!
Modified:
team/twilson/sqlite_astdb/main/db.c
Modified: team/twilson/sqlite_astdb/main/db.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/sqlite_astdb/main/db.c?view=diff&rev=323455&r1=323454&r2=323455
==============================================================================
--- team/twilson/sqlite_astdb/main/db.c (original)
+++ team/twilson/sqlite_astdb/main/db.c Tue Jun 14 15:25:04 2011
@@ -120,7 +120,7 @@
DEFINE_SQL_STATEMENT(deltree_all_stmt, "DELETE FROM astdb")
DEFINE_SQL_STATEMENT(gettree_stmt, "SELECT key, value FROM astdb WHERE key LIKE ? || '/' || '%'")
DEFINE_SQL_STATEMENT(gettree_all_stmt, "SELECT key, value FROM astdb")
-DEFINE_SQL_STATEMENT(showkey_stmt, "SELECT key, value FROM astdb WHERE key LIKE '%' || ?")
+DEFINE_SQL_STATEMENT(showkey_stmt, "SELECT key, value FROM astdb WHERE key LIKE '%' || '/' || ?")
DEFINE_SQL_STATEMENT(create_astdb_stmt, "CREATE TABLE IF NOT EXISTS astdb(key VARCHAR(256), value VARCHAR(256), PRIMARY KEY(key))")
static int init_stmt(sqlite3_stmt **stmt, const char *sql, size_t len)
@@ -662,7 +662,6 @@
static char *handle_cli_database_showkey(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- char suffix[MAX_DB_FIELD];
int counter = 0;
switch (cmd) {
@@ -676,16 +675,13 @@
return NULL;
}
- if (a->argc == 3) {
- /* Key only */
- snprintf(suffix, sizeof(suffix), "/%s", a->argv[2]);
- } else {
+ if (a->argc != 3) {
return CLI_SHOWUSAGE;
}
ast_mutex_lock(&dblock);
- if (!ast_strlen_zero(suffix) && (sqlite3_bind_text(showkey_stmt, 1, suffix, -1, SQLITE_STATIC) != SQLITE_OK)) {
- ast_log(LOG_WARNING, "Could bind %s to stmt: %s\n", suffix, sqlite3_errmsg(astdb));
+ if (!ast_strlen_zero(a->argv[2]) && (sqlite3_bind_text(showkey_stmt, 1, a->argv[2], -1, SQLITE_STATIC) != SQLITE_OK)) {
+ ast_log(LOG_WARNING, "Could bind %s to stmt: %s\n", a->argv[2], sqlite3_errmsg(astdb));
sqlite3_reset(showkey_stmt);
ast_mutex_unlock(&dblock);
return NULL;
More information about the asterisk-commits
mailing list