qc_sqlite: Handle a name like ``a.

This commit is contained in:
Johan Wikman 2016-09-29 23:48:21 +03:00
parent ca76cb1576
commit fa2a667195
2 changed files with 8 additions and 1 deletions

View File

@ -919,6 +919,7 @@ static void update_database_names(QC_SQLITE_INFO* info, const char* zDatabase)
static void update_names(QC_SQLITE_INFO* info, const char* zDatabase, const char* zTable)
{
char* zCopy = mxs_strdup(zTable);
// TODO: Is this call really needed. Check also sqlite3Dequote.
exposed_sqlite3Dequote(zCopy);
enlarge_string_array(1, info->table_names_len, &info->table_names, &info->table_names_capacity);

View File

@ -220,7 +220,13 @@ int sqlite3Dequote(char *z){
for(i=1, j=0;; i++){
assert( z[i] );
#ifdef MAXSCALE
if ( z[i]=='\\' ){
if ( z[i]==0 ){
// TODO: This is needed only because exposed_sqlite3Dequote() is called
// TODO: in qc_sqlite.c:update_names(). That call probably is not needed
// TODO: and should be removed, in which case this check could also be
// TODO: removed.
break;
}else if ( z[i]=='\\' ){
z[j++] = '\\';
if ( z[i+1]==quote || z[i+1]=='\\' ){
z[j++] = quote;