premake project setup, cant build windows

This commit is contained in:
2025-12-17 21:11:28 +01:00
parent d8760a188e
commit 05ab512b6b
63 changed files with 75069 additions and 51 deletions

259
vendor/mariadb/include/client_plugin.h vendored Normal file
View File

@@ -0,0 +1,259 @@
/* Copyright (C) 2010 - 2012 Sergei Golubchik and Monty Program Ab
2014, 2022 MariaDB Corporation AB
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 see <http://www.gnu.org/licenses>
or write to the Free Software Foundation, Inc.,
51 Franklin St., Fifth Floor, Boston, MA 02110, USA */
/**
@file
MySQL Client Plugin API
This file defines the API for plugins that work on the client side
*/
#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED
#define MYSQL_CLIENT_PLUGIN_INCLUDED
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
#endif
#ifndef PLUGINDIR
#define PLUGINDIR "lib/plugin"
#endif
#define plugin_declarations_sym "_mysql_client_plugin_declaration_"
/* known plugin types */
#define MYSQL_CLIENT_PLUGIN_RESERVED 0
#define MYSQL_CLIENT_PLUGIN_RESERVED2 1
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2 /* authentication */
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0101
#define MYSQL_CLIENT_MAX_PLUGINS 3
/* Connector/C specific plugin types */
#define MARIADB_CLIENT_REMOTEIO_PLUGIN 100 /* communication IO */
#define MARIADB_CLIENT_PVIO_PLUGIN 101
#define MARIADB_CLIENT_TRACE_PLUGIN 102
#define MARIADB_CLIENT_CONNECTION_PLUGIN 103
#define MARIADB_CLIENT_COMPRESSION_PLUGIN 104
#define MARIADB_CLIENT_REMOTEIO_PLUGIN_INTERFACE_VERSION 0x0100
#define MARIADB_CLIENT_PVIO_PLUGIN_INTERFACE_VERSION 0x0100
#define MARIADB_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION 0x0100
#define MARIADB_CLIENT_CONNECTION_PLUGIN_INTERFACE_VERSION 0x0100
#define MARIADB_CLIENT_COMPRESSION_PLUGIN_INTERFACE_VERSION 0x0100
#define MARIADB_CLIENT_MAX_PLUGINS 5
#define mysql_declare_client_plugin(X) \
struct st_mysql_client_plugin_ ## X \
_mysql_client_plugin_declaration_ = { \
MYSQL_CLIENT_ ## X ## _PLUGIN, \
MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION,
#define mysql_end_client_plugin }
/* generic plugin header structure */
#ifndef MYSQL_CLIENT_PLUGIN_HEADER
#define MYSQL_CLIENT_PLUGIN_HEADER \
int type; \
unsigned int interface_version; \
const char *name; \
const char *author; \
const char *desc; \
unsigned int version[3]; \
const char *license; \
void *mysql_api; \
int (*init)(char *, size_t, int, va_list); \
int (*deinit)(void); \
int (*options)(const char *option, const void *);
struct st_mysql_client_plugin
{
MYSQL_CLIENT_PLUGIN_HEADER
};
#endif
struct st_mysql;
/********* connection handler plugin specific declarations **********/
typedef struct st_ma_connection_plugin
{
MYSQL_CLIENT_PLUGIN_HEADER
/* functions */
MYSQL *(*connect)(MYSQL *mysql, const char *host,
const char *user, const char *passwd,
const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
void (*close)(MYSQL *mysql);
int (*set_optionsv)(MYSQL *mysql, unsigned int option, ...);
int (*set_connection)(MYSQL *mysql,enum enum_server_command command,
const char *arg,
size_t length, my_bool skipp_check, void *opt_arg);
my_bool (*reconnect)(MYSQL *mysql);
int (*reset)(MYSQL *mysql);
} MARIADB_CONNECTION_PLUGIN;
#define MARIADB_DB_DRIVER(a) ((a)->ext_db)
/******************* Communication IO plugin *****************/
#include <ma_pvio.h>
typedef struct st_mariadb_client_plugin_PVIO
{
MYSQL_CLIENT_PLUGIN_HEADER
struct st_ma_pvio_methods *methods;
} MARIADB_PVIO_PLUGIN;
/******** authentication plugin specific declarations *********/
#include <mysql/plugin_auth.h>
struct st_mysql_client_plugin_AUTHENTICATION
{
MYSQL_CLIENT_PLUGIN_HEADER
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
int (*hash_password_bin)(struct st_mysql *mysql, unsigned char *hash, size_t *hash_length);
};
/******** trace plugin *******/
struct st_mysql_client_plugin_TRACE
{
MYSQL_CLIENT_PLUGIN_HEADER
};
#include <ma_compress.h>
typedef struct st_mariadb_client_plugin_COMPRESS
{
MYSQL_CLIENT_PLUGIN_HEADER
ma_compress_ctx *(*init_ctx)(int compression_level);
void (*free_ctx)(ma_compress_ctx *ctx);
my_bool (*compress)(ma_compress_ctx *ctx, void *dst, size_t *dst_len, void *source, size_t source_len);
my_bool (*decompress)(ma_compress_ctx *ctx, void *dst, size_t *dst_len, void *source, size_t *source_len);
} MARIADB_COMPRESSION_PLUGIN;
/**
type of the mysql_authentication_dialog_ask function
@param mysql mysql
@param type type of the input
1 - ordinary string input
2 - password string
@param prompt prompt
@param buf a buffer to store the use input
@param buf_len the length of the buffer
@retval a pointer to the user input string.
It may be equal to 'buf' or to 'mysql->password'.
In all other cases it is assumed to be an allocated
string, and the "dialog" plugin will free() it.
*/
typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql,
int type, const char *prompt, char *buf, int buf_len);
/********************** remote IO plugin **********************/
#ifdef HAVE_REMOTEIO
#include <mariadb/ma_io.h>
/* Remote IO plugin */
typedef struct st_mysql_client_plugin_REMOTEIO
{
MYSQL_CLIENT_PLUGIN_HEADER
struct st_rio_methods *methods;
} MARIADB_REMOTEIO_PLUGIN;
#endif
/******** using plugins ************/
/**
loads a plugin and initializes it
@param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
and last_errno/last_error, for error reporting
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
function
@param ... arguments for the plugin initialization function
@retval
a pointer to the loaded plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin *
mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
int argc, ...);
/**
loads a plugin and initializes it, taking va_list as an argument
This is the same as mysql_load_plugin, but take va_list instead of
a list of arguments.
@param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
and last_errno/last_error, for error reporting
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
function
@param args arguments for the plugin initialization function
@retval
a pointer to the loaded plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin * STDCALL
mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
int argc, va_list args);
/**
finds an already loaded plugin by name, or loads it, if necessary
@param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
and last_errno/last_error, for error reporting
@param name a name of the plugin to load
@param type type of plugin that should be loaded
@retval
a pointer to the plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin * STDCALL
mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
/**
adds a plugin structure to the list of loaded plugins
This is useful if an application has the necessary functionality
(for example, a special load data handler) statically linked into
the application binary. It can use this function to register the plugin
directly, avoiding the need to factor it out into a shared object.
@param mysql MYSQL structure. It is only used for error reporting
@param plugin an st_mysql_client_plugin structure to register
@retval
a pointer to the plugin, or NULL in case of a failure
*/
struct st_mysql_client_plugin * STDCALL
mysql_client_register_plugin(struct st_mysql *mysql,
struct st_mysql_client_plugin *plugin);
extern struct st_mysql_client_plugin *mysql_client_builtins[];
#endif

134
vendor/mariadb/include/errmsg.h vendored Normal file
View File

@@ -0,0 +1,134 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
2012-2016 SkySQL AB, MariaDB Corporation AB
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 */
/* Error messages for mysql clients */
/* error messages for the demon is in share/language/errmsg.sys */
#ifndef _errmsg_h_
#define _errmsg_h_
#ifdef __cplusplus
extern "C" {
#endif
void init_client_errs(void);
extern const char *client_errors[]; /* Error messages */
extern const char *mariadb_client_errors[]; /* Error messages */
#ifdef __cplusplus
}
#endif
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
#define CER_MIN_ERROR 5000
#define CER_MAX_ERROR 5999
#define CLIENT_ERRMAP 2 /* Errormap used by ma_error() */
#define ER_UNKNOWN_ERROR_CODE "Unknown or undefined error code (%d)"
#define CR_UNKNOWN_ERROR 2000
#define CR_SOCKET_CREATE_ERROR 2001
#define CR_CONNECTION_ERROR 2002
#define CR_CONN_HOST_ERROR 2003 /* never sent to a client, message only */
#define CR_IPSOCK_ERROR 2004
#define CR_UNKNOWN_HOST 2005
#define CR_SERVER_GONE_ERROR 2006 /* disappeared _between_ queries */
#define CR_VERSION_ERROR 2007
#define CR_OUT_OF_MEMORY 2008
#define CR_WRONG_HOST_INFO 2009
#define CR_LOCALHOST_CONNECTION 2010
#define CR_TCP_CONNECTION 2011
#define CR_SERVER_HANDSHAKE_ERR 2012
#define CR_SERVER_LOST 2013 /* disappeared _during_ a query */
#define CR_COMMANDS_OUT_OF_SYNC 2014
#define CR_NAMEDPIPE_CONNECTION 2015
#define CR_NAMEDPIPEWAIT_ERROR 2016
#define CR_NAMEDPIPEOPEN_ERROR 2017
#define CR_NAMEDPIPESETSTATE_ERROR 2018
#define CR_CANT_READ_CHARSET 2019
#define CR_NET_PACKET_TOO_LARGE 2020
#define CR_SSL_CONNECTION_ERROR 2026
#define CR_MALFORMED_PACKET 2027
#define CR_NO_PREPARE_STMT 2030
#define CR_PARAMS_NOT_BOUND 2031
#define CR_INVALID_PARAMETER_NO 2034
#define CR_INVALID_BUFFER_USE 2035
#define CR_UNSUPPORTED_PARAM_TYPE 2036
#define CR_SHARED_MEMORY_CONNECTION 2037
#define CR_SHARED_MEMORY_CONNECT_ERROR 2038
#define CR_CONN_UNKNOWN_PROTOCOL 2047
#define CR_SECURE_AUTH 2049
#define CR_NO_DATA 2051
#define CR_NO_STMT_METADATA 2052
#define CR_NOT_IMPLEMENTED 2054
#define CR_SERVER_LOST_EXTENDED 2055 /* never sent to a client, message only */
#define CR_STMT_CLOSED 2056
#define CR_NEW_STMT_METADATA 2057
#define CR_ALREADY_CONNECTED 2058
#define CR_AUTH_PLUGIN_CANNOT_LOAD 2059
#define CR_DUPLICATE_CONNECTION_ATTR 2060
#define CR_AUTH_PLUGIN_ERR 2061
/* Always last, if you add new error codes please update the
value for CR_MYSQL_LAST_ERROR */
#define CR_MYSQL_LAST_ERROR CR_AUTH_PLUGIN_ERR
/*
* MariaDB Connector/C errors:
*/
#define CR_EVENT_CREATE_FAILED 5000
#define CR_BIND_ADDR_FAILED 5001
#define CR_ASYNC_NOT_SUPPORTED 5002
#define CR_FUNCTION_NOT_SUPPORTED 5003
#define CR_FILE_NOT_FOUND 5004
#define CR_FILE_READ 5005
#define CR_BULK_WITHOUT_PARAMETERS 5006
#define CR_INVALID_STMT 5007
#define CR_VERSION_MISMATCH 5008
#define CR_INVALID_PARAMETER 5009
#define CR_PLUGIN_NOT_ALLOWED 5010
#define CR_CONNSTR_PARSE_ERROR 5011
#define CR_ERR_LOAD_PLUGIN 5012
#define CR_ERR_NET_READ 5013
#define CR_ERR_NET_WRITE 5014
#define CR_ERR_NET_UNCOMPRESS 5015
#define CR_ERR_STMT_PARAM_CALLBACK 5016
#define CR_ERR_BINLOG_UNCOMPRESS 5017
#define CR_ERR_CHECKSUM_VERIFICATION_ERROR 5018
#define CR_ERR_UNSUPPORTED_BINLOG_FORMAT 5019
#define CR_UNKNOWN_BINLOG_EVENT 5020
#define CR_BINLOG_ERROR 5021
#define CR_BINLOG_INVALID_FILE 5022
#define CR_BINLOG_SEMI_SYNC_ERROR 5023
#define CR_INVALID_CLIENT_FLAG 5024
#define CR_STMT_NO_RESULT 5025
#define CR_ERR_MISSING_ERROR_INFO 5026
/* Always last, if you add new error codes please update the
value for CR_MARIADB_LAST_ERROR */
#define CR_MARIADB_LAST_ERROR CR_ERR_MISSING_ERROR_INFO
#endif
#define IS_MYSQL_ERROR(code) ((code) > CR_MIN_ERROR && (code) <= CR_MYSQL_LAST_ERROR)
#define IS_MARIADB_ERROR(code) ((code) > CER_MIN_ERROR && (code) <= CR_MARIADB_LAST_ERROR)
#define ER(code) IS_MYSQL_ERROR((code)) ? client_errors[(code) - CR_MIN_ERROR] : \
IS_MARIADB_ERROR((code)) ? mariadb_client_errors[(code) - CER_MIN_ERROR] : \
"Unknown or undefined error code"
#define CER(code) ER((code))

55
vendor/mariadb/include/ma_io.h vendored Normal file
View File

@@ -0,0 +1,55 @@
/* Copyright (C) 2015 MariaDB Corporation AB
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 */
#ifndef _ma_io_h_
#define _ma_io_h_
#ifdef HAVE_REMOTEIO
#include <curl/curl.h>
#endif
enum enum_file_type {
MA_FILE_NONE=0,
MA_FILE_LOCAL=1,
MA_FILE_REMOTE=2
};
typedef struct
{
enum enum_file_type type;
void *ptr;
} MA_FILE;
#ifdef HAVE_REMOTEIO
struct st_rio_methods {
MA_FILE *(*mopen)(const char *url, const char *mode);
int (*mclose)(MA_FILE *ptr);
int (*mfeof)(MA_FILE *file);
size_t (*mread)(void *ptr, size_t size, size_t nmemb, MA_FILE *file);
char * (*mgets)(char *ptr, size_t size, MA_FILE *file);
};
#endif
/* function prototypes */
MA_FILE *ma_open(const char *location, const char *mode, MYSQL *mysql);
int ma_close(MA_FILE *file);
int ma_feof(MA_FILE *file);
size_t ma_read(void *ptr, size_t size, size_t nmemb, MA_FILE *file);
char *ma_gets(char *ptr, size_t size, MA_FILE *file);
#endif

47
vendor/mariadb/include/ma_list.h vendored Normal file
View File

@@ -0,0 +1,47 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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 */
#ifndef _list_h_
#define _list_h_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct st_list {
struct st_list *prev,*next;
void *data;
} LIST;
typedef int (*list_walk_action)(void *,void *);
extern LIST *list_add(LIST *root,LIST *element);
extern LIST *list_delete(LIST *root,LIST *element);
extern LIST *list_cons(void *data,LIST *root);
extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,unsigned int free_data);
extern unsigned int list_length(LIST *list);
extern int list_walk(LIST *list,list_walk_action action,char * argument);
#define list_rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
#define list_pop(A) do {LIST *old=(A); (A)=list_delete(old,old) ; ma_free((char *) old,MYF(MY_FAE)); } while(0)
#ifdef __cplusplus
}
#endif
#endif

141
vendor/mariadb/include/ma_pvio.h vendored Normal file
View File

@@ -0,0 +1,141 @@
#ifndef _ma_pvio_h_
#define _ma_pvio_h_
#define cio_defined
#ifdef HAVE_TLS
#include <ma_tls.h>
#else
#define MARIADB_TLS void
#endif
/* CONC-492: Allow to build plugins outside of MariaDB Connector/C
source tree when ma_global.h was not included. */
#if !defined(_global_h) && !defined(MY_GLOBAL_INCLUDED)
typedef unsigned char uchar;
#endif
#define PVIO_SET_ERROR if (pvio->set_error) \
pvio->set_error
#define PVIO_READ_AHEAD_CACHE_SIZE 16384
#define PVIO_READ_AHEAD_CACHE_MIN_SIZE 2048
#define PVIO_EINTR_TRIES 2
struct st_ma_pvio_methods;
typedef struct st_ma_pvio_methods PVIO_METHODS;
#define IS_PVIO_ASYNC(a) \
((a)->mysql && (a)->mysql->options.extension && (a)->mysql->options.extension->async_context)
#define IS_PVIO_ASYNC_ACTIVE(a) \
(IS_PVIO_ASYNC(a)&& (a)->mysql->options.extension->async_context->active)
#define IS_MYSQL_ASYNC(a) \
((a)->options.extension && (a)->options.extension->async_context)
#define IS_MYSQL_ASYNC_ACTIVE(a) \
(IS_MYSQL_ASYNC(a)&& (a)->options.extension->async_context->active)
enum enum_pvio_timeout {
PVIO_CONNECT_TIMEOUT= 0,
PVIO_READ_TIMEOUT,
PVIO_WRITE_TIMEOUT
};
enum enum_pvio_io_event
{
VIO_IO_EVENT_READ,
VIO_IO_EVENT_WRITE,
VIO_IO_EVENT_CONNECT
};
enum enum_pvio_type {
PVIO_TYPE_UNIXSOCKET= 0,
PVIO_TYPE_SOCKET,
PVIO_TYPE_NAMEDPIPE,
PVIO_TYPE_SHAREDMEM,
};
enum enum_pvio_operation {
PVIO_READ= 0,
PVIO_WRITE=1
};
#define SHM_DEFAULT_NAME "MYSQL"
struct st_pvio_callback;
typedef struct st_pvio_callback {
void (*callback)(MYSQL *mysql, uchar *buffer, size_t size);
struct st_pvio_callback *next;
} PVIO_CALLBACK;
struct st_ma_pvio {
void *data;
/* read ahead cache */
uchar *cache;
uchar *cache_pos;
size_t cache_size;
enum enum_pvio_type type;
int timeout[3];
int ssl_type; /* todo: change to enum (ssl plugins) */
MARIADB_TLS *ctls;
MYSQL *mysql;
PVIO_METHODS *methods;
void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...);
void (*callback)(MARIADB_PVIO *pvio, my_bool is_read, const uchar *buffer, size_t length);
size_t bytes_read;
size_t bytes_sent;
};
typedef struct st_ma_pvio_cinfo
{
const char *host;
const char *unix_socket;
int port;
enum enum_pvio_type type;
MYSQL *mysql;
} MA_PVIO_CINFO;
struct st_ma_pvio_methods
{
my_bool (*set_timeout)(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout);
int (*get_timeout)(MARIADB_PVIO *pvio, enum enum_pvio_timeout type);
ssize_t (*read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
ssize_t (*async_read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
ssize_t (*write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length);
ssize_t (*async_write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length);
int (*wait_io_or_timeout)(MARIADB_PVIO *pvio, my_bool is_read, int timeout);
int (*blocking)(MARIADB_PVIO *pvio, my_bool value, my_bool *old_value);
my_bool (*connect)(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo);
my_bool (*close)(MARIADB_PVIO *pvio);
int (*fast_send)(MARIADB_PVIO *pvio);
int (*keepalive)(MARIADB_PVIO *pvio);
my_bool (*get_handle)(MARIADB_PVIO *pvio, void *handle);
my_bool (*is_blocking)(MARIADB_PVIO *pvio);
my_bool (*is_alive)(MARIADB_PVIO *pvio);
my_bool (*has_data)(MARIADB_PVIO *pvio, ssize_t *data_len);
int(*shutdown)(MARIADB_PVIO *pvio);
};
/* Function prototypes */
MARIADB_PVIO *ma_pvio_init(MA_PVIO_CINFO *cinfo);
void ma_pvio_close(MARIADB_PVIO *pvio);
ssize_t ma_pvio_cache_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
ssize_t ma_pvio_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
ssize_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length);
int ma_pvio_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type);
my_bool ma_pvio_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout);
int ma_pvio_fast_send(MARIADB_PVIO *pvio);
int ma_pvio_keepalive(MARIADB_PVIO *pvio);
my_socket ma_pvio_get_socket(MARIADB_PVIO *pvio);
my_bool ma_pvio_is_blocking(MARIADB_PVIO *pvio);
my_bool ma_pvio_blocking(MARIADB_PVIO *pvio, my_bool block, my_bool *previous_mode);
my_bool ma_pvio_is_blocking(MARIADB_PVIO *pvio);
int ma_pvio_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int timeout);
my_bool ma_pvio_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo);
my_bool ma_pvio_is_alive(MARIADB_PVIO *pvio);
my_bool ma_pvio_get_handle(MARIADB_PVIO *pvio, void *handle);
my_bool ma_pvio_has_data(MARIADB_PVIO *pvio, ssize_t *length);
#endif /* _ma_pvio_h_ */

178
vendor/mariadb/include/ma_tls.h vendored Normal file
View File

@@ -0,0 +1,178 @@
#ifndef _ma_tls_h_
#define _ma_tls_h_
#include <ma_hash.h>
enum enum_pvio_tls_type {
SSL_TYPE_DEFAULT=0,
#ifdef _WIN32
SSL_TYPE_SCHANNEL,
#endif
SSL_TYPE_OPENSSL,
SSL_TYPE_GNUTLS
};
#define PROTOCOL_SSLV3 0
#define PROTOCOL_TLS_1_0 1
#define PROTOCOL_TLS_1_1 2
#define PROTOCOL_TLS_1_2 3
#define PROTOCOL_TLS_1_3 4
#define PROTOCOL_UNKNOWN 5
#define PROTOCOL_MAX PROTOCOL_TLS_1_3
#define TLS_VERSION_LENGTH 64
#define have_fingerprint(m) \
((m)->options.extension) && \
(((m)->options.extension->tls_fp && (m)->options.extension->tls_fp[0]) ||\
((m)->options.extension->tls_fp_list && (m)->options.extension->tls_fp_list[0]))
extern char tls_library_version[TLS_VERSION_LENGTH];
extern my_bool ma_is_ip_address(const char *s);
typedef struct st_ma_pvio_tls {
void *data;
MARIADB_PVIO *pvio;
void *ssl;
MARIADB_X509_INFO cert_info;
} MARIADB_TLS;
/* Function prototypes */
/* ma_tls_start
initializes the ssl library
Parameter:
errmsg pointer to error message buffer
errmsg_len length of error message buffer
Returns:
0 success
1 if an error occurred
Notes:
On success the global variable ma_tls_initialized will be set to 1
*/
int ma_tls_start(char *errmsg, size_t errmsg_len);
/* ma_tls_end
unloads/deinitializes ssl library and unsets global variable
ma_tls_initialized
*/
void ma_tls_end(void);
/* ma_tls_init
creates a new SSL structure for a SSL connection and loads
client certificates
Parameters:
MYSQL a mysql structure
Returns:
void * a pointer to internal SSL structure
*/
void * ma_tls_init(MYSQL *mysql);
/* ma_tls_connect
performs SSL handshake
Parameters:
MARIADB_TLS MariaDB SSL container
Returns:
0 success
1 error
*/
my_bool ma_tls_connect(MARIADB_TLS *ctls);
/* ma_tls_read
reads up to length bytes from socket
Parameters:
ctls MariaDB SSL container
buffer read buffer
length buffer length
Returns:
0-n bytes read
-1 if an error occurred
*/
ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length);
/* ma_tls_write
write buffer to socket
Parameters:
ctls MariaDB SSL container
buffer write buffer
length buffer length
Returns:
0-n bytes written
-1 if an error occurred
*/
ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length);
/* ma_tls_close
closes SSL connection and frees SSL structure which was previously
created by ma_tls_init call
Parameters:
MARIADB_TLS MariaDB SSL container
Returns:
0 success
1 error
*/
my_bool ma_tls_close(MARIADB_TLS *ctls);
/* ma_tls_verify_server_cert
validation check of server certificate
Parameter:
MARIADB_TLS MariaDB SSL container
flags verification flags
Returns:
0 success
1 error
*/
int ma_tls_verify_server_cert(MARIADB_TLS *ctls, unsigned int flags);
/* ma_tls_get_cipher
returns cipher for current ssl connection
Parameter:
MARIADB_TLS MariaDB SSL container
Returns:
cipher in use or
NULL on error
*/
const char *ma_tls_get_cipher(MARIADB_TLS *ssl);
/* ma_tls_get_finger_print
returns SHA1 finger print of server certificate
Parameter:
MARIADB_TLS MariaDB SSL container
hash_type hash_type as defined in ma_hash.h
fp buffer for fingerprint
fp_len buffer length
Returns:
actual size of finger print
*/
unsigned int ma_tls_get_finger_print(MARIADB_TLS *ctls, uint hash_type, char *fp, unsigned int fp_len);
/* ma_tls_get_protocol_version
returns protocol version number in use
Parameter:
MARIADB_TLS MariaDB SSL container
Returns:
protocol number
*/
int ma_tls_get_protocol_version(MARIADB_TLS *ctls);
const char *ma_pvio_tls_get_protocol_version(MARIADB_TLS *ctls);
int ma_pvio_tls_get_protocol_version_id(MARIADB_TLS *ctls);
unsigned int ma_tls_get_peer_cert_info(MARIADB_TLS *ctls, unsigned int size);
void ma_tls_set_connection(MYSQL *mysql);
/* Function prototypes */
MARIADB_TLS *ma_pvio_tls_init(MYSQL *mysql);
my_bool ma_pvio_tls_connect(MARIADB_TLS *ctls);
ssize_t ma_pvio_tls_read(MARIADB_TLS *ctls, const uchar *buffer, size_t length);
ssize_t ma_pvio_tls_write(MARIADB_TLS *ctls, const uchar *buffer, size_t length);
my_bool ma_pvio_tls_close(MARIADB_TLS *ctls);
int ma_pvio_tls_verify_server_cert(MARIADB_TLS *ctls, unsigned int flags);
const char *ma_pvio_tls_cipher(MARIADB_TLS *ctls);
my_bool ma_pvio_tls_check_fp(MARIADB_TLS *ctls, const char *fp, const char *fp_list);
my_bool ma_pvio_start_ssl(MARIADB_PVIO *pvio);
void ma_pvio_tls_set_connection(MYSQL *mysql);
void ma_pvio_tls_end();
unsigned int ma_pvio_tls_get_peer_cert_info(MARIADB_TLS *ctls, unsigned int size);
#endif /* _ma_tls_h_ */

491
vendor/mariadb/include/mariadb_com.h vendored Normal file
View File

@@ -0,0 +1,491 @@
/************************************************************************************
Copyright (C) 2000, 2012 MySQL AB & MySQL Finland AB & TCX DataKonsult AB,
Monty Program AB
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 see <http://www.gnu.org/licenses>
or write to the Free Software Foundation, Inc.,
51 Franklin St., Fifth Floor, Boston, MA 02110, USA
Part of this code includes code from the PHP project which
is freely available from http://www.php.net
*************************************************************************************/
/*
** Common definition between mysql server & client
*/
#ifndef _mysql_com_h
#define _mysql_com_h
#define NAME_CHAR_LEN 64
#define NAME_LEN 256 /* Field/table name length */
#define HOSTNAME_LENGTH 255
#define SYSTEM_MB_MAX_CHAR_LENGTH 4
#define USERNAME_CHAR_LENGTH 128
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH * SYSTEM_MB_MAX_CHAR_LENGTH)
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
#define SCRAMBLE_LENGTH 20
#define SCRAMBLE_LENGTH_323 8
#define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "."
#if defined(_WIN32) && !defined( _CUSTOMCONFIG_)
#define MARIADB_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "MySql"
#endif /* _WIN32 */
/* for use in mysql client tools only */
#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
#define BINCMP_FLAG 131072
enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT,ROW_RESULT,DECIMAL_RESULT};
enum mysql_enum_shutdown_level
{
SHUTDOWN_DEFAULT = 0,
KILL_QUERY= 254,
KILL_CONNECTION= 255
};
enum enum_server_command
{
COM_SLEEP = 0,
COM_QUIT,
COM_INIT_DB,
COM_QUERY,
COM_FIELD_LIST,
COM_CREATE_DB,
COM_DROP_DB,
COM_REFRESH,
COM_SHUTDOWN,
COM_STATISTICS,
COM_PROCESS_INFO,
COM_CONNECT,
COM_PROCESS_KILL,
COM_DEBUG,
COM_PING,
COM_TIME = 15,
COM_DELAYED_INSERT,
COM_CHANGE_USER,
COM_BINLOG_DUMP,
COM_TABLE_DUMP,
COM_CONNECT_OUT = 20,
COM_REGISTER_SLAVE,
COM_STMT_PREPARE = 22,
COM_STMT_EXECUTE = 23,
COM_STMT_SEND_LONG_DATA = 24,
COM_STMT_CLOSE = 25,
COM_STMT_RESET = 26,
COM_SET_OPTION = 27,
COM_STMT_FETCH = 28,
COM_DAEMON= 29,
COM_UNSUPPORTED= 30,
COM_RESET_CONNECTION = 31,
COM_STMT_BULK_EXECUTE = 250,
COM_RESERVED_1 = 254, /* former COM_MULTI, now removed */
COM_END
};
#define NOT_NULL_FLAG 1 /* Field can't be NULL */
#define PRI_KEY_FLAG 2 /* Field is part of a primary key */
#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */
#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */
#define BLOB_FLAG 16 /* Field is a blob */
#define UNSIGNED_FLAG 32 /* Field is unsigned */
#define ZEROFILL_FLAG 64 /* Field is zerofill */
#define BINARY_FLAG 128
/* The following are only sent to new clients */
#define ENUM_FLAG 256 /* field is an enum */
#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */
#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
#define SET_FLAG 2048 /* field is a set */
/* new since 3.23.58 */
#define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */
#define ON_UPDATE_NOW_FLAG 8192 /* Field is set to NOW on UPDATE */
/* end new */
#define NUM_FLAG 32768 /* Field is num (for clients) */
#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
#define GROUP_FLAG 32768 /* Intern: Group field */
#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
#define REFRESH_TABLES 4 /* close all tables */
#define REFRESH_HOSTS 8 /* Flush host cache */
#define REFRESH_STATUS 16 /* Flush status variables */
#define REFRESH_THREADS 32 /* Flush thread cache */
#define REFRESH_SLAVE 64 /* Reset master info and restart slave
thread */
#define REFRESH_MASTER 128 /* Remove all bin logs in the index
and truncate the index */
/* The following can't be set with mysql_refresh() */
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
#define REFRESH_FAST 32768 /* Intern flag */
#define CLIENT_MYSQL 1
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
#define CLIENT_LONG_FLAG 4 /* Get all column flags */
#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
#define CLIENT_COMPRESS 32 /* Can use compression protocol */
#define CLIENT_ODBC 64 /* Odbc client */
#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
/* added in 4.x */
#define CLIENT_PROTOCOL_41 512
#define CLIENT_RESERVED 16384
#define CLIENT_SECURE_CONNECTION 32768
#define CLIENT_MULTI_STATEMENTS (1UL << 16)
#define CLIENT_MULTI_RESULTS (1UL << 17)
#define CLIENT_PS_MULTI_RESULTS (1UL << 18)
#define CLIENT_PLUGIN_AUTH (1UL << 19)
#define CLIENT_CONNECT_ATTRS (1UL << 20)
#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21)
#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22)
#define CLIENT_SESSION_TRACKING (1UL << 23)
#define CLIENT_ZSTD_COMPRESSION (1UL << 26)
#define CLIENT_PROGRESS (1UL << 29) /* client supports progress indicator */
#define CLIENT_PROGRESS_OBSOLETE CLIENT_PROGRESS
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_SSL_VERIFY_SERVER_CERT_OBSOLETE CLIENT_SSL_VERIFY_SERVER_CERT
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
/* MariaDB-specific capabilities */
#define MARIADB_CLIENT_FLAGS 0xFFFFFFFF00000000ULL
#define MARIADB_CLIENT_PROGRESS (1ULL << 32)
#define MARIADB_CLIENT_RESERVED_1 (1ULL << 33) /* Former COM_MULTI, don't use */
#define MARIADB_CLIENT_STMT_BULK_OPERATIONS (1ULL << 34)
/* support of extended data type/format information, since 10.5.0 */
#define MARIADB_CLIENT_EXTENDED_METADATA (1ULL << 35)
/* Do not resend metadata for prepared statements, since 10.6*/
#define MARIADB_CLIENT_CACHE_METADATA (1ULL << 36)
/* permit sending unit result-set for BULK commands */
#define MARIADB_CLIENT_BULK_UNIT_RESULTS (1ULL << 37)
#define IS_MARIADB_EXTENDED_SERVER(mysql)\
(!(mysql->server_capabilities & CLIENT_MYSQL))
#define MARIADB_CLIENT_SUPPORTED_FLAGS (MARIADB_CLIENT_PROGRESS |\
MARIADB_CLIENT_STMT_BULK_OPERATIONS|\
MARIADB_CLIENT_EXTENDED_METADATA|\
MARIADB_CLIENT_CACHE_METADATA|\
MARIADB_CLIENT_BULK_UNIT_RESULTS)
#define CLIENT_SUPPORTED_FLAGS (CLIENT_MYSQL |\
CLIENT_FOUND_ROWS |\
CLIENT_LONG_FLAG |\
CLIENT_CONNECT_WITH_DB |\
CLIENT_NO_SCHEMA |\
CLIENT_COMPRESS |\
CLIENT_ODBC |\
CLIENT_LOCAL_FILES |\
CLIENT_IGNORE_SPACE |\
CLIENT_INTERACTIVE |\
CLIENT_SSL |\
CLIENT_IGNORE_SIGPIPE |\
CLIENT_TRANSACTIONS |\
CLIENT_PROTOCOL_41 |\
CLIENT_RESERVED |\
CLIENT_SECURE_CONNECTION |\
CLIENT_MULTI_STATEMENTS |\
CLIENT_MULTI_RESULTS |\
CLIENT_PROGRESS |\
CLIENT_SSL_VERIFY_SERVER_CERT |\
CLIENT_REMEMBER_OPTIONS |\
CLIENT_PLUGIN_AUTH |\
CLIENT_SESSION_TRACKING |\
CLIENT_CONNECT_ATTRS)
#define CLIENT_ALLOWED_FLAGS (CLIENT_SUPPORTED_FLAGS |\
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA |\
CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS |\
CLIENT_ZSTD_COMPRESSION |\
CLIENT_PS_MULTI_RESULTS |\
CLIENT_REMEMBER_OPTIONS)
#define CLIENT_CAPABILITIES (CLIENT_MYSQL | \
CLIENT_LONG_FLAG |\
CLIENT_TRANSACTIONS |\
CLIENT_SECURE_CONNECTION |\
CLIENT_MULTI_RESULTS | \
CLIENT_PS_MULTI_RESULTS |\
CLIENT_PROTOCOL_41 |\
CLIENT_PLUGIN_AUTH |\
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \
CLIENT_SESSION_TRACKING |\
CLIENT_CONNECT_ATTRS)
#define CLIENT_DEFAULT_FLAGS ((CLIENT_SUPPORTED_FLAGS & ~CLIENT_COMPRESS)\
& ~CLIENT_SSL)
#define CLIENT_DEFAULT_EXTENDED_FLAGS (MARIADB_CLIENT_SUPPORTED_FLAGS &\
~MARIADB_CLIENT_BULK_UNIT_RESULTS)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
#define SERVER_MORE_RESULTS_EXIST 8
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
#define SERVER_QUERY_NO_INDEX_USED 32
#define SERVER_STATUS_CURSOR_EXISTS 64
#define SERVER_STATUS_LAST_ROW_SENT 128
#define SERVER_STATUS_DB_DROPPED 256
#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
#define SERVER_STATUS_METADATA_CHANGED 1024
#define SERVER_QUERY_WAS_SLOW 2048
#define SERVER_PS_OUT_PARAMS 4096
#define SERVER_STATUS_IN_TRANS_READONLY 8192
#define SERVER_SESSION_STATE_CHANGED 16384
#define SERVER_STATUS_ANSI_QUOTES 32768
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
#define NET_WAIT_TIMEOUT (8*60*60) /* Wait for new query */
/* for server integration (mysqlbinlog) */
#define LIST_PROCESS_HOST_LEN 64
#define MYSQL50_TABLE_NAME_PREFIX "#mysql50#"
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1)
#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH)
struct st_ma_pvio;
typedef struct st_ma_pvio MARIADB_PVIO;
#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR column */
#define MAX_BLOB_WIDTH 8192 /* Default width for blob */
/* the following defines were added for PHP's mysqli and pdo extensions:
see: CONC-56
*/
#define MAX_TINYINT_WIDTH 3
#define MAX_SMALLINT_WIDTH 5
#define MAX_MEDIUMINT_WIDTH 8
#define MAX_INT_WIDTH 10
#define MAX_BIGINT_WIDTH 20
struct st_ma_connection_plugin;
typedef struct st_net {
MARIADB_PVIO *pvio;
unsigned char *buff;
unsigned char *buff_end,*write_pos,*read_pos;
my_socket fd; /* For Perl DBI/dbd */
unsigned long remain_in_buf,length;
unsigned long buf_length, where_b;
unsigned long max_packet, max_packet_size;
unsigned int pkt_nr, compress_pkt_nr;
unsigned int write_timeout, read_timeout, retry_count;
int fcntl;
unsigned int *return_status;
unsigned char reading_or_writing;
char save_char;
char unused_1;
unsigned char tls_verify_status;
my_bool compress;
my_bool unused_2;
char *unused_3;
unsigned int last_errno;
unsigned char error;
my_bool unused_5;
my_bool unused_6;
char last_error[MYSQL_ERRMSG_SIZE];
char sqlstate[SQLSTATE_LENGTH+1];
struct st_mariadb_net_extension *extension;
} NET;
#define packet_error ((unsigned int) -1)
/* used by mysql_set_server_option */
enum enum_mysql_set_option
{
MYSQL_OPTION_MULTI_STATEMENTS_ON,
MYSQL_OPTION_MULTI_STATEMENTS_OFF
};
/* for status callback function */
enum enum_mariadb_status_info
{
STATUS_TYPE= 0,
SESSION_TRACK_TYPE
};
enum enum_session_state_type
{
SESSION_TRACK_SYSTEM_VARIABLES= 0,
SESSION_TRACK_SCHEMA,
SESSION_TRACK_STATE_CHANGE,
/* currently not supported by MariaDB Server */
SESSION_TRACK_GTIDS,
SESSION_TRACK_TRANSACTION_CHARACTERISTICS,
SESSION_TRACK_TRANSACTION_STATE /* make sure that SESSION_TRACK_END always points
to last element of enum !! */
};
#define SESSION_TRACK_BEGIN 0
#define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_STATE
#define SESSION_TRACK_TYPES (SESSION_TRACK_END + 1)
/* SESSION_TRACK_TRANSACTION_TYPE was renamed to SESSION_TRACK_TRANSACTION_STATE
in 3e699a1738cdfb0a2c5b8eabfa8301b8d11cf711.
This is a workaround to prevent breaking of travis and buildbot tests.
TODO: Remove this after server fixes */
#define SESSION_TRACK_TRANSACTION_TYPE SESSION_TRACK_TRANSACTION_STATE
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE,
MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_BIT,
/*
the following types are not used by client,
only for mysqlbinlog!!
*/
MYSQL_TYPE_TIMESTAMP2,
MYSQL_TYPE_DATETIME2,
MYSQL_TYPE_TIME2,
/* --------------------------------------------- */
MYSQL_TYPE_JSON=245,
MYSQL_TYPE_NEWDECIMAL=246,
MYSQL_TYPE_ENUM=247,
MYSQL_TYPE_SET=248,
MYSQL_TYPE_TINY_BLOB=249,
MYSQL_TYPE_MEDIUM_BLOB=250,
MYSQL_TYPE_LONG_BLOB=251,
MYSQL_TYPE_BLOB=252,
MYSQL_TYPE_VAR_STRING=253,
MYSQL_TYPE_STRING=254,
MYSQL_TYPE_GEOMETRY=255,
MAX_NO_FIELD_TYPES };
#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compatibility */
#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compatibility */
#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL
#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL
#define FIELD_TYPE_TINY MYSQL_TYPE_TINY
#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT
#define FIELD_TYPE_LONG MYSQL_TYPE_LONG
#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT
#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE
#define FIELD_TYPE_NULL MYSQL_TYPE_NULL
#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP
#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG
#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24
#define FIELD_TYPE_DATE MYSQL_TYPE_DATE
#define FIELD_TYPE_TIME MYSQL_TYPE_TIME
#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME
#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR
#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE
#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM
#define FIELD_TYPE_SET MYSQL_TYPE_SET
#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB
#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB
#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB
#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB
#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING
#define FIELD_TYPE_STRING MYSQL_TYPE_STRING
#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY
#define FIELD_TYPE_BIT MYSQL_TYPE_BIT
extern unsigned long max_allowed_packet;
extern unsigned long net_buffer_length;
#define net_new_transaction(net) ((net)->pkt_nr=0)
int ma_net_init(NET *net, MARIADB_PVIO *pvio);
void ma_net_end(NET *net);
void ma_net_clear(NET *net);
int ma_net_flush(NET *net);
int ma_net_write(NET *net,const unsigned char *packet, size_t len);
int ma_net_write_buff(NET *net, const char *packet, size_t len);
int ma_net_write_command(NET *net,unsigned char command,const char *packet,
size_t len, my_bool disable_flush);
int ma_net_real_write(NET *net,const char *packet, size_t len);
extern unsigned long ma_net_read(NET *net);
struct rand_struct {
unsigned long seed1,seed2,max_value;
double max_value_dbl;
};
/* The following is for user defined functions */
typedef struct st_udf_args
{
unsigned int arg_count; /* Number of arguments */
enum Item_result *arg_type; /* Pointer to item_results */
char **args; /* Pointer to argument */
unsigned long *lengths; /* Length of string arguments */
char *maybe_null; /* Set to 1 for all maybe_null args */
} UDF_ARGS;
/* This holds information about the result */
typedef struct st_udf_init
{
my_bool maybe_null; /* 1 if function can return NULL */
unsigned int decimals; /* for real functions */
unsigned int max_length; /* For string functions */
char *ptr; /* free pointer for function data */
my_bool const_item; /* 0 if result is independent of arguments */
} UDF_INIT;
/* Connection types */
#define MARIADB_CONNECTION_UNIXSOCKET 0
#define MARIADB_CONNECTION_TCP 1
#define MARIADB_CONNECTION_NAMEDPIPE 2
#define MARIADB_CONNECTION_SHAREDMEM 3
/* Constants when using compression */
#define NET_HEADER_SIZE 4 /* standard header size */
#define COMP_HEADER_SIZE 3 /* compression header extra size */
/* Prototypes to password functions */
#define native_password_plugin_name "mysql_native_password"
#define old_password_plugin_name "mysql_old_password"
#ifdef __cplusplus
extern "C" {
#endif
char *ma_scramble_323(char *to,const char *message,const char *password);
void ma_scramble_41(const unsigned char *buffer, const char *scramble, const char *password);
void ma_hash_password(unsigned long *result, const char *password, size_t len);
void ma_make_scrambled_password(char *to,const char *password);
/* Some other useful functions */
void mariadb_load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv);
my_bool ma_thread_init(void);
void ma_thread_end(void);
#ifdef __cplusplus
}
#endif
#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
#endif

76
vendor/mariadb/include/mariadb_ctype.h vendored Normal file
View File

@@ -0,0 +1,76 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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 */
/*
A better implementation of the UNIX ctype(3) library.
Notes: my_global.h should be included before ctype.h
*/
#ifndef _mariadb_ctype_h
#define _mariadb_ctype_h
#include <ctype.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CHARSET_DIR "charsets/"
#define MY_CS_NAME_SIZE 32
#define MADB_DEFAULT_CHARSET_NAME "latin1"
#define MADB_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#define MADB_AUTODETECT_CHARSET_NAME "auto"
/* we use the mysqlnd implementation */
typedef struct ma_charset_info_st
{
unsigned int nr; /* so far only 1 byte for charset */
unsigned int state;
const char *csname;
const char *name;
const char *dir;
unsigned int codepage;
const char *encoding;
unsigned int char_minlen;
unsigned int char_maxlen;
unsigned int (*mb_charlen)(unsigned int c);
unsigned int (*mb_valid)(const char *start, const char *end);
} MARIADB_CHARSET_INFO;
extern const MARIADB_CHARSET_INFO mariadb_compiled_charsets[];
extern MARIADB_CHARSET_INFO *ma_default_charset_info;
extern MARIADB_CHARSET_INFO *ma_charset_bin;
extern MARIADB_CHARSET_INFO *ma_charset_latin1;
extern MARIADB_CHARSET_INFO *ma_charset_utf8_general_ci;
extern MARIADB_CHARSET_INFO *ma_charset_utf16le_general_ci;
MARIADB_CHARSET_INFO *find_compiled_charset(unsigned int cs_number);
MARIADB_CHARSET_INFO *find_compiled_charset_by_name(const char *name);
size_t mysql_cset_escape_quotes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len);
size_t mysql_cset_escape_slashes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len);
const char* madb_get_os_character_set(void);
#ifdef _WIN32
int madb_get_windows_cp(const char *charset);
#endif
#ifdef __cplusplus
}
#endif
#endif

