Commit e66b7405 authored by unknown's avatar unknown

file parser for new .frm


include/my_sys.h:
  names for get_date format flags
include/mysqld_error.h:
  error of parser
libmysqld/Makefile.am:
  parser file added
mysys/mf_getdate.c:
  function comment for get_date()
  2 new flags added
  names for get_date format flags
sql/Makefile.am:
  parser file added
sql/mysql_priv.h:
  parser file added
sql/share/czech/errmsg.txt:
  file parser errors
sql/share/danish/errmsg.txt:
  file parser errors
sql/share/dutch/errmsg.txt:
  file parser errors
sql/share/english/errmsg.txt:
  file parser errors
sql/share/estonian/errmsg.txt:
  file parser errors
sql/share/french/errmsg.txt:
  file parser errors
sql/share/german/errmsg.txt:
  file parser errors
sql/share/greek/errmsg.txt:
  file parser errors
sql/share/hungarian/errmsg.txt:
  file parser errors
sql/share/italian/errmsg.txt:
  file parser errors
sql/share/japanese/errmsg.txt:
  file parser errors
sql/share/korean/errmsg.txt:
  file parser errors
sql/share/norwegian-ny/errmsg.txt:
  file parser errors
sql/share/norwegian/errmsg.txt:
  file parser errors
sql/share/polish/errmsg.txt:
  file parser errors
sql/share/portuguese/errmsg.txt:
  file parser errors
sql/share/romanian/errmsg.txt:
  file parser errors
sql/share/russian/errmsg.txt:
  file parser errors
sql/share/serbian/errmsg.txt:
  file parser errors
sql/share/slovak/errmsg.txt:
  file parser errors
sql/share/spanish/errmsg.txt:
  file parser errors
sql/share/swedish/errmsg.txt:
  file parser errors
sql/share/ukrainian/errmsg.txt:
  file parser errors
BitKeeper/etc/ignore:
  Added libmysqld/parse_file.cc to the ignore list
parent d7938b9f
......@@ -655,3 +655,4 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
libmysqld/parse_file.cc
......@@ -121,6 +121,13 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_ERRNO_EDOM 33
#define MY_ERRNO_ERANGE 34
/* Bits for get_date timeflag */
#define GETDATE_DATE_TIME 1
#define GETDATE_SHORT_DATE 2
#define GETDATE_HHMMSSTIME 4
#define GETDATE_GMT 8
#define GETDATE_FIXEDLENGTH 16
/* defines when allocating data */
#ifdef SAFEMALLOC
#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
......
......@@ -348,4 +348,9 @@
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1329
#define ER_SP_CURSOR_AFTER_HANDLER 1330
#define ER_SP_CASE_NOT_FOUND 1331
#define ER_ERROR_MESSAGES 332
#define ER_FPARSER_TOO_BIG_FILE 1332
#define ER_FPARSER_BAD_HEADER 1333
#define ER_FPARSER_EOF_IN_COMMENT 1334
#define ER_FPARSER_ERROR_IN_PARAMETER 1335
#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1336
#define ER_ERROR_MESSAGES 337
......@@ -58,7 +58,8 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc protocol_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
libmysqld_a_SOURCES=
......
......@@ -19,11 +19,20 @@
#include "mysys_priv.h"
#include <m_string.h>
/*
If flag & 1 Return date and time
If flag & 2 Return short date format YYMMDD
if flag & 4 Return time in HHMMDD format.
*/
/*
get date as string
SYNOPSIS
get_date()
to - string where date will be written
flag - format of date:
If flag & GETDATE_TIME Return date and time
If flag & GETDATE_SHORT_DATE Return short date format YYMMDD
If flag & GETDATE_HHMMSSTIME Return time in HHMMDD format.
If flag & GETDATE_GMT Date/time in GMT
If flag & GETDATE_FIXEDLENGTH Return fixed length date/time
date - for conversion
*/
void get_date(register my_string to, int flag, time_t date)
......@@ -36,27 +45,36 @@ void get_date(register my_string to, int flag, time_t date)
skr=date ? (time_t) date : time((time_t*) 0);
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
localtime_r(&skr,&tm_tmp);
if (flag & GETDATE_GMT)
localtime_r(&skr,&tm_tmp);
else
gmtime_r(&skr,&tm_tmp);
start_time= &tm_tmp;
#else
start_time=localtime(&skr);
if (flag & GETDATE_GMT)
start_time= localtime(&skr);
else
gmtime(&skr,&tm_tmp);
#endif
if (flag & 2)
if (flag & GETDATE_SHORT_DATE)
sprintf(to,"%02d%02d%02d",
start_time->tm_year % 100,
start_time->tm_mon+1,
start_time->tm_mday);
else
sprintf(to,"%d-%02d-%02d",
sprintf(to, ((flag & GETDATE_FIXEDLENGTH) ?
"%4d-%02d-%02d" : "%d-%02d-%02d"),
start_time->tm_year+1900,
start_time->tm_mon+1,
start_time->tm_mday);
if (flag & 1)
sprintf(strend(to)," %2d:%02d:%02d",
if (flag & GETDATE_DATE_TIME)
sprintf(strend(to),
((flag & GETDATE_FIXEDLENGTH) ?
" %02d:%02d:%02d" : " %2d:%02d:%02d"),
start_time->tm_hour,
start_time->tm_min,
start_time->tm_sec);
else if (flag & 4)
else if (flag & GETDATE_HHMMSSTIME)
sprintf(strend(to),"%02d%02d%02d",
start_time->tm_hour,
start_time->tm_min,
......
......@@ -58,7 +58,8 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
log_event.h sql_repl.h slave.h \
stacktrace.h sql_sort.h sql_cache.h set_var.h \
spatial.h gstream.h client_settings.h \
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
parse_file.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
......@@ -89,7 +90,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\
gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
sp_cache.cc
sp_cache.cc parse_file.cc
gen_lex_hash_SOURCES = gen_lex_hash.cc
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
......
......@@ -375,6 +375,7 @@ inline THD *_current_thd(void)
#include "sql_list.h"
#include "sql_map.h"
#include "handler.h"
#include "parse_file.h"
#include "table.h"
#include "field.h" /* Field definitions */
#include "protocol.h"
......
This diff is collapsed.
/* -*- C++ -*- */
/* Copyright (C) 2004 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _PARSE_FILE_H_
#define _PARSE_FILE_H_
#define PARSE_FILE_TIMESTAMPLENGTH 19
typedef enum {
FILE_OPTIONS_STRING, /* String (LEX_STRING) */
FILE_OPTIONS_ESTRING, /* Escaped string (LEX_STRING) */
FILE_OPTIONS_ULONGLONG, /* ulonglong parapeter (ulonglong) */
FILE_OPTIONS_REV, /* Revision version number (ulonglong) */
FILE_OPTIONS_TIMESTAMP, /* timestamp (LEX_STRING have to be
allocated with length 20 (19+1) */
FILE_OPTIONS_STRLIST /* list of strings (List<char*>) */
} file_opt_type;
struct File_option
{
const LEX_STRING name; /* Name of the option */
int offset; /* offset to base address of value */
enum file_opt_type type; /* Option type */
};
class File_parser;
File_parser *sql_parse_prepare(const LEX_STRING *file_name,
MEM_ROOT *mem_root);
my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
gptr base, File_option *parameters, uint versions);
class File_parser: public Sql_alloc
{
char *buff, *start, *end;
LEX_STRING file_type;
my_bool content_ok;
public:
File_parser() :buff(0), start(0), end(0), content_ok(0)
{ file_type.str= 0; file_type.length= 0; }
my_bool ok() { return content_ok; }
LEX_STRING *type() { return &file_type; }
my_bool parse(gptr base, MEM_ROOT *mem_root,
struct File_option *parameters, uint required);
friend File_parser *sql_parse_prepare(const LEX_STRING *file_name,
MEM_ROOT *mem_root,
bool bad_format_errors);
};
#endif /* _PARSE_FILE_H_ */
......@@ -344,3 +344,8 @@ character-set=latin2
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -338,3 +338,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -346,3 +346,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -335,3 +335,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -340,3 +340,8 @@ character-set=latin7
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -335,3 +335,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -347,3 +347,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -335,3 +335,8 @@ character-set=greek
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -337,3 +337,8 @@ character-set=latin2
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -335,3 +335,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -337,3 +337,8 @@ character-set=ujis
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -335,3 +335,8 @@ character-set=euckr
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -337,3 +337,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -337,3 +337,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -339,3 +339,8 @@ character-set=latin2
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -336,3 +336,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -339,3 +339,8 @@ character-set=latin2
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -337,3 +337,8 @@ character-set=koi8r
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
" '%-.64s'"
" '%-.64s'"
" '%-.64s'"
" '%-.64s' (: '%-.64s')"
" '%-.64s'"
......@@ -329,3 +329,8 @@ character-set=cp1250
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -343,3 +343,8 @@ character-set=latin2
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -337,3 +337,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -335,3 +335,8 @@ character-set=latin1
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
"Configuration file '%-.64s' is too big"
"Malformed file type header in file '%-.64s'"
"Unexpected end of file during parsing comment '%-.64s'"
"Error during parsing parameter '%-.64s' (line: '%-.64s')"
"Unexpected end of file during skipping unknown parameter '%-.64s'"
......@@ -340,3 +340,8 @@ character-set=koi8u
"Variable or condition declaration after cursor or handler declaration"
"Cursor declaration after handler declaration"
"Case not found for CASE statement"
" Ʀæ '%-.64s'"
"צ ̦ '%-.64s'"
"Ħ ˦ Ҧ '%-.64s'"
" ЦΦ '%-.64s' (: '%-.64s')"
"Ħ ˦ ¦ צ '%-.64s'"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment