1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-03 16:53:36 +03:00

All identifiers to be quoted in square brackets, for compatibility with

MS-Access. (CVS 370)

FossilOrigin-Name: e17a858c9eeb70c62f54c88e6be5897e58d67301
This commit is contained in:
drh
2002-02-14 21:42:51 +00:00
parent cffa014dc3
commit 2f4392ff5b
7 changed files with 36 additions and 16 deletions

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.36 2002/01/22 14:11:30 drh Exp $
** $Id: util.c,v 1.37 2002/02/14 21:42:51 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -349,13 +349,22 @@ void sqliteSetNString(char **pz, ...){
** the quote characters. The conversion is done in-place. If the
** input does not begin with a quote character, then this routine
** is a no-op.
**
** 2002-Feb-14: This routine is extended to remove MS-Access style
** brackets from around identifers. For example: "[a-b-c]" becomes
** "a-b-c".
*/
void sqliteDequote(char *z){
int quote;
int i, j;
if( z==0 ) return;
quote = z[0];
if( quote!='\'' && quote!='"' ) return;
switch( quote ){
case '\'': break;
case '"': break;
case '[': quote = ']'; break;
default: return;
}
for(i=1, j=0; z[i]; i++){
if( z[i]==quote ){
if( z[i+1]==quote ){