mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-08 01:47:11 +02:00
Integrate MySQL module.
This commit is contained in:
module
CMakeLists.txt
Library
Vendor
CMakeLists.txt
MDBC
CMakeLists.txtCOPYING.LIBREADME
cmake
COPYING-CMAKE-SCRIPTSCheckFunctions.cmakeCheckIncludeFiles.cmakeCheckTypes.cmakeConnectorName.cmakeFindIconv.cmakeSearchLibrary.cmakeWindowsCache.cmakeinstall.cmakelinux_x86_toolchain.cmakesign.cmakesymlink.cmakeversion_info.cmake
examples
include
CMakeLists.txtconfig-win.hdbug.herrmsg.hgetopt.hhash.hm_ctype.hm_string.hma_common.hma_dyncol.hma_secure.hmy_alarm.hmy_base.hmy_config.hmy_config.h.inmy_context.hmy_dir.hmy_global.hmy_list.hmy_net.hmy_no_pthread.hmy_pthread.hmy_stmt.hmy_sys.hmysql.h
mysql
mysql_async.hmysql_com.hmysql_io.hmysql_mm.hmysql_priv.hmysql_version.hmysql_version.h.inmysql_wireprotocol.hmysqld_error.hmysys_err.hsha1.hthr_alarm.hviolite.hlibmariadb
CMakeLists.txtacinclude.m4array.cbchange.cbmove.cbmove_upp.ccharset.cclient_plugin.cdbug.cdefault.cerrmsg.cerrors.cget_password.cgetopt.cgetopt1.chash.cint2str.cis_prefix.clibmariadb.clist.cllstr.clonglong2str.cma_dtoa.cma_dyncol.cma_secure.cma_time.cmf_dirname.cmf_fn_ext.cmf_format.cmf_loadpath.cmf_pack.cmf_path.cmf_unixpath.cmf_wcomp.cmulalloc.cmy_alloc.cmy_auth.cmy_charset.cmy_compress.cmy_context.cmy_div.cmy_error.cmy_fopen.cmy_fstream.cmy_getwd.cmy_init.cmy_lib.cmy_loaddata.cmy_malloc.cmy_messnc.cmy_net.cmy_once.cmy_open.cmy_port.cmy_pthread.cmy_read.cmy_realloc.cmy_seek.cmy_static.cmy_static.hmy_stmt.cmy_stmt_codec.cmy_symlink.cmy_thr_init.cmy_vsnprintf.cmy_write.cmysql_async.cmysys_priv.hnet.cpassword.csha1.cstr2int.cstrcend.cstrcont.cstrend.cstrfill.cstring.cstrinstr.cstrmake.cstrmov.cstrnlen.cstrnmov.cstrto.cstrtoll.cstrtoull.cstrxmov.cstrxnmov.cthr_mutex.ctypelib.cviolite.c
mariadb_config
plugins
win-iconv
win
packaging
resource.rc.inzlib
CMakeLists.txtChangeLogFAQINDEXMakefileMakefile.inREADMEadler32.c
amiga
compress.cconfigurecontrib
README.contrib
crc32.ccrc32.hdeflate.cdeflate.hada
buffer_demo.adbmtest.adbread.adbreadme.txttest.adbzlib-streams.adbzlib-streams.adszlib-thin.adbzlib-thin.adszlib.adbzlib.adszlib.gpr
amd64
asm686
blast
delphi
dotzlib
DotZLib.buildDotZLib.chmDotZLib.sln
DotZLib
AssemblyInfo.csChecksumImpl.csCircularBuffer.csCodecBase.csDeflater.csDotZLib.csDotZLib.csprojGZipStream.csInflater.csUnitTests.cs
LICENSE_1_0.txtreadme.txtgcc_gvmat64
infback9
inflate86
iostream
iostream2
iostream3
masmx64
masmx86
minizip
MakefileMakefile.amMiniZip64_Changes.txtMiniZip64_info.txtconfigure.accrypt.hioapi.cioapi.hiowin32.ciowin32.hmake_vms.comminiunz.cminiunzip.1minizip.1minizip.cminizip.pc.inmztools.cmztools.hunzip.cunzip.hzip.czip.h
pascal
puff
testzlib
untgz
vstudio
readme.txt
vc10
miniunz.vcxprojminiunz.vcxproj.filtersminizip.vcxprojminizip.vcxproj.filterstestzlib.vcxprojtestzlib.vcxproj.filterstestzlibdll.vcxprojtestzlibdll.vcxproj.filterszlib.rczlibstat.vcxprojzlibstat.vcxproj.filterszlibvc.defzlibvc.slnzlibvc.vcxprojzlibvc.vcxproj.filters
vc11
miniunz.vcxprojminizip.vcxprojtestzlib.vcxprojtestzlibdll.vcxprojzlib.rczlibstat.vcxprojzlibvc.defzlibvc.slnzlibvc.vcxproj
vc12
miniunz.vcxprojminizip.vcxprojtestzlib.vcxprojtestzlibdll.vcxprojzlib.rczlibstat.vcxprojzlibvc.defzlibvc.slnzlibvc.vcxproj
vc14
miniunz.vcxprojminizip.vcxprojtestzlib.vcxprojtestzlibdll.vcxprojzlib.rczlibstat.vcxprojzlibvc.defzlibvc.slnzlibvc.vcxproj
vc9
doc
examples
gzclose.cgzguts.hgzlib.cgzread.cgzwrite.cinfback.cinffast.cinffast.hinffixed.hinflate.cinflate.hinftrees.cinftrees.hmake_vms.commsdos
nintendods
old
os400
qnx
test
treebuild.xmltrees.ctrees.huncompr.cwatcom
win32
zconf.h.cmakeinzconf.h.inzconf.h.includedzlib.3zlib.3.pdfzlib.hzlib.mapzlib.pc.cmakeinzlib.pc.inzlib2ansizutil.czutil.h
254
module/Vendor/MDBC/include/my_stmt.h
vendored
Normal file
254
module/Vendor/MDBC/include/my_stmt.h
vendored
Normal file
@ -0,0 +1,254 @@
|
||||
/************************************************************************
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02111-1301, USA
|
||||
|
||||
Part of this code includes code from PHP's mysqlnd extension
|
||||
(written by Andrey Hristov, Georg Richter and Ulf Wendel), freely
|
||||
available from http://www.php.net/software
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#define MYSQL_NO_DATA 100
|
||||
#define MYSQL_DATA_TRUNCATED 101
|
||||
#define MYSQL_DEFAULT_PREFETCH_ROWS (unsigned long) 1
|
||||
|
||||
/* Bind flags */
|
||||
#define MADB_BIND_DUMMY 1
|
||||
|
||||
|
||||
#define SET_CLIENT_STMT_ERROR(a, b, c, d) \
|
||||
{ \
|
||||
(a)->last_errno= (b);\
|
||||
strncpy((a)->sqlstate, (c), sizeof((a)->sqlstate));\
|
||||
strncpy((a)->last_error, (d) ? (d) : ER((b)), sizeof((a)->last_error));\
|
||||
}
|
||||
|
||||
#define CLEAR_CLIENT_STMT_ERROR(a) \
|
||||
{ \
|
||||
(a)->last_errno= 0;\
|
||||
strcpy((a)->sqlstate, "00000");\
|
||||
(a)->last_error[0]= 0;\
|
||||
}
|
||||
|
||||
#define MYSQL_PS_SKIP_RESULT_W_LEN -1
|
||||
#define MYSQL_PS_SKIP_RESULT_STR -2
|
||||
#define STMT_ID_LENGTH 4
|
||||
|
||||
|
||||
typedef struct st_mysql_stmt MYSQL_STMT;
|
||||
|
||||
typedef MYSQL_RES* (*mysql_stmt_use_or_store_func)(MYSQL_STMT *);
|
||||
|
||||
enum enum_stmt_attr_type
|
||||
{
|
||||
STMT_ATTR_UPDATE_MAX_LENGTH,
|
||||
STMT_ATTR_CURSOR_TYPE,
|
||||
STMT_ATTR_PREFETCH_ROWS
|
||||
};
|
||||
|
||||
enum enum_cursor_type
|
||||
{
|
||||
CURSOR_TYPE_NO_CURSOR= 0,
|
||||
CURSOR_TYPE_READ_ONLY= 1,
|
||||
CURSOR_TYPE_FOR_UPDATE= 2,
|
||||
CURSOR_TYPE_SCROLLABLE= 4
|
||||
};
|
||||
|
||||
typedef enum mysql_stmt_state
|
||||
{
|
||||
MYSQL_STMT_INITTED = 0,
|
||||
MYSQL_STMT_PREPARED,
|
||||
MYSQL_STMT_EXECUTED,
|
||||
// MYSQL_STMT_USE_RESULT,
|
||||
// MYSQL_STMT_STORE_RESULT,
|
||||
MYSQL_STMT_WAITING_USE_OR_STORE,
|
||||
MYSQL_STMT_USE_OR_STORE_CALLED,
|
||||
MYSQL_STMT_USER_FETCHING, /* fetch_row_buff or fetch_row_unbuf */
|
||||
MYSQL_STMT_FETCH_DONE
|
||||
} enum_mysqlnd_stmt_state;
|
||||
|
||||
typedef struct st_mysql_bind
|
||||
{
|
||||
unsigned long *length; /* output length pointer */
|
||||
my_bool *is_null; /* Pointer to null indicator */
|
||||
void *buffer; /* buffer to get/put data */
|
||||
/* set this if you want to track data truncations happened during fetch */
|
||||
my_bool *error;
|
||||
unsigned char *row_ptr; /* for the current data position */
|
||||
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
|
||||
void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *,
|
||||
unsigned char **row);
|
||||
void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
|
||||
unsigned char **row);
|
||||
/* output buffer length, must be set when fetching str/binary */
|
||||
unsigned long buffer_length;
|
||||
unsigned long offset; /* offset position for char/binary fetch */
|
||||
unsigned long length_value; /* Used if length is 0 */
|
||||
unsigned int flags; /* special flags, e.g. for dummy bind */
|
||||
unsigned int pack_length; /* Internal length for packed data */
|
||||
enum enum_field_types buffer_type; /* buffer type */
|
||||
my_bool error_value; /* used if error is 0 */
|
||||
my_bool is_unsigned; /* set if integer type is unsigned */
|
||||
my_bool long_data_used; /* If used with mysql_send_long_data */
|
||||
my_bool is_null_value; /* Used if is_null is 0 */
|
||||
void *extension;
|
||||
} MYSQL_BIND;
|
||||
|
||||
typedef struct st_mysqlnd_upsert_result
|
||||
{
|
||||
unsigned int warning_count;
|
||||
unsigned int server_status;
|
||||
my_ulonglong affected_rows;
|
||||
my_ulonglong last_insert_id;
|
||||
} mysql_upsert_status;
|
||||
|
||||
typedef struct st_mysql_cmd_buffer
|
||||
{
|
||||
unsigned char *buffer;
|
||||
size_t length;
|
||||
} MYSQL_CMD_BUFFER;
|
||||
|
||||
typedef struct st_mysql_error_info
|
||||
{
|
||||
unsigned int error_no;
|
||||
char error[MYSQL_ERRMSG_SIZE+1];
|
||||
char sqlstate[SQLSTATE_LENGTH + 1];
|
||||
} mysql_error_info;
|
||||
|
||||
|
||||
struct st_mysqlnd_stmt_methods
|
||||
{
|
||||
my_bool (*prepare)(const MYSQL_STMT * stmt, const char * const query, unsigned int query_len);
|
||||
my_bool (*execute)(const MYSQL_STMT * stmt);
|
||||
MYSQL_RES * (*use_result)(const MYSQL_STMT * stmt);
|
||||
MYSQL_RES * (*store_result)(const MYSQL_STMT * stmt);
|
||||
MYSQL_RES * (*get_result)(const MYSQL_STMT * stmt);
|
||||
my_bool (*free_result)(const MYSQL_STMT * stmt);
|
||||
my_bool (*seek_data)(const MYSQL_STMT * stmt, my_ulonglong row);
|
||||
my_bool (*reset)(const MYSQL_STMT * stmt);
|
||||
my_bool (*close)(const MYSQL_STMT * stmt); /* private */
|
||||
my_bool (*dtor)(const MYSQL_STMT * stmt); /* use this for mysqlnd_stmt_close */
|
||||
|
||||
my_bool (*fetch)(const MYSQL_STMT * stmt, my_bool * const fetched_anything);
|
||||
|
||||
my_bool (*bind_param)(const MYSQL_STMT * stmt, const MYSQL_BIND bind);
|
||||
my_bool (*refresh_bind_param)(const MYSQL_STMT * stmt);
|
||||
my_bool (*bind_result)(const MYSQL_STMT * stmt, const MYSQL_BIND *bind);
|
||||
my_bool (*send_long_data)(const MYSQL_STMT * stmt, unsigned int param_num,
|
||||
const char * const data, unsigned long length);
|
||||
MYSQL_RES *(*get_parameter_metadata)(const MYSQL_STMT * stmt);
|
||||
MYSQL_RES *(*get_result_metadata)(const MYSQL_STMT * stmt);
|
||||
my_ulonglong (*get_last_insert_id)(const MYSQL_STMT * stmt);
|
||||
my_ulonglong (*get_affected_rows)(const MYSQL_STMT * stmt);
|
||||
my_ulonglong (*get_num_rows)(const MYSQL_STMT * stmt);
|
||||
|
||||
unsigned int (*get_param_count)(const MYSQL_STMT * stmt);
|
||||
unsigned int (*get_field_count)(const MYSQL_STMT * stmt);
|
||||
unsigned int (*get_warning_count)(const MYSQL_STMT * stmt);
|
||||
|
||||
unsigned int (*get_error_no)(const MYSQL_STMT * stmt);
|
||||
const char * (*get_error_str)(const MYSQL_STMT * stmt);
|
||||
const char * (*get_sqlstate)(const MYSQL_STMT * stmt);
|
||||
|
||||
my_bool (*get_attribute)(const MYSQL_STMT * stmt, enum enum_stmt_attr_type attr_type, const void * value);
|
||||
my_bool (*set_attribute)(const MYSQL_STMT * stmt, enum enum_stmt_attr_type attr_type, const void * value);
|
||||
};
|
||||
|
||||
typedef int (*mysql_stmt_fetch_row_func)(MYSQL_STMT *stmt, unsigned char **row);
|
||||
|
||||
struct st_mysql_stmt
|
||||
{
|
||||
MEM_ROOT mem_root;
|
||||
MYSQL *mysql;
|
||||
unsigned long stmt_id;
|
||||
unsigned long flags;/* cursor is set here */
|
||||
enum_mysqlnd_stmt_state state;
|
||||
MYSQL_FIELD *fields;
|
||||
unsigned int field_count;
|
||||
unsigned int param_count;
|
||||
unsigned char send_types_to_server;
|
||||
MYSQL_BIND *params;
|
||||
MYSQL_BIND *bind;
|
||||
MYSQL_DATA result; /* we don't use mysqlnd's result set logic */
|
||||
MYSQL_ROWS *result_cursor;
|
||||
my_bool bind_result_done;
|
||||
my_bool bind_param_done;
|
||||
|
||||
mysql_upsert_status upsert_status;
|
||||
|
||||
unsigned int last_errno;
|
||||
char last_error[MYSQL_ERRMSG_SIZE+1];
|
||||
char sqlstate[SQLSTATE_LENGTH + 1];
|
||||
|
||||
my_bool update_max_length;
|
||||
unsigned long prefetch_rows;
|
||||
LIST list;
|
||||
|
||||
my_bool cursor_exists;
|
||||
|
||||
void *extension;
|
||||
mysql_stmt_fetch_row_func fetch_row_func;
|
||||
unsigned int execute_count;/* count how many times the stmt was executed */
|
||||
mysql_stmt_use_or_store_func default_rset_handler;
|
||||
struct st_mysqlnd_stmt_methods *m;
|
||||
};
|
||||
|
||||
typedef void (*ps_field_fetch_func)(MYSQL_BIND *r_param, const MYSQL_FIELD * field, unsigned char **row);
|
||||
typedef struct st_mysql_perm_bind {
|
||||
ps_field_fetch_func func;
|
||||
/* should be signed int */
|
||||
int pack_len;
|
||||
unsigned long max_len;
|
||||
} MYSQL_PS_CONVERSION;
|
||||
|
||||
extern MYSQL_PS_CONVERSION mysql_ps_fetch_functions[MYSQL_TYPE_GEOMETRY + 1];
|
||||
unsigned long net_safe_read(MYSQL *mysql);
|
||||
void mysql_init_ps_subsystem(void);
|
||||
unsigned long net_field_length(unsigned char **packet);
|
||||
int simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||
size_t length, my_bool skipp_check, void *opt_arg);
|
||||
/*
|
||||
* function prototypes
|
||||
*/
|
||||
MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
|
||||
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length);
|
||||
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
|
||||
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
|
||||
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset);
|
||||
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
|
||||
unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt);
|
||||
my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr);
|
||||
my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *attr);
|
||||
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
|
||||
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
|
||||
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
|
||||
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
|
||||
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
|
||||
my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length);
|
||||
MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
|
||||
MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
|
||||
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
|
||||
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
|
||||
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
|
||||
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset);
|
||||
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
|
||||
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
|
||||
my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
|
||||
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
|
||||
my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
|
||||
unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
|
||||
int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt);
|
||||
my_bool STDCALL mysql_stmt_more_results(MYSQL_STMT *stmt);
|
Reference in New Issue
Block a user