Patch utfsql.diff from Nirgal

This commit is contained in:
Nirgal Vourgre 2011-08-28 19:49:54 -04:00 committed by Brian Bruns
parent aee657f603
commit 07f915b3c7
4 changed files with 31 additions and 23 deletions

View File

@ -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);

View File

@ -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]; }
%%

View File

@ -806,4 +806,3 @@ mdb_sql_dump_results(MdbSQL *sql)
/* the column and table names are no good now */
mdb_sql_reset(sql);
}

View File

@ -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<sz;i++) {
fprintf(out,"%c",i >= vlen ? ' ' : v[i]);
}
fprintf(out,"|");
if (first)
fputc('|', out);
vlen = strlen_utf(v);
fputs(v, out);
for (i=vlen;i<sz;i++)
fputc(' ', out);
fputc('|', out);
}
static void print_break(FILE *out, int sz, int first)
{
int i;
if (first) {
fprintf(out,"+");
}
for (i=0;i<sz;i++) {
fprintf(out,"-");
}
fprintf(out,"+");
if (first)
fputc('+', out);
for (i=0;i<sz;i++)
fputc('-', out);
fputc('+', out);
}
void print_rows_retrieved(FILE *out, unsigned long row_count)
{