260
vendor/mariadb/include/mariadb_dyncol.h vendored Normal file
View File

@@ -0,0 +1,260 @@
/* Copyright (c) 2011, Monty Program Ab
Copyright (c) 2011, Oleksandr Byelkin
Copyright (c) 2012, 2022 MariaDB Corporation AB
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef ma_dyncol_h
#define ma_dyncol_h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef LIBMARIADB
#include <decimal.h>
#include <my_decimal_limits.h>
#endif
#include <mysql.h>
#ifndef longlong_defined
#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8
typedef unsigned long long int ulonglong; /* ulong or unsigned long long */
typedef long long int longlong;
#else
typedef unsigned long ulonglong; /* ulong or unsigned long long */
typedef long longlong;
#endif
#define longlong_defined
#endif
#ifndef _my_sys_h
typedef struct st_dynamic_string
{
char *str;
size_t length,max_length,alloc_increment;
} DYNAMIC_STRING;
#endif
struct st_mysql_lex_string
{
char *str;
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
typedef struct st_mysql_lex_string LEX_STRING;
/*
Limits of implementation
*/
#define MAX_TOTAL_NAME_LENGTH 65535
#define MAX_NAME_LENGTH (MAX_TOTAL_NAME_LENGTH/4)
/* NO and OK is the same used just to show semantics */
#define ER_DYNCOL_NO ER_DYNCOL_OK
enum enum_dyncol_func_result
{
ER_DYNCOL_OK= 0,
ER_DYNCOL_YES= 1, /* For functions returning 0/1 */
ER_DYNCOL_FORMAT= -1, /* Wrong format of the encoded string */
ER_DYNCOL_LIMIT= -2, /* Some limit reached */
ER_DYNCOL_RESOURCE= -3, /* Out of resources */
ER_DYNCOL_DATA= -4, /* Incorrect input data */
ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */
ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */
};
typedef DYNAMIC_STRING DYNAMIC_COLUMN;
enum enum_dynamic_column_type
{
DYN_COL_NULL= 0,
DYN_COL_INT,
DYN_COL_UINT,
DYN_COL_DOUBLE,
DYN_COL_STRING,
DYN_COL_DECIMAL,
DYN_COL_DATETIME,
DYN_COL_DATE,
DYN_COL_TIME,
DYN_COL_DYNCOL
};
typedef enum enum_dynamic_column_type DYNAMIC_COLUMN_TYPE;
struct st_dynamic_column_value
{
DYNAMIC_COLUMN_TYPE type;
union
{
long long long_value;
unsigned long long ulong_value;
double double_value;
struct {
MYSQL_LEX_STRING value;
MARIADB_CHARSET_INFO *charset;
} string;
#ifndef LIBMARIADB
struct {
decimal_digit_t buffer[DECIMAL_BUFF_LENGTH];
decimal_t value;
} decimal;
#endif
MYSQL_TIME time_value;
} x;
};
typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE;
#ifdef MADYNCOL_DEPRECATED
enum enum_dyncol_func_result
dynamic_column_create(DYNAMIC_COLUMN *str,
uint column_nr, DYNAMIC_COLUMN_VALUE *value);
enum enum_dyncol_func_result
dynamic_column_create_many(DYNAMIC_COLUMN *str,
uint column_count,
uint *column_numbers,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr,
DYNAMIC_COLUMN_VALUE *value);
enum enum_dyncol_func_result
dynamic_column_update_many(DYNAMIC_COLUMN *str,
uint add_column_count,
uint *column_numbers,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr);
enum enum_dyncol_func_result
dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint);
enum enum_dyncol_func_result
dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr,
DYNAMIC_COLUMN_VALUE *store_it_here);
#endif
/* new functions */
enum enum_dyncol_func_result
mariadb_dyncol_create_many_num(DYNAMIC_COLUMN *str,
uint column_count,
uint *column_numbers,
DYNAMIC_COLUMN_VALUE *values,
my_bool new_string);
enum enum_dyncol_func_result
mariadb_dyncol_create_many_named(DYNAMIC_COLUMN *str,
uint column_count,
MYSQL_LEX_STRING *column_keys,
DYNAMIC_COLUMN_VALUE *values,
my_bool new_string);
enum enum_dyncol_func_result
mariadb_dyncol_update_many_num(DYNAMIC_COLUMN *str,
uint add_column_count,
uint *column_keys,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
mariadb_dyncol_update_many_named(DYNAMIC_COLUMN *str,
uint add_column_count,
MYSQL_LEX_STRING *column_keys,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
mariadb_dyncol_exists_num(DYNAMIC_COLUMN *org, uint column_nr);
enum enum_dyncol_func_result
mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name);
/* List of not NULL columns */
enum enum_dyncol_func_result
mariadb_dyncol_list_num(DYNAMIC_COLUMN *str, uint *count, uint **nums);
enum enum_dyncol_func_result
mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count,
MYSQL_LEX_STRING **names);
/*
if the column do not exists it is NULL
*/
enum enum_dyncol_func_result
mariadb_dyncol_get_num(DYNAMIC_COLUMN *org, uint column_nr,
DYNAMIC_COLUMN_VALUE *store_it_here);
enum enum_dyncol_func_result
mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name,
DYNAMIC_COLUMN_VALUE *store_it_here);
my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str);
enum enum_dyncol_func_result
mariadb_dyncol_check(DYNAMIC_COLUMN *str);
enum enum_dyncol_func_result
mariadb_dyncol_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json);
void mariadb_dyncol_free(DYNAMIC_COLUMN *str);
#define mariadb_dyncol_init(A) memset((A), 0, sizeof(DYNAMIC_COLUMN))
#define dynamic_column_initialize(A) mariadb_dyncol_init((A))
#define dynamic_column_column_free(A) mariadb_dyncol_free((A))
/* conversion of values to 3 base types */
enum enum_dyncol_func_result
mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
MARIADB_CHARSET_INFO *cs, char quote);
enum enum_dyncol_func_result
mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val);
enum enum_dyncol_func_result
mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val);
enum enum_dyncol_func_result
mariadb_dyncol_unpack(DYNAMIC_COLUMN *str,
uint *count,
MYSQL_LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals);
int mariadb_dyncol_column_cmp_named(const MYSQL_LEX_STRING *s1,
const MYSQL_LEX_STRING *s2);
enum enum_dyncol_func_result
mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count);
#define mariadb_dyncol_value_init(V) \
do {\
(V)->type= DYN_COL_NULL;\
} while(0)
/*
Prepare value for using as decimal
*/
void mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE *value);
#ifdef __cplusplus
}
#endif
#endif

650
vendor/mariadb/include/mariadb_rpl.h vendored Normal file
View File

@@ -0,0 +1,650 @@
/* Copyright (C) 2018-2022 MariaDB Corporation AB
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 */
#ifndef _mariadb_rpl_h_
#define _mariadb_rpl_h_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <mariadb/ma_io.h>
#define MARIADB_RPL_VERSION 0x0002
#define MARIADB_RPL_REQUIRED_VERSION 0x0002
#define RPL_BINLOG_MAGIC (const uchar*) "\xFE\x62\x69\x6E"
#define RPL_BINLOG_MAGIC_SIZE 4
/* Protocol flags */
#define MARIADB_RPL_BINLOG_DUMP_NON_BLOCK 1
#define MARIADB_RPL_BINLOG_SEND_ANNOTATE_ROWS 2
#define MARIADB_RPL_IGNORE_HEARTBEAT (1 << 17)
#define EVENT_HEADER_OFS 20
#define FL_STMT_END 1
/* GTID flags */
/* FL_STANDALONE is set in case there is no terminating COMMIT event. */
#define FL_STANDALONE 0x01
/* FL_GROUP_COMMIT_ID is set when event group is part of a group commit */
#define FL_GROUP_COMMIT_ID 0x02
/* FL_TRANSACTIONAL is set for an event group that can be safely rolled back
(no MyISAM, eg.).
*/
#define FL_TRANSACTIONAL 0x04
/*
FL_ALLOW_PARALLEL reflects the (negation of the) value of
@@SESSION.skip_parallel_replication at the time of commit.
*/
#define FL_ALLOW_PARALLEL 0x08;
/*
FL_WAITED is set if a row lock wait (or other wait) is detected during the
execution of the transaction.
*/
#define FL_WAITED 0x10
/* FL_DDL is set for event group containing DDL. */
#define FL_DDL 0x20
/* FL_PREPARED_XA is set for XA transaction. */
#define FL_PREPARED_XA 0x40
/* FL_"COMMITTED or ROLLED-BACK"_XA is set for XA transaction. */
#define FL_COMPLETED_XA 0x80
/* SEMI SYNCHRONOUS REPLICATION */
#define SEMI_SYNC_INDICATOR 0xEF
#define SEMI_SYNC_ACK_REQ 0x01
/* Options */
enum mariadb_rpl_option {
MARIADB_RPL_FILENAME, /* Filename and length */
MARIADB_RPL_START, /* Start position */
MARIADB_RPL_SERVER_ID, /* Server ID */
MARIADB_RPL_FLAGS, /* Protocol flags */
MARIADB_RPL_GTID_CALLBACK, /* GTID callback function */
MARIADB_RPL_GTID_DATA, /* GTID data */
MARIADB_RPL_BUFFER,
MARIADB_RPL_VERIFY_CHECKSUM,
MARIADB_RPL_UNCOMPRESS,
MARIADB_RPL_HOST,
MARIADB_RPL_PORT,
MARIADB_RPL_EXTRACT_VALUES,
MARIADB_RPL_SEMI_SYNC,
};
/* Event types: From MariaDB Server sql/log_event.h */
enum mariadb_rpl_event {
UNKNOWN_EVENT= 0,
START_EVENT_V3= 1,
QUERY_EVENT= 2,
STOP_EVENT= 3,
ROTATE_EVENT= 4,
INTVAR_EVENT= 5,
LOAD_EVENT= 6,
SLAVE_EVENT= 7,
CREATE_FILE_EVENT= 8,
APPEND_BLOCK_EVENT= 9,
EXEC_LOAD_EVENT= 10,
DELETE_FILE_EVENT= 11,
NEW_LOAD_EVENT= 12,
RAND_EVENT= 13,
USER_VAR_EVENT= 14,
FORMAT_DESCRIPTION_EVENT= 15,
XID_EVENT= 16,
BEGIN_LOAD_QUERY_EVENT= 17,
EXECUTE_LOAD_QUERY_EVENT= 18,
TABLE_MAP_EVENT = 19,
PRE_GA_WRITE_ROWS_EVENT = 20, /* deprecated */
PRE_GA_UPDATE_ROWS_EVENT = 21, /* deprecated */
PRE_GA_DELETE_ROWS_EVENT = 22, /* deprecated */
WRITE_ROWS_EVENT_V1 = 23,
UPDATE_ROWS_EVENT_V1 = 24,
DELETE_ROWS_EVENT_V1 = 25,
INCIDENT_EVENT= 26,
HEARTBEAT_LOG_EVENT= 27,
IGNORABLE_LOG_EVENT= 28,
ROWS_QUERY_LOG_EVENT= 29,
WRITE_ROWS_EVENT = 30,
UPDATE_ROWS_EVENT = 31,
DELETE_ROWS_EVENT = 32,
GTID_LOG_EVENT= 33,
ANONYMOUS_GTID_LOG_EVENT= 34,
PREVIOUS_GTIDS_LOG_EVENT= 35,
TRANSACTION_CONTEXT_EVENT= 36,
VIEW_CHANGE_EVENT= 37,
XA_PREPARE_LOG_EVENT= 38,
PARTIAL_UPDATE_ROWS_EVENT = 39,
/*
Add new events here - right above this comment!
Existing events (except ENUM_END_EVENT) should never change their numbers
*/
/* New MySQL events are to be added right above this comment */
MYSQL_EVENTS_END,
MARIA_EVENTS_BEGIN= 160,
ANNOTATE_ROWS_EVENT= 160,
BINLOG_CHECKPOINT_EVENT= 161,
GTID_EVENT= 162,
GTID_LIST_EVENT= 163,
START_ENCRYPTION_EVENT= 164,
QUERY_COMPRESSED_EVENT = 165,
WRITE_ROWS_COMPRESSED_EVENT_V1 = 166,
UPDATE_ROWS_COMPRESSED_EVENT_V1 = 167,
DELETE_ROWS_COMPRESSED_EVENT_V1 = 168,
WRITE_ROWS_COMPRESSED_EVENT = 169,
UPDATE_ROWS_COMPRESSED_EVENT = 170,
DELETE_ROWS_COMPRESSED_EVENT = 171,
/* Add new MariaDB events here - right above this comment! */
ENUM_END_EVENT /* end marker */
};
/* ROWS_EVENT flags */
#define STMT_END_F 0x01
#define NO_FOREIGN_KEY_CHECKS_F 0x02
#define RELAXED_UNIQUE_KEY_CHECKS_F 0x04
#define COMPLETE_ROWS_F 0x08
#define NO_CHECK_CONSTRAINT_CHECKS_F 0x80
enum mariadb_rpl_status_code {
Q_FLAGS2_CODE= 0x00,
Q_SQL_MODE_CODE= 0x01,
Q_CATALOG_CODE= 0x02,
Q_AUTO_INCREMENT_CODE= 0x03,
Q_CHARSET_CODE= 0x04,
Q_TIMEZONE_CODE= 0x05,
Q_CATALOG_NZ_CODE= 0x06,
Q_LC_TIME_NAMES_CODE= 0x07,
Q_CHARSET_DATABASE_CODE= 0x08,
Q_TABLE_MAP_FOR_UPDATE_CODE= 0x09,
Q_MASTER_DATA_WRITTEN_CODE= 0x0A,
Q_INVOKERS_CODE= 0x0B,
Q_UPDATED_DB_NAMES_CODE= 0x0C,
Q_MICROSECONDS_CODE= 0x0D,
Q_COMMIT_TS_CODE= 0x0E, /* unused */
Q_COMMIT_TS2_CODE= 0x0F, /* unused */
Q_EXPLICIT_DEFAULTS_FOR_TIMESTAMP_CODE= 0x10,
Q_DDL_LOGGED_WITH_XID_CODE= 0x11,
Q_DEFAULT_COLLATION_FOR_UTF8_CODE= 0x12,
Q_SQL_REQUIRE_PRIMARY_KEY_CODE= 0x13,
Q_DEFAULT_TABLE_ENCRYPTION_CODE= 0x14,
Q_HRNOW= 128, /* second part: 3 bytes */
Q_XID= 129 /* xid: 8 bytes */
};
#ifdef DEFAULT_CHARSET
#undef DEFAULT_CHARSET
#endif
enum opt_metadata_field_type
{
SIGNEDNESS = 1,
DEFAULT_CHARSET,
COLUMN_CHARSET,
COLUMN_NAME,
SET_STR_VALUE,
ENUM_STR_VALUE,
GEOMETRY_TYPE,
SIMPLE_PRIMARY_KEY,
PRIMARY_KEY_WITH_PREFIX,
ENUM_AND_SET_DEFAULT_CHARSET,
ENUM_AND_SET_COLUMN_CHARSET
};
/* QFLAGS2 codes */
#define OPTION_AUTO_IS_NULL 0x00040000
#define OPTION_NOT_AUTOCOMMIT 0x00080000
#define OPTION_NO_FOREIGN_KEY_CHECKS 0x04000000
#define OPTION_RELAXED_UNIQUE_CHECKS 0x08000000
/* SQL modes */
#define MODE_REAL_AS_FLOAT 0x00000001
#define MODE_PIPES_AS_CONCAT 0x00000002
#define MODE_ANSI_QUOTES 0x00000004
#define MODE_IGNORE_SPACE 0x00000008
#define MODE_NOT_USED 0x00000010
#define MODE_ONLY_FULL_GROUP_BY 0x00000020
#define MODE_NO_UNSIGNED_SUBTRACTION 0x00000040
#define MODE_NO_DIR_IN_CREATE 0x00000080
#define MODE_POSTGRESQL 0x00000100
#define MODE_ORACLE 0x00000200
#define MODE_MSSQL 0x00000400
#define MODE_DB2 0x00000800
#define MODE_MAXDB 0x00001000
#define MODE_NO_KEY_OPTIONS 0x00002000
#define MODE_NO_TABLE_OPTIONS 0x00004000
#define MODE_NO_FIELD_OPTIONS 0x00008000
#define MODE_MYSQL323 0x00010000
#define MODE_MYSQL40 0x00020000
#define MODE_ANSI 0x00040000
#define MODE_NO_AUTO_VALUE_ON_ZERO 0x00080000
#define MODE_NO_BACKSLASH_ESCAPES 0x00100000
#define MODE_STRICT_TRANS_TABLES 0x00200000
#define MODE_STRICT_ALL_TABLES 0x00400000
#define MODE_NO_ZERO_IN_DATE 0x00800000
#define MODE_NO_ZERO_DATE 0x01000000
#define MODE_INVALID_DATES 0x02000000
#define MODE_ERROR_FOR_DIVISION_BY_ZERO 0x04000000
#define MODE_TRADITIONAL 0x08000000
#define MODE_NO_AUTO_CREATE_USER 0x10000000
#define MODE_HIGH_NOT_PRECEDENCE 0x20000000
#define MODE_NO_ENGINE_SUBSTITUTION 0x40000000
#define MODE_PAD_CHAR_TO_FULL_LENGTH 0x80000000
/* Log Event flags */
/* used in FOMRAT_DESCRIPTION_EVENT. Indicates if it
is the active binary log.
Note: When reading data via COM_BINLOG_DUMP this
flag is never set.
*/
#define LOG_EVENT_BINLOG_IN_USE_F 0x0001
/* Looks like this flag is no longer in use */
#define LOG_EVENT_FORCED_ROTATE_F 0x0002
/* Log entry depends on thread, e.g. when using user variables
or temporary tables */
#define LOG_EVENT_THREAD_SPECIFIC_F 0x0004
/* Indicates that the USE command can be suppressed before
executing a statement: e.g. DRIP SCHEMA */
#define LOG_EVENT_SUPPRESS_USE_F 0x0008
/* ??? */
#define LOG_EVENT_UPDATE_TABLE_MAP_F 0x0010
/* Artifical event */
#define LOG_EVENT_ARTIFICIAL_F 0x0020
/* ??? */
#define LOG_EVENT_RELAY_LOG_F 0x0040
/* If an event is not supported, and LOG_EVENT_IGNORABLE_F was not
set, an error will be reported. */
#define LOG_EVENT_IGNORABLE_F 0x0080
/* ??? */
#define LOG_EVENT_NO_FILTER_F 0x0100
/* ?? */
#define LOG_EVENT_MTS_ISOLATE_F 0x0200
/* if session variable @@skip_repliation was set, this flag will be
reported for events which should be skipped. */
#define LOG_EVENT_SKIP_REPLICATION_F 0x8000
typedef struct {
char *str;
size_t length;
} MARIADB_STRING;
enum mariadb_row_event_type {
WRITE_ROWS= 0,
UPDATE_ROWS= 1,
DELETE_ROWS= 2
};
/* Global transaction id */
typedef struct st_mariadb_gtid {
unsigned int domain_id;
unsigned int server_id;
unsigned long long sequence_nr;
} MARIADB_GTID;
/* Generic replication handle */
typedef struct st_mariadb_rpl {
unsigned int version;
MYSQL *mysql;
char *filename;
uint32_t filename_length;
uint32_t server_id;
unsigned long start_position;
uint16_t flags;
uint8_t fd_header_len; /* header len from last format description event */
uint8_t use_checksum;
uint8_t artificial_checksum;
uint8_t verify_checksum;
uint8_t post_header_len[ENUM_END_EVENT];
MA_FILE *fp;
uint32_t error_no;
char error_msg[MYSQL_ERRMSG_SIZE];
uint8_t uncompress;
char *host;
uint32_t port;
uint8_t extract_values;
char nonce[12];
uint8_t encrypted;
uint8_t is_semi_sync;
}MARIADB_RPL;
typedef struct st_mariadb_rpl_value {
enum enum_field_types field_type;
uint8_t is_null;
uint8_t is_signed;
union {
int64_t ll;
uint64_t ull;
float f;
double d;
MYSQL_TIME tm;
MARIADB_STRING str;
} val;
} MARIADB_RPL_VALUE;
typedef struct st_rpl_mariadb_row {
uint32_t column_count;
MARIADB_RPL_VALUE *columns;
struct st_rpl_mariadb_row *next;
} MARIADB_RPL_ROW;
/* Event header */
struct st_mariadb_rpl_rotate_event {
unsigned long long position;
MARIADB_STRING filename;
};
struct st_mariadb_rpl_query_event {
uint32_t thread_id;
uint32_t seconds;
MARIADB_STRING database;
uint32_t errornr;
MARIADB_STRING status;
MARIADB_STRING statement;
};
struct st_mariadb_rpl_previous_gtid_event {
MARIADB_CONST_DATA content;
};
struct st_mariadb_rpl_gtid_list_event {
uint32_t gtid_cnt;
MARIADB_GTID *gtid;
};
struct st_mariadb_rpl_format_description_event
{
uint16_t format;
char *server_version;
uint32_t timestamp;
uint8_t header_len;
MARIADB_STRING post_header_lengths;
};
struct st_mariadb_rpl_checkpoint_event {
MARIADB_STRING filename;
};
struct st_mariadb_rpl_xid_event {
uint64_t transaction_nr;
};
struct st_mariadb_rpl_gtid_event {
uint64_t sequence_nr;
uint32_t domain_id;
uint8_t flags;
uint64_t commit_id;
uint32_t format_id;
uint8_t gtrid_len;
uint8_t bqual_len;
MARIADB_STRING xid;
};
struct st_mariadb_rpl_annotate_rows_event {
MARIADB_STRING statement;
};
struct st_mariadb_rpl_table_map_event {
unsigned long long table_id;
MARIADB_STRING database;
MARIADB_STRING table;
uint32_t column_count;
MARIADB_STRING column_types;
MARIADB_STRING metadata;
unsigned char *null_indicator;
unsigned char *signed_indicator;
MARIADB_CONST_DATA column_names;
MARIADB_CONST_DATA geometry_types;
uint32_t default_charset;
MARIADB_CONST_DATA column_charsets;
MARIADB_CONST_DATA simple_primary_keys;
MARIADB_CONST_DATA prefixed_primary_keys;
MARIADB_CONST_DATA set_values;
MARIADB_CONST_DATA enum_values;
uint8_t enum_set_default_charset;
MARIADB_CONST_DATA enum_set_column_charsets;
};
struct st_mariadb_rpl_rand_event {
unsigned long long first_seed;
unsigned long long second_seed;
};
struct st_mariadb_rpl_intvar_event {
unsigned long long value;
uint8_t type;
};
struct st_mariadb_begin_load_query_event {
uint32_t file_id;
unsigned char *data;
};
struct st_mariadb_start_encryption_event {
uint8_t scheme;
uint32_t key_version;
char nonce[12];
};
struct st_mariadb_execute_load_query_event {
uint32_t thread_id;
uint32_t execution_time;
MARIADB_STRING schema;
uint16_t error_code;
uint32_t file_id;
uint32_t ofs1;
uint32_t ofs2;
uint8_t duplicate_flag;
MARIADB_STRING status_vars;
MARIADB_STRING statement;
};
struct st_mariadb_rpl_uservar_event {
MARIADB_STRING name;
uint8_t is_null;
uint8_t type;
uint32_t charset_nr;
MARIADB_STRING value;
uint8_t flags;
};
struct st_mariadb_rpl_rows_event {
enum mariadb_row_event_type type;
uint64_t table_id;
uint16_t flags;
uint32_t column_count;
unsigned char *column_bitmap;
unsigned char *column_update_bitmap;
unsigned char *null_bitmap;
size_t row_data_size;
void *row_data;
size_t extra_data_size;
void *extra_data;
uint8_t compressed;
uint32_t row_count;
};
struct st_mariadb_rpl_heartbeat_event {
MARIADB_STRING filename;
};
struct st_mariadb_rpl_xa_prepare_log_event {
uint8_t one_phase;
uint32_t format_id;
uint32_t gtrid_len;
uint32_t bqual_len;
MARIADB_STRING xid;
};
struct st_mariadb_gtid_log_event {
uint8_t commit_flag;
char source_id[16];
uint64_t sequence_nr;
};
typedef struct st_mariadb_rpl_event
{
/* common header */
MA_MEM_ROOT memroot;
unsigned char *raw_data;
size_t raw_data_size;
size_t raw_data_ofs;
unsigned int checksum;
char ok;
enum mariadb_rpl_event event_type;
unsigned int timestamp;
unsigned int server_id;
unsigned int event_length;
unsigned int next_event_pos;
unsigned short flags;
/****************/
union {
struct st_mariadb_rpl_rotate_event rotate;
struct st_mariadb_rpl_query_event query;
struct st_mariadb_rpl_format_description_event format_description;
struct st_mariadb_rpl_gtid_list_event gtid_list;
struct st_mariadb_rpl_checkpoint_event checkpoint;
struct st_mariadb_rpl_xid_event xid;
struct st_mariadb_rpl_gtid_event gtid;
struct st_mariadb_rpl_annotate_rows_event annotate_rows;
struct st_mariadb_rpl_table_map_event table_map;
struct st_mariadb_rpl_rand_event rand;
struct st_mariadb_rpl_intvar_event intvar;
struct st_mariadb_rpl_uservar_event uservar;
struct st_mariadb_rpl_rows_event rows;
struct st_mariadb_rpl_heartbeat_event heartbeat;
struct st_mariadb_rpl_xa_prepare_log_event xa_prepare_log;
struct st_mariadb_begin_load_query_event begin_load_query;
struct st_mariadb_execute_load_query_event execute_load_query;
struct st_mariadb_gtid_log_event gtid_log;
struct st_mariadb_start_encryption_event start_encryption;
struct st_mariadb_rpl_previous_gtid_event previous_gtid;
} event;
/* Added in C/C 3.3.0 */
uint8_t is_semi_sync;
uint8_t semi_sync_flags;
/* Added in C/C 3.3.5 */
MARIADB_RPL *rpl;
} MARIADB_RPL_EVENT;
/* compression uses myisampack format */
#define myisam_uint1korr(B) ((uint8_t)(*B))
#define myisam_sint1korr(B) ((int8_t)(*B))
#define myisam_uint2korr(B)\
((uint16_t)(((uint16_t)(((const uchar*)(B))[1])) | ((uint16_t) (((const uchar*) (B))[0]) << 8)))
#define myisam_sint2korr(B)\
((int16_t)(((int16_t)(((const uchar*)(B))[1])) | ((int16_t) (((const uchar*) (B))[0]) << 8)))
#define myisam_uint3korr(B)\
((uint32_t)(((uint32_t)(((const uchar*)(B))[2])) |\
(((uint32_t)(((const uchar*)(B))[1])) << 8) |\
(((uint32_t)(((const uchar*)(B))[0])) << 16)))
#define myisam_sint3korr(B)\
((int32_t)(((int32_t)(((const uchar*)(B))[2])) |\
(((int32_t)(((const uchar*)(B))[1])) << 8) |\
(((int32_t)(((const uchar*)(B))[0])) << 16)))
#define myisam_uint4korr(B)\
((uint32_t)(((uint32_t)(((const uchar*)(B))[3])) |\
(((uint32_t)(((const uchar*)(B))[2])) << 8) |\
(((uint32_t)(((const uchar*) (B))[1])) << 16) |\
(((uint32_t)(((const uchar*) (B))[0])) << 24)))
#define myisam_sint4korr(B)\
((int32_t)(((int32_t)(((const uchar*)(B))[3])) |\
(((int32_t)(((const uchar*)(B))[2])) << 8) |\
(((int32_t)(((const uchar*) (B))[1])) << 16) |\
(((int32_t)(((const uchar*) (B))[0])) << 24)))
#define mi_uint5korr(B)\
((uint64_t)(((uint32_t) (((const uchar*) (B))[4])) |\
(((uint32_t) (((const uchar*) (B))[3])) << 8) |\
(((uint32_t) (((const uchar*) (B))[2])) << 16) |\
(((uint32_t) (((const uchar*) (B))[1])) << 24)) |\
(((uint64_t) (((const uchar*) (B))[0])) << 32))
#define RPL_SAFEGUARD(rpl, event, condition) \
if (!(condition))\
{\
my_set_error((rpl)->mysql, CR_BINLOG_ERROR, SQLSTATE_UNKNOWN, 0,\
(rpl)->filename_length, (rpl)->filename,\
(rpl)->start_position,\
"Packet corrupted");\
mariadb_free_rpl_event((event));\
return 0;\
}
#define mariadb_rpl_init(a) mariadb_rpl_init_ex((a), MARIADB_RPL_VERSION)
#define rpl_clear_error(rpl)\
(rpl)->error_no= (rpl)->error_msg[0]= 0
#define IS_ROW_VERSION2(a)\
((a) == WRITE_ROWS_EVENT || (a) == UPDATE_ROWS_EVENT || \
(a) == DELETE_ROWS_EVENT || (a) == WRITE_ROWS_COMPRESSED_EVENT ||\
(a) == UPDATE_ROWS_COMPRESSED_EVENT || (a) == DELETE_ROWS_COMPRESSED_EVENT)
#define IS_ROW_EVENT(a)\
((a)->event_type == WRITE_ROWS_COMPRESSED_EVENT_V1 ||\
(a)->event_type == UPDATE_ROWS_COMPRESSED_EVENT_V1 ||\
(a)->event_type == DELETE_ROWS_COMPRESSED_EVENT_V1 ||\
(a)->event_type == WRITE_ROWS_EVENT_V1 ||\
(a)->event_type == UPDATE_ROWS_EVENT_V1 ||\
(a)->event_type == DELETE_ROWS_EVENT_V1 ||\
(a)->event_type == WRITE_ROWS_EVENT ||\
(a)->event_type == UPDATE_ROWS_EVENT ||\
(a)->event_type == DELETE_ROWS_EVENT)
/* Function prototypes */
MARIADB_RPL * STDCALL mariadb_rpl_init_ex(MYSQL *mysql, unsigned int version);
const char * STDCALL mariadb_rpl_error(MARIADB_RPL *rpl);
uint32_t STDCALL mariadb_rpl_errno(MARIADB_RPL *rpl);
int STDCALL mariadb_rpl_optionsv(MARIADB_RPL *rpl, enum mariadb_rpl_option, ...);
int STDCALL mariadb_rpl_get_optionsv(MARIADB_RPL *rpl, enum mariadb_rpl_option, ...);
int STDCALL mariadb_rpl_open(MARIADB_RPL *rpl);
void STDCALL mariadb_rpl_close(MARIADB_RPL *rpl);
MARIADB_RPL_EVENT * STDCALL mariadb_rpl_fetch(MARIADB_RPL *rpl, MARIADB_RPL_EVENT *event);
void STDCALL mariadb_free_rpl_event(MARIADB_RPL_EVENT *event);
MARIADB_RPL_ROW * STDCALL
mariadb_rpl_extract_rows(MARIADB_RPL *rpl,
MARIADB_RPL_EVENT *tm_event,
MARIADB_RPL_EVENT *row_event);
#ifdef __cplusplus
}
#endif
#endif

