diff --git a/configure.in b/configure.in index c69f140..bf861fe 100644 --- a/configure.in +++ b/configure.in @@ -41,7 +41,7 @@ dnl --------------------------------------------------------------------- sql=true AC_MSG_CHECKING( Are we using flex ) if test "x$LEX" = "xflex"; then -LFLAGS="$LFLAGS -i" +LFLAGS="$LFLAGS -i -8" AC_MSG_RESULT( yes ); else AC_MSG_RESULT( no - SQL engine disable); diff --git a/src/sql/lexer.l b/src/sql/lexer.l index 32a9ce6..be17e54 100644 --- a/src/sql/lexer.l +++ b/src/sql/lexer.l @@ -63,7 +63,7 @@ like { return LIKE; } return IDENT; } -[A-Za-z][A-Za-z0-9_#@]* { yylval.name = strdup(yytext); return NAME; } +[a-z\xa0-\xff][a-z0-9_#@\xa0-\xff]* { yylval.name = strdup(yytext); return NAME; } '[^']*'' { yyless(yyleng-1); @@ -74,10 +74,13 @@ like { return LIKE; } return STRING; } -(-*[0-9]+|([0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?) { - yylval.name = strdup(yytext); return NUMBER; - } -~?(\/?[A-Za-z0-9\.]+)+ { yylval.name = strdup(yytext); return PATH; } +(-*[0-9]+|([0-9]*\.[0-9]+)(e[-+]?[0-9]+)?) { + yylval.name = strdup(yytext); return NUMBER; + } +~?(\/?[a-z0-9\.\xa0-\xff]+)+ { + yylval.name = strdup(yytext); return PATH; + } + . { return yytext[0]; } %% diff --git a/src/sql/mdbsql.c b/src/sql/mdbsql.c index b455960..61956af 100644 --- a/src/sql/mdbsql.c +++ b/src/sql/mdbsql.c @@ -806,4 +806,3 @@ mdb_sql_dump_results(MdbSQL *sql) /* the column and table names are no good now */ mdb_sql_reset(sql); } - diff --git a/src/util/mdb-sql.c b/src/util/mdb-sql.c index a70a2f0..b3e2d86 100644 --- a/src/util/mdb-sql.c +++ b/src/util/mdb-sql.c @@ -74,7 +74,7 @@ char *readline(char *prompt) char *buf, line[1000]; int i = 0; - printf("%s",prompt); + puts(prompt); if (! fgets(line,1000,stdin)) { return NULL; } @@ -91,6 +91,15 @@ int i = 0; } #endif +static int strlen_utf(const char *s) { + int len = 0; + while (*s) { + if ((*s++ & 0xc0) != 0x80) + len++; + } + return len; +} + void do_set_cmd(MdbSQL *sql, char *s) { @@ -215,25 +224,22 @@ void print_value(FILE *out, char *v, int sz, int first) int i; int vlen; - if (first) { - fprintf(out,"|"); - } - vlen = strlen(v); - for (i=0;i= vlen ? ' ' : v[i]); - } - fprintf(out,"|"); + if (first) + fputc('|', out); + vlen = strlen_utf(v); + fputs(v, out); + for (i=vlen;i