Import Tcl 8.6.10
This commit is contained in:
335
pkgs/tdbcmysql1.1.1/generic/fakemysql.h
Normal file
335
pkgs/tdbcmysql1.1.1/generic/fakemysql.h
Normal file
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* fakemysql.h --
|
||||
*
|
||||
* Fake definitions of the MySQL API sufficient to build tdbc::mysql
|
||||
* without having an MySQL installation on the build system. This file
|
||||
* comprises only data type, constant and function definitions.
|
||||
*
|
||||
* The programmers of this file believe that it contains material not
|
||||
* subject to copyright under the doctrines of scenes a faire and
|
||||
* of merger of idea and expression. Accordingly, this file is in the
|
||||
* public domain.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef FAKEMYSQL_H_INCLUDED
|
||||
#define FAKEMYSQL_H_INCLUDED
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef MODULE_SCOPE
|
||||
#define MODULE_SCOPE extern
|
||||
#endif
|
||||
|
||||
MODULE_SCOPE Tcl_LoadHandle MysqlInitStubs(Tcl_Interp*);
|
||||
|
||||
#ifdef _WIN32
|
||||
#define STDCALL __stdcall
|
||||
#else
|
||||
#define STDCALL /* nothing */
|
||||
#endif
|
||||
|
||||
enum enum_field_types {
|
||||
MYSQL_TYPE_DECIMAL=0,
|
||||
MYSQL_TYPE_TINY=1,
|
||||
MYSQL_TYPE_SHORT=2,
|
||||
MYSQL_TYPE_LONG=3,
|
||||
MYSQL_TYPE_FLOAT=4,
|
||||
MYSQL_TYPE_DOUBLE=5,
|
||||
MYSQL_TYPE_NULL=6,
|
||||
MYSQL_TYPE_TIMESTAMP=7,
|
||||
MYSQL_TYPE_LONGLONG=8,
|
||||
MYSQL_TYPE_INT24=9,
|
||||
MYSQL_TYPE_DATE=10,
|
||||
MYSQL_TYPE_TIME=11,
|
||||
MYSQL_TYPE_DATETIME=12,
|
||||
MYSQL_TYPE_YEAR=13,
|
||||
MYSQL_TYPE_NEWDATE=14,
|
||||
MYSQL_TYPE_VARCHAR=15,
|
||||
MYSQL_TYPE_BIT=16,
|
||||
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
|
||||
};
|
||||
|
||||
enum mysql_option {
|
||||
MYSQL_SET_CHARSET_NAME=7,
|
||||
};
|
||||
|
||||
enum mysql_status {
|
||||
MYSQL_STATUS_READY=0,
|
||||
};
|
||||
|
||||
#define CLIENT_COMPRESS 32
|
||||
#define CLIENT_INTERACTIVE 1024
|
||||
#define MYSQL_DATA_TRUNCATED 101
|
||||
#define MYSQL_ERRMSG_SIZE 512
|
||||
#define MYSQL_NO_DATA 100
|
||||
#define SCRAMBLE_LENGTH 20
|
||||
#define SQLSTATE_LENGTH 5
|
||||
|
||||
typedef struct st_list LIST;
|
||||
typedef struct st_mem_root MEM_ROOT;
|
||||
typedef struct st_mysql MYSQL;
|
||||
typedef struct st_mysql_bind MYSQL_BIND;
|
||||
typedef struct st_mysql_field MYSQL_FIELD;
|
||||
typedef struct st_mysql_res MYSQL_RES;
|
||||
typedef char** MYSQL_ROW;
|
||||
typedef struct st_mysql_stmt MYSQL_STMT;
|
||||
typedef char my_bool;
|
||||
#ifndef Socket_defined
|
||||
typedef int my_socket;
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
typedef Tcl_WideUInt my_ulonglong;
|
||||
typedef struct st_net NET;
|
||||
typedef struct st_used_mem USED_MEM;
|
||||
typedef struct st_vio Vio;
|
||||
|
||||
struct st_mem_root {
|
||||
USED_MEM *free;
|
||||
USED_MEM *used;
|
||||
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);
|
||||
};
|
||||
|
||||
struct st_mysql_options {
|
||||
unsigned int connect_timeout;
|
||||
unsigned int read_timeout;
|
||||
unsigned int write_timeout;
|
||||
unsigned int port;
|
||||
unsigned int protocol;
|
||||
unsigned long client_flag;
|
||||
char *host;
|
||||
char *user;
|
||||
char *password;
|
||||
char *unix_socket;
|
||||
char *db;
|
||||
struct st_dynamic_array *init_commands;
|
||||
char *my_cnf_file;
|
||||
char *my_cnf_group;
|
||||
char *charset_dir;
|
||||
char *charset_name;
|
||||
char *ssl_key;
|
||||
char *ssl_cert;
|
||||
char *ssl_ca;
|
||||
char *ssl_capath;
|
||||
char *ssl_cipher;
|
||||
char *shared_memory_base_name;
|
||||
unsigned long max_allowed_packet;
|
||||
my_bool use_ssl;
|
||||
my_bool compress,named_pipe;
|
||||
my_bool rpl_probe;
|
||||
my_bool rpl_parse;
|
||||
my_bool no_master_reads;
|
||||
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
|
||||
my_bool separate_thread;
|
||||
#endif
|
||||
enum mysql_option methods_to_use;
|
||||
char *client_ip;
|
||||
my_bool secure_auth;
|
||||
my_bool report_data_truncation;
|
||||
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;
|
||||
void *extension;
|
||||
};
|
||||
|
||||
struct st_net {
|
||||
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
|
||||
Vio *vio;
|
||||
unsigned char *buff;
|
||||
unsigned char *buff_end;
|
||||
unsigned char *write_pos;
|
||||
unsigned char *read_pos;
|
||||
my_socket fd;
|
||||
unsigned long remain_in_buf;
|
||||
unsigned long length;
|
||||
unsigned long buf_length;
|
||||
unsigned long where_b;
|
||||
unsigned long max_packet;
|
||||
unsigned long max_packet_size;
|
||||
unsigned int pkt_nr;
|
||||
unsigned int compress_pkt_nr;
|
||||
unsigned int write_timeout;
|
||||
unsigned int read_timeout;
|
||||
unsigned int retry_count;
|
||||
int fcntl;
|
||||
unsigned int *return_status;
|
||||
unsigned char reading_or_writing;
|
||||
char save_char;
|
||||
my_bool unused0;
|
||||
my_bool unused;
|
||||
my_bool compress;
|
||||
my_bool unused1;
|
||||
#endif
|
||||
unsigned char *query_cache_query;
|
||||
unsigned int last_errno;
|
||||
unsigned char error;
|
||||
my_bool unused2;
|
||||
my_bool return_errno;
|
||||
char last_error[MYSQL_ERRMSG_SIZE];
|
||||
char sqlstate[SQLSTATE_LENGTH+1];
|
||||
void *extension;
|
||||
#if defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
|
||||
my_bool skip_big_packet;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* st_mysql differs between 5.0 and 5.1, but the 5.0 version is a
|
||||
* strict subset, we don't use any of the 5.1 fields, and we don't
|
||||
* ever allocate the structure ourselves.
|
||||
*/
|
||||
|
||||
struct st_mysql {
|
||||
NET net;
|
||||
unsigned char *connector_fd;
|
||||
char *host;
|
||||
char *user;
|
||||
char *passwd;
|
||||
char *unix_socket;
|
||||
char *server_version;
|
||||
char *host_info;
|
||||
char *info;
|
||||
char *db;
|
||||
struct charset_info_st *charset;
|
||||
MYSQL_FIELD *fields;
|
||||
MEM_ROOT field_alloc;
|
||||
my_ulonglong affected_rows;
|
||||
my_ulonglong insert_id;
|
||||
my_ulonglong extra_info;
|
||||
unsigned long thread_id;
|
||||
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;
|
||||
struct st_mysql_options options;
|
||||
enum mysql_status status;
|
||||
my_bool free_me;
|
||||
my_bool reconnect;
|
||||
char scramble[SCRAMBLE_LENGTH+1];
|
||||
my_bool rpl_pivot;
|
||||
struct st_mysql *master;
|
||||
struct st_mysql *next_slave;
|
||||
struct st_mysql* last_used_slave;
|
||||
struct st_mysql* last_used_con;
|
||||
LIST *stmts;
|
||||
const struct st_mysql_methods *methods;
|
||||
void *thd;
|
||||
my_bool *unbuffered_fetch_owner;
|
||||
char *info_buffer;
|
||||
};
|
||||
|
||||
/*
|
||||
* There are different version of the MYSQL_BIND structure before and after
|
||||
* MySQL 5.1. We go after the fields of the structure using accessor functions
|
||||
* so that the code in this file is compatible with both versions.
|
||||
*/
|
||||
|
||||
struct st_mysql_bind_51 { /* Post-5.1 */
|
||||
unsigned long* length;
|
||||
my_bool* is_null;
|
||||
void* buffer;
|
||||
my_bool* error;
|
||||
unsigned char* row_ptr;
|
||||
void (*store_param_func)(NET* net, MYSQL_BIND* param);
|
||||
void (*fetch_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
|
||||
void (*skip_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
|
||||
unsigned long buffer_length;
|
||||
unsigned long offset;
|
||||
unsigned long length_value;
|
||||
unsigned int param_number;
|
||||
unsigned int pack_length;
|
||||
enum enum_field_types buffer_type;
|
||||
my_bool error_value;
|
||||
my_bool is_unsigned;
|
||||
my_bool long_data_used;
|
||||
my_bool is_null_value;
|
||||
void* extension;
|
||||
};
|
||||
|
||||
struct st_mysql_bind_50 { /* Pre-5.1 */
|
||||
unsigned long* length;
|
||||
my_bool* is_null;
|
||||
void* buffer;
|
||||
my_bool* error;
|
||||
enum enum_field_types buffer_type;
|
||||
unsigned long buffer_length;
|
||||
unsigned char* row_ptr;
|
||||
unsigned long offset;
|
||||
unsigned long length_value;
|
||||
unsigned int param_number;
|
||||
unsigned int pack_length;
|
||||
my_bool error_value;
|
||||
my_bool is_unsigned;
|
||||
my_bool long_data_used;
|
||||
my_bool is_null_value;
|
||||
void (*store_param_func)(NET* net, MYSQL_BIND* param);
|
||||
void (*fetch_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
|
||||
void (*skip_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
|
||||
};
|
||||
|
||||
/*
|
||||
* There are also different versions of the MYSQL_FIELD structure; fortunately,
|
||||
* the 5.1 version is a strict extension of the 5.0 version.
|
||||
*/
|
||||
|
||||
struct st_mysql_field {
|
||||
char* name;
|
||||
char *org_name;
|
||||
char* table;
|
||||
char* org_table;
|
||||
char* db;
|
||||
char* catalog;
|
||||
char* def;
|
||||
unsigned long length;
|
||||
unsigned long max_length;
|
||||
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;
|
||||
unsigned int decimals;
|
||||
unsigned int charsetnr;
|
||||
enum enum_field_types type;
|
||||
};
|
||||
struct st_mysql_field_50 {
|
||||
struct st_mysql_field field;
|
||||
};
|
||||
struct st_mysql_field_51 {
|
||||
struct st_mysql_field field;
|
||||
void* extension;
|
||||
};
|
||||
#define NOT_NULL_FLAG 1
|
||||
|
||||
#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
|
||||
|
||||
#define mysql_library_init mysql_server_init
|
||||
#define mysql_library_end mysql_server_end
|
||||
|
||||
#include "mysqlStubs.h"
|
||||
|
||||
#endif /* not FAKEMYSQL_H_INCLUDED */
|
||||
24
pkgs/tdbcmysql1.1.1/generic/int2ptr_ptr2int.h
Normal file
24
pkgs/tdbcmysql1.1.1/generic/int2ptr_ptr2int.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Macros used to cast between pointers and integers (e.g. when storing an int
|
||||
* in ClientData), on 64-bit architectures they avoid gcc warning about "cast
|
||||
* to/from pointer from/to integer of different size".
|
||||
*/
|
||||
|
||||
#if !defined(INT2PTR) && !defined(PTR2INT)
|
||||
# if defined(HAVE_INTPTR_T) || defined(intptr_t)
|
||||
# define INT2PTR(p) ((void *)(intptr_t)(p))
|
||||
# define PTR2INT(p) ((int)(intptr_t)(p))
|
||||
# else
|
||||
# define INT2PTR(p) ((void *)(p))
|
||||
# define PTR2INT(p) ((int)(p))
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(UINT2PTR) && !defined(PTR2UINT)
|
||||
# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
|
||||
# define UINT2PTR(p) ((void *)(uintptr_t)(p))
|
||||
# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
|
||||
# else
|
||||
# define UINT2PTR(p) ((void *)(p))
|
||||
# define PTR2UINT(p) ((unsigned int)(p))
|
||||
# endif
|
||||
#endif
|
||||
58
pkgs/tdbcmysql1.1.1/generic/mysqlStubDefs.txt
Normal file
58
pkgs/tdbcmysql1.1.1/generic/mysqlStubDefs.txt
Normal file
@@ -0,0 +1,58 @@
|
||||
# mysqlStubDefs.txt --
|
||||
#
|
||||
# Definitions of routines in the MySQL libraries that will be
|
||||
# resolved and imported at run time.
|
||||
#
|
||||
# This file contains only function declarations necessary to interoperability
|
||||
# with the SQL/CLI application programming interface. The programmers believe
|
||||
# that the material in this file is not subject to copyright, under the
|
||||
# doctrines of scenes a faire and of the merger of idea and expression.
|
||||
# Accordingly, this file is in the public domain.
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
* STUBSTRUCT: mysqlStubs
|
||||
* LIBRARY: mysqlclient_r mysqlclient mysql
|
||||
* CONVENTION: STDCALL
|
||||
|
||||
int mysql_server_init(int, char**, char**);
|
||||
void mysql_server_end(void);
|
||||
my_ulonglong mysql_affected_rows(MYSQL*);
|
||||
my_bool mysql_autocommit(MYSQL*, my_bool);
|
||||
my_bool mysql_change_user(MYSQL*, const char*, const char*, const char*);
|
||||
my_bool mysql_close(MYSQL*);
|
||||
my_bool mysql_commit(MYSQL*);
|
||||
unsigned int mysql_errno(MYSQL*);
|
||||
const char* mysql_error(MYSQL*);
|
||||
MYSQL_FIELD* mysql_fetch_fields(MYSQL_RES*);
|
||||
unsigned long* mysql_fetch_lengths(MYSQL_RES*);
|
||||
MYSQL_ROW mysql_fetch_row(MYSQL_RES*);
|
||||
unsigned int mysql_field_count(MYSQL*);
|
||||
void mysql_free_result(MYSQL_RES*);
|
||||
unsigned long mysql_get_client_version(void);
|
||||
MYSQL* mysql_init(MYSQL*);
|
||||
MYSQL_RES* mysql_list_fields(MYSQL*, const char*, const char*);
|
||||
MYSQL_RES* mysql_list_tables(MYSQL*, const char*);
|
||||
unsigned int mysql_num_fields(MYSQL_RES*);
|
||||
int mysql_options(MYSQL*, enum mysql_option, const void*);
|
||||
int mysql_query(MYSQL*, const char*);
|
||||
MYSQL* mysql_real_connect(MYSQL*, const char*, const char*, const char*, const char*, unsigned int, const char*, unsigned long);
|
||||
my_bool mysql_rollback(MYSQL*);
|
||||
int mysql_select_db(MYSQL*, const char*);
|
||||
const char* mysql_sqlstate(MYSQL*);
|
||||
my_bool mysql_ssl_set(MYSQL*, const char*, const char*, const char*, const char*, const char*);
|
||||
my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT*);
|
||||
my_bool mysql_stmt_bind_param(MYSQL_STMT*, MYSQL_BIND*);
|
||||
my_bool mysql_stmt_bind_result(MYSQL_STMT*, MYSQL_BIND*);
|
||||
my_bool mysql_stmt_close(MYSQL_STMT*);
|
||||
unsigned int mysql_stmt_errno(MYSQL_STMT*);
|
||||
const char* mysql_stmt_error(MYSQL_STMT*);
|
||||
int mysql_stmt_execute(MYSQL_STMT*);
|
||||
int mysql_stmt_fetch(MYSQL_STMT*);
|
||||
int mysql_stmt_fetch_column(MYSQL_STMT*, MYSQL_BIND*, unsigned int, unsigned long);
|
||||
MYSQL_STMT* mysql_stmt_init(MYSQL*);
|
||||
int mysql_stmt_prepare(MYSQL_STMT*, const char*, unsigned long);
|
||||
MYSQL_RES* mysql_stmt_result_metadata(MYSQL_STMT*);
|
||||
const char* mysql_stmt_sqlstate(MYSQL_STMT*);
|
||||
int mysql_stmt_store_result(MYSQL_STMT*);
|
||||
MYSQL_RES* mysql_store_result(MYSQL*);
|
||||
178
pkgs/tdbcmysql1.1.1/generic/mysqlStubInit.c
Normal file
178
pkgs/tdbcmysql1.1.1/generic/mysqlStubInit.c
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* mysqlStubInit.c --
|
||||
*
|
||||
* Stubs tables for the foreign MySQL libraries so that
|
||||
* Tcl extensions can use them without the linker's knowing about them.
|
||||
*
|
||||
* @CREATED@ 2017-05-26 05:57:32Z by genExtStubs.tcl from ../generic/mysqlStubDefs.txt
|
||||
*
|
||||
* Copyright (c) 2010 by Kevin B. Kenny.
|
||||
*
|
||||
* Please refer to the file, 'license.terms' for the conditions on
|
||||
* redistribution of this file and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <tcl.h>
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "fakemysql.h"
|
||||
|
||||
/*
|
||||
* Static data used in this file
|
||||
*/
|
||||
|
||||
/*
|
||||
* Names of the libraries that might contain the MySQL API
|
||||
*/
|
||||
|
||||
#if defined(__CYGWIN__) && !defined(LIBPREFIX)
|
||||
# define LIBPREFIX "cyg"
|
||||
#else
|
||||
# define LIBPREFIX "lib"
|
||||
#endif
|
||||
|
||||
static const char *const mysqlStubLibNames[] = {
|
||||
/* @LIBNAMES@: DO NOT EDIT THESE NAMES */
|
||||
"mysqlclient_r", "mysqlclient", "mysql", "mariadbclient", "mariadb", NULL
|
||||
/* @END@ */
|
||||
};
|
||||
|
||||
/* ABI Version numbers of the MySQL API that we can cope with */
|
||||
|
||||
static const char mysqlSuffixes[][4] = {
|
||||
"", ".20", ".19", ".18", ".17", ".16", ".15"
|
||||
};
|
||||
|
||||
/* Names of the functions that we need from MySQL */
|
||||
|
||||
static const char *const mysqlSymbolNames[] = {
|
||||
/* @SYMNAMES@: DO NOT EDIT THESE NAMES */
|
||||
"mysql_server_init",
|
||||
"mysql_server_end",
|
||||
"mysql_affected_rows",
|
||||
"mysql_autocommit",
|
||||
"mysql_change_user",
|
||||
"mysql_close",
|
||||
"mysql_commit",
|
||||
"mysql_errno",
|
||||
"mysql_error",
|
||||
"mysql_fetch_fields",
|
||||
"mysql_fetch_lengths",
|
||||
"mysql_fetch_row",
|
||||
"mysql_field_count",
|
||||
"mysql_free_result",
|
||||
"mysql_get_client_version",
|
||||
"mysql_init",
|
||||
"mysql_list_fields",
|
||||
"mysql_list_tables",
|
||||
"mysql_num_fields",
|
||||
"mysql_options",
|
||||
"mysql_query",
|
||||
"mysql_real_connect",
|
||||
"mysql_rollback",
|
||||
"mysql_select_db",
|
||||
"mysql_sqlstate",
|
||||
"mysql_ssl_set",
|
||||
"mysql_stmt_affected_rows",
|
||||
"mysql_stmt_bind_param",
|
||||
"mysql_stmt_bind_result",
|
||||
"mysql_stmt_close",
|
||||
"mysql_stmt_errno",
|
||||
"mysql_stmt_error",
|
||||
"mysql_stmt_execute",
|
||||
"mysql_stmt_fetch",
|
||||
"mysql_stmt_fetch_column",
|
||||
"mysql_stmt_init",
|
||||
"mysql_stmt_prepare",
|
||||
"mysql_stmt_result_metadata",
|
||||
"mysql_stmt_sqlstate",
|
||||
"mysql_stmt_store_result",
|
||||
"mysql_store_result",
|
||||
NULL
|
||||
/* @END@ */
|
||||
};
|
||||
|
||||
/*
|
||||
* Table containing pointers to the functions named above.
|
||||
*/
|
||||
|
||||
static mysqlStubDefs mysqlStubsTable;
|
||||
const mysqlStubDefs* mysqlStubs = &mysqlStubsTable;
|
||||
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
* MysqlInitStubs --
|
||||
*
|
||||
* Initialize the Stubs table for the MySQL API
|
||||
*
|
||||
* Results:
|
||||
* Returns the handle to the loaded MySQL client library, or NULL
|
||||
* if the load is unsuccessful. Leaves an error message in the
|
||||
* interpreter.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
MODULE_SCOPE Tcl_LoadHandle
|
||||
MysqlInitStubs(Tcl_Interp* interp)
|
||||
{
|
||||
int status; /* Status of Tcl library calls */
|
||||
Tcl_Obj* path; /* Path name of a module to be loaded */
|
||||
Tcl_Obj* shlibext; /* Extension to use for load modules */
|
||||
Tcl_LoadHandle handle = NULL;
|
||||
/* Handle to a load module */
|
||||
int i;
|
||||
size_t j;
|
||||
|
||||
/* Determine the shared library extension */
|
||||
|
||||
status = Tcl_EvalEx(interp, "::info sharedlibextension", -1,
|
||||
TCL_EVAL_GLOBAL);
|
||||
if (status != TCL_OK) return NULL;
|
||||
shlibext = Tcl_GetObjResult(interp);
|
||||
Tcl_IncrRefCount(shlibext);
|
||||
|
||||
/* Walk the list of possible library names to find an MySQL client */
|
||||
|
||||
status = TCL_ERROR;
|
||||
for (i = 0; status == TCL_ERROR && mysqlStubLibNames[i] != NULL; ++i) {
|
||||
for (j = 0; status == TCL_ERROR && (j < sizeof(mysqlSuffixes)/sizeof(mysqlSuffixes[0])); ++j) {
|
||||
path = Tcl_NewStringObj(LIBPREFIX, -1);
|
||||
Tcl_AppendToObj(path, mysqlStubLibNames[i], -1);
|
||||
#ifdef __CYGWIN__
|
||||
if (*mysqlSuffixes[j]) {
|
||||
Tcl_AppendToObj(path, "-", -1);
|
||||
Tcl_AppendToObj(path, mysqlSuffixes[j]+1, -1);
|
||||
}
|
||||
#endif
|
||||
Tcl_AppendObjToObj(path, shlibext);
|
||||
#ifndef __CYGWIN__
|
||||
Tcl_AppendToObj(path, mysqlSuffixes[j], -1);
|
||||
#endif
|
||||
Tcl_IncrRefCount(path);
|
||||
|
||||
/* Try to load a client library and resolve symbols within it. */
|
||||
|
||||
Tcl_ResetResult(interp);
|
||||
status = Tcl_LoadFile(interp, path, mysqlSymbolNames, 0,
|
||||
&mysqlStubsTable, &handle);
|
||||
Tcl_DecrRefCount(path);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Either we've successfully loaded a library (status == TCL_OK),
|
||||
* or we've run out of library names (in which case status==TCL_ERROR
|
||||
* and the error message reflects the last unsuccessful load attempt).
|
||||
*/
|
||||
Tcl_DecrRefCount(shlibext);
|
||||
if (status != TCL_OK) {
|
||||
return NULL;
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
101
pkgs/tdbcmysql1.1.1/generic/mysqlStubs.h
Normal file
101
pkgs/tdbcmysql1.1.1/generic/mysqlStubs.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
*
|
||||
* ../generic/mysqlStubs.h --
|
||||
*
|
||||
* Stubs for procedures in mysqlStubDefs.txt
|
||||
*
|
||||
* Generated by genExtStubs.tcl: DO NOT EDIT
|
||||
* 2017-05-26 05:57:32Z
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct mysqlStubDefs {
|
||||
|
||||
/* Functions from libraries: mysqlclient_r mysqlclient mysql */
|
||||
|
||||
int (STDCALL*mysql_server_initPtr)(int, char**, char**);
|
||||
void (STDCALL*mysql_server_endPtr)(void);
|
||||
my_ulonglong (STDCALL*mysql_affected_rowsPtr)(MYSQL*);
|
||||
my_bool (STDCALL*mysql_autocommitPtr)(MYSQL*, my_bool);
|
||||
my_bool (STDCALL*mysql_change_userPtr)(MYSQL*, const char*, const char*, const char*);
|
||||
my_bool (STDCALL*mysql_closePtr)(MYSQL*);
|
||||
my_bool (STDCALL*mysql_commitPtr)(MYSQL*);
|
||||
unsigned int (STDCALL*mysql_errnoPtr)(MYSQL*);
|
||||
const char* (STDCALL*mysql_errorPtr)(MYSQL*);
|
||||
MYSQL_FIELD* (STDCALL*mysql_fetch_fieldsPtr)(MYSQL_RES*);
|
||||
unsigned long* (STDCALL*mysql_fetch_lengthsPtr)(MYSQL_RES*);
|
||||
MYSQL_ROW (STDCALL*mysql_fetch_rowPtr)(MYSQL_RES*);
|
||||
unsigned int (STDCALL*mysql_field_countPtr)(MYSQL*);
|
||||
void (STDCALL*mysql_free_resultPtr)(MYSQL_RES*);
|
||||
unsigned long (STDCALL*mysql_get_client_versionPtr)(void);
|
||||
MYSQL* (STDCALL*mysql_initPtr)(MYSQL*);
|
||||
MYSQL_RES* (STDCALL*mysql_list_fieldsPtr)(MYSQL*, const char*, const char*);
|
||||
MYSQL_RES* (STDCALL*mysql_list_tablesPtr)(MYSQL*, const char*);
|
||||
unsigned int (STDCALL*mysql_num_fieldsPtr)(MYSQL_RES*);
|
||||
int (STDCALL*mysql_optionsPtr)(MYSQL*, enum mysql_option, const void*);
|
||||
int (STDCALL*mysql_queryPtr)(MYSQL*, const char*);
|
||||
MYSQL* (STDCALL*mysql_real_connectPtr)(MYSQL*, const char*, const char*, const char*, const char*, unsigned int, const char*, unsigned long);
|
||||
my_bool (STDCALL*mysql_rollbackPtr)(MYSQL*);
|
||||
int (STDCALL*mysql_select_dbPtr)(MYSQL*, const char*);
|
||||
const char* (STDCALL*mysql_sqlstatePtr)(MYSQL*);
|
||||
my_bool (STDCALL*mysql_ssl_setPtr)(MYSQL*, const char*, const char*, const char*, const char*, const char*);
|
||||
my_ulonglong (STDCALL*mysql_stmt_affected_rowsPtr)(MYSQL_STMT*);
|
||||
my_bool (STDCALL*mysql_stmt_bind_paramPtr)(MYSQL_STMT*, MYSQL_BIND*);
|
||||
my_bool (STDCALL*mysql_stmt_bind_resultPtr)(MYSQL_STMT*, MYSQL_BIND*);
|
||||
my_bool (STDCALL*mysql_stmt_closePtr)(MYSQL_STMT*);
|
||||
unsigned int (STDCALL*mysql_stmt_errnoPtr)(MYSQL_STMT*);
|
||||
const char* (STDCALL*mysql_stmt_errorPtr)(MYSQL_STMT*);
|
||||
int (STDCALL*mysql_stmt_executePtr)(MYSQL_STMT*);
|
||||
int (STDCALL*mysql_stmt_fetchPtr)(MYSQL_STMT*);
|
||||
int (STDCALL*mysql_stmt_fetch_columnPtr)(MYSQL_STMT*, MYSQL_BIND*, unsigned int, unsigned long);
|
||||
MYSQL_STMT* (STDCALL*mysql_stmt_initPtr)(MYSQL*);
|
||||
int (STDCALL*mysql_stmt_preparePtr)(MYSQL_STMT*, const char*, unsigned long);
|
||||
MYSQL_RES* (STDCALL*mysql_stmt_result_metadataPtr)(MYSQL_STMT*);
|
||||
const char* (STDCALL*mysql_stmt_sqlstatePtr)(MYSQL_STMT*);
|
||||
int (STDCALL*mysql_stmt_store_resultPtr)(MYSQL_STMT*);
|
||||
MYSQL_RES* (STDCALL*mysql_store_resultPtr)(MYSQL*);
|
||||
} mysqlStubDefs;
|
||||
#define mysql_server_init (mysqlStubs->mysql_server_initPtr)
|
||||
#define mysql_server_end (mysqlStubs->mysql_server_endPtr)
|
||||
#define mysql_affected_rows (mysqlStubs->mysql_affected_rowsPtr)
|
||||
#define mysql_autocommit (mysqlStubs->mysql_autocommitPtr)
|
||||
#define mysql_change_user (mysqlStubs->mysql_change_userPtr)
|
||||
#define mysql_close (mysqlStubs->mysql_closePtr)
|
||||
#define mysql_commit (mysqlStubs->mysql_commitPtr)
|
||||
#define mysql_errno (mysqlStubs->mysql_errnoPtr)
|
||||
#define mysql_error (mysqlStubs->mysql_errorPtr)
|
||||
#define mysql_fetch_fields (mysqlStubs->mysql_fetch_fieldsPtr)
|
||||
#define mysql_fetch_lengths (mysqlStubs->mysql_fetch_lengthsPtr)
|
||||
#define mysql_fetch_row (mysqlStubs->mysql_fetch_rowPtr)
|
||||
#define mysql_field_count (mysqlStubs->mysql_field_countPtr)
|
||||
#define mysql_free_result (mysqlStubs->mysql_free_resultPtr)
|
||||
#define mysql_get_client_version (mysqlStubs->mysql_get_client_versionPtr)
|
||||
#define mysql_init (mysqlStubs->mysql_initPtr)
|
||||
#define mysql_list_fields (mysqlStubs->mysql_list_fieldsPtr)
|
||||
#define mysql_list_tables (mysqlStubs->mysql_list_tablesPtr)
|
||||
#define mysql_num_fields (mysqlStubs->mysql_num_fieldsPtr)
|
||||
#define mysql_options (mysqlStubs->mysql_optionsPtr)
|
||||
#define mysql_query (mysqlStubs->mysql_queryPtr)
|
||||
#define mysql_real_connect (mysqlStubs->mysql_real_connectPtr)
|
||||
#define mysql_rollback (mysqlStubs->mysql_rollbackPtr)
|
||||
#define mysql_select_db (mysqlStubs->mysql_select_dbPtr)
|
||||
#define mysql_sqlstate (mysqlStubs->mysql_sqlstatePtr)
|
||||
#define mysql_ssl_set (mysqlStubs->mysql_ssl_setPtr)
|
||||
#define mysql_stmt_affected_rows (mysqlStubs->mysql_stmt_affected_rowsPtr)
|
||||
#define mysql_stmt_bind_param (mysqlStubs->mysql_stmt_bind_paramPtr)
|
||||
#define mysql_stmt_bind_result (mysqlStubs->mysql_stmt_bind_resultPtr)
|
||||
#define mysql_stmt_close (mysqlStubs->mysql_stmt_closePtr)
|
||||
#define mysql_stmt_errno (mysqlStubs->mysql_stmt_errnoPtr)
|
||||
#define mysql_stmt_error (mysqlStubs->mysql_stmt_errorPtr)
|
||||
#define mysql_stmt_execute (mysqlStubs->mysql_stmt_executePtr)
|
||||
#define mysql_stmt_fetch (mysqlStubs->mysql_stmt_fetchPtr)
|
||||
#define mysql_stmt_fetch_column (mysqlStubs->mysql_stmt_fetch_columnPtr)
|
||||
#define mysql_stmt_init (mysqlStubs->mysql_stmt_initPtr)
|
||||
#define mysql_stmt_prepare (mysqlStubs->mysql_stmt_preparePtr)
|
||||
#define mysql_stmt_result_metadata (mysqlStubs->mysql_stmt_result_metadataPtr)
|
||||
#define mysql_stmt_sqlstate (mysqlStubs->mysql_stmt_sqlstatePtr)
|
||||
#define mysql_stmt_store_result (mysqlStubs->mysql_stmt_store_resultPtr)
|
||||
#define mysql_store_result (mysqlStubs->mysql_store_resultPtr)
|
||||
MODULE_SCOPE const mysqlStubDefs *mysqlStubs;
|
||||
3770
pkgs/tdbcmysql1.1.1/generic/tdbcmysql.c
Normal file
3770
pkgs/tdbcmysql1.1.1/generic/tdbcmysql.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user