File: test.cpp

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (70 lines) | stat: -rw-r--r-- 1,195 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "LexerTest.h"

//int main(int argc, char* argv[])
//{
//  LexerTest test;
//  test.testLexer();
//
//  return 0;
//}

#define MYSQL_LEX 1
#define MYSQL_SERVER


//extern "C" 
//{
extern int pthread_dummy(int) { return 0; }
//}

typedef void* YYSTYPE;
#define YYSTYPE_IS_DECLARED

#include <sstream>
#include "myx_lex_helpers.h"

#include "mysql_version.h"
#include "my_global.h"
#include "my_sys.h"
#include "sql_string.h"
#include "unireg.h"

#include "structs.h"
#include <m_ctype.h>
#include <hash.h>

#include "sql_lex.h"


int MYSQLlex(void **arg, void *yylex);
void lex_init(void);
void lex_start(LEX *lex, const uchar *buf, uint length);

int main(int argc, char* argv[])
{
  YYSTYPE yystype;

  lex_init();
  const char *query= "CREATE TABLE test.t1 (id INT NOT NULL PRIMARY KEY, t TEXT)";

  LEX lex;
  lex_start(&lex, reinterpret_cast<const unsigned char *>(query), (unsigned int)strlen(query));
  lex.charset= get_charset_by_name("utf8_bin", MYF(0));

  lex_args.arg1= &yystype;
  lex_args.arg2= &lex;

  yytokentype retval;

  while(1)
  {
    retval= (yytokentype)yylex(&yystype);
    retval= retval;
  }

  //LexerTest test;
  //test.stringParse(query);
  
  return 0;
}