263
vendor/mariadb/include/mariadb_stmt.h vendored Normal file
View File

@@ -0,0 +1,263 @@
/************************************************************************
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 MARIADB_STMT_BULK_SUPPORTED(stmt)\
((stmt)->mysql && \
(!((stmt)->mysql->server_capabilities & CLIENT_MYSQL) &&\
((stmt)->mysql->extension->mariadb_server_capabilities & \
(MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32))))
#define MARIADB_STMT_BULK_UNIT_RESULTS_SUPPORTED(stmt)\
((stmt)->mysql && \
(!((stmt)->mysql->server_capabilities & CLIENT_MYSQL) &&\
((stmt)->mysql->extension->mariadb_client_flag & \
(MARIADB_CLIENT_BULK_UNIT_RESULTS >> 32))))
#define CLEAR_CLIENT_STMT_ERROR(a) \
do { \
(a)->last_errno= 0;\
strcpy((a)->sqlstate, "00000");\
(a)->last_error[0]= 0;\
} while (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,
/* MariaDB only */
STMT_ATTR_PREBIND_PARAMS=200,
STMT_ATTR_ARRAY_SIZE,
STMT_ATTR_ROW_SIZE,
STMT_ATTR_STATE,
STMT_ATTR_CB_USER_DATA,
STMT_ATTR_CB_PARAM,
STMT_ATTR_CB_RESULT,
STMT_ATTR_SQL_STATEMENT
};
enum enum_cursor_type
{
CURSOR_TYPE_NO_CURSOR= 0,
CURSOR_TYPE_READ_ONLY= 1,
CURSOR_TYPE_FOR_UPDATE= 2,
CURSOR_TYPE_SCROLLABLE= 4
};
enum enum_indicator_type
{
STMT_INDICATOR_NTS=-1,
STMT_INDICATOR_NONE=0,
STMT_INDICATOR_NULL=1,
STMT_INDICATOR_DEFAULT=2,
STMT_INDICATOR_IGNORE=3,
STMT_INDICATOR_IGNORE_ROW=4
};
/*
bulk PS flags
*/
#define STMT_BULK_FLAG_CLIENT_SEND_TYPES 128
#define STMT_BULK_FLAG_SEND_UNIT_RESULTS 64
typedef enum mysql_stmt_state
{
MYSQL_STMT_INITTED = 0,
MYSQL_STMT_PREPARED,
MYSQL_STMT_EXECUTED,
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;
union {
unsigned char *row_ptr; /* for the current data position */
char *indicator; /* indicator variable */
} u;
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;
unsigned long long affected_rows;
unsigned long long 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;
typedef int (*mysql_stmt_fetch_row_func)(MYSQL_STMT *stmt, unsigned char **row);
typedef void (*ps_result_callback)(void *data, unsigned int column, unsigned char **row);
typedef my_bool (*ps_param_callback)(void *data, MYSQL_BIND *bind, unsigned int row_nr);
struct st_mysql_stmt
{
MA_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;
unsigned char *request_buffer;
unsigned int array_size;
size_t row_size;
unsigned int prebind_params;
void *user_data;
ps_result_callback result_callback;
ps_param_callback param_callback;
size_t request_length;
MARIADB_CONST_STRING sql;
};
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 ma_net_safe_read(MYSQL *mysql);
void mysql_init_ps_subsystem(void);
unsigned long net_field_length(unsigned char **packet);
int ma_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
size_t length, my_bool skipp_check, void *opt_arg);
void stmt_set_error(MYSQL_STMT *stmt,
unsigned int error_nr,
const char *sqlstate,
const char *format,
...);
/*
* 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, unsigned long long offset);
unsigned long long STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
unsigned long long STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
unsigned long long 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);
int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt, const char *stmt_str, size_t length);
MYSQL_FIELD * STDCALL mariadb_stmt_fetch_fields(MYSQL_STMT *stmt);

View File

@@ -0,0 +1,44 @@
/* Copyright Abandoned 1996, 1999, 2001 MySQL AB
This file is public domain and comes with NO WARRANTY of any kind */
/* Version numbers for protocol & mysqld */
#ifndef _mariadb_version_h_
#define _mariadb_version_h_
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
#define PROTOCOL_VERSION 10
#define MARIADB_CLIENT_VERSION_STR "10.8.8"
#define MARIADB_BASE_VERSION "mariadb-10.8"
#define MARIADB_VERSION_ID 100808
#define MARIADB_PORT 3306
#define MARIADB_UNIX_ADDR "/tmp/mysql.sock"
#ifndef MYSQL_UNIX_ADDR
#define MYSQL_UNIX_ADDR MARIADB_UNIX_ADDR
#endif
#ifndef MYSQL_PORT
#define MYSQL_PORT MARIADB_PORT
#endif
#define MYSQL_CONFIG_NAME "my"
#define MYSQL_VERSION_ID 100808
#define MYSQL_SERVER_VERSION "10.8.8-MariaDB"
#define MARIADB_PACKAGE_VERSION "3.4.8"
#define MARIADB_PACKAGE_VERSION_ID 30408
#define MARIADB_SYSTEM_TYPE "Windows"
#define MARIADB_MACHINE_TYPE "AMD64"
#define MARIADB_PLUGINDIR "C:/Program Files/mariadb-connector-c/lib/mariadb/plugin"
/* mysqld compile time options */
#ifndef MYSQL_CHARSET
#define MYSQL_CHARSET ""
#endif
#endif
/* Source information */
#define CC_SOURCE_REVISION "46880b003653a000e9588bd73c8b1dd65088c686"
#endif /* _mariadb_version_h_ */

943
vendor/mariadb/include/mysql.h vendored Normal file
View File

@@ -0,0 +1,943 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
2012 by MontyProgram AB
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 */
/* defines for the libmariadb library */
#ifndef _mysql_h
#define _mysql_h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef LIBMARIADB
#define LIBMARIADB
#endif
#ifndef MYSQL_CLIENT
#define MYSQL_CLIENT
#endif
#include <stdarg.h>
#include <time.h>
#if !defined (_global_h) && !defined (MY_GLOBAL_INCLUDED) /* If not standard header */
#include <sys/types.h>
typedef char my_bool;
typedef unsigned long long my_ulonglong;
#if !defined(_WIN32)
#define STDCALL
#else
#define STDCALL __stdcall
#endif
#ifndef my_socket_defined
#define my_socket_defined
#if defined(_WIN64)
#define my_socket unsigned long long
#elif defined(_WIN32)
#define my_socket unsigned int
#else
typedef int my_socket;
#endif
#endif
#endif
#include "mariadb_com.h"
#include "mariadb_version.h"
#include "ma_list.h"
#include "mariadb_ctype.h"
typedef struct st_ma_const_string
{
const char *str;
size_t length;
} MARIADB_CONST_STRING;
typedef struct st_ma_const_data
{
const unsigned char *data;
size_t length;
} MARIADB_CONST_DATA;
#ifndef ST_MA_USED_MEM_DEFINED
#define ST_MA_USED_MEM_DEFINED
typedef struct st_ma_used_mem { /* struct for once_alloc */
struct st_ma_used_mem *next; /* Next block in use */
size_t left; /* memory left in block */
size_t size; /* Size of block */
} MA_USED_MEM;
typedef struct st_ma_mem_root {
MA_USED_MEM *free;
MA_USED_MEM *used;
MA_USED_MEM *pre_alloc;
size_t min_malloc;
size_t block_size;
unsigned int block_num;
unsigned int first_block_usage;
void (*error_handler)(void);
} MA_MEM_ROOT;
#endif
extern unsigned int mysql_port;
extern char *mysql_unix_port;
extern unsigned int mariadb_deinitialize_ssl;
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG)
#define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR || (f)->type == MYSQL_TYPE_NEWDECIMAL || (f)->type == MYSQL_TYPE_DECIMAL)
typedef struct st_mysql_field {
char *name; /* Name of column */
char *org_name; /* Name of original column (added after 3.23.58) */
char *table; /* Table of column if column was a field */
char *org_table; /* Name of original table (added after 3.23.58 */
char *db; /* table schema (added after 3.23.58) */
char *catalog; /* table catalog (added after 3.23.58) */
char *def; /* Default value (set by mysql_list_fields) */
unsigned long length; /* Width of column */
unsigned long max_length; /* Max width of selected set */
/* added after 3.23.58 */
unsigned int name_length;
unsigned int org_name_length;
unsigned int table_length;
unsigned int org_table_length;
unsigned int db_length;
unsigned int catalog_length;
unsigned int def_length;
/***********************/
unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */
unsigned int charsetnr; /* char set number (added in 4.1) */
enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
void *extension; /* added in 4.1 */
} MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
#define SET_CLIENT_ERROR(a, b, c, d) \
do { \
(a)->net.last_errno= (b);\
strncpy((a)->net.sqlstate, (c), SQLSTATE_LENGTH);\
(a)->net.sqlstate[SQLSTATE_LENGTH]= 0;\
strncpy((a)->net.last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE - 1);\
(a)->net.last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\
} while(0)
/* For mysql_async.c */
#define set_mariadb_error(A,B,C) SET_CLIENT_ERROR((A),(B),(C),0)
extern const char *SQLSTATE_UNKNOWN;
#define unknown_sqlstate SQLSTATE_UNKNOWN
#define CLEAR_CLIENT_ERROR(a) \
do { \
(a)->net.last_errno= 0;\
strcpy((a)->net.sqlstate, "00000");\
(a)->net.last_error[0]= '\0';\
if ((a)->net.extension)\
(a)->net.extension->extended_errno= 0;\
} while (0)
#define MYSQL_COUNT_ERROR (~(unsigned long long) 0)
typedef struct st_mysql_rows {
struct st_mysql_rows *next; /* list of rows */
MYSQL_ROW data;
unsigned long length;
} MYSQL_ROWS;
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
typedef struct st_mysql_data {
MYSQL_ROWS *data;
void *embedded_info;
MA_MEM_ROOT alloc;
unsigned long long rows;
unsigned int fields;
void *extension;
} MYSQL_DATA;
enum mysql_option
{
MYSQL_OPT_CONNECT_TIMEOUT,
MYSQL_OPT_COMPRESS,
MYSQL_OPT_NAMED_PIPE,
MYSQL_INIT_COMMAND,
MYSQL_READ_DEFAULT_FILE,
MYSQL_READ_DEFAULT_GROUP,
MYSQL_SET_CHARSET_DIR,
MYSQL_SET_CHARSET_NAME,
MYSQL_OPT_LOCAL_INFILE,
MYSQL_OPT_PROTOCOL,
MYSQL_SHARED_MEMORY_BASE_NAME,
MYSQL_OPT_READ_TIMEOUT,
MYSQL_OPT_WRITE_TIMEOUT,
MYSQL_OPT_USE_RESULT,
MYSQL_OPT_USE_REMOTE_CONNECTION,
MYSQL_OPT_USE_EMBEDDED_CONNECTION,
MYSQL_OPT_GUESS_CONNECTION,
MYSQL_SET_CLIENT_IP,
MYSQL_SECURE_AUTH,
MYSQL_REPORT_DATA_TRUNCATION,
MYSQL_OPT_RECONNECT,
MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
MYSQL_PLUGIN_DIR,
MYSQL_DEFAULT_AUTH,
MYSQL_OPT_BIND,
MYSQL_OPT_SSL_KEY,
MYSQL_OPT_SSL_CERT,
MYSQL_OPT_SSL_CA,
MYSQL_OPT_SSL_CAPATH,
MYSQL_OPT_SSL_CIPHER,
MYSQL_OPT_SSL_CRL,
MYSQL_OPT_SSL_CRLPATH,
/* Connection attribute options */
MYSQL_OPT_CONNECT_ATTR_RESET,
MYSQL_OPT_CONNECT_ATTR_ADD,
MYSQL_OPT_CONNECT_ATTR_DELETE,
MYSQL_SERVER_PUBLIC_KEY,
MYSQL_ENABLE_CLEARTEXT_PLUGIN,
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
MYSQL_OPT_SSL_ENFORCE,
MYSQL_OPT_MAX_ALLOWED_PACKET,
MYSQL_OPT_NET_BUFFER_LENGTH,
MYSQL_OPT_TLS_VERSION,
MYSQL_OPT_ZSTD_COMPRESSION_LEVEL,
/* MariaDB-specific */
MYSQL_PROGRESS_CALLBACK=5999,
MYSQL_OPT_NONBLOCK,
/* MariaDB Connector/C specific */
MYSQL_DATABASE_DRIVER=7000,
MARIADB_OPT_SSL_FP, /* deprecated, use MARIADB_OPT_TLS_PEER_FP instead */
MARIADB_OPT_SSL_FP_LIST, /* deprecated, use MARIADB_OPT_TLS_PEER_FP_LIST instead */
MARIADB_OPT_TLS_PASSPHRASE, /* passphrase for encrypted certificates */
MARIADB_OPT_TLS_CIPHER_STRENGTH,
MARIADB_OPT_TLS_VERSION,
MARIADB_OPT_TLS_PEER_FP, /* single finger print for server certificate verification */
MARIADB_OPT_TLS_PEER_FP_LIST, /* finger print white list for server certificate verification */
MARIADB_OPT_CONNECTION_READ_ONLY,
MYSQL_OPT_CONNECT_ATTRS, /* for mysql_get_optionv */
MARIADB_OPT_USERDATA,
MARIADB_OPT_CONNECTION_HANDLER,
MARIADB_OPT_PORT,
MARIADB_OPT_UNIXSOCKET,
MARIADB_OPT_PASSWORD,
MARIADB_OPT_HOST,
MARIADB_OPT_USER,
MARIADB_OPT_SCHEMA,
MARIADB_OPT_DEBUG,
MARIADB_OPT_FOUND_ROWS,
MARIADB_OPT_MULTI_RESULTS,
MARIADB_OPT_MULTI_STATEMENTS,
MARIADB_OPT_INTERACTIVE,
MARIADB_OPT_PROXY_HEADER,
MARIADB_OPT_IO_WAIT,
MARIADB_OPT_SKIP_READ_RESPONSE,
MARIADB_OPT_RESTRICTED_AUTH,
MARIADB_OPT_RPL_REGISTER_REPLICA,
MARIADB_OPT_STATUS_CALLBACK,
MARIADB_OPT_SERVER_PLUGINS,
MARIADB_OPT_BULK_UNIT_RESULTS,
MARIADB_OPT_TLS_VERIFICATION_CALLBACK
};
enum mariadb_value {
MARIADB_CHARSET_ID,
MARIADB_CHARSET_NAME,
MARIADB_CLIENT_ERRORS,
MARIADB_CLIENT_VERSION,
MARIADB_CLIENT_VERSION_ID,
MARIADB_CONNECTION_ASYNC_TIMEOUT,
MARIADB_CONNECTION_ASYNC_TIMEOUT_MS,
MARIADB_CONNECTION_MARIADB_CHARSET_INFO,
MARIADB_CONNECTION_ERROR,
MARIADB_CONNECTION_ERROR_ID,
MARIADB_CONNECTION_HOST,
MARIADB_CONNECTION_INFO,
MARIADB_CONNECTION_PORT,
MARIADB_CONNECTION_PROTOCOL_VERSION_ID,
MARIADB_CONNECTION_PVIO_TYPE,
MARIADB_CONNECTION_SCHEMA,
MARIADB_CONNECTION_SERVER_TYPE,
MARIADB_CONNECTION_SERVER_VERSION,
MARIADB_CONNECTION_SERVER_VERSION_ID,
MARIADB_CONNECTION_SOCKET,
MARIADB_CONNECTION_SQLSTATE,
MARIADB_CONNECTION_SSL_CIPHER,
MARIADB_TLS_LIBRARY,
MARIADB_CONNECTION_TLS_VERSION,
MARIADB_CONNECTION_TLS_VERSION_ID,
MARIADB_CONNECTION_TYPE,
MARIADB_CONNECTION_UNIX_SOCKET,
MARIADB_CONNECTION_USER,
MARIADB_MAX_ALLOWED_PACKET,
MARIADB_NET_BUFFER_LENGTH,
MARIADB_CONNECTION_SERVER_STATUS,
MARIADB_CONNECTION_SERVER_CAPABILITIES,
MARIADB_CONNECTION_EXTENDED_SERVER_CAPABILITIES,
MARIADB_CONNECTION_CLIENT_CAPABILITIES,
MARIADB_CONNECTION_BYTES_READ,
MARIADB_CONNECTION_BYTES_SENT,
MARIADB_TLS_PEER_CERT_INFO,
MARIADB_TLS_VERIFY_STATUS
};
enum mysql_status { MYSQL_STATUS_READY,
MYSQL_STATUS_GET_RESULT,
MYSQL_STATUS_USE_RESULT,
MYSQL_STATUS_QUERY_SENT,
MYSQL_STATUS_SENDING_LOAD_DATA,
MYSQL_STATUS_FETCHING_DATA,
MYSQL_STATUS_NEXT_RESULT_PENDING,
MYSQL_STATUS_QUIT_SENT, /* object is "destroyed" at this stage */
MYSQL_STATUS_STMT_RESULT
};
enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
struct st_mysql_options {
unsigned int connect_timeout, read_timeout, write_timeout;
unsigned int port, protocol;
unsigned long client_flag;
char *host,*user,*password,*unix_socket,*db;
struct st_dynamic_array *init_command;
char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
char *ssl_key; /* PEM key file */
char *ssl_cert; /* PEM cert file */
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher;
char *shared_memory_base_name;
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe;
my_bool reconnect, unused_1, unused_2, unused_3;
enum mysql_option methods_to_use;
char *bind_address;
my_bool secure_auth;
my_bool report_data_truncation;
/* function pointers for local infile support */
int (*local_infile_init)(void **, const char *, void *);
int (*local_infile_read)(void *, char *, unsigned int);
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
void *local_infile_userdata;
struct st_mysql_options_extension *extension;
};
typedef struct st_mysql {
NET net; /* Communication parameters */
void *unused_0;
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info,*db;
const struct ma_charset_info_st *charset; /* character set */
MYSQL_FIELD *fields;
MA_MEM_ROOT field_alloc;
unsigned long long affected_rows;
unsigned long long insert_id; /* id if insert on table with NEXTNR */
unsigned long long extra_info; /* Used by mysqlshow */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
unsigned long client_flag;
unsigned long server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
unsigned int warning_count; /* warning count, added in 4.1 protocol */
struct st_mysql_options options;
enum mysql_status status;
my_bool free_me; /* If free in mysql_close */
my_bool unused_1;
char scramble_buff[20+ 1];
/* madded after 3.23.58 */
my_bool unused_2;
void *unused_3, *unused_4, *unused_5, *unused_6;
LIST *stmts;
const struct st_mariadb_methods *methods;
void *thd;
my_bool *unbuffered_fetch_owner;
char *info_buffer;
struct st_mariadb_extension *extension;
} MYSQL;
typedef struct st_mysql_res {
unsigned long long row_count;
unsigned int field_count, current_field;
MYSQL_FIELD *fields;
MYSQL_DATA *data;
MYSQL_ROWS *data_cursor;
MA_MEM_ROOT field_alloc;
MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */
unsigned long *lengths; /* column lengths of current row */
MYSQL *handle; /* for unbuffered reads */
my_bool eof; /* Used my mysql_fetch_row */
my_bool is_ps;
} MYSQL_RES;
typedef struct
{
unsigned long *p_max_allowed_packet;
unsigned long *p_net_buffer_length;
void *extension;
} MYSQL_PARAMETERS;
enum mariadb_field_attr_t
{
MARIADB_FIELD_ATTR_DATA_TYPE_NAME= 0,
MARIADB_FIELD_ATTR_FORMAT_NAME= 1
};
#define MARIADB_FIELD_ATTR_LAST MARIADB_FIELD_ATTR_FORMAT_NAME
int STDCALL mariadb_field_attr(MARIADB_CONST_STRING *attr,
const MYSQL_FIELD *field,
enum mariadb_field_attr_t type);
#ifndef _mysql_time_h_
enum enum_mysql_timestamp_type
{
MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
};
typedef struct st_mysql_time
{
unsigned int year, month, day, hour, minute, second;
unsigned long second_part;
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
#define AUTO_SEC_PART_DIGITS 39
#endif
#define SEC_PART_DIGITS 6
#define MARIADB_INVALID_SOCKET -1
/* Asynchronous API constants */
#define MYSQL_WAIT_READ 1
#define MYSQL_WAIT_WRITE 2
#define MYSQL_WAIT_EXCEPT 4
#define MYSQL_WAIT_TIMEOUT 8
#define MARIADB_TLS_VERIFY_OK 0
#define MARIADB_TLS_VERIFY_TRUST 1
#define MARIADB_TLS_VERIFY_HOST 2
#define MARIADB_TLS_VERIFY_FINGERPRINT 4
#define MARIADB_TLS_VERIFY_PERIOD 8
#define MARIADB_TLS_VERIFY_REVOKED 16
#define MARIADB_TLS_VERIFY_UNKNOWN 32
#define MARIADB_TLS_VERIFY_ERROR 128 /* last */
typedef struct character_set
{
unsigned int number; /* character set number */
unsigned int state; /* character set state */
const char *csname; /* character set name */
const char *name; /* collation name */
const char *comment; /* comment */
const char *dir; /* character set directory */
unsigned int mbminlen; /* min. length for multibyte strings */
unsigned int mbmaxlen; /* max. length for multibyte strings */
} MY_CHARSET_INFO;
/* Local infile support functions */
#define LOCAL_INFILE_ERROR_LEN 512
#include "mariadb_stmt.h"
#ifndef MYSQL_CLIENT_PLUGIN_HEADER
#define MYSQL_CLIENT_PLUGIN_HEADER \
int type; \
unsigned int interface_version; \
const char *name; \
const char *author; \
const char *desc; \
unsigned int version[3]; \
const char *license; \
void *mysql_api; \
int (*init)(char *, size_t, int, va_list); \
int (*deinit)(void); \
int (*options)(const char *option, const void *);
struct st_mysql_client_plugin
{
MYSQL_CLIENT_PLUGIN_HEADER
};
enum mariadb_tls_verification {
MARIADB_VERIFY_NONE = 0,
MARIADB_VERIFY_PIPE,
MARIADB_VERIFY_UNIXSOCKET,
MARIADB_VERIFY_LOCALHOST,
MARIADB_VERIFY_FINGERPRINT,
MARIADB_VERIFY_PEER_CERT
};
typedef struct
{
int version;
char *issuer;
char *subject;
char fingerprint[129];
struct tm not_before;
struct tm not_after;
} MARIADB_X509_INFO;
struct st_mysql_client_plugin *
mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
int argc, ...);
struct st_mysql_client_plugin * STDCALL
mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
int argc, va_list args);
struct st_mysql_client_plugin * STDCALL
mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
struct st_mysql_client_plugin * STDCALL
mysql_client_register_plugin(struct st_mysql *mysql,
struct st_mysql_client_plugin *plugin);
#endif
void STDCALL mysql_set_local_infile_handler(MYSQL *mysql,
int (*local_infile_init)(void **, const char *, void *),
int (*local_infile_read)(void *, char *, unsigned int),
void (*local_infile_end)(void *),
int (*local_infile_error)(void *, char*, unsigned int),
void *);
void mysql_set_local_infile_default(MYSQL *mysql);
void my_set_error(MYSQL *mysql, unsigned int error_nr,
const char *sqlstate, const char *format, ...);
/* Functions to get information from the MYSQL and MYSQL_RES structures */
/* Should definitely be used if one uses shared libraries */
my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
my_bool STDCALL mysql_eof(MYSQL_RES *res);
MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
unsigned int fieldnr);
MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res);
unsigned int STDCALL mysql_field_tell(MYSQL_RES *res);
unsigned int STDCALL mysql_field_count(MYSQL *mysql);
my_bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql);
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
my_bool STDCALL mysql_autocommit(MYSQL *mysql, my_bool mode);
my_bool STDCALL mysql_commit(MYSQL *mysql);
my_bool STDCALL mysql_rollback(MYSQL *mysql);
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
unsigned int STDCALL mysql_errno(MYSQL *mysql);
const char * STDCALL mysql_error(MYSQL *mysql);
const char * STDCALL mysql_info(MYSQL *mysql);
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
const char * STDCALL mysql_character_set_name(MYSQL *mysql);
void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs);
int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
my_bool mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...);
my_bool STDCALL mariadb_get_info(MYSQL *mysql, enum mariadb_value value, void *arg);
MYSQL * STDCALL mysql_init(MYSQL *mysql);
int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql);
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db);
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
const char *user,
const char *passwd,
const char *db,
unsigned int port,
const char *unix_socket,
unsigned long clientflag);
void STDCALL mysql_close(MYSQL *sock);
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
int STDCALL mysql_query(MYSQL *mysql, const char *q);
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length);
int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
int STDCALL mysql_dump_debug_info(MYSQL *mysql);
int STDCALL mysql_refresh(MYSQL *mysql,
unsigned int refresh_options);
int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
int STDCALL mysql_ping(MYSQL *mysql);
char * STDCALL mysql_stat(MYSQL *mysql);
char * STDCALL mysql_get_server_info(MYSQL *mysql);
unsigned long STDCALL mysql_get_server_version(MYSQL *mysql);
char * STDCALL mysql_get_host_info(MYSQL *mysql);
unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
const char *wild);
MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
const void *arg);
int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option,
const void *arg1, const void *arg2);
void STDCALL mysql_free_result(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result,
unsigned long long offset);
MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET);
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_FIELD_OFFSET offset);
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
unsigned long STDCALL mysql_escape_string(char *to,const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
char *to,const char *from,
unsigned long length);
unsigned int STDCALL mysql_thread_safe(void);
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char * STDCALL mysql_sqlstate(MYSQL *mysql);
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void);
void STDCALL mysql_thread_end(void);
my_bool STDCALL mysql_thread_init(void);
int STDCALL mysql_set_server_option(MYSQL *mysql,
enum enum_mysql_set_option option);
const char * STDCALL mysql_get_client_info(void);
unsigned long STDCALL mysql_get_client_version(void);
my_bool STDCALL mariadb_connection(MYSQL *mysql);
const char * STDCALL mysql_get_server_name(MYSQL *mysql);
MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname);
MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr);
size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs,
char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
int mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...);
int mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...);
int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg);
unsigned long STDCALL mysql_hex_string(char *to, const char *from, unsigned long len);
my_socket STDCALL mysql_get_socket(MYSQL *mysql);
unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
my_bool STDCALL mariadb_reconnect(MYSQL *mysql);
int STDCALL mariadb_cancel(MYSQL *mysql);
void STDCALL mysql_debug(const char *debug);
unsigned long STDCALL mysql_net_read_packet(MYSQL *mysql);
unsigned long STDCALL mysql_net_field_length(unsigned char **packet);
my_bool STDCALL mysql_embedded(void);
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
/* Async API */
int STDCALL mysql_close_start(MYSQL *sock);
int STDCALL mysql_close_cont(MYSQL *sock, int status);
int STDCALL mysql_commit_start(my_bool *ret, MYSQL * mysql);
int STDCALL mysql_commit_cont(my_bool *ret, MYSQL * mysql, int status);
int STDCALL mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, int ready_status);
int STDCALL mysql_dump_debug_info_start(int *ret, MYSQL *mysql);
int STDCALL mysql_rollback_start(my_bool *ret, MYSQL * mysql);
int STDCALL mysql_rollback_cont(my_bool *ret, MYSQL * mysql, int status);
int STDCALL mysql_autocommit_start(my_bool *ret, MYSQL * mysql,
my_bool auto_mode);
int STDCALL mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status);
int STDCALL mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, const char *table,
const char *wild);
int STDCALL mysql_autocommit_cont(my_bool *ret, MYSQL * mysql, int status);
int STDCALL mysql_next_result_start(int *ret, MYSQL *mysql);
int STDCALL mysql_next_result_cont(int *ret, MYSQL *mysql, int status);
int STDCALL mysql_select_db_start(int *ret, MYSQL *mysql, const char *db);
int STDCALL mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status);
int STDCALL mysql_stmt_warning_count(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt);
int STDCALL mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status);
int STDCALL mysql_set_character_set_start(int *ret, MYSQL *mysql,
const char *csname);
int STDCALL mysql_set_character_set_cont(int *ret, MYSQL *mysql,
int status);
int STDCALL mysql_change_user_start(my_bool *ret, MYSQL *mysql,
const char *user,
const char *passwd,
const char *db);
int STDCALL mysql_change_user_cont(my_bool *ret, MYSQL *mysql,
int status);
int STDCALL mysql_real_connect_start(MYSQL **ret, MYSQL *mysql,
const char *host,
const char *user,
const char *passwd,
const char *db,
unsigned int port,
const char *unix_socket,
unsigned long clientflag);
int STDCALL mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql,
int status);
int STDCALL mysql_query_start(int *ret, MYSQL *mysql,
const char *q);
int STDCALL mysql_query_cont(int *ret, MYSQL *mysql,
int status);
int STDCALL mysql_send_query_start(int *ret, MYSQL *mysql,
const char *q,
unsigned long length);
int STDCALL mysql_send_query_cont(int *ret, MYSQL *mysql, int status);
int STDCALL mysql_real_query_start(int *ret, MYSQL *mysql,
const char *q,
unsigned long length);
int STDCALL mysql_real_query_cont(int *ret, MYSQL *mysql,
int status);
int STDCALL mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql);
int STDCALL mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql,
int status);
int STDCALL mysql_shutdown_start(int *ret, MYSQL *mysql,
enum mysql_enum_shutdown_level
shutdown_level);
int STDCALL mysql_shutdown_cont(int *ret, MYSQL *mysql,
int status);
int STDCALL mysql_refresh_start(int *ret, MYSQL *mysql,
unsigned int refresh_options);
int STDCALL mysql_refresh_cont(int *ret, MYSQL *mysql, int status);
int STDCALL mysql_kill_start(int *ret, MYSQL *mysql,
unsigned long pid);
int STDCALL mysql_kill_cont(int *ret, MYSQL *mysql, int status);
int STDCALL mysql_set_server_option_start(int *ret, MYSQL *mysql,
enum enum_mysql_set_option
option);
int STDCALL mysql_set_server_option_cont(int *ret, MYSQL *mysql,
int status);
int STDCALL mysql_ping_start(int *ret, MYSQL *mysql);
int STDCALL mysql_ping_cont(int *ret, MYSQL *mysql, int status);
int STDCALL mysql_stat_start(const char **ret, MYSQL *mysql);
int STDCALL mysql_stat_cont(const char **ret, MYSQL *mysql,
int status);
int STDCALL mysql_free_result_start(MYSQL_RES *result);
int STDCALL mysql_free_result_cont(MYSQL_RES *result, int status);
int STDCALL mysql_fetch_row_start(MYSQL_ROW *ret,
MYSQL_RES *result);
int STDCALL mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result,
int status);
int STDCALL mysql_read_query_result_start(my_bool *ret,
MYSQL *mysql);
int STDCALL mysql_read_query_result_cont(my_bool *ret,
MYSQL *mysql, int status);
int STDCALL mysql_reset_connection_start(int *ret, MYSQL *mysql);
int STDCALL mysql_reset_connection_cont(int *ret, MYSQL *mysql, int status);
int STDCALL mysql_session_track_get_next(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length);
int STDCALL mysql_session_track_get_first(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length);
int STDCALL mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt,const char *query, unsigned long length);
int STDCALL mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int status);
int STDCALL mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt);
int STDCALL mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int status);
int STDCALL mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int status);
int STDCALL mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt);
int STDCALL mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt,int status);
int STDCALL mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt);
int STDCALL mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT * stmt, int status);
int STDCALL mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT * stmt);
int STDCALL mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int status);
int STDCALL mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt);
int STDCALL mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt,
int status);
int STDCALL mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt,
unsigned int param_number,
const char *data,
unsigned long len);
int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt,
int status);
int STDCALL mysql_reset_connection(MYSQL *mysql);
/* API function calls (used by dynamic plugins) */
struct st_mariadb_api {
unsigned long long (STDCALL *mysql_num_rows)(MYSQL_RES *res);
unsigned int (STDCALL *mysql_num_fields)(MYSQL_RES *res);
my_bool (STDCALL *mysql_eof)(MYSQL_RES *res);
MYSQL_FIELD *(STDCALL *mysql_fetch_field_direct)(MYSQL_RES *res, unsigned int fieldnr);
MYSQL_FIELD * (STDCALL *mysql_fetch_fields)(MYSQL_RES *res);
MYSQL_ROWS * (STDCALL *mysql_row_tell)(MYSQL_RES *res);
unsigned int (STDCALL *mysql_field_tell)(MYSQL_RES *res);
unsigned int (STDCALL *mysql_field_count)(MYSQL *mysql);
my_bool (STDCALL *mysql_more_results)(MYSQL *mysql);
int (STDCALL *mysql_next_result)(MYSQL *mysql);
unsigned long long (STDCALL *mysql_affected_rows)(MYSQL *mysql);
my_bool (STDCALL *mysql_autocommit)(MYSQL *mysql, my_bool mode);
my_bool (STDCALL *mysql_commit)(MYSQL *mysql);
my_bool (STDCALL *mysql_rollback)(MYSQL *mysql);
unsigned long long (STDCALL *mysql_insert_id)(MYSQL *mysql);
unsigned int (STDCALL *mysql_errno)(MYSQL *mysql);
const char * (STDCALL *mysql_error)(MYSQL *mysql);
const char * (STDCALL *mysql_info)(MYSQL *mysql);
unsigned long (STDCALL *mysql_thread_id)(MYSQL *mysql);
const char * (STDCALL *mysql_character_set_name)(MYSQL *mysql);
void (STDCALL *mysql_get_character_set_info)(MYSQL *mysql, MY_CHARSET_INFO *cs);
int (STDCALL *mysql_set_character_set)(MYSQL *mysql, const char *csname);
my_bool (*mariadb_get_infov)(MYSQL *mysql, enum mariadb_value value, void *arg, ...);
my_bool (STDCALL *mariadb_get_info)(MYSQL *mysql, enum mariadb_value value, void *arg);
MYSQL * (STDCALL *mysql_init)(MYSQL *mysql);
int (STDCALL *mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher);
const char * (STDCALL *mysql_get_ssl_cipher)(MYSQL *mysql);
my_bool (STDCALL *mysql_change_user)(MYSQL *mysql, const char *user, const char *passwd, const char *db);
MYSQL * (STDCALL *mysql_real_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag);
void (STDCALL *mysql_close)(MYSQL *sock);
int (STDCALL *mysql_select_db)(MYSQL *mysql, const char *db);
int (STDCALL *mysql_query)(MYSQL *mysql, const char *q);
int (STDCALL *mysql_send_query)(MYSQL *mysql, const char *q, unsigned long length);
my_bool (STDCALL *mysql_read_query_result)(MYSQL *mysql);
int (STDCALL *mysql_real_query)(MYSQL *mysql, const char *q, unsigned long length);
int (STDCALL *mysql_shutdown)(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
int (STDCALL *mysql_dump_debug_info)(MYSQL *mysql);
int (STDCALL *mysql_refresh)(MYSQL *mysql, unsigned int refresh_options);
int (STDCALL *mysql_kill)(MYSQL *mysql,unsigned long pid);
int (STDCALL *mysql_ping)(MYSQL *mysql);
char * (STDCALL *mysql_stat)(MYSQL *mysql);
char * (STDCALL *mysql_get_server_info)(MYSQL *mysql);
unsigned long (STDCALL *mysql_get_server_version)(MYSQL *mysql);
char * (STDCALL *mysql_get_host_info)(MYSQL *mysql);
unsigned int (STDCALL *mysql_get_proto_info)(MYSQL *mysql);
MYSQL_RES * (STDCALL *mysql_list_dbs)(MYSQL *mysql,const char *wild);
MYSQL_RES * (STDCALL *mysql_list_tables)(MYSQL *mysql,const char *wild);
MYSQL_RES * (STDCALL *mysql_list_fields)(MYSQL *mysql, const char *table, const char *wild);
MYSQL_RES * (STDCALL *mysql_list_processes)(MYSQL *mysql);
MYSQL_RES * (STDCALL *mysql_store_result)(MYSQL *mysql);
MYSQL_RES * (STDCALL *mysql_use_result)(MYSQL *mysql);
int (STDCALL *mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg);
void (STDCALL *mysql_free_result)(MYSQL_RES *result);
void (STDCALL *mysql_data_seek)(MYSQL_RES *result, unsigned long long offset);
MYSQL_ROW_OFFSET (STDCALL *mysql_row_seek)(MYSQL_RES *result, MYSQL_ROW_OFFSET);
MYSQL_FIELD_OFFSET (STDCALL *mysql_field_seek)(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset);
MYSQL_ROW (STDCALL *mysql_fetch_row)(MYSQL_RES *result);
unsigned long * (STDCALL *mysql_fetch_lengths)(MYSQL_RES *result);
MYSQL_FIELD * (STDCALL *mysql_fetch_field)(MYSQL_RES *result);
unsigned long (STDCALL *mysql_escape_string)(char *to,const char *from, unsigned long from_length);
unsigned long (STDCALL *mysql_real_escape_string)(MYSQL *mysql, char *to,const char *from, unsigned long length);
unsigned int (STDCALL *mysql_thread_safe)(void);
unsigned int (STDCALL *mysql_warning_count)(MYSQL *mysql);
const char * (STDCALL *mysql_sqlstate)(MYSQL *mysql);
int (STDCALL *mysql_server_init)(int argc, char **argv, char **groups);
void (STDCALL *mysql_server_end)(void);
void (STDCALL *mysql_thread_end)(void);
my_bool (STDCALL *mysql_thread_init)(void);
int (STDCALL *mysql_set_server_option)(MYSQL *mysql, enum enum_mysql_set_option option);
const char * (STDCALL *mysql_get_client_info)(void);
unsigned long (STDCALL *mysql_get_client_version)(void);
my_bool (STDCALL *mariadb_connection)(MYSQL *mysql);
const char * (STDCALL *mysql_get_server_name)(MYSQL *mysql);
MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_name)(const char *csname);
MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_nr)(unsigned int csnr);
size_t (STDCALL *mariadb_convert_string)(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs, char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
int (*mysql_optionsv)(MYSQL *mysql,enum mysql_option option, ...);
int (*mysql_get_optionv)(MYSQL *mysql, enum mysql_option option, void *arg, ...);
int (STDCALL *mysql_get_option)(MYSQL *mysql, enum mysql_option option, void *arg);
unsigned long (STDCALL *mysql_hex_string)(char *to, const char *from, unsigned long len);
my_socket (STDCALL *mysql_get_socket)(MYSQL *mysql);
unsigned int (STDCALL *mysql_get_timeout_value)(const MYSQL *mysql);
unsigned int (STDCALL *mysql_get_timeout_value_ms)(const MYSQL *mysql);
my_bool (STDCALL *mariadb_reconnect)(MYSQL *mysql);
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, unsigned long long offset);
unsigned long long (STDCALL *mysql_stmt_num_rows)(MYSQL_STMT *stmt);
unsigned long long (STDCALL *mysql_stmt_affected_rows)(MYSQL_STMT *stmt);
unsigned long long (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);
int (STDCALL *mariadb_stmt_execute_direct)(MYSQL_STMT *stmt, const char *stmtstr, size_t length);
int (STDCALL *mysql_reset_connection)(MYSQL *mysql);
};
/* these methods can be overwritten by db plugins */
struct st_mariadb_methods {
MYSQL *(*db_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd,
const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag);
void (*db_close)(MYSQL *mysql);
int (*db_command)(MYSQL *mysql,enum enum_server_command command, const char *arg,
size_t length, my_bool skip_check, void *opt_arg);
void (*db_skip_result)(MYSQL *mysql);
int (*db_read_query_result)(MYSQL *mysql);
MYSQL_DATA *(*db_read_rows)(MYSQL *mysql,MYSQL_FIELD *fields, unsigned int field_count);
int (*db_read_one_row)(MYSQL *mysql,unsigned int fields,MYSQL_ROW row, unsigned long *lengths);
/* prepared statements */
my_bool (*db_supported_buffer_type)(enum enum_field_types type);
my_bool (*db_read_prepare_response)(MYSQL_STMT *stmt);
int (*db_read_stmt_result)(MYSQL *mysql);
my_bool (*db_stmt_get_result_metadata)(MYSQL_STMT *stmt);
my_bool (*db_stmt_get_param_metadata)(MYSQL_STMT *stmt);
int (*db_stmt_read_all_rows)(MYSQL_STMT *stmt);
int (*db_stmt_fetch)(MYSQL_STMT *stmt, unsigned char **row);
int (*db_stmt_fetch_to_bind)(MYSQL_STMT *stmt, unsigned char *row);
void (*db_stmt_flush_unbuffered)(MYSQL_STMT *stmt);
void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...);
void (*invalidate_stmts)(MYSQL *mysql, const char *function_name);
struct st_mariadb_api *api;
int (*db_read_execute_response)(MYSQL_STMT *stmt);
unsigned char* (*db_execute_generate_request)(MYSQL_STMT *stmt, size_t *request_len, my_bool internal);
};
/* synonyms/aliases functions */
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#define mysql_library_init mysql_server_init
#define mysql_library_end mysql_server_end
#define mariadb_connect(hdl, conn_str) mysql_real_connect((hdl),(conn_str), NULL, NULL, NULL, 0, NULL, 0)
/* new api functions */
#define HAVE_MYSQL_REAL_CONNECT
#ifdef __cplusplus
}
#endif
#endif

1240
vendor/mariadb/include/mysqld_error.h vendored Normal file

File diff suppressed because it is too large Load Diff

107
vendor/mariadb/include/plugin_auth.h vendored Normal file
View File

@@ -0,0 +1,107 @@
#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab
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 */
/**
@file
This file defines constants and data structures that are the same for
both client- and server-side authentication plugins.
*/
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/** the max allowed length for a user name */
#define MYSQL_USERNAME_LENGTH 512
/**
return values of the plugin authenticate_user() method.
*/
/**
Authentication failed. Additionally, all other CR_xxx values
(libmariadb error code) can be used too.
The client plugin may set the error code and the error message directly
in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error
code was returned, an error message in the MYSQL structure will be
overwritten. If CR_ERROR is returned without setting the error in MYSQL,
CR_UNKNOWN_ERROR will be user.
*/
#define CR_ERROR 0
/**
Authentication (client part) was successful. It does not mean that the
authentication as a whole was successful, usually it only means
that the client was able to send the user name and the password to the
server. If CR_OK is returned, the libmariadb reads the next packet expecting
it to be one of OK, ERROR, or CHANGE_PLUGIN packets.
*/
#define CR_OK -1
/**
Authentication was successful.
It means that the client has done its part successfully and also that
a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN).
In this case, libmariadb will not read a packet from the server,
but it will use the data at mysql->net.read_pos.
A plugin may return this value if the number of roundtrips in the
authentication protocol is not known in advance, and the client plugin
needs to read one packet more to determine if the authentication is finished
or not.
*/
#define CR_OK_HANDSHAKE_COMPLETE -2
typedef struct st_plugin_vio_info
{
enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol;
int socket; /**< it's set, if the protocol is SOCKET or TCP */
#ifdef _WIN32
HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */
#endif
} MYSQL_PLUGIN_VIO_INFO;
/**
Provides plugin access to communication channel
*/
typedef struct st_plugin_vio
{
/**
Plugin provides a pointer reference and this function sets it to the
contents of any incoming packet. Returns the packet length, or -1 if
the plugin should terminate.
*/
int (*read_packet)(struct st_plugin_vio *vio,
unsigned char **buf);
/**
Plugin provides a buffer with data and the length and this
function sends it as a packet. Returns 0 on success, 1 on failure.
*/
int (*write_packet)(struct st_plugin_vio *vio,
const unsigned char *packet,
int packet_len);
/**
Fills in a st_plugin_vio_info structure, providing the information
about the connection.
*/
void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info);
} MYSQL_PLUGIN_VIO;
#endif