📄 myodbc.h
字号:
/* This file is public domain and comes with NO WARRANTY of any kind */
#undef LOG_ALL
#define ODBCVER 0x0250 /* ODBC 3.0 has no installer */
#ifdef APSTUDIO_READONLY_SYMBOLS
#define WIN32 /* Hack for rc files */
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef RC_INVOKED
#define stdin /* Don't include stdio */
#endif
#include <global.h>
#include <my_sys.h>
#include <mysql.h>
#include <list.h>
#include <m_string.h>
#ifdef __cplusplus
}
#endif
#ifndef _UNIX_
#include <windowsx.h>
#ifndef RC_INVOKED
#pragma pack(1)
#endif
/* #include "w16macro.h" */
#include "sql.h"
#include "sqlext.h"
#endif /* IS NOT UNIX */
#ifdef _UNIX_
#include <isql.h>
#include <isqlext.h>
#include <odbc_types.h>
#include <odbc_funcs.h>
#endif /* IS UNIX */
#ifdef WIN32
#define INTFUNC __stdcall
#define EXPFUNC __stdcall
#else
#define INTFUNC PASCAL
#define EXPFUNC __export CALLBACK
#endif
#undef SQL_SPEC_STRING /* Wrong in VC++ 5.0 */
#define SQL_SPEC_STRING "02.50" /* String constant for version */
#define DRIVER_VERSION "2.50.17"
#define MYSQL_RESET_BUFFERS 1000 /* Intern param to SQLFreeStmt */
#define MYSQL_RESET 1001 /* Intern param to SQLFreeStmt */
#define MYSQL_3_21_PROTOCOL 10
#define x_free(A) { gptr tmp=(gptr) (A); if (tmp) my_free(tmp,MYF(MY_WME+MY_FAE)); }
// Environment information. This is allocated by "SQLAllocEnv".
typedef struct tagENV {
short DummyEntry;
} ENV;
// Database connection information. This is allocated by "SQLAllocConnect".
#define FLAG_FIELD_LENGTH 1 // field_length instead of max_length
#define FLAG_FOUND_ROWS 2 // Access wants can't handle affected_rows
#define FLAG_DEBUG 4 // Put a debug log on C:\myodbc.log
#define FLAG_BIG_PACKETS 8 // Allow BIG packets.
#define FLAG_NO_PROMPT 16 // Don't prompt on connection even if driver request it
#define FLAG_OLD_ODBC_PROG 32 // The program require ODBC 1.0 syntax
#define FLAG_NO_SCHEMA 64
#define FLAG_NO_DEFAULT_CURSOR 128
#define FLAG_NO_FETCH 256
#define FLAG_PAD_SPACE 512 // Pad CHAR fields with space to max length.
typedef struct stmt_options {
uint bind_type,rows_in_set,cursor_type;
ulong max_length,max_rows;
} STMT_OPTIONS;
typedef struct tagDBC {
ENV *env;
MYSQL mysql;
char *dsn,*database,*user,*password,*server,sqlstate[5];
uint port,flag;
ulong login_timeout;
LIST *statements;
STMT_OPTIONS stmt_options;
} DBC;
// Statment information. This is allocated by "SQLAllocStmt".
typedef struct st_bind {
MYSQL_FIELD *field;
SWORD fCType;
PTR rgbValue; /* Save data here */
SDWORD cbValueMax;
SDWORD FAR *pcbValue;
LIST list;
} BIND;
typedef struct st_param_bind {
SWORD SqlType,CType;
gptr buffer;
char *pos_in_query,*value;
SDWORD ValueMax,*actual_len,value_length;
bool alloced,used;
} PARAM_BIND;
enum MY_STATE { ST_UNKNOWN, ST_PREPARED, ST_PRE_EXECUTED, ST_EXECUTED };
typedef struct tagSTMT {
DBC FAR *dbc;
MYSQL_RES *result;
uint current_row,last_getdata_col;
ulong getdata_offset;
uint *order,order_count,param_count,current_param,*result_lengths,
rows_found_in_set,position_in_set,bound_columns;
STMT_OPTIONS stmt_options;
enum MY_STATE state;
MYSQL_ROW array,result_array,current_values;
MYSQL_ROW (*fix_fields)(struct tagSTMT FAR* stmt,MYSQL_ROW row);
MYSQL_FIELD *fields;
MYSQL_ROW_OFFSET end_of_set; /* end of set for SQLExtendedFetch() */
DYNAMIC_ARRAY params; /* For SQLBindParamter */
BIND *bind; /* For SQLBindCol */
SWORD *odbc_types; /* sql types for fields */
char *query,*query_end;
LIST list;
} STMT;
extern HANDLE NEAR s_hModule; // DLL handle.
extern char *default_locale, *decimal_point, *thousands_sep;
extern uint decimal_point_length,thousands_sep_length;
// Resource defines for "SQLDriverConnect" dialog box.
#define ID_LISTBOX 100
#define CONFIGDSN 1001
#define CONFIGDEFAULT 1002
#define EDRIVERCONNECT 1003
RETCODE my_SQLExecute(STMT FAR* stmt);
RETCODE my_SQLPrepare(HSTMT hstmt,UCHAR FAR *szSqlStr, SDWORD cbSqlStr);
/* Functions in utility.c */
void mysql_link_fields(STMT *stmt,MYSQL_FIELD *fields,uint field_count);
void fix_result_types(STMT *stmt);
char *fix_str(char *to,char *from,int length);
char *dupp_str(char *from,int length);
bool empty_str(char *from,int length);
RETCODE copy_result(DBC FAR *dbc,UCHAR FAR *rgbValue,SWORD cbValueMax,
SWORD FAR *pcbValue,char FAR *src);
RETCODE copy_lresult(DBC FAR *dbc,UCHAR FAR *rgbValue,SDWORD cbValueMax,
SDWORD FAR *pcbValue,char *src,ulong src_length,
ulong max_length,ulong fill_length,ulong *offset);
void remove_escape(char *name);
RETCODE set_error(DBC FAR *dbc,char *state,char *message,uint errcode);
int unireg_to_sql_datatype(STMT FAR *stmt, MYSQL_FIELD *field, char *buff,
ulong *transfer_length,ulong *precision,
ulong *display_size);
int unireg_to_c_datatype(MYSQL_FIELD *field);
int default_c_type(int sql_data_type);
ulong bind_length(int sql_data_type,ulong length);
my_bool str_to_date(DATE_STRUCT *rgbValue, const char *str,uint length);
ulong str_to_time(const char *str,uint length);
void init_getfunctions(void);
void myodbc_init(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -