mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Merge pull request #1655 from molecula/bug/syang/query-console-drop-table
CLOUD-137: Wrap field and table names in backticks for sql queries
This commit is contained in:
commit
153dea6e1d
1 changed files with 13 additions and 1 deletions
|
|
@ -110,7 +110,19 @@ export const QueryContainer: FC<{}> = () => {
|
|||
setLoading(false);
|
||||
}
|
||||
} else {
|
||||
querySQL(query, handleQueryMessages, handleQueryEnd);
|
||||
let queryArr = query.split(' ');
|
||||
queryArr.forEach((word, idx) => {
|
||||
if (word.includes('-')) {
|
||||
let wordArr = word.split('.');
|
||||
wordArr.forEach((section, idx) => {
|
||||
if(section.includes('-') && !word.includes('`')) {
|
||||
wordArr[idx] = `\`${wordArr[idx]}\``;
|
||||
}
|
||||
})
|
||||
queryArr[idx] = wordArr.join('.');
|
||||
}
|
||||
});
|
||||
querySQL(queryArr.join(' '), handleQueryMessages, handleQueryEnd);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue