My Project
Functions
parse_file.cc File Reference

Text .frm files management routines. More...

#include "sql_priv.h"
#include "parse_file.h"
#include "unireg.h"
#include "sql_table.h"
#include <errno.h>
#include <m_ctype.h>
#include <my_sys.h>
#include <my_dir.h>

Functions

long mysql_rm_arc_files (THD *thd, MY_DIR *dirp, const char *org_path)
my_bool sql_create_definition_file (const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, uchar *base, File_option *parameters)
my_bool rename_in_schema_file (THD *thd, const char *schema, const char *old_name, const char *new_db, const char *new_name)
File_parsersql_parse_prepare (const LEX_STRING *file_name, MEM_ROOT *mem_root, bool bad_format_errors)
my_bool read_escaped_string (const char *ptr, const char *eol, LEX_STRING *str)
const char * parse_escaped_string (const char *ptr, const char *end, MEM_ROOT *mem_root, LEX_STRING *str)
bool get_file_options_ulllist (const char *&ptr, const char *end, const char *line, uchar *base, File_option *parameter, MEM_ROOT *mem_root)

Detailed Description

Text .frm files management routines.


Function Documentation

bool get_file_options_ulllist ( const char *&  ptr,
const char *  end,
const char *  line,
uchar *  base,
File_option parameter,
MEM_ROOT *  mem_root 
)

Parser for FILE_OPTIONS_ULLLIST type value.

Parameters:
[in,out]ptrpointer to parameter
[in]endend of the configuration
[in]linepointer to the line begining
[in]basebase address for parameter writing (structure like TABLE)
[in]parameterdescription
[in]mem_rootMEM_ROOT for parameters allocation
const char* parse_escaped_string ( const char *  ptr,
const char *  end,
MEM_ROOT *  mem_root,
LEX_STRING *  str 
)

parse \n delimited escaped string.

Parameters:
ptrpointer on string beginning
endpointer on symbol after parsed string end (still owned by buffer and can be accessed
mem_rootMEM_ROOT for parameter allocation
strpointer on string, where results should be stored
Return values:
0error
\::pointer on symbol after string
my_bool read_escaped_string ( const char *  ptr,
const char *  eol,
LEX_STRING *  str 
)

read escaped string from ptr to eol in already allocated str.

Parameters:
ptrpointer on string beginning
eolpointer on character after end of string
strtarget string
Return values:
FALSEOK
TRUEerror
my_bool rename_in_schema_file ( THD *  thd,
const char *  schema,
const char *  old_name,
const char *  new_db,
const char *  new_name 
)

Renames a frm file (including backups) in same schema.

thread handler

Parameters:
schemaname of given schema
old_nameoriginal file name
new_dbnew schema
new_namenew file name
Return values:
0OK
1Error (only if renaming of frm failed)
my_bool sql_create_definition_file ( const LEX_STRING *  dir,
const LEX_STRING *  file_name,
const LEX_STRING *  type,
uchar *  base,
File_option parameters 
)

Write new .frm.

Parameters:
dirdirectory where put .frm
file_name.frm file name
type.frm type string (VIEW, TABLE)
basebase address for parameter reading (structure like TABLE)
parametersparameters description
Return values:
FALSEOK
TRUEerror
File_parser* sql_parse_prepare ( const LEX_STRING *  file_name,
MEM_ROOT *  mem_root,
bool  bad_format_errors 
)

Prepare frm to parse (read to memory).

Parameters:
file_namepath & filename to .frm file
mem_rootMEM_ROOT for buffer allocation
bad_format_errorssend errors on bad content
Note:
returned pointer + 1 will be type of .frm
Returns:
0 - error
parser object
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines