1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Changed my_strntoxxx functions to clear error number on start

Allow one to change ANSI_QUOTES mode per thread and on the fly


sql/field.cc:
  Use new my_strntoxxx functions where function clears errno.
  Change variable names to 'not_used' for variables that is not used in function
sql/sql_base.cc:
  comment
sql/sql_lex.cc:
  Allow one to change ANSI_QUOTES mode per thread and on the fly
sql/sql_lex.h:
  Allow one to change ANSI_QUOTES mode per thread and on the fly
strings/ctype-simple.c:
  Changed my_strntoxxx functions to clear error number on start
  Changed my_strtod() to correctly set return error number
strings/ctype-utf8.c:
  Changed my_strntoxxx functions to clear error number on start
  Changed my_strtod() to correctly set return error number
This commit is contained in:
unknown
2003-01-17 16:33:54 +02:00
parent 3531347e8c
commit 4655f1d4b4
6 changed files with 88 additions and 60 deletions

View File

@ -107,7 +107,7 @@ void lex_init(void)
state_map[i]=(uchar) STATE_CHAR;
}
state_map[(uchar)'_']=state_map[(uchar)'$']=(uchar) STATE_IDENT;
state_map[(uchar)'\'']=state_map[(uchar)'"']=(uchar) STATE_STRING;
state_map[(uchar)'\'']=(uchar) STATE_STRING;
state_map[(uchar)'-']=state_map[(uchar)'+']=(uchar) STATE_SIGNED_NUMBER;
state_map[(uchar)'.']=(uchar) STATE_REAL_OR_POINT;
state_map[(uchar)'>']=state_map[(uchar)'=']=state_map[(uchar)'!']= (uchar) STATE_CMP_OP;
@ -122,10 +122,7 @@ void lex_init(void)
state_map[(uchar)'*']= (uchar) STATE_END_LONG_COMMENT;
state_map[(uchar)'@']= (uchar) STATE_USER_END;
state_map[(uchar) '`']= (uchar) STATE_USER_VARIABLE_DELIMITER;
if (global_system_variables.sql_mode & MODE_ANSI_QUOTES)
{
state_map[(uchar) '"'] = STATE_USER_VARIABLE_DELIMITER;
}
state_map[(uchar)'"']= (uchar) STAT_STRING_OR_DELIMITER;
/*
Create a second map to make it faster to find identifiers
@ -652,12 +649,13 @@ int yylex(void *arg, void *yythd)
return(IDENT);
case STATE_USER_VARIABLE_DELIMITER:
{
char delim= c; // Used char
lex->tok_start=lex->ptr; // Skip first `
#ifdef USE_MB
if (use_mb(system_charset_info))
{
while ((c=yyGet()) && state_map[c] != STATE_USER_VARIABLE_DELIMITER &&
c != (uchar) NAMES_SEP_CHAR)
while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR)
{
if (my_ismbhead(system_charset_info, c))
{
@ -673,16 +671,15 @@ int yylex(void *arg, void *yythd)
else
#endif
{
while ((c=yyGet()) && state_map[c] != STATE_USER_VARIABLE_DELIMITER &&
c != (uchar) NAMES_SEP_CHAR) ;
while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR) ;
}
yylval->lex_str=get_token(lex,yyLength());
if (lex->convert_set)
lex->convert_set->convert((char*) yylval->lex_str.str,lex->yytoklen);
if (state_map[c] == STATE_USER_VARIABLE_DELIMITER)
if (c == delim)
yySkip(); // Skip end `
return(IDENT);
}
case STATE_SIGNED_NUMBER: // Incomplete signed number
if (prev_state == STATE_OPERATOR_OR_IDENT)
{
@ -795,6 +792,13 @@ int yylex(void *arg, void *yythd)
lex->next_state= STATE_START; // Allow signed numbers
return(tokval);
case STAT_STRING_OR_DELIMITER:
if (((THD *) yythd)->variables.sql_mode & MODE_ANSI_QUOTES)
{
state= STATE_USER_VARIABLE_DELIMITER;
break;
}
/* " used for strings */
case STATE_STRING: // Incomplete text string
if (!(yylval->lex_str.str = get_text(lex)))
{
@ -889,6 +893,7 @@ int yylex(void *arg, void *yythd)
switch (state_map[yyPeek()]) {
case STATE_STRING:
case STATE_USER_VARIABLE_DELIMITER:
case STAT_STRING_OR_DELIMITER:
break;
case STATE_USER_END:
lex->next_state=STATE_SYSTEM_VAR;