From: Tilghman Lesher Date: Fri, 18 Nov 2011 22:16:26 +0000 (+0000) Subject: Fix a change in behavior in 'database show' from 1.8. X-Git-Tag: 10.1.0-rc1~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe5d04243bd64c09ae44d48623a711b4d99ba1cf;p=thirdparty%2Fasterisk.git Fix a change in behavior in 'database show' from 1.8. In 1.8 and previous versions, one could use any fullword portion of the key name, including the full key, to obtain the record. Until this patch, this did not work for the full key. Closes issue ASTERISK-18886 Patch: by tilghman Review: by twilson (http://pastebin.com/7rtu6bpk) on #asterisk-dev git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@345640 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/db.c b/main/db.c index 67a8ccdb72..d7c8f55509 100644 --- a/main/db.c +++ b/main/db.c @@ -117,9 +117,9 @@ static void db_sync(void); DEFINE_SQL_STATEMENT(put_stmt, "INSERT OR REPLACE INTO astdb (key, value) VALUES (?, ?)") DEFINE_SQL_STATEMENT(get_stmt, "SELECT value FROM astdb WHERE key=?") DEFINE_SQL_STATEMENT(del_stmt, "DELETE FROM astdb WHERE key=?") -DEFINE_SQL_STATEMENT(deltree_stmt, "DELETE FROM astdb WHERE key LIKE ? || '/' || '%'") +DEFINE_SQL_STATEMENT(deltree_stmt, "DELETE FROM astdb WHERE key || '/' LIKE ? || '/' || '%'") 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_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(create_astdb_stmt, "CREATE TABLE IF NOT EXISTS astdb(key VARCHAR(256), value VARCHAR(256), PRIMARY KEY(key))")