The world's most popular open source database
#include "mysql_priv.h"#include <my_dir.h>Include dependency graph for discover.cc:

Go to the source code of this file.
Functions | |
| int | readfrm (const char *name, const void **frmdata, uint *len) |
| int | writefrm (const char *name, const void *frmdata, uint len) |
| int readfrm | ( | const char * | name, | |
| const void ** | frmdata, | |||
| uint * | len | |||
| ) |
Definition at line 43 of file discover.cc.
References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, err, error, fn_format(), FN_REFLEN, MY_APPEND_EXT, my_close(), my_fstat(), my_open(), MY_STAT, MY_UNPACK_FILENAME, MY_WME, MYF, NULL, O_SHARE, read_string(), reg_ext, and VOID.
Referenced by mysql_write_frm().
00045 { 00046 int error; 00047 char index_file[FN_REFLEN]; 00048 File file; 00049 ulong read_len; 00050 char *read_data; 00051 MY_STAT state; 00052 DBUG_ENTER("readfrm"); 00053 DBUG_PRINT("enter",("name: '%s'",name)); 00054 00055 *frmdata= NULL; // In case of errors 00056 *len= 0; 00057 error= 1; 00058 if ((file=my_open(fn_format(index_file,name,"",reg_ext, 00059 MY_UNPACK_FILENAME|MY_APPEND_EXT), 00060 O_RDONLY | O_SHARE, 00061 MYF(0))) < 0) 00062 goto err_end; 00063 00064 // Get length of file 00065 error= 2; 00066 if (my_fstat(file, &state, MYF(0))) 00067 goto err; 00068 read_len= state.st_size; 00069 00070 // Read whole frm file 00071 error= 3; 00072 read_data= 0; 00073 if (read_string(file, &read_data, read_len)) 00074 goto err; 00075 00076 // Setup return data 00077 *frmdata= (void*) read_data; 00078 *len= read_len; 00079 error= 0; 00080 00081 err: 00082 if (file > 0) 00083 VOID(my_close(file,MYF(MY_WME))); 00084 00085 err_end: /* Here when no file */ 00086 DBUG_RETURN (error); 00087 } /* readfrm */
Here is the call graph for this function:

Here is the caller graph for this function:

| int writefrm | ( | const char * | name, | |
| const void * | frmdata, | |||
| uint | len | |||
| ) |
Definition at line 106 of file discover.cc.
References CREATE_MODE, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, error, fn_format(), FN_REFLEN, MY_APPEND_EXT, my_close(), my_create(), MY_NABP, MY_UNPACK_FILENAME, MY_WME, my_write, MYF, reg_ext, and VOID.
Referenced by ha_create_table_from_engine().
00107 { 00108 File file; 00109 char index_file[FN_REFLEN]; 00110 int error; 00111 DBUG_ENTER("writefrm"); 00112 DBUG_PRINT("enter",("name: '%s' len: %d ",name,len)); 00113 //DBUG_DUMP("frmdata", (char*)frmdata, len); 00114 00115 error= 0; 00116 if ((file=my_create(fn_format(index_file,name,"",reg_ext, 00117 MY_UNPACK_FILENAME|MY_APPEND_EXT), 00118 CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0) 00119 { 00120 if (my_write(file,(byte*)frmdata,len,MYF(MY_WME | MY_NABP))) 00121 error= 2; 00122 VOID(my_close(file,MYF(0))); 00123 } 00124 DBUG_RETURN(error); 00125 } /* writefrm */
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

