📄 odbclink.hpp
字号:
__property AnsiString Authentication = {read=fAuthentication, write=fAuthentication};
__property TODBCErrorEvent OnODBCError = {read=fOnODBCError, write=fOnODBCError};
__property AnsiString Version = {read=GetVersion, write=SetVersion};
};
class PASCALIMPLEMENTATION TODBCFieldCollection : public Classes::TCollection
{
typedef Classes::TCollection inherited;
private:
TODBCLink* fodbclink;
public:
__fastcall TODBCFieldCollection(TODBCLink* odbclink);
bool __fastcall HasKey(void);
DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
protected:
virtual void __fastcall Update(Classes::TCollectionItem* Item);
public:
#pragma option push -w-inl
/* TCollection.Destroy */ inline __fastcall virtual ~TODBCFieldCollection(void) { }
#pragma option pop
};
struct TODBCTypeInfo
{
public:
AnsiString datatypename;
AnsiString prefix;
AnsiString suffix;
AnsiString creparams;
} ;
class DELPHICLASS TODBCConnection;
class PASCALIMPLEMENTATION TODBCConnection : public System::TObject
{
typedef System::TObject inherited;
private:
void *henv;
void *hdbc;
void *stmt;
void *querystmt;
Classes::TStrings* strlist;
char info[1025];
char sql[1025];
AnsiString odbctablepath;
AnsiString odbctablename;
TODBCFieldCollection* afieldcollection;
AnsiString fConnectOptions;
AnsiString fAuthentication;
AnsiString fUserID;
public:
__fastcall TODBCConnection(TODBCFieldCollection* afc);
__fastcall virtual ~TODBCConnection(void);
AnsiString __fastcall DriverConnect(HWND wnd, AnsiString cstr);
AnsiString __fastcall BrowseConnect(HWND wnd, AnsiString cstr);
Classes::TStrings* __fastcall DriverConnectFile(HWND wnd, AnsiString drv, AnsiString fname);
Classes::TStrings* __fastcall DSNConnectFile(HWND wnd, AnsiString dsn, AnsiString fname);
int __fastcall FullConnect(AnsiString dsn);
Classes::TStrings* __fastcall DataSources(void);
Classes::TStrings* __fastcall Drivers(void);
Classes::TStrings* __fastcall Tables(void);
bool __fastcall HasTables(void);
int __fastcall NumFields(AnsiString table);
Classes::TStrings* __fastcall Fields(AnsiString table, bool update);
Classes::TStrings* __fastcall Statistics(AnsiString table);
int __fastcall ExecDirect(AnsiString s);
int __fastcall ExecSQL(AnsiString s);
int __fastcall PrepSQL(AnsiString s);
int __fastcall Error(void);
void __fastcall BindCol(int i, int coltype, void * ptr, short sz, int &avail);
bool __fastcall Fetch(void);
int __fastcall GetInfoInt(int i);
AnsiString __fastcall GetInfoStr(int i);
System::TDateTime __fastcall DateField(AnsiString s);
Classes::TStrings* __fastcall DataSourceFileExt(AnsiString ext);
int __fastcall DataSourceFileUse(AnsiString drv);
AnsiString __fastcall DataSourceFilter();
TODBCTypeInfo __fastcall GetTypeInfo(int DatatypeIdx);
int __fastcall BindParam(short parnum, void * par, short parintype, short pardbtype, short parlen);
int __fastcall Exec(void);
int __fastcall FreeSTMT(void);
void __fastcall SetConnectOptions(const AnsiString s);
};
class DELPHICLASS TODBCStatement;
class PASCALIMPLEMENTATION TODBCStatement : public System::TObject
{
typedef System::TObject inherited;
private:
void *sqlstmt;
TODBCConnection* odbcConnection;
public:
__fastcall TODBCStatement(TODBCConnection* aODBCConnection);
__fastcall virtual ~TODBCStatement(void);
bool __fastcall BindCol(int i, int coltype, void * ptr, short sz, int &avail);
int __fastcall BindParam(short parnum, void * par, short parintype, short pardbtype, short parlen);
bool __fastcall Fetch(void);
bool __fastcall ExtendedFetch(Word fetchtype, int row, int &numrows, void * rowstatus);
bool __fastcall Prep(AnsiString s);
bool __fastcall ExecDirect(AnsiString s);
bool __fastcall Execute(void);
bool __fastcall Cancel(void);
int __fastcall Columns(void);
int __fastcall Rows(void);
int __fastcall Error(void);
bool __fastcall SetCursorName(AnsiString cursname);
AnsiString __fastcall GetCursorName();
bool __fastcall SetPos(Word row, Word option, Word lock);
bool __fastcall SetOption(Word option, int param);
int __fastcall Attribute(Word i, Word desc);
};
//-- var, const, procedure ---------------------------------------------------
#define ODBCSUCCESS (Set<Byte, 0, 255> () << 0x0 << 0x1 )
static const Shortint MAJ_VER = 0x0;
static const Shortint MIN_VER = 0x4;
static const Shortint REL_VER = 0x0;
static const Shortint BLD_VER = 0x0;
extern PACKAGE AnsiString __fastcall StrListToPas(char * p, Word len);
extern PACKAGE AnsiString __fastcall GetListParam(AnsiString par, AnsiString s);
extern PACKAGE AnsiString __fastcall ReplaceStr(const AnsiString S, const AnsiString Srch, const AnsiString Replace);
extern PACKAGE AnsiString __fastcall UpcaseStr(const AnsiString S);
extern PACKAGE int __fastcall NCPos(const AnsiString Srch, const AnsiString S);
extern "C" short __stdcall SQLAllocConnect(void * henv, void * &phdbc);
extern "C" short __stdcall SQLAllocEnv(void * &phenv);
extern "C" short __stdcall SQLAllocStmt(void * hdbc, void * &pstmt);
extern "C" short __stdcall SQLBindCol(void * stmt, short icol, short fctype, void * data, int cbmax, int &datalen);
extern "C" short __stdcall SQLBindParameter(void * stmt, Word paramnum, short fparamtype, short ctype, short sqltype, int coldef, short scale, void * buf, int bufsize, void * pbuflen);
extern "C" short __stdcall SQLBrowseConnect(void * hdbc, char * szConnStrIn, short cbConnStrIn, char * szConnStrOut, short cbConnStrOutMax, short &pcbConnStrOut);
extern "C" short __stdcall SQLCancel(void * stmt);
extern "C" short __stdcall SQLConnect(void * hdbc, char * szDSN, short cbDSN, char * szUID, short cbUID, char * szAuth, short cbAuth);
extern "C" short __stdcall SQLDriverConnect(void * hdbc, HWND hwindow, char * ConnStr, short cbStr, char * szCompl, short cbMax, void * cbCompl, Word compl);
extern "C" short __stdcall SQLExecDirect(void * stmt, char * cmd, int cbCMD);
extern "C" short __stdcall SQLExecute(void * stmt);
extern "C" short __stdcall SQLDisconnect(void * hdbc);
extern "C" short __stdcall SQLFreeConnect(void * hdbc);
extern "C" short __stdcall SQLFreeEnv(void * henv);
extern "C" short __stdcall SQLFreeStmt(void * stmt, Word foption);
extern "C" short __stdcall SQLError(void * henv, void * hdbc, void * hstmt, char * state, int &errcode, char * errmsg, Word count, short &pberr);
extern "C" short __stdcall SQLPrepare(void * stmt, char * sqlstr, int cbMax);
extern "C" short __stdcall SQLSetParam(void * stmt, Word paramnum, short ctype, short sqltype, int coldef, int scale, void * buf, void * pbuflen);
extern "C" short __stdcall SQLNumResultCols(void * stmt, short &numcols);
extern "C" short __stdcall SQLDescribeCol(void * stmt, int icol, char * colname, short cbmax, short &pcollen, short &psqltype, short &plcoldef, short &pscale, short &pnull);
extern "C" short __stdcall SQLFetch(void * stmt);
extern "C" short __stdcall SQLExtendedFetch(void * stmt, Word fetchtype, int row, int &numrows, void * rowstatus);
extern "C" short __stdcall SQLTables(void * stmt, char * szTableQualifier, short cbTableQualifier, char * szTableOwner, short cbTableOwner, char * szTableName, short cbTableName, char * szTableType, short cbTableType);
extern "C" short __stdcall SQLColumns(void * stmt, char * szTableQualifier, short cbTableQualifier, char * szTableOwner, short cbTableOwner, char * szTableName, short cbTableName, char * szColumnName, short cbColumnName);
extern "C" short __stdcall SQLGetInfo(void * hdbc, Word finfotype, void * retbuf, short buflen, short &buflenret);
extern "C" short __stdcall SQLGetTypeInfo(void * stmt, Word fsqltype);
extern "C" short __stdcall SQLGetFunctions(void * hdbc, Word functype, void * retfunc);
extern "C" short __stdcall SQLDataSources(void * henv, Word direction, char * szDSN, Word cbDSN, Word &pbDSN, char * szDescr, Word cbDescr, Word &pbDescr);
extern "C" short __stdcall SQLDrivers(void * henv, Word direction, char * szDescr, Word cbDescr, Word &pbDescr, char * szAttr, Word cbAttr, Word &pbAttr);
extern "C" short __stdcall SQLSetConnectOption(void * hdbc, Word fOption, int vParam);
extern "C" short __stdcall SQLSetPos(void * hstmt, Word irow, Word fOption, Word fLock);
extern "C" short __stdcall SQLGetStmtOption(void * hstmt, Word fOption, void * pvParam);
extern "C" short __stdcall SQLSetCursorName(void * hstmt, char * szCursor, short cbCursor);
extern "C" short __stdcall SQLGetCursorName(void * hstmt, char * szCursor, short cbCursorMax, short &pcbCursor);
extern "C" short __stdcall SQLRowCount(void * hstmt, int &pcrow);
extern "C" short __stdcall SQLGetData(void * hstmt, short icol, short fCType, void * rgbValue, int cbValueMax, int &pcbValue);
extern "C" short __stdcall SQLPutData(void * hstmt, void * rgbValue, int cbValue);
extern "C" short __stdcall SQLSetScrollOptions(void * hstmt, Word fConcurrency, int crowKeyset, short crowRowset);
extern "C" short __stdcall SQLSetStmtOption(void * hstmt, Word fOption, int vParam);
extern "C" short __stdcall SQLPrimaryKeys(void * hstmt, char * szTableQualifier, short cbTableQualifier, char * szTableOwner, short cbTableOwner, char * szTableName, short cbTableName);
extern "C" short __stdcall SQLColAttributes(void * hstmt, short icol, short fDesc, void * pDesc, Word cbDesc, Word &pcbDesc, int &pfDesc);
extern "C" short __stdcall SQLStatistics(void * hstmt, char * szTableQualifier, short cbTableQualifier, char * szTableOwner, short cbTableOwner, char * szTableName, short cbTableName, Word fUnique, Word fAccuracy);
extern "C" bool __stdcall SQLConfigDataSource(HWND HWND, Word fRequest, char * lpszDriver, char * lpszAttributes);
} /* namespace Odbclink */
using namespace Odbclink;
#pragma pack(pop)
#pragma option pop
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Odbclink
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -