~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Mark Atwood
  • Date: 2011-10-19 00:10:47 UTC
  • mfrom: (2440.2.13 rf)
  • Revision ID: me@mark.atwood.name-20111019001047-atj0u8gedphon1tb
mergeĀ lp:~olafvdspek/drizzle/refactor5

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
                  m_cpp_utf8_processed_ptr will be set in the end of the
162
162
                  operation.
163
163
*/
164
 
void Lex_input_stream::body_utf8_append_literal(const lex_string_t *txt,
165
 
                                                const char *end_ptr)
 
164
void Lex_input_stream::body_utf8_append_literal(str_ref txt, const char *end_ptr)
166
165
{
167
166
  if (!m_cpp_utf8_processed_ptr)
168
167
    return;
169
168
 
170
169
  /* NOTE: utf_txt.length is in bytes, not in symbols. */
171
170
 
172
 
  memcpy(m_body_utf8_ptr, txt->data(), txt->size());
173
 
  m_body_utf8_ptr += txt->size();
 
171
  memcpy(m_body_utf8_ptr, txt.data(), txt.size());
 
172
  m_body_utf8_ptr += txt.size();
174
173
  *m_body_utf8_ptr= 0;
175
174
 
176
175
  m_cpp_utf8_processed_ptr= end_ptr;
756
755
 
757
756
      lip->body_utf8_append(lip->m_cpp_text_start);
758
757
 
759
 
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
 
758
      lip->body_utf8_append_literal(yylval->lex_str, lip->m_cpp_text_end);
760
759
 
761
760
      return(result_state);                     // IDENT or IDENT_QUOTED
762
761
 
853
852
 
854
853
      lip->body_utf8_append(lip->m_cpp_text_start);
855
854
 
856
 
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
 
855
      lip->body_utf8_append_literal(yylval->lex_str, lip->m_cpp_text_end);
857
856
 
858
857
      return(result_state);
859
858
 
879
878
          break;                                // Error
880
879
        lip->skip_binary(var_length-1);
881
880
      }
882
 
      if (double_quotes)
883
 
              yylval->lex_str=get_quoted_token(lip, 1, lip->yyLength() - double_quotes -1, quote_char);
884
 
      else
885
 
        yylval->lex_str=get_token(lip, 1, lip->yyLength() -1);
 
881
      yylval->lex_str= double_quotes
 
882
        ? get_quoted_token(lip, 1, lip->yyLength() - double_quotes - 1, quote_char)
 
883
        : get_token(lip, 1, lip->yyLength() - 1);
886
884
      if (c == quote_char)
887
885
        lip->yySkip();                  // Skip end `
888
886
      lip->next_state= MY_LEX_START;
889
887
      lip->body_utf8_append(lip->m_cpp_text_start);
890
 
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
891
 
      return(IDENT_QUOTED);
 
888
      lip->body_utf8_append_literal(yylval->lex_str, lip->m_cpp_text_end);
 
889
      return IDENT_QUOTED;
892
890
    }
893
891
    case MY_LEX_INT_OR_REAL:            // Complete int or incomplete real
894
892
      if (c != '.')
998
996
      yylval->lex_str.assign(yylval->lex_str.data(), lip->yytoklen);
999
997
 
1000
998
      lip->body_utf8_append(lip->m_cpp_text_start);
1001
 
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
 
999
      lip->body_utf8_append_literal(yylval->lex_str, lip->m_cpp_text_end);
1002
1000
 
1003
1001
      lex->text_string_is_7bit= (lip->tok_bitmap & 0x80) ? 0 : 1;
1004
1002
      return(TEXT_STRING);
1233
1231
      yylval->lex_str=get_token(lip, 0, length);
1234
1232
 
1235
1233
      lip->body_utf8_append(lip->m_cpp_text_start);
1236
 
 
1237
 
      lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
1238
 
 
1239
 
      return(result_state);
 
1234
      lip->body_utf8_append_literal(yylval->lex_str, lip->m_cpp_text_end);
 
1235
 
 
1236
      return result_state;
1240
1237
    }
1241
1238
  }
1242
1239
}