⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdmysql.hpp

📁 SQLDirect Component Library is a light-weight Borland Database Engine replacement for Borland Delphi
💻 HPP
📖 第 1 页 / 共 2 页
字号:
		* Args, const int Args_Size) : Sdcommon::ESDEngineError(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall ESDMySQLError(int Ident)/* overload */ : Sdcommon::ESDEngineError(
		Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall ESDMySQLError(int Ident, const System::TVarRec * Args
		, const int Args_Size)/* overload */ : Sdcommon::ESDEngineError(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall ESDMySQLError(const AnsiString Msg, int AHelpContext) : 
		Sdcommon::ESDEngineError(Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall ESDMySQLError(const AnsiString Msg, const System::TVarRec 
		* Args, const int Args_Size, int AHelpContext) : Sdcommon::ESDEngineError(Msg, Args, Args_Size, AHelpContext
		) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall ESDMySQLError(int Ident, int AHelpContext)/* overload */
		 : Sdcommon::ESDEngineError(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall ESDMySQLError(System::PResStringRec ResStringRec
		, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sdcommon::ESDEngineError(
		ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~ESDMySQLError(void) { }
	#pragma option pop
	
};


#pragma pack(push, 1)
struct TIMyConnInfo
{
	Byte ServerType;
	void *MySQLPtr;
} ;
#pragma pack(pop)

class DELPHICLASS TIMyDatabase;
class PASCALIMPLEMENTATION TIMyDatabase : public Sdcommon::TISqlDatabase 
{
	typedef Sdcommon::TISqlDatabase inherited;
	
private:
	void *FHandle;
	bool FIsEnableMoney;
	bool FIsClientVer3;
	void __fastcall Check(void * mysql);
	void __fastcall AllocHandle(void);
	void __fastcall FreeHandle(void);
	void __fastcall ExecCmd(const AnsiString SQL, bool CheckRslt);
	void * __fastcall GetMySQLPtr(void);
	void __fastcall SetDefaultOptions(void);
	
protected:
	virtual void * __fastcall GetHandle(void);
	virtual void __fastcall DoConnect(const AnsiString sRemoteDatabase, const AnsiString sUserName, const 
		AnsiString sPassword);
	virtual void __fastcall DoDisconnect(bool Force);
	virtual void __fastcall DoCommit(void);
	virtual void __fastcall DoRollback(void);
	virtual void __fastcall DoStartTransaction(void);
	virtual void __fastcall SetAutoCommitOption(bool Value);
	virtual void __fastcall SetHandle(void * AHandle);
	
public:
	__fastcall virtual TIMyDatabase(Classes::TStrings* ADbParams);
	__fastcall virtual ~TIMyDatabase(void);
	virtual Sdcommon::TISqlCommand* __fastcall CreateSqlCommand(void);
	virtual AnsiString __fastcall GetAutoIncSQL(void);
	virtual int __fastcall GetClientVersion(void);
	virtual int __fastcall GetServerVersion(void);
	virtual AnsiString __fastcall GetVersionString(void);
	virtual Sdcommon::TISqlCommand* __fastcall GetSchemaInfo(Sdcommon::TSDSchemaType ASchemaType, AnsiString 
		AObjectName);
	virtual void __fastcall SetTransIsolation(Sdcommon::TISqlTransIsolation Value);
	virtual bool __fastcall TestConnected(void);
	__property void * MySQLPtr = {read=GetMySQLPtr};
	__property bool IsClientVer3 = {read=FIsClientVer3, nodefault};
	__property bool IsEnableMoney = {read=FIsEnableMoney, nodefault};
};


class DELPHICLASS TIMyCommand;
class PASCALIMPLEMENTATION TIMyCommand : public Sdcommon::TISqlCommand 
{
	typedef Sdcommon::TISqlCommand inherited;
	
private:
	void *FHandle;
	char * *FRow;
	int *FFieldLens;
	AnsiString FStmt;
	AnsiString FBindStmt;
	__int64 FRowsAffected;
	__int64 FAutoIncID;
	int FFirstCalcFieldIdx;
	bool __fastcall GetIsOpened(void);
	HIDESBASE TIMyDatabase* __fastcall GetSqlDatabase(void);
	AnsiString __fastcall CnvtDateTime2SqlString(System::TDateTime Value);
	AnsiString __fastcall CnvtFloat2SqlString(double Value);
	AnsiString __fastcall CnvtVarBytes2EscapeString(AnsiString Value);
	char * __fastcall GetFieldValue(int Index);
	void __fastcall InternalQBindParams(void);
	void __fastcall InternalQExecute(void);
	
protected:
	void __fastcall Check(short Status);
	virtual Db::TFieldType __fastcall FieldDataType(int ExtDataType);
	virtual int __fastcall NativeDataType(Db::TFieldType FieldType);
	virtual Word __fastcall NativeDataSize(Db::TFieldType FieldType);
	virtual bool __fastcall RequiredCnvtFieldType(Db::TFieldType FieldType);
	virtual void __fastcall DoPrepare(AnsiString Value);
	virtual void __fastcall DoExecDirect(AnsiString Value);
	virtual void __fastcall DoExecute(void);
	virtual void __fastcall BindParamsBuffer(void);
	virtual void * __fastcall GetHandle(void);
	virtual void __fastcall GetFieldDescs(Sdcommon::TSDFieldDescList* Descs);
	virtual void __fastcall InitParamList(void);
	virtual void __fastcall SetFieldsBuffer(void);
	__property bool IsOpened = {read=GetIsOpened, nodefault};
	__property TIMyDatabase* SqlDatabase = {read=GetSqlDatabase};
	
public:
	__fastcall virtual TIMyCommand(Sdcommon::TISqlDatabase* ASqlDatabase);
	__fastcall virtual ~TIMyCommand(void);
	virtual void __fastcall CloseResultSet(void);
	virtual void __fastcall Disconnect(bool Force);
	virtual int __fastcall GetAutoIncValue(void);
	virtual int __fastcall GetRowsAffected(void);
	virtual bool __fastcall ResultSetExists(void);
	virtual bool __fastcall FetchNextRow(void);
	virtual bool __fastcall GetCnvtFieldData(Sdcommon::TSDFieldDesc* AFieldDesc, void * Buffer, int BufSize
		);
	virtual void __fastcall GetOutputParams(void);
	virtual int __fastcall ReadBlob(Sdcommon::TSDFieldDesc* AFieldDesc, Sdcommon::TBytes &BlobData);
};


class DELPHICLASS TIMyCommandShowTables;
class PASCALIMPLEMENTATION TIMyCommandShowTables : public TIMyCommand 
{
	typedef TIMyCommand inherited;
	
private:
	AnsiString FTableNames;
	bool FIsSysTables;
	int FCatNameFieldIdx;
	int FSchNameFieldIdx;
	int FTblTypeFieldIdx;
	
protected:
	virtual void __fastcall DoExecDirect(AnsiString Value);
	virtual void __fastcall GetFieldDescs(Sdcommon::TSDFieldDescList* Descs);
	
public:
	__fastcall virtual TIMyCommandShowTables(Sdcommon::TISqlDatabase* ASqlDatabase);
	virtual bool __fastcall FetchNextRow(void);
	__property AnsiString TableNames = {read=FTableNames, write=FTableNames};
	__property bool IsSysTables = {read=FIsSysTables, write=FIsSysTables, nodefault};
public:
	#pragma option push -w-inl
	/* TIMyCommand.Destroy */ inline __fastcall virtual ~TIMyCommandShowTables(void) { }
	#pragma option pop
	
};


class DELPHICLASS TIMyCommandShowColumns;
class PASCALIMPLEMENTATION TIMyCommandShowColumns : public TIMyCommand 
{
	typedef TIMyCommand inherited;
	
private:
	AnsiString FTableName;
	int FCatNameFieldIdx;
	int FSchNameFieldIdx;
	int FTblNameFieldIdx;
	int FColLenFieldIdx;
	int FColPrecFieldIdx;
	int FColScaleFieldIdx;
	int FColNullFieldIdx;
	
protected:
	virtual void __fastcall DoExecDirect(AnsiString Value);
	virtual void __fastcall GetFieldDescs(Sdcommon::TSDFieldDescList* Descs);
	
public:
	__fastcall virtual TIMyCommandShowColumns(Sdcommon::TISqlDatabase* ASqlDatabase);
	virtual bool __fastcall FetchNextRow(void);
	__property AnsiString TableName = {read=FTableName, write=FTableName};
public:
	#pragma option push -w-inl
	/* TIMyCommand.Destroy */ inline __fastcall virtual ~TIMyCommandShowColumns(void) { }
	#pragma option pop
	
};


class DELPHICLASS TIMyCommandShowIndexes;
class PASCALIMPLEMENTATION TIMyCommandShowIndexes : public TIMyCommand 
{
	typedef TIMyCommand inherited;
	
private:
	AnsiString FTableName;
	int FCatNameFieldIdx;
	int FSchNameFieldIdx;
	int FIdxTypeFieldIdx;
	int FIdxFilterFieldIdx;
	
protected:
	virtual void __fastcall DoExecDirect(AnsiString Value);
	virtual void __fastcall GetFieldDescs(Sdcommon::TSDFieldDescList* Descs);
	
public:
	__fastcall virtual TIMyCommandShowIndexes(Sdcommon::TISqlDatabase* ASqlDatabase);
	virtual bool __fastcall FetchNextRow(void);
	__property AnsiString TableName = {read=FTableName, write=FTableName};
public:
	#pragma option push -w-inl
	/* TIMyCommand.Destroy */ inline __fastcall virtual ~TIMyCommandShowIndexes(void) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
static const Shortint NAME_LEN = 0x40;
static const Shortint HOSTNAME_LENGTH = 0x3c;
static const Shortint USERNAME_LENGTH = 0x10;
static const Shortint SERVER_VERSION_LENGTH = 0x3c;
#define LOCAL_HOST "localhost"
static const char LOCAL_HOST_NAMEDPIPE = '\x2e';
#define MYSQL_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "MySql"
static const Shortint NOT_NULL_FLAG = 0x1;
static const Shortint PRI_KEY_FLAG = 0x2;
static const Shortint UNIQUE_KEY_FLAG = 0x4;
static const Shortint MULTIPLE_KEY_FLAG = 0x8;
static const Shortint BLOB_FLAG = 0x10;
static const Shortint UNSIGNED_FLAG = 0x20;
static const Shortint ZEROFILL_FLAG = 0x40;
static const Byte BINARY_FLAG = 0x80;
static const Word ENUM_FLAG = 0x100;
static const Word AUTO_INCREMENT_FLAG = 0x200;
static const Word TIMESTAMP_FLAG = 0x400;
static const Word SET_FLAG = 0x800;
static const Word NUM_FLAG = 0x8000;
static const Word PART_KEY_FLAG = 0x4000;
static const Word GROUP_FLAG = 0x8000;
static const int UNIQUE_FLAG = 0x10000;
static const Shortint REFRESH_GRANT = 0x1;
static const Shortint REFRESH_LOG = 0x2;
static const Shortint REFRESH_TABLES = 0x4;
static const Shortint REFRESH_HOSTS = 0x8;
static const Shortint REFRESH_STATUS = 0x10;
static const Shortint REFRESH_THREADS = 0x20;
static const Shortint REFRESH_SLAVE = 0x40;
static const Byte REFRESH_MASTER = 0x80;
static const Word REFRESH_READ_LOCK = 0x4000;
static const Word REFRESH_FAST = 0x8000;
static const int REFRESH_QUERY_CACHE = 0x10000;
static const int REFRESH_QUERY_CACHE_FREE = 0x20000;
static const int REFRESH_DES_KEY_FILE = 0x40000;
static const int REFRESH_USER_RESOURCES = 0x80000;
static const Shortint CLIENT_LONG_PASSWORD = 0x1;
static const Shortint CLIENT_FOUND_ROWS = 0x2;
static const Shortint CLIENT_LONG_FLAG = 0x4;
static const Shortint CLIENT_CONNECT_WITH_DB = 0x8;
static const Shortint CLIENT_NO_SCHEMA = 0x10;
static const Shortint CLIENT_COMPRESS = 0x20;
static const Shortint CLIENT_ODBC = 0x40;
static const Byte CLIENT_LOCAL_FILES = 0x80;
static const Word CLIENT_IGNORE_SPACE = 0x100;
static const Word CLIENT_CHANGE_USER = 0x200;
static const Word CLIENT_INTERACTIVE = 0x400;
static const Word CLIENT_SSL = 0x800;
static const Word CLIENT_IGNORE_SIGPIPE = 0x1000;
static const Word CLIENT_TRANSACTIONS = 0x2000;
static const Shortint SERVER_STATUS_IN_TRANS = 0x1;
static const Shortint SERVER_STATUS_AUTOCOMMIT = 0x2;
static const Byte MYSQL_ERRMSG_SIZE = 0xc8;
static const Shortint NET_READ_TIMEOUT = 0x1e;
static const Shortint NET_WRITE_TIMEOUT = 0x3c;
static const Word NET_WAIT_TIMEOUT = 0x7080;
static const Byte MAX_CHAR_WIDTH = 0xff;
static const Word MAX_BLOB_WIDTH = 0x2000;
static const Shortint FIELD_TYPE_DECIMAL = 0x0;
static const Shortint FIELD_TYPE_TINY = 0x1;
static const Shortint FIELD_TYPE_SHORT = 0x2;
static const Shortint FIELD_TYPE_LONG = 0x3;
static const Shortint FIELD_TYPE_FLOAT = 0x4;
static const Shortint FIELD_TYPE_DOUBLE = 0x5;
static const Shortint FIELD_TYPE_NULL = 0x6;
static const Shortint FIELD_TYPE_TIMESTAMP = 0x7;
static const Shortint FIELD_TYPE_LONGLONG = 0x8;
static const Shortint FIELD_TYPE_INT24 = 0x9;
static const Shortint FIELD_TYPE_DATE = 0xa;
static const Shortint FIELD_TYPE_TIME = 0xb;
static const Shortint FIELD_TYPE_DATETIME = 0xc;
static const Shortint FIELD_TYPE_YEAR = 0xd;
static const Shortint FIELD_TYPE_NEWDATE = 0xe;
static const Byte FIELD_TYPE_ENUM = 0xf7;
static const Byte FIELD_TYPE_SET = 0xf8;
static const Byte FIELD_TYPE_TINY_BLOB = 0xf9;
static const Byte FIELD_TYPE_MEDIUM_BLOB = 0xfa;
static const Byte FIELD_TYPE_LONG_BLOB = 0xfb;
static const Byte FIELD_TYPE_BLOB = 0xfc;
static const Byte FIELD_TYPE_VAR_STRING = 0xfd;
static const Byte FIELD_TYPE_STRING = 0xfe;
static const Byte FIELD_TYPE_GEOMETRY = 0xff;
static const Shortint FIELD_TYPE_CHAR = 0x1;
static const Byte FIELD_TYPE_INTERVAL = 0xf7;
extern PACKAGE __int64 __stdcall (*mysql_num_rows)(void * res);
extern PACKAGE int __stdcall (*mysql_num_fields)(void * res);
extern PACKAGE char __stdcall (*mysql_eof)(void * res);
extern PACKAGE void * __stdcall (*mysql_fetch_field_direct)(void * res, int fieldnr);
extern PACKAGE void * __stdcall (*mysql_fetch_fields)(void * res);
extern PACKAGE PMYSQL_ROWS __stdcall (*mysql_row_tell)(void * res);
extern PACKAGE int __stdcall (*mysql_field_tell)(void * res);
extern PACKAGE int __stdcall (*mysql_field_count)(void * mysql);
extern PACKAGE __int64 __stdcall (*mysql_affected_rows)(void * mysql);
extern PACKAGE __int64 __stdcall (*mysql_insert_id)(void * mysql);
extern PACKAGE int __stdcall (*mysql_errno)(void * mysql);
extern PACKAGE char * __stdcall (*mysql_error)(void * mysql);
extern PACKAGE char * __stdcall (*mysql_info)(void * mysql);
extern PACKAGE int __stdcall (*mysql_thread_id)(void * mysql);
extern PACKAGE char * __stdcall (*mysql_character_set_name)(void * mysql);
extern PACKAGE void * __stdcall (*mysql_init)(void * mysql);
extern PACKAGE int __stdcall (*mysql_ssl_set)(void * mysql, const char * key, const char * cert, const 
	char * ca, const char * capath);
extern PACKAGE char * __stdcall (*mysql_ssl_cipher)(void * mysql);
extern PACKAGE int __stdcall (*mysql_ssl_clear)(void * mysql);
extern PACKAGE void * __stdcall (*mysql_connect)(void * mysql, const char * host, const char * user, 
	const char * passwd);
extern PACKAGE char __stdcall (*mysql_change_user)(void * mysql, const char * user, const char * passwd
	, const char * db);
extern PACKAGE void * __stdcall (*mysql_real_connect)(void * mysql, const char * host, const char * 
	user, const char * passwd, const char * db, int port, const char * unix_socket, int clientflag);
extern PACKAGE void __stdcall (*mysql_close)(void * sock);
extern PACKAGE int __stdcall (*mysql_select_db)(void * mysql, const char * db);
extern PACKAGE int __stdcall (*mysql_query)(void * mysql, const char * q);
extern PACKAGE int __stdcall (*mysql_send_query)(void * mysql, const char * q, int length);
extern PACKAGE int __stdcall (*mysql_read_query_result)(void * mysql);
extern PACKAGE int __stdcall (*mysql_real_query)(void * mysql, const char * q, int length);
extern PACKAGE int __stdcall (*mysql_create_db)(void * mysql, const char * DB);
extern PACKAGE int __stdcall (*mysql_drop_db)(void * mysql, const char * DB);
extern PACKAGE int __stdcall (*mysql_shutdown)(void * mysql);
extern PACKAGE int __stdcall (*mysql_dump_debug_info)(void * mysql);
extern PACKAGE int __stdcall (*mysql_refresh)(void * mysql, int refresh_options);
extern PACKAGE int __stdcall (*mysql_kill)(void * mysql, int pid);
extern PACKAGE int __stdcall (*mysql_ping)(void * mysql);
extern PACKAGE char * __stdcall (*mysql_stat)(void * mysql);
extern PACKAGE char * __stdcall (*mysql_get_server_info)(void * mysql);
extern PACKAGE char * __stdcall (*mysql_get_client_info)(void);
extern PACKAGE char * __stdcall (*mysql_get_host_info)(void * mysql);
extern PACKAGE int __stdcall (*mysql_get_proto_info)(void * mysql);
extern PACKAGE void * __stdcall (*mysql_list_dbs)(void * mysql, const char * wild);
extern PACKAGE void * __stdcall (*mysql_list_tables)(void * mysql, const char * wild);
extern PACKAGE void * __stdcall (*mysql_list_fields)(void * mysql, const char * table, const char * 
	wild);
extern PACKAGE void * __stdcall (*mysql_list_processes)(void * mysql);
extern PACKAGE void * __stdcall (*mysql_store_result)(void * mysql);
extern PACKAGE void * __stdcall (*mysql_use_result)(void * mysql);
extern PACKAGE int __stdcall (*mysql_options)(void * mysql, TMySqlOption option, const char * arg);
extern PACKAGE void __stdcall (*mysql_free_result)(void * res);
extern PACKAGE void __stdcall (*mysql_data_seek)(void * res, __int64 offset);
extern PACKAGE PMYSQL_ROWS __stdcall (*mysql_row_seek)(void * res, PMYSQL_ROWS Row);
extern PACKAGE unsigned __stdcall (*mysql_field_seek)(void * res, unsigned offset);
extern PACKAGE PMYSQL_ROW __stdcall (*mysql_fetch_row)(void * res);
extern PACKAGE Windows::PLongint __stdcall (*mysql_fetch_lengths)(void * res);
extern PACKAGE PMYSQL_FIELD_V3 __stdcall (*mysql_fetch_field)(void * res);
extern PACKAGE int __stdcall (*mysql_escape_string)(char * szTo, const char * szFrom, int from_length
	);
extern PACKAGE int __stdcall (*mysql_real_escape_string)(void * mysql, char * szTo, const char * szFrom
	, int length);
extern PACKAGE void __stdcall (*mysql_debug)(const char * debug);
extern PACKAGE void __stdcall (*myodbc_remove_escape)(void * mysql, char * name);
extern PACKAGE int __stdcall (*mysql_thread_safe)(void);
extern PACKAGE int __stdcall (*mysql_server_init)(int argc, void * argv, void * groups);
extern PACKAGE void __stdcall (*mysql_server_end)(void);
extern PACKAGE char __stdcall (*mysql_thread_init)(void);
extern PACKAGE void __stdcall (*mysql_thread_end)(void);
#define DefSqlApiDLL "libmysql.dll"
extern PACKAGE AnsiString SqlApiDLL;
extern PACKAGE Sdcommon::TISqlDatabase* __fastcall InitSqlDatabase(Classes::TStrings* ADbParams);
extern PACKAGE void __fastcall LoadSqlLib(void);
extern PACKAGE void __fastcall FreeSqlLib(void);

}	/* namespace Sdmysql */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Sdmysql;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// SDMySql

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -