~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Monty Taylor
  • Date: 2009-06-08 18:19:53 UTC
  • mto: This revision was merged to the branch mainline in revision 1060.
  • Revision ID: mordred@inaugust.com-20090608181953-9n1u3im0kezu2aoy
Removed copy_and_convert.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
  next_state(MY_LEX_START),
68
68
  found_semicolon(NULL),
69
69
  ignore_space(1),
70
 
  in_comment(NO_COMMENT),
71
 
  m_underscore_cs(NULL)
 
70
  in_comment(NO_COMMENT)
72
71
{
73
72
  m_cpp_buf= (char*) session->alloc(length + 1);
74
73
  m_cpp_ptr= m_cpp_buf;
168
167
                  m_cpp_utf8_processed_ptr will be set in the end of the
169
168
                  operation.
170
169
*/
171
 
void Lex_input_stream::body_utf8_append_literal(Session *session,
172
 
                                                const LEX_STRING *txt,
173
 
                                                const CHARSET_INFO * const txt_cs,
 
170
void Lex_input_stream::body_utf8_append_literal(const LEX_STRING *txt,
174
171
                                                const char *end_ptr)
175
172
{
176
173
  if (!m_cpp_utf8_processed_ptr)
177
174
    return;
178
175
 
179
 
  LEX_STRING utf_txt;
180
 
 
181
 
  if (!my_charset_same(txt_cs, &my_charset_utf8_general_ci))
182
 
  {
183
 
    session->convert_string(&utf_txt,
184
 
                        &my_charset_utf8_general_ci,
185
 
                        txt->str, txt->length,
186
 
                        txt_cs);
187
 
  }
188
 
  else
189
 
  {
190
 
    utf_txt.str= txt->str;
191
 
    utf_txt.length= txt->length;
192
 
  }
193
 
 
194
176
  /* NOTE: utf_txt.length is in bytes, not in symbols. */
195
177
 
196
 
  memcpy(m_body_utf8_ptr, utf_txt.str, utf_txt.length);
197
 
  m_body_utf8_ptr += utf_txt.length;
 
178
  memcpy(m_body_utf8_ptr, txt->str, txt->length);
 
179
  m_body_utf8_ptr += txt->length;
198
180
  *m_body_utf8_ptr= 0;
199
181
 
200
182
  m_cpp_utf8_processed_ptr= end_ptr;
788
770
 
789
771
      lip->body_utf8_append(lip->m_cpp_text_start);
790
772
 
791
 
      lip->body_utf8_append_literal(session, &yylval->lex_str, cs,
792
 
                                    lip->m_cpp_text_end);
 
773
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
793
774
 
794
775
      return(result_state);                     // IDENT or IDENT_QUOTED
795
776
 
889
870
 
890
871
      lip->body_utf8_append(lip->m_cpp_text_start);
891
872
 
892
 
      lip->body_utf8_append_literal(session, &yylval->lex_str, cs,
893
 
                                    lip->m_cpp_text_end);
 
873
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
894
874
 
895
875
      return(result_state);
896
876
 
926
906
        lip->yySkip();                  // Skip end `
927
907
      lip->next_state= MY_LEX_START;
928
908
      lip->body_utf8_append(lip->m_cpp_text_start);
929
 
      lip->body_utf8_append_literal(session, &yylval->lex_str, cs, lip->m_cpp_text_end);
 
909
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
930
910
      return(IDENT_QUOTED);
931
911
    }
932
912
    case MY_LEX_INT_OR_REAL:            // Complete int or incomplete real
1038
1018
 
1039
1019
      lip->body_utf8_append(lip->m_cpp_text_start);
1040
1020
 
1041
 
      lip->body_utf8_append_literal(session, &yylval->lex_str,
1042
 
        lip->m_underscore_cs ? lip->m_underscore_cs : cs,
1043
 
        lip->m_cpp_text_end);
1044
 
 
1045
 
      lip->m_underscore_cs= NULL;
 
1021
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
1046
1022
 
1047
1023
      lex->text_string_is_7bit= (lip->tok_bitmap & 0x80) ? 0 : 1;
1048
1024
      return(TEXT_STRING);
1275
1251
 
1276
1252
      lip->body_utf8_append(lip->m_cpp_text_start);
1277
1253
 
1278
 
      lip->body_utf8_append_literal(session, &yylval->lex_str, cs,
1279
 
                                    lip->m_cpp_text_end);
 
1254
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
1280
1255
 
1281
1256
      return(result_state);
1282
1257
    }