From 63d98e39cdd210f45199bec764854f0abe2b13d2 Mon Sep 17 00:00:00 2001 From: mtollari Date: Thu, 26 Oct 2017 09:07:39 +0000 Subject: [PATCH] Patch level : 12.0 no-patch Files correlati : Commento : - Creazione nuova cartella per contenere tutte le librerie esterne - Aggiunta nuova libreria sqlapi per interfacciare campo a vari DB git-svn-id: svn://10.65.10.50/branches/R_10_00@24149 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- libraries/SQLAPI/include/SQLAPI.h | 1577 +++ libraries/SQLAPI/include/asa/poppk.h | 60 + libraries/SQLAPI/include/asa/pshpk1.h | 65 + libraries/SQLAPI/include/asa/pshpk2.h | 65 + libraries/SQLAPI/include/asa/pshpk4.h | 65 + libraries/SQLAPI/include/asa/sacapi.h | 927 ++ libraries/SQLAPI/include/asa/sqlca.h | 399 + libraries/SQLAPI/include/asa/sqlcallback.h | 76 + libraries/SQLAPI/include/asa/sqlfuncs.h | 104 + libraries/SQLAPI/include/asa/sqlos.h | 134 + libraries/SQLAPI/include/asaAPI.h | 122 + libraries/SQLAPI/include/db2API.h | 593 + libraries/SQLAPI/include/db2_win/sql.h | 2845 ++++ libraries/SQLAPI/include/db2_win/sqlca.h | 119 + libraries/SQLAPI/include/db2_win/sqlcli.h | 807 ++ libraries/SQLAPI/include/db2_win/sqlcli1.h | 1549 +++ libraries/SQLAPI/include/db2_win/sqlext.h | 2065 +++ libraries/SQLAPI/include/db2_win/sqlsystm.h | 115 + libraries/SQLAPI/include/ibAPI.h | 991 ++ libraries/SQLAPI/include/ibase/ib_util.h | 37 + libraries/SQLAPI/include/ibase/ibase.h | 2549 ++++ libraries/SQLAPI/include/ibase/iberror.h | 1739 +++ libraries/SQLAPI/include/infAPI.h | 432 + libraries/SQLAPI/include/informix/infxcli.h | 310 + libraries/SQLAPI/include/informix/infxsql.h | 1505 +++ libraries/SQLAPI/include/informix/sqlext.h | 2069 +++ libraries/SQLAPI/include/myAPI.h | 303 + libraries/SQLAPI/include/mysql/errmsg.h | 112 + libraries/SQLAPI/include/mysql/my_alloc.h | 60 + libraries/SQLAPI/include/mysql/my_list.h | 45 + libraries/SQLAPI/include/mysql/mysql.h | 739 + libraries/SQLAPI/include/mysql/mysql_com.h | 602 + libraries/SQLAPI/include/mysql/mysql_time.h | 55 + .../SQLAPI/include/mysql/mysql_version.h | 32 + libraries/SQLAPI/include/mysql/typelib.h | 54 + libraries/SQLAPI/include/odbcAPI.h | 472 + libraries/SQLAPI/include/odbc_win/sql.h | 839 ++ libraries/SQLAPI/include/odbc_win/sqlext.h | 2069 +++ libraries/SQLAPI/include/odbc_win/sqltypes.h | 305 + libraries/SQLAPI/include/odbc_win/sqlucode.h | 817 ++ libraries/SQLAPI/include/ora7API.h | 201 + libraries/SQLAPI/include/oraAPI.h | 532 + libraries/SQLAPI/include/ora_win/nzerror.h | 674 + libraries/SQLAPI/include/ora_win/nzt.h | 2387 ++++ libraries/SQLAPI/include/ora_win/oci.h | 3045 +++++ libraries/SQLAPI/include/ora_win/oci1.h | 182 + libraries/SQLAPI/include/ora_win/oci8dp.h | 317 + libraries/SQLAPI/include/ora_win/ociap.h | 11122 ++++++++++++++++ libraries/SQLAPI/include/ora_win/ociapr.h | 155 + libraries/SQLAPI/include/ora_win/ocidef.h | 886 ++ libraries/SQLAPI/include/ora_win/ocidem.h | 113 + libraries/SQLAPI/include/ora_win/ocidfn.h | 249 + libraries/SQLAPI/include/ora_win/ociextp.h | 282 + libraries/SQLAPI/include/ora_win/ocikpr.h | 165 + libraries/SQLAPI/include/ora_win/ocixml.h | 188 + libraries/SQLAPI/include/ora_win/ocixmldb.h | 141 + libraries/SQLAPI/include/ora_win/ocixstream.h | 1899 +++ libraries/SQLAPI/include/ora_win/odci.h | 798 ++ libraries/SQLAPI/include/ora_win/oratypes.h | 322 + libraries/SQLAPI/include/ora_win/ori.h | 2095 +++ libraries/SQLAPI/include/ora_win/orid.h | 373 + libraries/SQLAPI/include/ora_win/orl.h | 3633 +++++ libraries/SQLAPI/include/ora_win/oro.h | 883 ++ libraries/SQLAPI/include/ora_win/ort.h | 2594 ++++ libraries/SQLAPI/include/ora_win/xa.h | 200 + libraries/SQLAPI/include/pgAPI.h | 290 + libraries/SQLAPI/include/pgsql/libpq-fe.h | 587 + libraries/SQLAPI/include/pgsql/libpq-fs.h | 24 + .../SQLAPI/include/pgsql/pg_config_ext.h | 11 + libraries/SQLAPI/include/pgsql/postgres_ext.h | 69 + libraries/SQLAPI/include/samisc.h | 144 + libraries/SQLAPI/include/sbAPI.h | 514 + libraries/SQLAPI/include/sl3API.h | 262 + libraries/SQLAPI/include/sqlbase/sql.h | 1834 +++ libraries/SQLAPI/include/sqlite/sqlite3.h | 5734 ++++++++ libraries/SQLAPI/include/ss6API.h | 375 + libraries/SQLAPI/include/ssNcliAPI.h | 561 + libraries/SQLAPI/include/ssOleDbAPI.h | 46 + libraries/SQLAPI/include/ss_win/sqldb.h | 255 + libraries/SQLAPI/include/ss_win/sqlfront.h | 795 ++ libraries/SQLAPI/include/ss_win/sqlncli.h | 4645 +++++++ libraries/SQLAPI/include/ss_win/sqloledb.h | 867 ++ libraries/SQLAPI/include/sybAPI.h | 649 + libraries/SQLAPI/include/sybase/bkpublic.h | 291 + libraries/SQLAPI/include/sybase/csconfig.h | 165 + libraries/SQLAPI/include/sybase/cspublic.h | 1952 +++ libraries/SQLAPI/include/sybase/cstypes.h | 1216 ++ libraries/SQLAPI/include/sybase/ctpublic.h | 478 + libraries/SQLAPI/include/sybase/sqlca.h | 38 + libraries/SQLAPI/include/sybase/sqlda.h | 44 + 90 files changed, 83105 insertions(+) create mode 100644 libraries/SQLAPI/include/SQLAPI.h create mode 100644 libraries/SQLAPI/include/asa/poppk.h create mode 100644 libraries/SQLAPI/include/asa/pshpk1.h create mode 100644 libraries/SQLAPI/include/asa/pshpk2.h create mode 100644 libraries/SQLAPI/include/asa/pshpk4.h create mode 100644 libraries/SQLAPI/include/asa/sacapi.h create mode 100644 libraries/SQLAPI/include/asa/sqlca.h create mode 100644 libraries/SQLAPI/include/asa/sqlcallback.h create mode 100644 libraries/SQLAPI/include/asa/sqlfuncs.h create mode 100644 libraries/SQLAPI/include/asa/sqlos.h create mode 100644 libraries/SQLAPI/include/asaAPI.h create mode 100644 libraries/SQLAPI/include/db2API.h create mode 100644 libraries/SQLAPI/include/db2_win/sql.h create mode 100644 libraries/SQLAPI/include/db2_win/sqlca.h create mode 100644 libraries/SQLAPI/include/db2_win/sqlcli.h create mode 100644 libraries/SQLAPI/include/db2_win/sqlcli1.h create mode 100644 libraries/SQLAPI/include/db2_win/sqlext.h create mode 100644 libraries/SQLAPI/include/db2_win/sqlsystm.h create mode 100644 libraries/SQLAPI/include/ibAPI.h create mode 100644 libraries/SQLAPI/include/ibase/ib_util.h create mode 100644 libraries/SQLAPI/include/ibase/ibase.h create mode 100644 libraries/SQLAPI/include/ibase/iberror.h create mode 100644 libraries/SQLAPI/include/infAPI.h create mode 100644 libraries/SQLAPI/include/informix/infxcli.h create mode 100644 libraries/SQLAPI/include/informix/infxsql.h create mode 100644 libraries/SQLAPI/include/informix/sqlext.h create mode 100644 libraries/SQLAPI/include/myAPI.h create mode 100644 libraries/SQLAPI/include/mysql/errmsg.h create mode 100644 libraries/SQLAPI/include/mysql/my_alloc.h create mode 100644 libraries/SQLAPI/include/mysql/my_list.h create mode 100644 libraries/SQLAPI/include/mysql/mysql.h create mode 100644 libraries/SQLAPI/include/mysql/mysql_com.h create mode 100644 libraries/SQLAPI/include/mysql/mysql_time.h create mode 100644 libraries/SQLAPI/include/mysql/mysql_version.h create mode 100644 libraries/SQLAPI/include/mysql/typelib.h create mode 100644 libraries/SQLAPI/include/odbcAPI.h create mode 100644 libraries/SQLAPI/include/odbc_win/sql.h create mode 100644 libraries/SQLAPI/include/odbc_win/sqlext.h create mode 100644 libraries/SQLAPI/include/odbc_win/sqltypes.h create mode 100644 libraries/SQLAPI/include/odbc_win/sqlucode.h create mode 100644 libraries/SQLAPI/include/ora7API.h create mode 100644 libraries/SQLAPI/include/oraAPI.h create mode 100644 libraries/SQLAPI/include/ora_win/nzerror.h create mode 100644 libraries/SQLAPI/include/ora_win/nzt.h create mode 100644 libraries/SQLAPI/include/ora_win/oci.h create mode 100644 libraries/SQLAPI/include/ora_win/oci1.h create mode 100644 libraries/SQLAPI/include/ora_win/oci8dp.h create mode 100644 libraries/SQLAPI/include/ora_win/ociap.h create mode 100644 libraries/SQLAPI/include/ora_win/ociapr.h create mode 100644 libraries/SQLAPI/include/ora_win/ocidef.h create mode 100644 libraries/SQLAPI/include/ora_win/ocidem.h create mode 100644 libraries/SQLAPI/include/ora_win/ocidfn.h create mode 100644 libraries/SQLAPI/include/ora_win/ociextp.h create mode 100644 libraries/SQLAPI/include/ora_win/ocikpr.h create mode 100644 libraries/SQLAPI/include/ora_win/ocixml.h create mode 100644 libraries/SQLAPI/include/ora_win/ocixmldb.h create mode 100644 libraries/SQLAPI/include/ora_win/ocixstream.h create mode 100644 libraries/SQLAPI/include/ora_win/odci.h create mode 100644 libraries/SQLAPI/include/ora_win/oratypes.h create mode 100644 libraries/SQLAPI/include/ora_win/ori.h create mode 100644 libraries/SQLAPI/include/ora_win/orid.h create mode 100644 libraries/SQLAPI/include/ora_win/orl.h create mode 100644 libraries/SQLAPI/include/ora_win/oro.h create mode 100644 libraries/SQLAPI/include/ora_win/ort.h create mode 100644 libraries/SQLAPI/include/ora_win/xa.h create mode 100644 libraries/SQLAPI/include/pgAPI.h create mode 100644 libraries/SQLAPI/include/pgsql/libpq-fe.h create mode 100644 libraries/SQLAPI/include/pgsql/libpq-fs.h create mode 100644 libraries/SQLAPI/include/pgsql/pg_config_ext.h create mode 100644 libraries/SQLAPI/include/pgsql/postgres_ext.h create mode 100644 libraries/SQLAPI/include/samisc.h create mode 100644 libraries/SQLAPI/include/sbAPI.h create mode 100644 libraries/SQLAPI/include/sl3API.h create mode 100644 libraries/SQLAPI/include/sqlbase/sql.h create mode 100644 libraries/SQLAPI/include/sqlite/sqlite3.h create mode 100644 libraries/SQLAPI/include/ss6API.h create mode 100644 libraries/SQLAPI/include/ssNcliAPI.h create mode 100644 libraries/SQLAPI/include/ssOleDbAPI.h create mode 100644 libraries/SQLAPI/include/ss_win/sqldb.h create mode 100644 libraries/SQLAPI/include/ss_win/sqlfront.h create mode 100644 libraries/SQLAPI/include/ss_win/sqlncli.h create mode 100644 libraries/SQLAPI/include/ss_win/sqloledb.h create mode 100644 libraries/SQLAPI/include/sybAPI.h create mode 100644 libraries/SQLAPI/include/sybase/bkpublic.h create mode 100644 libraries/SQLAPI/include/sybase/csconfig.h create mode 100644 libraries/SQLAPI/include/sybase/cspublic.h create mode 100644 libraries/SQLAPI/include/sybase/cstypes.h create mode 100644 libraries/SQLAPI/include/sybase/ctpublic.h create mode 100644 libraries/SQLAPI/include/sybase/sqlca.h create mode 100644 libraries/SQLAPI/include/sybase/sqlda.h diff --git a/libraries/SQLAPI/include/SQLAPI.h b/libraries/SQLAPI/include/SQLAPI.h new file mode 100644 index 000000000..dc6b55fc1 --- /dev/null +++ b/libraries/SQLAPI/include/SQLAPI.h @@ -0,0 +1,1577 @@ +#if !defined(__SQLAPI_H__) +#define __SQLAPI_H__ + +#ifdef SQLAPI_EXPORTS +#define SQLAPI_API __declspec(dllexport) +#else +#define SQLAPI_API +#endif + +#ifdef SQLAPI_DECL_THROW +#define SQLAPI_THROW(x) throw(x) +#else +#define SQLAPI_THROW(x) +#endif + +#if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) || defined(_WINDOWS) || defined(_WINDOWS_) +#define SQLAPI_WINDOWS +#include +#endif + +#if !defined(SQLAPI_WINDOWS) || defined (CYGWIN) +#include +#include +#endif + +#ifndef SQLAPI_WINDOWS +#include +#endif + +#ifdef UNDER_CE +#include +#else +#include +#include +#endif +#include +#include +#include + +#ifdef SQLAPI_WINDOWS +// 64-bit integer +typedef __int64 sa_int64_t; +typedef unsigned __int64 sa_uint64_t; +// SQLAPI callback naming +#define SQLAPI_CALLBACK __cdecl +#else +// 64-bit integer +typedef long long int sa_int64_t; +typedef unsigned long long int sa_uint64_t; +// SQLAPI callback naming +#define SQLAPI_CALLBACK +#endif // ! SQLAPI_WINDOWS + +#ifdef SA_USE_STL +#include +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX UINT_MAX +#endif + +class ISAClient; +class ISAConnection; +class ISACursor; + +class SAMutex; + +class SAConnection; +class SACommand; +struct sa_Commands; +class saOptions; +class SAParam; +class SAField; + +class SAException; + +class saPlaceHolder; + +class SABytes; +class SALongBinary; +class SALongChar; +class SABLob; +class SACLob; +class SAValueRead; + +//! \addtogroup enums SQLAPI++ defined enums +//! \{ + +typedef + enum eSAClient +{ + //! DBMS client is not specified + SA_Client_NotSpecified, + //! ODBC + SA_ODBC_Client, + //! Oracle + SA_Oracle_Client, + //! Microsoft SQL Server + SA_SQLServer_Client, + //! InterBase or Firebird + SA_InterBase_Client, + //! SQLBase + SA_SQLBase_Client, + //! IBM DB2 + SA_DB2_Client, + //! Informix + SA_Informix_Client, + //! Sybase ASE + SA_Sybase_Client, + //! MySQL + SA_MySQL_Client, + //! PostgreSQL + SA_PostgreSQL_Client, + //! SQLite + SA_SQLite_Client, + //! SQL Anywere + SA_SQLAnywhere_Client, + _SA_Client_Reserverd = (int)(((unsigned int)(-1))/2) +} SAClient_t; + +typedef + enum eSAErrorClass +{ + //! no error occurred + SA_No_Error, + //! user-generated error + SA_UserGenerated_Error, + //! the Library-generated error + SA_Library_Error, + //! DBMS API error occured + SA_DBMS_API_Error, + _SA_ErrorClass_Reserved = (int)(((unsigned int)(-1))/2) +} SAErrorClass_t; + +typedef + enum eSAIsolationLevel +{ + //! the default(unknown) isolation level + SA_LevelUnknown = -1, + //! standard ANSI isolation level 0 + SA_ANSILevel0, + //! standard ANSI isolation level 1 + SA_ANSILevel1, + //! standard ANSI isolation level 2 + SA_ANSILevel2, + //! standard ANSI isolation level 3 + SA_ANSILevel3, + //! isolation level 'Read Uncommitted' + SA_ReadUncommitted = SA_ANSILevel0, + //! isolation level 'Read Committed' + SA_ReadCommitted = SA_ANSILevel1, + //! isolation level 'Repeatable Read' + SA_RepeatableRead = SA_ANSILevel2, + //! isolation level 'Serializable' + SA_Serializable = SA_ANSILevel3, + _SA_IsolationLevel_Reserved = (int)(((unsigned int)(-1))/2) +} SAIsolationLevel_t; + +typedef + enum eSAAutoCommit +{ + //! the default(unknown) auto-commit mode + SA_AutoCommitUnknown = -1, + //! auto-commit mode is off + SA_AutoCommitOff, + //! auto-commit mode is on + SA_AutoCommitOn, + _SA_AutoCommit_Reserved = (int)(((unsigned int)(-1))/2) +} SAAutoCommit_t; + +typedef + enum eSADataType +{ + SA_dtUnknown, + SA_dtBool, + SA_dtShort, + SA_dtUShort, + SA_dtLong, + SA_dtULong, + SA_dtDouble, + SA_dtNumeric, + SA_dtDateTime, + SA_dtInterval, + SA_dtString, + SA_dtBytes, + SA_dtLongBinary, + SA_dtLongChar, + SA_dtBLob, + SA_dtCLob, + SA_dtCursor, + SA_dtSpecificToDBMS, + _SA_DataType_Reserved = (int)(((unsigned int)(-1))/2) +} SADataType_t; + +typedef + enum eSACommandType +{ + //! command type is not defined + SA_CmdUnknown, + //! command is an SQL statement (with or without parameters) + SA_CmdSQLStmt, + //! command is a raw SQL statement and not interpreted by SQLAPI++ + SA_CmdSQLStmtRaw, + //! command is a stored procedure or a function + SA_CmdStoredProc, + _SA_Cmd_Reserved = (int)(((unsigned int)(-1))/2) +} SACommandType_t; + +typedef + enum eSAParamDirType +{ + SA_ParamInput, + SA_ParamInputOutput, + SA_ParamOutput, + SA_ParamReturn, + _SA_ParamDirType_Reserved = (int)(((unsigned int)(-1))/2) +} SAParamDirType_t; + +typedef + enum eSALongOrLobReaderModes +{ + SA_LongOrLobReaderDefault, + SA_LongOrLobReaderManual, + _SA_LongOrLobReaderModes_Reserved = (int)(((unsigned int)(-1))/2) +} SALongOrLobReaderModes_t; + +typedef + enum eSAPieceType +{ + SA_FirstPiece = 1, + SA_NextPiece = 2, + SA_LastPiece = 3, + SA_OnePiece = 4, + _SA_Reserved_PieceType = (int)(((unsigned int)(-1))/2) +} SAPieceType_t; + +typedef + enum eSAConnectionHandlerType +{ + //! The handles is called after DBMS connection structures is allocated + SA_PreConnectHandler, + //! The handles is called after DBMS connection is esteblished + SA_PostConnectHandler +} SAConnectionHandlerType_t; + +//! \} + +//! \addtogroup typedefs SQLAPI++ defined types +//! \{ + +//! Callback for exception pre-handling +typedef bool (SQLAPI_CALLBACK *PreHandleException_t)(SAException &x, void* pAddlData); + +//! Long or LOB writer callback, use for parameter binding +typedef size_t (SQLAPI_CALLBACK *saLongOrLobWriter_t)(SAPieceType_t &ePieceType, void *pBuf, size_t nLen, void *pAddlData); + +//! Long or LOB reader callback, use for field fetching +typedef void (SQLAPI_CALLBACK *saLongOrLobReader_t)(SAPieceType_t ePieceType, void *pBuf, size_t nLen, size_t nBlobSize, void *pAddlData); + +//! DBMS connection handling callback +typedef void (SQLAPI_CALLBACK *saConnectionHandler_t)(SAConnection &con, SAConnectionHandlerType_t eHandlerType); + +//! \} + +typedef void (SQLAPI_CALLBACK *EnumCursors_t)(ISACursor *, void *); + +class SQLAPI_API saAPI +{ +protected: + saAPI(); +public: + virtual ~saAPI(); +}; + +class SQLAPI_API saConnectionHandles +{ +protected: + saConnectionHandles(); +public: + virtual ~saConnectionHandles(); +}; + +class SQLAPI_API saCommandHandles +{ +protected: + saCommandHandles(); +public: + virtual ~saCommandHandles(); +}; + +#if defined(SA_UNICODE) +#define _TSA(x) L ## x +typedef wchar_t SAChar; +#else +typedef char SAChar; +#define _TSA(x) x +#endif + +struct SAStringData; + +//! Provides support for manipulating character values +class SQLAPI_API SAString +{ +public: + // Constructors + //! Constructs an empty SAString + SAString(); + //! Copy constructor + SAString(const SAString &stringSrc); + //! Initializes SAString from a single character + SAString(SAChar ch, size_t nRepeat = 1); + //! Initializes SAString from an ANSI (multibyte) string (converts to SAChar) + SAString(const char *lpsz); + //! Initializes SAString from a UNICODE string (converts to SAChar) + SAString(const wchar_t *lpsz); + //! Initializes SAString from subset of characters from an ANSI (multibyte) string (converts to SAChar) + SAString(const char *lpch, size_t nLength); + //! Initializes SAString from subset of characters from a UNICODE string (converts to SAChar) + SAString(const wchar_t *lpch, size_t nLength); + //! Initializes SAString from unsigned characters (converts to SAChar) + SAString(const unsigned char *psz); + //! Special constructor for binary data (no converion to SAChar) + SAString(const void *pBuffer, size_t nLengthInBytes); + + // Attributes & Operations + + //! Get the data length (in characters). + size_t GetLength() const; + //! True if zero length + bool IsEmpty() const; + //! Clear contents to empty + void Empty(); + + //! Return pointer to const string + operator const SAChar *() const; + + // overloaded assignment + + //! Ref-counted copy from another SAString + const SAString &operator =(const SAString &sSrc); + //! Set string content to single character + const SAString &operator=(SAChar ch); +#ifdef SA_UNICODE + const SAString &operator=(char ch); +#endif + //! Copy string content from ANSI (multibyte) string (converts to SAChar) + const SAString &operator=(const char *lpsz); + //! Copy string content from UNICODE string (converts to SAChar) + const SAString &operator=(const wchar_t *lpsz); + //! Copy string content from unsigned chars + const SAString &operator=(const unsigned char *psz); + + // string concatenation + + //! Concatenate from another SAString + const SAString &operator+=(const SAString &string); + //! Concatenate a single character + const SAString &operator+=(SAChar ch); +#ifdef SA_UNICODE + // concatenate an ANSI character after converting it to SAChar + const SAString &operator+=(char ch); +#endif + //! Concatenate from a SAChar string + const SAString &operator+=(const SAChar *lpsz); + + friend SAString SQLAPI_API operator+(const SAString &string1, const SAString &string2); + friend SAString SQLAPI_API operator+(const SAString &string, SAChar ch); + friend SAString SQLAPI_API operator+(SAChar ch, const SAString &string); +#ifdef SA_UNICODE + friend SAString SQLAPI_API operator+(const SAString &string, char ch); + friend SAString SQLAPI_API operator+(char ch, const SAString &string); +#endif + friend SAString SQLAPI_API operator+(const SAString &string, const SAChar *lpsz); + friend SAString SQLAPI_API operator+(const SAChar *lpsz, const SAString &string); + + // string comparison + + //! Straight character comparison + int Compare(const SAChar *lpsz) const; + //! Compare ignoring case + int CompareNoCase(const SAChar *lpsz) const; +#ifndef UNDER_CE + //! NLS aware comparison, case sensitive + int Collate(const SAChar *lpsz) const; +#endif + + //! Convert the object to an uppercase + void MakeUpper(); + //! Convert the object to an lowercase + void MakeLower(); + + // simple sub-string extraction + + //! Return all characters starting at zero-based nFirst + SAString Mid(size_t nFirst) const; + //! Return nCount characters starting at zero-based nFirst + SAString Mid(size_t nFirst, size_t nCount) const; + //! Return first nCount characters in string + SAString Left(size_t nCount) const; + //! Return nCount characters from end of string + SAString Right(size_t nCount) const; + //! Return the character at the specified string position + SAChar GetAt(size_t nPos) const; + + // trimming whitespace (either side) + + //! Remove whitespace starting from right edge + void TrimRight(); + //! Remove whitespace starting from left side + void TrimLeft(); + + // trimming anything (either side) + + //! Remove continuous occurrences of chTarget starting from right + void TrimRight(SAChar chTarget); + //! Remove continuous occcurrences of characters in passed string, + // starting from right + void TrimRight(const SAChar *lpszTargets); + //! Remove continuous occurrences of chTarget starting from left + void TrimLeft(SAChar chTarget); + //! Remove continuous occcurrences of characters in + // passed string, starting from left + void TrimLeft(const SAChar *lpszTargets); + + // advanced manipulation + + // replace occurrences of substring lpszOld with lpszNew; + // empty lpszNew removes instances of lpszOld + size_t Replace(const SAChar *lpszOld, const SAChar *lpszNew); + // insert character at zero-based index; concatenates + // if index is past end of string + size_t Insert(size_t nIndex, SAChar ch); + // insert substring at zero-based index; concatenates + // if index is past end of string + size_t Insert(size_t nIndex, const SAChar *pstr); + // delete nCount characters starting at zero-based index + size_t Delete(size_t nIndex, size_t nCount = 1); + + // searching + + // find character starting at left, SIZ if not found + size_t Find(SAChar ch) const; + // find character starting at right + size_t ReverseFind(SAChar ch) const; + // find character starting at zero-based index and going right + size_t Find(SAChar ch, size_t nStart) const; + // find first instance of any character in passed string + size_t FindOneOf(const SAChar *lpszCharSet) const; + // find first instance of substring + size_t Find(const SAChar *lpszSub) const; + // find first instance of substring starting at zero-based index + size_t Find(const SAChar *lpszSub, size_t nStart) const; + + // simple formatting + + // printf-like formatting using passed string + void Format(const SAChar *lpszFormat, ...); + // printf-like formatting using variable arguments parameter + void FormatV(const SAChar *, va_list argList); + + // Access to string implementation buffer as "C" character array + + // get pointer to modifiable buffer at least as long as nMinBufLength + SAChar *GetBuffer(size_t nMinBufLength); + // release buffer, setting length to nNewLength (or to first null if SIZE_MAX) + void ReleaseBuffer(size_t nNewLength = SIZE_MAX); + + // Use LockBuffer/UnlockBuffer to turn refcounting off + + // turn refcounting off + SAChar *LockBuffer(); + // turn refcounting back on + void UnlockBuffer(); + + // Special buffer access routines to manipulate binary data + + // get binary data length (in bytes) + size_t GetBinaryLength() const; + // return pointer to const binary data buffer + operator const void *() const; + // get pointer to modifiable binary data buffer at least as long as nMinBufLengthInBytes + void *GetBinaryBuffer(size_t nMinBufLengthInBytes); + // release buffer, setting length to nNewLength (or to first nul if -1) + void ReleaseBinaryBuffer(size_t nNewLengthInBytes); + + // return pointer to const Unicode string, convert if needed + const wchar_t *GetWideChars() const; + // get string length (in Unicode characters) + size_t GetWideCharsLength() const; + // return pointer to const multibyte string, convert if needed + const char *GetMultiByteChars() const; + // get string length (in multibyte characters) + size_t GetMultiByteCharsLength() const; + + // Special conversion functions (multibyte <-> Unicode) +#ifdef SA_UNICODE + // return pointer to const UTF8 string + const char *GetUTF8Chars() const; + // get string length (in UTF8 characters) + size_t GetUTF8CharsLength() const; + // assing UTF8 data + void SetUTF8Chars(const char* szSrc, size_t nSrcLen = SIZE_MAX); +#endif // SA_UNICODE + // return pointer to const UTF16 string + const void *GetUTF16Chars() const; + // get string length (in UTF16 characters) + size_t GetUTF16CharsLength() const; + // assing UTF16 data + void SetUTF16Chars(const void* szSrc, size_t nSrcLen = SIZE_MAX); + + // Implementation +public: + ~SAString(); + +protected: + SAChar *m_pchData; // pointer to ref counted string data + + // implementation helpers + SAStringData *GetData() const; + void Init(); + void AllocBuffer(size_t nLen); +#ifdef SA_UNICODE + void AssignBinaryCopy(size_t nSrcLenInBytes, const void *pSrcData); + void ConcatBinaryCopy(size_t nSrc1LenInBytes, const void *pSrc1Data, size_t nSrc2LenInBytes, const void *pSrc2Data); + void ConcatBinaryInPlace(size_t nSrcLen, const void *pData); +#endif // SA_UNICODE + void AssignCopy(size_t nSrcLen, const SAChar *lpszSrcData); + void ConcatCopy(size_t nSrc1Len, const SAChar *lpszSrc1Data, size_t nSrc2Len, const SAChar *lpszSrc2Data); + void ConcatInPlace(size_t nSrcLen, const SAChar *lpszSrcData); + + void CopyBeforeWrite(); + void AllocBeforeWrite(size_t nLen); + void Release(); + static void Release(SAStringData *pData); + static size_t SafeStrlen(const SAChar *lpsz); + static void FreeData(SAStringData *pData); + +#ifdef SA_USE_STL +public: + SAString(const std::string &stringSrc); + SAString(const std::wstring &stringSrc); + const SAString &operator=(const std::string &stringSrc); + const SAString &operator=(const std::wstring &stringSrc); + const SAString &operator+=(const std::string &stringSrc); + const SAString &operator+=(const std::wstring &stringSrc); +#endif +}; + +// Compare helpers +bool SQLAPI_API operator==(const SAString &s1, const SAString &s2); +bool SQLAPI_API operator==(const SAString &s1, const SAChar *s2); +bool SQLAPI_API operator==(const SAChar *s1, const SAString &s2); +bool SQLAPI_API operator!=(const SAString &s1, const SAString &s2); +bool SQLAPI_API operator!=(const SAString &s1, const SAChar *s2); +bool SQLAPI_API operator!=(const SAChar *s1, const SAString &s2); +bool SQLAPI_API operator<(const SAString &s1, const SAString &s2); +bool SQLAPI_API operator<(const SAString &s1, const SAChar *s2); +bool SQLAPI_API operator<(const SAChar *s1, const SAString &s2); +bool SQLAPI_API operator>(const SAString &s1, const SAString &s2); +bool SQLAPI_API operator>(const SAString &s1, const SAChar *s2); +bool SQLAPI_API operator>(const SAChar *s1, const SAString &s2); +bool SQLAPI_API operator<=(const SAString &s1, const SAString &s2); +bool SQLAPI_API operator<=(const SAString &s1, const SAChar *s2); +bool SQLAPI_API operator<=(const SAChar *s1, const SAString &s2); +bool SQLAPI_API operator>=(const SAString &s1, const SAString &s2); +bool SQLAPI_API operator>=(const SAString &s1, const SAChar *s2); +bool SQLAPI_API operator>=(const SAChar *s1, const SAString &s2); + + +class SQLAPI_API SANull +{ +}; + +#define SA_NUMERIC_MANTISSA_SIZE 32 +class SQLAPI_API SANumeric +{ + void InitZero(); + bool setFromPlainString(const SAChar *sVal); + bool setFromExpString(const SAString &sVal); + +public: + SANumeric(); // default constructor, initializes to zero + + SANumeric(double dVal); // initializes from double + SANumeric &operator=(double); // reinitializes from double + operator double() const; // converts to double + + SANumeric(sa_int64_t iVal); // initializes from 64-bit integer + SANumeric(sa_uint64_t iVal); + SANumeric &operator=(sa_int64_t); // reinitializes from 64-bit integer + SANumeric &operator=(sa_uint64_t); + operator sa_int64_t() const; // converts to 64-bit integer + operator sa_uint64_t() const; + + SANumeric &operator=(const SAChar *sVal); // reinitializes from string + operator SAString() const; // converts to string + +public: + unsigned char precision; // the maximum number of digits in base 10 + unsigned char scale; // the number of digits to the right of the decimal point + unsigned char sign; // the sign: 1 for positive numbers, 0 for negative numbers + + // a number stored as SA_NUMERIC_MANTISSA_SIZE-byte scaled integer, with the least-significant byte on the left + unsigned char val[SA_NUMERIC_MANTISSA_SIZE]; +}; + +class SQLAPI_API SAInterval +{ +public: + SAInterval(); + SAInterval(double dVal); + SAInterval(long nDays, int nHours, int nMins, int nSecs); + SAInterval(long nDays, int nHours, int nMins, int nSecs, unsigned int nNanoSeconds); + + double GetTotalDays() const; + double GetTotalHours() const; + double GetTotalMinutes() const; + double GetTotalSeconds() const; + + long GetDays() const; + long GetHours() const; + long GetMinutes() const; + long GetSeconds() const; + + unsigned int Fraction() const; + + SAInterval& operator=(double dVal); + + SAInterval operator+(const SAInterval& interval) const; + SAInterval operator-(const SAInterval& interval) const; + SAInterval& operator+=(const SAInterval interval); + SAInterval& operator-=(const SAInterval interval); + SAInterval operator-() const; + + operator double() const; + + operator SAString() const; + + void SetInterval(long nDays, int nHours, int nMins, int nSecs, unsigned int nNanoSeconds); + +private: + double m_interval; + unsigned int m_nFraction; // 0..999999999 +}; + +//! Provides support for manipulating date/time values +class SQLAPI_API SADateTime +{ + friend class SAValueRead; + + static int m_saMonthDays[13]; + +protected: + static bool DateFromTm( + unsigned short wYear, unsigned short wMonth, unsigned short wDay, + unsigned short wHour, unsigned short wMinute, unsigned short wSecond, + unsigned int nNanoSecond, + double &dtDest); + static bool TmFromDate( + double dtSrc, + struct tm &tmDest, unsigned int &nNanoSecond); + +protected: + void Init_Tm(); + void Init(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, unsigned int nFraction, const SAChar* timezone); + struct tm m_tm; + unsigned int m_nFraction; // 0..999999999 + SAString m_timezone; + +public: + SADateTime(); + SADateTime(int nYear, int nMonth, int nDay); + SADateTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec); + SADateTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, unsigned int nFraction); + SADateTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, const SAChar* timezone); + SADateTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, unsigned int nFraction, const SAChar* timezone); + SADateTime(int nHour, int nMin, int nSec, unsigned int nFraction); + SADateTime(const struct tm &tmValue); + SADateTime(double dt); +#ifndef UNDER_CE + SADateTime(const struct timeb &tmbValue); + SADateTime(const struct timeval &tmvValue); +#endif +#ifdef SQLAPI_WINDOWS + SADateTime(SYSTEMTIME &st); +#endif + SADateTime(const SADateTime &other); + + operator struct tm &(); + operator struct tm() const; + operator double() const; + operator SAString() const; + + int GetYear() const; // year, f.ex., 1999, 2000 + int GetMonth() const; // 1..12 + int GetDay() const; // 1..31 + int GetHour() const; // 0..23 + int GetMinute() const; // 0..59 + int GetSecond() const; // 0..59 + int GetDayOfWeek() const; // 1..7, 1=Sunday, 2=Monday, and so on + int GetDayOfYear() const; // 1..366, where January 1 = 1 + + unsigned int &Fraction(); + unsigned int Fraction() const; + + SAString& Timezone(); + const SAChar* Timezone() const; + +#ifndef UNDER_CE + void GetTimeValue(struct timeb &tmv); + void GetTimeValue(struct timeval &tmv); +#endif +#ifdef SQLAPI_WINDOWS + void GetTimeValue(SYSTEMTIME &st); +#endif + + //! Return the current date/time value + static SADateTime SQLAPI_CALLBACK currentDateTime(); + static SADateTime SQLAPI_CALLBACK currentDateTimeWithFraction(); + + SADateTime operator+(SAInterval interval) const; + SADateTime operator-(SAInterval interval) const; + SADateTime& operator+=(SAInterval interval); + SADateTime& operator-=(SAInterval interval); + + SAInterval operator-(const SADateTime& dt) const; +}; + +class SQLAPI_API SAPos +{ + friend class SACommand; + + SAString m_sName; + +public: + SAPos(int nByID); + SAPos(const SAString& sByName); +}; + +class SQLAPI_API saOptions +{ + int m_nOptionCount; + SAParam **m_ppOptions; + +private: + // disable copy constructor + saOptions(const saOptions &); + // disable assignment operator + saOptions &operator = (const saOptions &); + +public: + saOptions(); + virtual ~saOptions(); + + SAString &operator[](const SAString &sOptionName); + SAString operator[](const SAString &sOptionName) const; +}; + +//! Represents an unique session with a data source +class SQLAPI_API SAConnection +{ + friend class SACommand; + friend class SAField; + friend class SAParam; + friend class ISAConnection; + friend class Iora7Connection; + friend class Iora8Connection; + friend class ora8ExternalConnection; + +private: + // disable copy constructor + SAConnection(const SAConnection &); + // disable assignment operator + SAConnection &operator = (const SAConnection &); + + SAClient_t m_eSAClient; + ISAConnection *m_pISAConnection; + SAMutex *m_pCommandsMutex; + sa_Commands *m_pCommands; + + SAIsolationLevel_t m_eIsolationLevel; + SAAutoCommit_t m_eAutoCommit; + + saOptions m_Options; + + int nReserved; + +protected: + void EnumCursors(EnumCursors_t fn, void *pAddlData); + void RegisterCommand(SACommand *pCommand); + void UnRegisterCommand(SACommand *pCommand); + ISACursor *GetISACursor(SACommand *pCommand); + +public: + SAConnection(); + virtual ~SAConnection(); + + void setClient(SAClient_t eSAClient) SQLAPI_THROW(SAException); + SAClient_t Client() const; + long ClientVersion() const SQLAPI_THROW(SAException); + long ServerVersion() const SQLAPI_THROW(SAException); + SAString ServerVersionString() const SQLAPI_THROW(SAException); + + bool isConnected() const; + bool isAlive() const; + void Connect( + const SAString &sDBString, + const SAString &sUserID, + const SAString &sPassword, + SAClient_t eSAClient = SA_Client_NotSpecified, + saConnectionHandler_t fHandler = NULL) SQLAPI_THROW(SAException); + void Disconnect() SQLAPI_THROW(SAException); + void Destroy(); + void Reset(); + + void setIsolationLevel(SAIsolationLevel_t eIsolationLevel) SQLAPI_THROW(SAException); + SAIsolationLevel_t IsolationLevel() const; + void setAutoCommit(SAAutoCommit_t eAutoCommit) SQLAPI_THROW(SAException); + SAAutoCommit_t AutoCommit() const; + void Commit() SQLAPI_THROW(SAException); + void Rollback() SQLAPI_THROW(SAException); + + SAString &setOption(const SAString &sOptionName); + SAString Option(const SAString &sOptionName) const; + + saAPI *NativeAPI() const SQLAPI_THROW(SAException); + saConnectionHandles *NativeHandles() SQLAPI_THROW(SAException); +}; + +// SAConnection options (common for at least several DBMS-es) +// Worksattion ID +#define SACON_OPTION_WSID _TSA("WSID") +// Application Name +#define SACON_OPTION_APPNAME _TSA("APPNAME") + +//! Defines a specific command that you intend to execute against a data source. +class SQLAPI_API SACommand +{ + friend class SAConnection; + friend class IibCursor; + friend class IsybCursor; + friend class IssDBLibCursor; + friend class IsbCursor; + friend class ImyCursor; + friend class IpgCursor; + friend class Iora8Connection; + friend class Iora8Cursor; + friend class Iora7Connection; + friend class Iora7Cursor; + +private: + // disable copy constructor + SACommand(const SACommand &); + // disable assignment operator + SACommand &operator = (const SACommand &); + + SAConnection *m_pConnection; + + SACommandType_t m_eCmdType; + SAString m_sCmd; + bool m_bPrepared; + bool m_bExecuted; + bool m_bFieldsDescribed; + bool m_bSelectBuffersSet; + + bool m_bParamsKnown; + int m_nPlaceHolderCount; + saPlaceHolder **m_ppPlaceHolders; + int m_nParamCount; + SAParam **m_ppParams; + int m_nMaxParamID; + SAParam **m_ppParamsID; + int m_nCurParamID; + SAString m_sCurParamName; + + int m_nFieldCount; + SAField **m_ppFields; + + saOptions m_Options; + + int nReserved; + + void Init(); + + static int CompareIdentifier( + const SAString &sIdentifier1, + const SAString &sIdentifier2); + SAParam &CreateParam( + const SAString &sName, + SADataType_t eParamType, + int nNativeType, + size_t nParamSize, + int nParamPrecision, + int nParamScale, + SAParamDirType_t eDirType, + const SAString &sFullName, + size_t nStart, // param position in SQL statement + size_t nEnd); // param end position in SQL statemen + void GetParamsSP(); + void UnDescribeParams(); + void ParseInputMarkers( + SAString &sCmd, + bool *pbSpacesInCmd); + + void DescribeFields() SQLAPI_THROW(SAException); + void CreateField( + const SAString &sName, + SADataType_t eFieldType, + int nNativeType, + size_t nFieldSize, + int nFieldPrecision, + int nFieldScale, + bool bFieldRequired); + void DestroyFields(); + + // parses sql statement and create bind parameters array if any (In) + // also cancels previous stsement if any + void ParseCmd( + const SAString &sSQL, + SACommandType_t eCmdType); + + void UnSetCommandText(); + void UnPrepare(); + void UnExecute(); + +public: + //! Construct command with no associated connection and SQL + SACommand(); + //! Construct command based on the given connection and SQL + SACommand( + SAConnection *pConnection, + const SAString &sCmd = SAString(), + SACommandType_t eCmdType = SA_CmdUnknown); + + virtual ~SACommand(); + + SAConnection *Connection() const; + void setConnection(SAConnection *pConnection); + + virtual void Open() SQLAPI_THROW(SAException); + virtual bool isOpened(); + virtual bool isExecuted(); + virtual void Close() SQLAPI_THROW(SAException); + virtual void Destroy(); + virtual void Reset(); + + void setCommandText( + const SAString &sSQL, + SACommandType_t eCmdType = SA_CmdUnknown); + SAString CommandText() const; + SACommandType_t CommandType() const; + virtual void Prepare() SQLAPI_THROW(SAException); + virtual void Execute() SQLAPI_THROW(SAException); + bool isResultSet() SQLAPI_THROW(SAException); + long RowsAffected() SQLAPI_THROW(SAException); // returns number of rows affected by last DML operation + bool FetchNext() SQLAPI_THROW(SAException); // returns true if new row is fetched + bool FetchPrior() SQLAPI_THROW(SAException); + bool FetchFirst() SQLAPI_THROW(SAException); + bool FetchLast() SQLAPI_THROW(SAException); + bool FetchPos(int offset, bool Relative = false) SQLAPI_THROW(SAException); + void Cancel() SQLAPI_THROW(SAException); + + SAParam &CreateParam( + const SAString &sName, + SADataType_t eParamType, + SAParamDirType_t eDirType = SA_ParamInput); + SAParam &CreateParam( + const SAString &sName, + SADataType_t eParamType, + int nNativeType, + size_t nParamSize, + int nParamPrecision, + int nParamScale, + SAParamDirType_t eDirType); + void DestroyParams(); + int ParamCount(); + SAParam &ParamByIndex(int i); // zero based index of C array + SAParam &Param(int nParamByID); // id in SQL statement, not in C array + SAParam &Param(const SAString& sParamByName); + SACommand &operator << (const SAPos &pos); + SACommand &operator << (const SANull &null); + SACommand &operator << (bool Value); + SACommand &operator << (short Value); + SACommand &operator << (unsigned short Value); + SACommand &operator << (long Value); + SACommand &operator << (unsigned long Value); + SACommand &operator << (double Value); + SACommand &operator << (const SANumeric &Value); + SACommand &operator << (sa_int64_t Value); + SACommand &operator << (sa_uint64_t Value); + SACommand &operator << (const SADateTime &Value); + SACommand &operator << (const SAChar *Value); // special overload for string constants + SACommand &operator << (const SAString &Value); + SACommand &operator << (const SABytes &Value); + SACommand &operator << (const SALongBinary &Value); + SACommand &operator << (const SALongChar &Value); + SACommand &operator << (const SABLob &Value); + SACommand &operator << (const SACLob &Value); + SACommand &operator << (const SAValueRead &Value); + + int FieldCount() SQLAPI_THROW(SAException); + SAField &Field(int nField) SQLAPI_THROW(SAException); // 1-based field number in result set + SAField &Field(const SAString &sField) SQLAPI_THROW(SAException); + SAField &operator[](int nField) SQLAPI_THROW(SAException); // 1-based field number in result set + SAField &operator[](const SAString &sField) SQLAPI_THROW(SAException); + + SAString &setOption(const SAString &sOptionName); + SAString Option(const SAString &sOptionName) const; + + saCommandHandles *NativeHandles() SQLAPI_THROW(SAException); + void setBatchExceptionPreHandler(PreHandleException_t fnHandler, void* pAddlData); +}; + +// SACommand options (common for at least several DBMS-es) +// Prefertching rows +#define SACMD_PREFETCH_ROWS _TSA("PreFetchRows") +// Using scrollable cursor +#define SACMD_SCROLLABLE _TSA("Scrollable") +// Option values +#define SAOPT_TRUE _TSA("1") + +class SQLAPI_API SAValueRead +{ + friend class ISACursor; + friend class IibCursor; + friend class Iora7Cursor; + friend class Iora8Cursor; + friend class IsbCursor; + friend class IodbcCursor; + friend class IssDBLibCursor; + friend class IssOleDbCursor; + friend class Idb2Cursor; + friend class IinfCursor; + friend class IsybCursor; + friend class ImyCursor; + friend class IpgCursor; + friend class Isl3Cursor; + friend class IssNCliCursor; + friend class IasaCursor; + +protected: + SALongOrLobReaderModes_t m_eReaderMode; + + saLongOrLobReader_t m_fnReader; + size_t m_nReaderWantedPieceSize; + void *m_pReaderAddlData; + + unsigned char *m_pReaderBuf; + size_t m_nReaderAlloc; + size_t m_nExpectedSizeMax; + size_t m_nReaderRead; + size_t m_nPieceSize; + + size_t PrepareReader( + size_t nExpectedSizeMax, // to optimaze buf allocation for internal buffer, 0 = unknown + size_t nCallerMaxSize, // max Piece that can be proceeced by API + unsigned char *&pBuf, + saLongOrLobReader_t fnReader, + size_t nReaderWantedPieceSize, + void *pReaderAddlData, + bool bAddSpaceForNull = false); + void InvokeReader( + SAPieceType_t ePieceType, + unsigned char *&pBuf, + size_t nPieceLen); + SAString asLongOrLob() const; + +protected: + SADataType_t m_eDataType; + + // null indicator + bool *m_pbNull; + // scalar types + void *m_pScalar; + // an exact numeric value with a fixed precision and scale + SANumeric *m_pNumeric; + // Date time + SADateTime *m_pDateTime; + // Time interval + SAInterval *m_pInterval; + // variable length types (string, bytes, Longs and Lobs) + SAString *m_pString; + // Cursor + SACommand *m_pCursor; +private: + // null indicator + bool m_bInternalNull; + // scalar types + union uScalars + { + bool m_Bool; + short m_Short; + unsigned short m_uShort; + long m_Long; + unsigned long m_uLong; + double m_Double; + } m_InternalScalar; + SANumeric m_InternalNumeric; + SADateTime m_InternalDateTime; + SAInterval m_InternalInterval; + // variable length types (string, bytes, Longs and Lobs) + SAString m_InternalString; + // Cursor + SACommand m_InternalCursor; + +public: + SAValueRead(SADataType_t eDataType); + SAValueRead(const SAValueRead &vr); + virtual ~SAValueRead(); + + SAValueRead &operator =(const SAValueRead &vr); + +public: + SADataType_t DataType() const; + + // Null type + bool isNull() const; + + // scalar types + bool asBool() const; + short asShort() const; + unsigned short asUShort() const; + long asLong() const; + unsigned long asULong() const; + double asDouble() const; + + // numeric + SANumeric asNumeric() const; + + // date/time + SADateTime asDateTime() const; + + // Interval + SAInterval asInterval() const; + + // variable length types + SAString asString() const; + SAString asBytes() const; + SAString asLongBinary() const; + SAString asLongChar() const; + SAString asBLob() const; + SAString asCLob() const; + + // cursor + SACommand *asCursor() const; + + void setLongOrLobReaderMode(SALongOrLobReaderModes_t eMode); + SALongOrLobReaderModes_t LongOrLobReaderMode() const; + + // operators for quick accessing values + // do not inline to prevent varnings + operator bool() const; + operator short() const; + operator unsigned short() const; + operator long() const; + operator unsigned long() const; + operator double() const; + operator SANumeric() const; + operator SADateTime() const; + operator SAInterval() const; + operator SAString() const; + operator SACommand *() const; + + // data and indicator storage +public: + void setIndicatorStorage(bool *pStorage); + void setDataStorage(void *pStorage, SADataType_t eDataType); +}; + +class SQLAPI_API SAValue : public SAValueRead +{ + friend class ISACursor; + friend class IibCursor; + friend class IssDBLibCursor; + friend class Iora7Cursor; + friend class Iora8Cursor; + friend class IsbCursor; + friend class IodbcCursor; + friend class Idb2Cursor; + friend class IinfCursor; + friend class IsybCursor; + friend class ImyCursor; + friend class IpgCursor; + friend class Isl3Cursor; + friend class IssNCliCursor; + friend class IasaCursor; + +private: + bool m_bInternalUseDefault; + +protected: + bool *m_pbUseDefault; + + saLongOrLobWriter_t m_fnWriter; + size_t m_nWriterSize; + void *m_pWriterAddlData; + void *m_pWriterBuf; + size_t m_nWriterAlloc; + size_t m_nWriterWritten; + + size_t InvokeWriter( + SAPieceType_t &ePieceType, + size_t nCallerMaxSize, + void *&pBuf); + +public: + SAValue(SADataType_t eDataType); + virtual ~SAValue(); + + // Sets NULL value + void setAsNull(); + // Sets a flag to use default value + void setAsDefault(); + // queries if "default value" flag is set + bool isDefault() const; + + void setAsUnknown(); + + // scalar types + bool &setAsBool(); + short &setAsShort(); + unsigned short &setAsUShort(); + long &setAsLong(); + unsigned long &setAsULong(); + double &setAsDouble(); + + // numeric + SANumeric &setAsNumeric(); + + // date/time + SADateTime &setAsDateTime(); + + // interval + SAInterval &setAsInterval(); + + // variable length types + SAString &setAsString(); + SAString &setAsBytes(); + SAString &setAsLongBinary( + saLongOrLobWriter_t fnWriter = NULL, + size_t nWriterSize = 0, void *pAddlData = NULL); + SAString &setAsLongChar( + saLongOrLobWriter_t fnWriter = NULL, + size_t nWriterSize = 0, void *pAddlData = NULL); + SAString &setAsBLob( + saLongOrLobWriter_t fnWriter = NULL, + size_t nWriterSize = 0, void *pAddlData = NULL); + SAString &setAsCLob( + saLongOrLobWriter_t fnWriter = NULL, + size_t nWriterSize = 0, void *pAddlData = NULL); + + // cursor + SACommand *&setAsCursor(); + + // special set function(s) + SAValueRead &setAsValueRead(); +}; + +class SQLAPI_API SAParam : public SAValue +{ + friend class SACommand; + friend class saPlaceHolder; + friend class saOptions; + + SACommand *m_pCommand; + + SAString m_sName; + SADataType_t m_eParamType; + int m_nNativeType; + size_t m_nParamSize; + int m_nParamPrecision; + int m_nParamScale; + SAParamDirType_t m_eDirType; + + saOptions m_Options; + +private: + // disable copy constructor + SAParam(const SAParam &); + // disable assignment operator + SAParam &operator = (const SAParam &); + +protected: + SAParam( + SACommand *pCommand, + const SAString &sName, + SADataType_t eParamType, + int nNativeType, + size_t nParamSize, + int nParamPrecision, + int nParamScale, + SAParamDirType_t eDirType); + virtual ~SAParam(); + +public: + const SAString &Name() const; + SADataType_t ParamType() const; + void setParamType(SADataType_t eParamType); + int ParamNativeType() const; + void setParamNativeType(int nNativeType); + size_t ParamSize() const; + void setParamSize(size_t nParamSize); + SAParamDirType_t ParamDirType() const; + void setParamDirType(SAParamDirType_t eParamDirType); + int ParamPrecision() const; + void setParamPrecision(int nParamPrecision); + int ParamScale() const; + void setParamScale(int nParamScale); + + void ReadLongOrLob( + saLongOrLobReader_t fnReader, + size_t nReaderWantedSize, + void *pAddlData); + + SAString &setOption(const SAString &sOptionName); + SAString Option(const SAString &sOptionName) const; +}; + +class SQLAPI_API saPlaceHolder +{ + friend class SACommand; + + SAString m_sFullName; + size_t m_nStart; + size_t m_nEnd; + + SAParam *m_pParamRef; + +private: + saPlaceHolder( + const SAString &sFullName, + size_t nStart, + size_t nEnd, + SAParam *pParamRef); + virtual ~saPlaceHolder(); + +public: + const SAString &getFullName() const; + size_t& getStart(); + size_t& getEnd(); + SAParam *getParam() const; +}; + +class SQLAPI_API SABytes : public SAString +{ +public: + SABytes(const SAString &sData); +}; + +class SQLAPI_API SALongOrLob : public SAString +{ + friend class SACommand; + +protected: + saLongOrLobWriter_t m_fnWriter; + size_t m_nWriterPieceSize; + void *m_pAddlData; + + SALongOrLob(const SAString &sData); + SALongOrLob( + saLongOrLobWriter_t fnWriter, + size_t nWriterPieceSize, + void *pAddlData); +}; + +class SQLAPI_API SALongBinary : public SALongOrLob +{ +public: + SALongBinary(const SAString &sData); + SALongBinary( + saLongOrLobWriter_t fnWriter, + size_t nWriterPieceSize, + void *pAddlData); +}; + +class SQLAPI_API SALongChar : public SALongOrLob +{ +public: + SALongChar(const SAString &sData); + SALongChar( + saLongOrLobWriter_t fnWriter, + size_t nWriterPieceSize, + void *pAddlData); +}; + +class SQLAPI_API SABLob : public SALongOrLob +{ +public: + SABLob(const SAString &sData); + SABLob( + saLongOrLobWriter_t fnWriter, + size_t nWriterPieceSize, + void *pAddlData); +}; + +class SQLAPI_API SACLob : public SALongOrLob +{ +public: + SACLob(const SAString &sData); + SACLob( + saLongOrLobWriter_t fnWriter, + unsigned int nWriterPieceSize, + void *pAddlData); +}; + +class SQLAPI_API SAField : public SAValueRead +{ + friend class SACommand; + + SACommand *m_pCommand; + + // as reported by describe API + int m_nPos; // 1-based + SAString m_sName; + SADataType_t m_eFieldType; + int m_nNativeType; + size_t m_nFieldSize; + int m_nFieldPrecision; + int m_nFieldScale; + bool m_bFieldRequired; + + saOptions m_Options; + +private: + // disable copy constructor + SAField(const SAField &); + // disable assignment operator + SAField &operator = (const SAField &); + +protected: + SAField( + SACommand *pCommand, + int nPos, // 1-based + const SAString &sName, + SADataType_t eFieldType, + int nNativeType, + size_t nFieldSize, + int nFieldPrecision, + int nFieldScale, + bool bFieldRequired); + virtual ~SAField(); + +public: + int Pos() const; + const SAString &Name() const; + SADataType_t FieldType() const; + int FieldNativeType() const; + size_t FieldSize() const; + int FieldPrecision() const; + int FieldScale() const; + bool isFieldRequired() const; + + // !!! + void setFieldSize(int nSize); + void setFieldType(SADataType_t eType); + + void ReadLongOrLob( + saLongOrLobReader_t fnReader, + size_t nReaderWantedSize, + void *pAddlData); + + SAString &setOption(const SAString &sOptionName); + SAString Option(const SAString &sOptionName) const; +}; + +class SQLAPI_API SAException +#ifdef SQLAPI_EXCEPTION_DELIVERED_FROM + : public SQLAPI_EXCEPTION_DELIVERED_FROM +#endif +{ + friend class SAConnection; + friend class SACommand; + +public: + SAException( + SAException* pNested, + SAErrorClass_t eError, + int nNativeError, + int nErrPos, + const SAString &sMsg); + SAException( + SAException* pNested, + SAErrorClass_t eError, + int nNativeError, + int nErrPos, + const SAChar *lpszFormat, ...); + + SAException( + SAErrorClass_t eError, + int nNativeError, + int nErrPos, + const SAString &sMsg); + SAException( + SAErrorClass_t eError, + int nNativeError, + int nErrPos, + const SAChar *lpszFormat, ...); + + SAException(const SAException &other); + +public: + virtual ~SAException(); + + static void SQLAPI_CALLBACK throwUserException( + int nUserCode, const SAChar *lpszFormat, ...); + + SAErrorClass_t ErrClass() const; + int ErrNativeCode() const; + int ErrPos() const; + SAString ErrMessage() const; + SAString ErrText() const; + const SAException* NestedException() const; + +#ifdef SQLAPI_EXCEPTION_HAS_CUSTOM_MEMBERS + SQLAPI_EXCEPTION_HAS_CUSTOM_MEMBERS +#endif + +protected: + SAErrorClass_t m_eErrorClass; + int m_nNativeError; + int m_nErrPos; + SAString m_sMsg; + SAException* m_pNested; + + int nReserved; +}; + +class SQLAPI_API SAUserException : public SAException +{ + friend class SAException; + +protected: + SAUserException(int nUserCode, const SAString &sMsg); + +public: + virtual ~SAUserException(); +}; + +typedef enum eSATraceInfo +{ + SA_Trace_None = 0, + SA_Trace_QueryText = 1 //! trace real DBMS API query text SQLAPI++ sends +} SATraceInfo_t; + +//! Callback for tracing +typedef void (SQLAPI_CALLBACK *SATraceFunction_t)( + SATraceInfo_t traceInfo, //! tracing into label + SAConnection* pCon, //! related SAConnection or NULL + SACommand* pCmd, //! related SACommand or NULL + const SAChar* szTraceInfo, //! tracing text + void* pData); //! user provided data + +//! Global SQLAPI++ settings +class SQLAPI_API SAGlobals +{ +public: + static char * SQLAPI_CALLBACK setlocale(int category, const char *locale); + + static int GetVersionMajor(); + static int GetVersionMinor(); + static int GetVersionBuild(); + + static bool& UnloadAPI(); + + static const SAChar* ClientToString(SAClient_t eSAClient); + static SAClient_t StringToClient(const SAChar* szClientName); + + static void SetTraceFunction(SATraceInfo_t traceInfo, SATraceFunction_t traceFunc, void* pData); +}; + +#define SQLAPI_VER_MAJOR 4 +#define SQLAPI_VER_MINOR 1 +#define SQLAPI_VER_BUILD 5 + +#endif // !defined(__SQLAPI_H__) + + diff --git a/libraries/SQLAPI/include/asa/poppk.h b/libraries/SQLAPI/include/asa/poppk.h new file mode 100644 index 000000000..fc73eaaee --- /dev/null +++ b/libraries/SQLAPI/include/asa/poppk.h @@ -0,0 +1,60 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1996-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** +/* Include this file to restore the default structure packing setting. */ + +#if defined( __WATCOMC__ ) + #pragma pack(__pop); +#elif defined( _MSC_VER ) && _MSC_VER > 800 + #pragma pack( pop, pshpk ) +#elif defined( __ALPHA__ ) || defined( _CFE ) + #pragma pack(); +#elif defined( __MWERKS__ ) + #pragma options align= reset +#elif defined( __BORLANDC__ ) + #pragma option -a. +#elif (defined( __IBMC__ ) && ( __IBMC__ < 500 )) || (defined (__IBMCPP__) && ( __IBMCPP__ < 500 ) ) + #pragma pack( pop ) +#elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if defined( _PUSH_PACK_SECOND ) + #undef _PUSH_PACK_SECOND + #pragma pack (_PUSH_PACK_FIRST) + #elif defined( _PUSH_PACK_FIRST ) + #undef _PUSH_PACK_FIRST + #pragma pack( ) + #else + #error Tried to pop a pack without a successful push + #endif +#elif defined( HP ) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if defined( _PUSH_PACK_SECOND ) + #undef _PUSH_PACK_SECOND + #pragma pack _PUSH_PACK_FIRST + #elif defined( _PUSH_PACK_FIRST ) + #undef _PUSH_PACK_FIRST + #pragma pack + #else + #error Tried to pop a pack without a successful push + #endif +#elif defined( _AIX ) && !defined(__GNUC__) + #if defined( _PUSH_PACK_SECOND ) + #undef _PUSH_PACK_SECOND + #pragma options align=_PUSH_PACK_FIRST + #elif defined( _PUSH_PACK_FIRST ) + #undef _PUSH_PACK_FIRST + #pragma options align=reset + #else + #error Tried to pop a pack without a successful push + #endif +#elif defined( __GNUC__ ) && (!defined( ALIGN_WORDS ) || defined( FORCE_PACK )) + #pragma pack(pop) +#endif + +#if defined ( _NO_PRAGMA_PUSH_PACK ) + #if defined( _PUSH_PACK ) + #undef _PUSH_PACK + #else + #error Tried to pop a pack without a successful push + #endif +#endif diff --git a/libraries/SQLAPI/include/asa/pshpk1.h b/libraries/SQLAPI/include/asa/pshpk1.h new file mode 100644 index 000000000..ca3264a24 --- /dev/null +++ b/libraries/SQLAPI/include/asa/pshpk1.h @@ -0,0 +1,65 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1996-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** +/* Include this file to cause 1-byte structure packing. */ + +#if defined( __WATCOMC__ ) + #pragma pack(__push,1); +#elif defined( _MSC_VER ) && _MSC_VER > 800 + #pragma warning( disable : 4103 ) + #pragma pack( push, pshpk, 1 ) +#elif defined( __ALPHA__ ) || defined( _CFE ) // SGI's C preprocessor + #if !defined( _NO_PRAGMA_PUSH_PACK ) + #define _NO_PRAGMA_PUSH_PACK + #endif + #pragma pack(1); +#elif defined( MAC ) + #if defined( __MWERKS__ ) + #pragma options align= packed + #else + #error "Need a pshpk1.h for this Mac compiler" + #endif +#elif defined( __BORLANDC__ ) + #pragma option -a- +#elif (defined( __IBMC__ ) && ( __IBMC__ < 500 )) || (defined( __IBMCPP__ ) && ( __IBMCPP__ < 500 ) ) + #pragma pack( push, 1 ) +#elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST 1 + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND 1 + #else + #error Tried to push a pack at too great a depth + #endif + #pragma pack(1) +#elif defined( HP ) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST 1 + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND 1 + #else + #error Tried to push a pack at too great a depth + #endif + #pragma pack 1 +#elif defined( _AIX ) && !defined(__GNUC__) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST packed + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND packed + #else + #error Tried to push a pack at too great a depth + #endif + #pragma options align=packed +#elif defined( __GNUC__ ) && (!defined( ALIGN_WORDS ) || defined( FORCE_PACK )) + #pragma pack(push, 1) +#endif + +#if defined( _NO_PRAGMA_PUSH_PACK ) + #if defined( _PUSH_PACK ) + #error Tried to push a pack at too great a depth + #else + #define _PUSH_PACK + #endif +#endif diff --git a/libraries/SQLAPI/include/asa/pshpk2.h b/libraries/SQLAPI/include/asa/pshpk2.h new file mode 100644 index 000000000..de0b52fd9 --- /dev/null +++ b/libraries/SQLAPI/include/asa/pshpk2.h @@ -0,0 +1,65 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1996-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** +/* Include this file to cause 2-byte structure packing. */ + +#if defined( __WATCOMC__ ) + #pragma pack(__push,2); +#elif defined( _MSC_VER ) && _MSC_VER > 800 + #pragma warning( disable : 4103 ) + #pragma pack( push, pshpk, 2 ) +#elif defined( __ALPHA__ ) || defined( _CFE ) // SGI's C preprocessor + #if !defined( _NO_PRAGMA_PUSH_PACK ) + #define _NO_PRAGMA_PUSH_PACK + #endif + #pragma pack(2); +#elif defined( MAC ) + #if defined( __MWERKS__ ) + #pragma options align= mac68k + #else + #error "Need a pshpk2.h for this Mac compiler" + #endif +#elif defined( __BORLANDC__ ) + #pragma option -a2 +#elif (defined( __IBMC__ ) && ( __IBMC__ < 500 )) || (defined (__IBMCPP__) && ( __IBMCPP__ < 500 )) + #pragma pack( push, 2 ) +#elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST 2 + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND 2 + #else + #error Tried to push a pack at too great a depth + #endif + #pragma pack(2) +#elif defined( HP ) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST 2 + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND 2 + #else + #error Tried to push a pack at too great a depth + #endif + #pragma pack 2 +#elif defined( _AIX ) && !defined(__GNUC__) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST twobyte + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND twobyte + #else + #error Tried to push a pack at too great a depth + #endif + #pragma options align=twobyte +#elif defined( __GNUC__ ) && (!defined( ALIGN_WORDS ) || defined( FORCE_PACK )) + #pragma pack(push, 2) +#endif + +#if defined( _NO_PRAGMA_PUSH_PACK ) + #if defined( _PUSH_PACK ) + #error Tried to push a pack at too great a depth + #else + #define _PUSH_PACK + #endif +#endif diff --git a/libraries/SQLAPI/include/asa/pshpk4.h b/libraries/SQLAPI/include/asa/pshpk4.h new file mode 100644 index 000000000..6e934a46e --- /dev/null +++ b/libraries/SQLAPI/include/asa/pshpk4.h @@ -0,0 +1,65 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1996-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** +/* Include this file to cause 4-byte structure packing. */ + +#if defined( __WATCOMC__ ) + #pragma pack(__push,4); +#elif defined( _MSC_VER ) && _MSC_VER > 800 + #pragma warning( disable : 4103 ) + #pragma pack( push, pshpk, 4 ) +#elif defined( _CFE ) || defined( __ALPHA__ ) + #if !defined( _NO_PRAGMA_PUSH_PACK ) + #define _NO_PRAGMA_PUSH_PACK + #endif + #pragma pack(4); +#elif defined( MAC ) + #if defined( __MWERKS__ ) + #pragma options align= mac68k4byte + #else + #error "Need a pshpk4.h for this Mac compiler" + #endif +#elif defined( __BORLANDC__ ) + #pragma option -a4 +#elif (defined( __IBMC__ ) && ( __IBMC__ < 500)) || (defined (__IBMCPP__) && ( __IBMCPP__ < 500 )) + #pragma pack( push, 4 ) +#elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST 4 + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND 4 + #else + #error Tried to push a pack at too great a depth + #endif + #pragma pack(4) +#elif defined( HP ) && ( !defined( ALIGN_WORDS ) || defined( FORCE_PACK ) ) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST 4 + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND 4 + #else + #error Tried to push a pack at too great a depth + #endif + #pragma pack 4 +#elif defined( _AIX ) && !defined(__GNUC__) + #if !defined( _PUSH_PACK_FIRST ) + #define _PUSH_PACK_FIRST power + #elif !defined( _PUSH_PACK_SECOND ) + #define _PUSH_PACK_SECOND power + #else + #error Tried to push a pack at too great a depth + #endif + #pragma options align=power +#elif defined( __GNUC__ ) && (!defined( ALIGN_WORDS ) || defined( FORCE_PACK )) + #pragma pack(push, 4) +#endif + +#if defined( _NO_PRAGMA_PUSH_PACK ) + #if defined( _PUSH_PACK ) + #error Tried to push a pack at too great a depth + #else + #define _PUSH_PACK + #endif +#endif diff --git a/libraries/SQLAPI/include/asa/sacapi.h b/libraries/SQLAPI/include/asa/sacapi.h new file mode 100644 index 000000000..8b065c330 --- /dev/null +++ b/libraries/SQLAPI/include/asa/sacapi.h @@ -0,0 +1,927 @@ +/* ==================================================== + * + * Copyright 2008-2011 iAnywhere Solutions, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + * + * While not a requirement of the license, if you do modify this file, we + * would appreciate hearing about it. Please email + * sqlany_interfaces@sybase.com + * + * ==================================================== + */ + +#ifndef SACAPI_H +#define SACAPI_H + +/** \mainpage SQL Anywhere C API + * + * \section intro_sec Introduction + * The purpose of this API is to simplify creating C/C++ wrapper drivers for various interpreted languages + * such as PHP, Perl, Python, Ruby, and others. This API layer sits on top of DBLIB and was implemented + * using Embedded SQL. This API is not a replacement of DBLIB. It is just a way to simplify creating applications + * from C/C++ code without having to learn all the details of Embedded SQL. + * + * \section distribution Distribution of the API + * The API is built as a DLL (shared object on UNIX). The name of the DLL is \b dbcapi.dll + * ( \b libdbcapi.so on UNIX). This DLL is linked statically to DBLIB of the SQL Anywhere version that it was + * built against. When dbcapi.dll is loaded, the corresponding dblibX.dll is loaded by the OS. Applications that + * interface with dbcapi.dll can either link directly to it or load it dynamically. For dynamic + * loading of the DLL, please refer to the Dynamic Loading section below. + * + * The file sacapi.h is the main header file for the API. It describes all the data types and the entry + * points of the API. + * + * \section dynamic_loading Dynamically Loading the DLL + * The header file sacapidll.h contains the proper code to dynamically load the DLL. An application would + * need to include the sacapidll.h header file and compile in sacapidll.c with their source. + * sqlany_initialize_interface() can be used to dynamically load the DLL and lookup all the entry points. + * + * \section threading_support Threading Support + * The C API library is thread-unaware, meaning that the library does not perform any tasks that require + * mutual exclusion. In order to allow the library to work in threaded applications, there is only one rule to + * follow: no more than one request is allowed on a single connection . With this rule, the application + * is responsible for doing mutual exclusion when accessing any connection-specific resource. This includes + * connection handles, prepared statements, and result set objects. + * + * \version 2.0 + */ + +/** \file sacapi.h + * Main API header file. + * This file describes all the data types and entry points of the API. + */ + +/** Defines to indicate the API versions + */ +#define SQLANY_API_VERSION_1 1 + +/** Version 2 introduced the "_ex" functions and the ability to cancel requests. + */ +#define SQLANY_API_VERSION_2 2 + +/** Returns the minimal error buffer size. + */ +#define SACAPI_ERROR_SIZE 256 + +#if defined(__cplusplus) +extern "C" { +#endif + +/** A handle to an interface context + */ +typedef struct a_sqlany_interface_context a_sqlany_interface_context; + +/** A handle to a connection object + */ +typedef struct a_sqlany_connection a_sqlany_connection; + +/** A handle to a statement object + */ +typedef struct a_sqlany_stmt a_sqlany_stmt; + +#ifdef WIN32 +/** A portable 32-bit signed value */ +typedef __int32 sacapi_i32; +/** A portable 32-bit unsigned value */ +typedef unsigned __int32 sacapi_u32; +/** A portable boolean value */ +typedef sacapi_i32 sacapi_bool; +#else +/** A portable 32-bit signed value */ +typedef signed int sacapi_i32; +/** A portable 32-bit unsigned value */ +typedef unsigned int sacapi_u32; +/** A portable boolean value */ +typedef sacapi_i32 sacapi_bool; +#endif + +// TODO:Character set issues + + +/** Specifies the data type being passed in or retrieved. + */ +typedef enum a_sqlany_data_type +{ + /// Invalid data type. + A_INVALID_TYPE, + /// Binary data. Binary data is treated as-is and no character set conversion is performed. + A_BINARY, + /// String data. The data where character set conversion is performed. + A_STRING, + /// Double data. Includes float values. + A_DOUBLE, + /// 64-bit integer. + A_VAL64, + /// 64-bit unsigned integer. + A_UVAL64, + /// 32-bit integer. + A_VAL32, + /// 32-bit unsigned integer. + A_UVAL32, + /// 16-bit integer. + A_VAL16, + /// 16-bit unsigned integer. + A_UVAL16, + /// 8-bit integer. + A_VAL8, + /// 8-bit unsigned integer. + A_UVAL8 +} a_sqlany_data_type; + +/** Returns a description of the attributes of a data value. + * + * To view examples of the a_sqlany_data_value structure in use, + * see any of the following sample files in the sdk\\dbcapi\\examples directory + * of your SQL Anywhere installation. + * + *
    + *
  • dbcapi_isql.cpp + *
  • fetching_a_result_set.cpp + *
  • send_retrieve_full_blob.cpp + *
  • preparing_statements.cpp + *
+ */ +typedef struct a_sqlany_data_value +{ + /// A pointer to user supplied buffer of data. + char * buffer; + /// The size of the buffer. + size_t buffer_size; + /// A pointer to the number of valid bytes in the buffer. This value must be less than buffer_size. + size_t * length; + /// The type of the data + a_sqlany_data_type type; + /// A pointer to indicate whether the last fetched data is NULL. + sacapi_bool * is_null; +} a_sqlany_data_value; + +/** A data direction enumeration. + */ +typedef enum a_sqlany_data_direction +{ + /// Invalid data direction. + DD_INVALID = 0x0, + /// Input-only host variables. + DD_INPUT = 0x1, + /// Output-only host variables. + DD_OUTPUT = 0x2, + /// Input and output host variables. + DD_INPUT_OUTPUT = 0x3 +} a_sqlany_data_direction; + +/** A bind parameter structure used to bind parameter and prepared statements. + * + * To view examples of the a_sqlany_bind_param structure in use, + * see any of the following sample files in the sdk\\dbcapi\\examples directory + * of your SQL Anywhere installation. + * + *
    + *
  • preparing_statements.cpp + *
  • send_retrieve_full_blob.cpp + *
  • send_retrieve_part_blob.cpp + *
+ * \sa sqlany_execute() + */ +typedef struct a_sqlany_bind_param +{ + /// The direction of the data. (input, output, input_output) + a_sqlany_data_direction direction; + /// The actual value of the data. + a_sqlany_data_value value; + /// Name of the bind parameter. This is only used by sqlany_describe_bind_param(). + char *name; +} a_sqlany_bind_param; + +/** An enumeration of the native types of values as described by the server. + * + * The value types correspond to the embedded SQL data types. + * For more information on embedded SQL data types, see + * \salink{Embedded SQL data types, "http://dcx.sybase.com/selectproduct?turl=1201en/dbprogramming/esqlvar.html", "programming", "esqlvar"}. + * + * \hideinitializers + * \sa sqlany_get_column_info(), a_sqlany_column_info + */ +typedef enum a_sqlany_native_type +{ + /// No data type. + DT_NOTYPE = 0, + /// Null-terminated character string that is a valid date. + DT_DATE = 384, + /// Null-terminated character string that is a valid time. + DT_TIME = 388, + /// Null-terminated character string that is a valid timestamp. + DT_TIMESTAMP = 392, + /// Varying length character string, in the CHAR character set, with a two-byte length field. The maximum length is 32765 bytes. When sending data, you must set the length field. When fetching data, the database server sets the length field. The data is not null-terminated or blank-padded. + DT_VARCHAR = 448, + /// Fixed-length blank-padded character string, in the CHAR character set. The maximum length, specified in bytes, is 32767. The data is not null-terminated. + DT_FIXCHAR = 452, + /// Long varying length character string, in the CHAR character set. + DT_LONGVARCHAR = 456, + /// Null-terminated character string, in the CHAR character set. The string is blank-padded if the database is initialized with blank-padded strings. + DT_STRING = 460, + /// 8-byte floating-point number. + DT_DOUBLE = 480, + /// 4-byte floating-point number. + DT_FLOAT = 482, + /// Packed decimal number (proprietary format). + DT_DECIMAL = 484, + /// 32-bit signed integer. + DT_INT = 496, + /// 16-bit signed integer. + DT_SMALLINT = 500, + /// Varying length binary data with a two-byte length field. The maximum length is 32765 bytes. When supplying information to the database server, you must set the length field. When fetching information from the database server, the server sets the length field. + DT_BINARY = 524, + /// Long binary data. + DT_LONGBINARY = 528, + /// 8-bit signed integer. + DT_TINYINT = 604, + /// 64-bit signed integer. + DT_BIGINT = 608, + /// 32-bit unsigned integer. + DT_UNSINT = 612, + /// 16-bit unsigned integer. + DT_UNSSMALLINT = 616, + /// 64-bit unsigned integer. + DT_UNSBIGINT = 620, + /// 8-bit signed integer. + DT_BIT = 624, + /// Long varying length character string, in the NCHAR character set. + DT_LONGNVARCHAR = 640 +} a_sqlany_native_type; + +/** Returns column metadata information. + * + * sqlany_get_column_info() can be used to populate this structure. + * + * To view an example of the a_sqlany_column_info structure in use, + * see the following sample file in the sdk\\dbcapi\\examples + * directory of your SQL Anywhere installation. + * + *
    + *
  • dbcapi_isql.cpp + *
+ */ +typedef struct a_sqlany_column_info +{ + /// The name of the column (null-terminated). + /// The string can be referenced as long as the result set object is not freed. + char * name; + /// The column data type. + a_sqlany_data_type type; + /// The native type of the column in the database. + a_sqlany_native_type native_type; + /// The precision. + unsigned short precision; + /// The scale. + unsigned short scale; + /// The maximum size a data value in this column can take. + size_t max_size; + /// Indicates whether a value in the column can be null. + sacapi_bool nullable; +} a_sqlany_column_info; + +/** Gets information about the currently bound parameters. + * + * sqlany_get_bind_param_info() can be used to populate this structure. + * + * To view examples of the a_sqlany_bind_param_info structure in use, + * see any of the following sample files in the sdk\\dbcapi\\examples + * directory of your SQL Anywhere installation. + * + *
    + *
  • preparing_statements.cpp + *
  • send_retrieve_full_blob.cpp + *
  • send_retrieve_part_blob.cpp + *
+ * \sa sqlany_execute() + */ +typedef struct a_sqlany_bind_param_info +{ + /// A pointer to the name of the parameter. + char * name; + /// The direction of the parameter. + a_sqlany_data_direction direction; + /// Information about the bound input value. + a_sqlany_data_value input_value; + /// Information about the bound output value. + a_sqlany_data_value output_value; +} a_sqlany_bind_param_info; + +/** Returns metadata information about a column value in a result set. + * + * sqlany_get_data_info() can be used + * to populate this structure with information about what was last retrieved by a fetch operation. + * + * To view an example of the a_sqlany_data_data_info structure in use, + * see the following sample file in the sdk\\dbcapi\\examples directory + * of your SQL Anywhere installation. + * + *
    + *
  • send_retrieve_part_blob.cpp + *
+ * \sa sqlany_get_data_info() + */ +typedef struct a_sqlany_data_info +{ + /// The type of the data in the column. + a_sqlany_data_type type; + /// Indicates whether the last fetched data is NULL. + /// This field is only valid after a successful fetch operation. + sacapi_bool is_null; + /// The total number of bytes available to be fetched. + /// This field is only valid after a successful fetch operation. + size_t data_size; +} a_sqlany_data_info; + +/** Initializes the interface. + * + * The following example demonstrates how to initialize the SQL Anywhere C API DLL: + * + *
+ * sacapi_u32 api_version;
+ * if( sqlany_init( "PHP", SQLANY_API_VERSION_1, &api_version ) ) {
+ *     printf( "Interface initialized successfully!\n" );
+ * } else {
+ *     printf( "Failed to initialize the interface! Supported version=%d\n", api_version );
+ * }
+ * 
+ * + * \param app_name A string that names the application that is using the API. For example, "PHP", "PERL", or "RUBY". + * \param api_version The version of the compiled application. + * \param version_available An optional argument to return the maximum supported API version. + * \return 1 on success, 0 otherwise + * \sa sqlany_fini() + */ +sacapi_bool sqlany_init( const char * app_name, sacapi_u32 api_version, sacapi_u32 * version_available ); + +#if _SACAPI_VERSION+0 >= 2 + /** Initializes the interface using a context. + * + * \param app_name A string that names the API used, for example "PHP", "PERL", or "RUBY". + * \param api_version The current API version that the application is using. + * This should normally be one of the SQLANY_API_VERSION_* macros + * \param version_available An optional argument to return the maximum API version that is supported. + * \return a context object on success and NULL on failure. + * \sa sqlany_fini_ex() + */ + a_sqlany_interface_context *sqlany_init_ex( const char * app_name, sacapi_u32 api_version, sacapi_u32 * version_available ); +#endif + +/** Finalizes the interface. + * + * Frees any resources allocated by the API. + * + * \sa sqlany_init() +*/ +void sqlany_fini(); +#if _SACAPI_VERSION+0 >= 2 + /** Finalize the interface that was created using the specified context. + * Frees any resources allocated by the API. + * \param context A context object that was returned from sqlany_init_ex() + * \sa sqlany_init_ex() + */ + void sqlany_fini_ex( a_sqlany_interface_context *context ); +#endif + +/** Creates a connection object. + * + * You must create an API connection object before establishing a database connection. Errors can be retrieved + * from the connection object. Only one request can be processed on a connection at a time. In addition, + * not more than one thread is allowed to access a connection object at a time. Undefined behavior or a failure + * occurs when multiple threads attempt to access a connection object simultaneously. + * + * \return A connection object + * \sa sqlany_connect(), sqlany_disconnect() + */ +a_sqlany_connection * sqlany_new_connection( void ); +#if _SACAPI_VERSION+0 >= 2 + /** Creates a connection object using a context. + * An API connection object needs to be created before a database connection is established. Errors can be retrieved + * from the connection object. Only one request can be processed on a connection at a time. In addition, + * not more than one thread is allowed to access a connection object at a time. If multiple threads attempt + * to access a connection object simultaneously, then undefined behaviour/crashes will occur. + * \param context A context object that was returned from sqlany_init_ex() + * \return A connection object + * \sa sqlany_connect(), sqlany_disconnect(), sqlany_init_ex() + */ + a_sqlany_connection *sqlany_new_connection_ex( a_sqlany_interface_context *context ); +#endif + +/** Frees the resources associated with a connection object. + * + * \param sqlany_conn A connection object created with sqlany_new_connection(). + * \sa sqlany_new_connection() + */ +void sqlany_free_connection( a_sqlany_connection *sqlany_conn ); + +/** Creates a connection object based on a supplied DBLIB SQLCA pointer. + * + * \param arg A void * pointer to a DBLIB SQLCA object. + * \return A connection object. + * \sa sqlany_new_connection(), sqlany_execute(), sqlany_execute_direct(), sqlany_execute_immediate(), sqlany_prepare() + */ +a_sqlany_connection * sqlany_make_connection( void * arg ); +#if _SACAPI_VERSION+0 >= 2 + /** Creates a connection object based on a supplied DBLIB SQLCA pointer and context. + * \param context A valid context object that was created by sqlany_init_ex() + * \param arg A void * pointer to a DBLIB SQLCA object. + * \return A connection object. + * \sa sqlany_init_ex(), sqlany_execute(), sqlany_execute_direct(), sqlany_execute_immediate(), sqlany_prepare() + */ + a_sqlany_connection *sqlany_make_connection_ex( a_sqlany_interface_context *context, void *arg ); +#endif + +/** Creates a connection to a SQL Anywhere database server using the supplied connection object and connection string. + * + * The supplied connection object must first be allocated using sqlany_new_connection(). + * + * The following example demonstrates how to retrieve the error code of a failed connection attempt: + * + *
+ * a_sqlany_connection * sqlany_conn;
+ * sqlany_conn = sqlany_new_connection();
+ * if( !sqlany_connect( sqlany_conn, "uid=dba;pwd=sql" ) ) {
+ *     char reason[SACAPI_ERROR_SIZE];
+ *     sacapi_i32 code;
+ *     code = sqlany_error( sqlany_conn, reason, sizeof(reason) );
+ *     printf( "Connection failed. Code: %d Reason: %s\n", code, reason );
+ * } else {
+ *     printf( "Connected successfully!\n" );
+ *     sqlany_disconnect( sqlany_conn );
+ * }
+ * sqlany_free_connection( sqlany_conn );
+ * 
+ * + * For more information on connecting to a SQL Anywhere database server, see + * \salink{Connection parameters, "http://dcx.sybase.com/selectproduct?turl=1201en/dbadmin/da-conparm.html", "dbadmin", "da-conparm"} and + * \salink{SQL Anywhere database connections, "http://dcx.sybase.com/selectproduct?turl=1201en/dbadmin/da-dbconnections.html", "dbadmin", "da-dbconnections"}. + * + * \param sqlany_conn A connection object created by sqlany_new_connection(). + * \param str A SQL Anywhere connection string. + * \return 1 if the connection is established successfully or 0 when the connection fails. Use sqlany_error() to + * retrieve the error code and message. + * \sa sqlany_new_connection(), sqlany_error() + */ +sacapi_bool sqlany_connect( a_sqlany_connection * sqlany_conn, const char * str ); + +/** Disconnects an already established SQL Anywhere connection. + * + * All uncommitted transactions are rolled back. + * + * \param sqlany_conn A connection object with a connection established using sqlany_connect(). + * \return 1 when successful or 0 when unsuccessful. + * \sa sqlany_connect(), sqlany_new_connection() + */ +sacapi_bool sqlany_disconnect( a_sqlany_connection * sqlany_conn ); + +#if _SACAPI_VERSION+0 >= 2 + /** Cancel an outstanding request on a connection. + * This function can be used to cancel an outstanding request on a specific connection. + * \param sqlany_conn A connection object with a connection established using sqlany_connect(). + */ + void sqlany_cancel( a_sqlany_connection * sqlany_conn ); +#endif + +/** Executes the supplied SQL statement immediately without returning a result set. + * + * This function is useful for SQL statements that do not return a result set. + * + * \param sqlany_conn A connection object with a connection established using sqlany_connect(). + * \param sql A string representing the SQL statement to be executed. + * \return 1 on success or 0 on failure. + */ +sacapi_bool sqlany_execute_immediate( a_sqlany_connection * sqlany_conn, const char * sql ); + +/** Prepares a supplied SQL string. + * + * Execution does not happen until sqlany_execute() is + * called. The returned statement object should be freed using sqlany_free_stmt(). + * +* The following statement demonstrates how to prepare a SELECT SQL string: + * + *
+ * char * str;
+ * a_sqlany_stmt * stmt;
+ *
+ * str = "select * from employees where salary >= ?";
+ * stmt = sqlany_prepare( sqlany_conn, str );
+ * if( stmt == NULL ) {
+ *     // Failed to prepare statement, call sqlany_error() for more info
+ * }
+ * 
+ * + * \param sqlany_conn A connection object with a connection established using sqlany_connect(). + * \param sql_str The SQL statement to be prepared. + * \return A handle to a SQL Anywhere statement object. The statement object can be used by sqlany_execute() + * to execute the statement. + * \sa sqlany_free_stmt(), sqlany_connect(), sqlany_execute(), sqlany_num_params(), sqlany_describe_bind_param(), sqlany_bind_param() + */ +a_sqlany_stmt * sqlany_prepare( a_sqlany_connection * sqlany_conn, const char * sql_str ); + +/** Frees resources associated with a prepared statement object. + * + * \param sqlany_stmt A statement object returned by the successful execution of sqlany_prepare() or sqlany_execute_direct(). + * \sa sqlany_prepare(), sqlany_execute_direct() + */ +void sqlany_free_stmt( a_sqlany_stmt * sqlany_stmt ); + +/** Returns the number of parameters expected for a prepared statement. + * + * \param sqlany_stmt A statement object returned by the successful execution of sqlany_prepare(). + * \return The expected number of parameters, or -1 if the statement object is not valid. + * \sa sqlany_prepare() + */ +sacapi_i32 sqlany_num_params( a_sqlany_stmt * sqlany_stmt ); + +/** Describes the bind parameters of a prepared statement. + * + * This function allows the caller to determine information about prepared statement parameters. The type of prepared + * statement, stored procedured or a DML, determines the amount of information provided. The direction of the parameters + * (input, output, or input-output) are always provided. + * + * \param sqlany_stmt A statement prepared successfully using sqlany_prepare(). + * \param index The index of the parameter. This number must be between 0 and sqlany_num_params() - 1. + * \param param A a_sqlany_bind_param structure that is populated with information. + * \return 1 when successful or 0 when unsuccessful. + * \sa sqlany_bind_param(), sqlany_prepare() + */ +sacapi_bool sqlany_describe_bind_param( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param * param ); + +/** Bind a user-supplied buffer as a parameter to the prepared statement. + * + * \param sqlany_stmt A statement prepared successfully using sqlany_prepare(). + * \param index The index of the parameter. This number must be between 0 and sqlany_num_params() - 1. + * \param param A a_sqlany_bind_param structure description of the parameter to be bound. + * \return 1 on success or 0 on unsuccessful. + * \sa sqlany_describe_bind_param() + */ +sacapi_bool sqlany_bind_param( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param * param ); + +/** Sends data as part of a bound parameter. + * + * This method can be used to send a large amount of data for a bound parameter in chunks. + * + * \param sqlany_stmt A statement prepared successfully using sqlany_prepare(). + * \param index The index of the parameter. This should be a number between 0 and sqlany_num_params() - 1. + * \param buffer The data to be sent. + * \param size The number of bytes to send. + * \return 1 on success or 0 on failure. + * \sa sqlany_prepare() + */ +sacapi_bool sqlany_send_param_data( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, char * buffer, size_t size ); + +/** Resets a statement to its prepared state condition. + * + * \param sqlany_stmt A statement prepared successfully using sqlany_prepare(). + * \return 1 on success, 0 on failure. + * \sa sqlany_prepare() + */ +sacapi_bool sqlany_reset( a_sqlany_stmt * sqlany_stmt ); + +/** Retrieves information about the parameters that were bound using sqlany_bind_param(). + * + * \param sqlany_stmt A statement prepared successfully using sqlany_prepare(). + * \param index The index of the parameter. This number should be between 0 and sqlany_num_params() - 1. + * \param info A sqlany_bind_param_info buffer to be populated with the bound parameter's information. + * \return 1 on success or 0 on failure. + * \sa sqlany_bind_param(), sqlany_describe_bind_param(), sqlany_prepare() + */ +sacapi_bool sqlany_get_bind_param_info( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param_info * info ); + +/** Executes a prepared statement. + * + * You can use sqlany_num_cols() to verify if the executed statement returned a result set. + * + * The following example shows how to execute a statement that does not return a result set: + * + *
+ * a_sqlany_stmt * 	 stmt;
+ * int		     	 i;
+ * a_sqlany_bind_param   param;
+ *
+ * stmt = sqlany_prepare( sqlany_conn, "insert into moe(id,value) values( ?,? )" );
+ * if( stmt ) {
+ *     sqlany_describe_bind_param( stmt, 0, ¶m );
+ *     param.value.buffer = (char *)\&i;
+ *     param.value.type   = A_VAL32;
+ *     sqlany_bind_param( stmt, 0, ¶m );
+ *
+ *     sqlany_describe_bind_param( stmt, 1, ¶m );
+ *     param.value.buffer = (char *)\&i;
+ *     param.value.type   = A_VAL32;
+ *     sqlany_bind_param( stmt, 1, ¶m );
+ *
+ *     for( i = 0; i < 10; i++ ) {
+ *         if( !sqlany_execute( stmt ) ) {	
+ *	           // call sqlany_error()
+ *	       }
+ *     }
+ *     sqlany_free_stmt( stmt );
+ * }
+ * 
+ * + * \param sqlany_stmt A statement prepared successfully using sqlany_prepare(). + * \return 1 if the statement is executed successfully or 0 on failure. + * \sa sqlany_prepare() + */ +sacapi_bool sqlany_execute( a_sqlany_stmt * sqlany_stmt ); + +/** Executes the SQL statement specified by the string argument and possibly returns a result set. + * + * Use this method if you want to prepare and execute a statement, + * or instead of calling sqlany_prepare() followed by sqlany_execute(). + * + * The following example shows how to execute a statement that returns a result set: + * + *
+ * a_sqlany_stmt *   stmt;
+ *
+ * stmt = sqlany_execute_direct( sqlany_conn, "select * from employees" );
+ * if( stmt && sqlany_num_cols( stmt ) > 0 ) {
+ *     while( sqlany_fetch_next( stmt ) ) {
+ *         int i;
+ *	       for( i = 0; i < sqlany_num_cols( stmt ); i++ ) {
+ *             // Get column i data 
+ *         }
+ *     }
+ *     sqlany_free_stmt( stmt  );
+ * }
+ * 
+ * + * Note: This function cannot be used for executing a SQL statement with parameters. + * + * \param sqlany_conn A connection object with a connection established using sqlany_connect(). + * \param sql_str A SQL string. The SQL string should not have parameters such as ?. + * \return A statement handle if the function executes successfully, NULL when the function executes unsuccessfully. + * \sa sqlany_fetch_absolute(), sqlany_fetch_next(), sqlany_num_cols(), sqlany_get_column() + */ +a_sqlany_stmt * sqlany_execute_direct( a_sqlany_connection * sqlany_conn, const char * sql_str ); + +/** Moves the current row in the result set to the row number specified and then fetches the data at that row. + * + * \param sqlany_stmt A statement object that was executed by + * sqlany_execute() or sqlany_execute_direct(). + * \param row_num The row number to be fetched. The first row is 1, the last row is -1. + * \return 1 if the fetch was successfully, 0 when the fetch is unsuccessful. + * \sa sqlany_execute_direct(), sqlany_execute(), sqlany_error(), sqlany_fetch_next() + */ +sacapi_bool sqlany_fetch_absolute( a_sqlany_stmt * sqlany_stmt, sacapi_i32 row_num ); + +/** Returns the next row from the result set. + * + * This function fetches the next row from the result set. + * When the result object is first created, the current row + * pointer is set to before the first row, that is, row 0. + * This function first advances the row pointer and then fetches + * the data at the new row. + * + * \param sqlany_stmt A statement object that was executed by + * sqlany_execute() or sqlany_execute_direct(). + * \return 1 if the fetch was successfully, 0 when the fetch is unsuccessful. + * \sa sqlany_fetch_absolute(), sqlany_execute_direct(), sqlany_execute(), sqlany_error() + */ +sacapi_bool sqlany_fetch_next( a_sqlany_stmt * sqlany_stmt ); + +/** Advances to the next result set in a multiple result set query. + * + * If a query (such as a call to a stored procedure) returns multiple result sets, then this function + * advances from the current result set to the next. + * +* The following example demonstrates how to advance to the next result set in a multiple result set query: + * + *
+ * stmt = sqlany_execute_direct( sqlany_conn, "call my_multiple_results_procedure()" );
+ * if( result ) {
+ *     do {
+ *         while( sqlany_fetch_next( stmt ) ) {
+ *            // get column data    
+ *         }
+ *     } while( sqlany_get_next_result( stmt ) );
+ *     sqlany_free_stmt( stmt );
+ * }
+ * 
+ * + * \param sqlany_stmt A statement object executed by + * sqlany_execute() or sqlany_execute_direct(). + * \return 1 if the statement successfully advances to the next result set, 0 otherwise. + * \sa sqlany_execute_direct(), sqlany_execute() + */ +sacapi_bool sqlany_get_next_result( a_sqlany_stmt * sqlany_stmt ); + +/** Returns the number of rows affected by execution of the prepared statement. + * + * \param sqlany_stmt A statement that was prepared and executed successfully with no result set returned. + * For example, an INSERT, UPDATE or DELETE statement was executed. + * \return The number of rows affected or -1 on failure. + * \sa sqlany_execute(), sqlany_execute_direct() + */ +sacapi_i32 sqlany_affected_rows( a_sqlany_stmt * sqlany_stmt ); + +/** Returns number of columns in the result set. + * + * \param sqlany_stmt A statement object created by sqlany_prepare() or sqlany_execute_direct(). + * \return The number of columns in the result set or -1 on a failure. + * \sa sqlany_execute(), sqlany_execute_direct(), sqlany_prepare() + */ +sacapi_i32 sqlany_num_cols( a_sqlany_stmt * sqlany_stmt ); + +/** Returns the number of rows in the result set. + * + * By default this function only returns an estimate. To return an exact count, set the row_counts option + * on the connection. For more information on the row_counts option, see + * \salink{row_counts option [database], "http://dcx.sybase.com/selectproduct?turl=1201en/dbadmin/row-counts-option.html", "dbadmin", "row-counts-option"}. + * + * \param sqlany_stmt A statement object that was executed by + * sqlany_execute() or sqlany_execute_direct(). + * \return The number rows in the result set. If the number of rows is an estimate, the number returned is + * negative and the estimate is the absolute value of the returned integer. The value returned is positive + * if the number of rows is exact. + * \sa sqlany_execute_direct(), sqlany_execute() + */ +sacapi_i32 sqlany_num_rows( a_sqlany_stmt * sqlany_stmt ); + +/** Fills the supplied buffer with the value fetched for the specified column. + * + * For A_BINARY and A_STRING * data types, + * value->buffer points to an internal buffer associated with the result set. + * Do not rely upon or alter the content of the pointer buffer as it changes when a + * new row is fetched or when the result set object is freed. Users should copy the + * data out of those pointers into their own buffers. + * + * The value->length field indicates the number of valid characters that + * value->buffer points to. The data returned in value->buffer is not + * null-terminated. This function fetches all the returned values from the SQL + * Anywhere database server. For example, if the column contains + * a 2GB blob, this function attempts to allocate enough memory to hold that value. + * If you do not want to allocate memory, use sqlany_get_data() instead. + * + * \param sqlany_stmt A statement object executed by + * sqlany_execute() or sqlany_execute_direct(). + * \param col_index The number of the column to be retrieved. + * A column number is between 0 and sqlany_num_cols() - 1. + * \param buffer A a_sqlany_data_value object to be filled with the data fetched for column col_index. + * \return 1 on success or 0 for failure. A failure can happen if any of the parameters are invalid or if there is + * not enough memory to retrieve the full value from the SQL Anywhere database server. + * \sa sqlany_execute_direct(), sqlany_execute(), sqlany_fetch_absolute(), sqlany_fetch_next() + */ +sacapi_bool sqlany_get_column( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_data_value * buffer ); + +/** Retrieves the data fetched for the specified column into the supplied buffer memory. + * + * \param sqlany_stmt A statement object executed by + * sqlany_execute() or sqlany_execute_direct(). + * \param col_index The number of the column to be retrieved. + * A column number is between 0 and sqlany_num_cols() - 1. + * \param offset The starting offset of the data to get. + * \param buffer A buffer to be filled with the contents of the column. The buffer pointer must be aligned correctly + * for the data type copied into it. + * \param size The size of the buffer in bytes. The function fails + * if you specify a size greater than 2GB. + * \return The number of bytes successfully copied into the supplied buffer. + * This number must not exceed 2GB. + * 0 indicates that no data remains to be copied. -1 indicates a failure. + * \sa sqlany_execute(), sqlany_execute_direct(), sqlany_fetch_absolute(), sqlany_fetch_next() + */ +sacapi_i32 sqlany_get_data( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, size_t offset, void * buffer, size_t size ); + +/** Retrieves information about the data that was fetched by the last fetch operation. + * + * \param sqlany_stmt A statement object executed by + * sqlany_execute() or sqlany_execute_direct(). + * \param col_index The column number between 0 and sqlany_num_cols() - 1. + * \param buffer A data info buffer to be filled with the metadata about the data fetched. + * \return 1 on success, and 0 on failure. Failure is returned when any of the supplied parameters are invalid. + * \sa sqlany_execute(), sqlany_execute_direct(), sqlany_fetch_absolute(), sqlany_fetch_next() + */ +sacapi_bool sqlany_get_data_info( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_data_info * buffer ); + +/** Retrieves column metadata information and fills the a_sqlany_column_info structure with information about the column. + * + * \param sqlany_stmt A statement object created by sqlany_prepare() or sqlany_execute_direct(). + * \param col_index The column number between 0 and sqlany_num_cols() - 1. + * \param buffer A column info structure to be filled with column information. + * \return 1 on success or 0 if the column index is out of range, + * or if the statement does not return a result set. + * \sa sqlany_execute(), sqlany_execute_direct(), sqlany_prepare() + */ +sacapi_bool sqlany_get_column_info( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_column_info * buffer ); + +/** Commits the current transaction. + * + * \param sqlany_conn The connection object on which the commit operation is performed. + * \return 1 when successful or 0 when unsuccessful. + * \sa sqlany_rollback() + */ +sacapi_bool sqlany_commit( a_sqlany_connection * sqlany_conn ); + +/** Rolls back the current transaction. + * + * \param sqlany_conn The connection object on which the rollback operation is to be performed. + * \return 1 on success, 0 otherwise. + * \sa sqlany_commit() + */ +sacapi_bool sqlany_rollback( a_sqlany_connection * sqlany_conn ); + +/** Returns the current client version. + * + * This method fills the buffer passed with the major, minor, patch, and build number of the client library. + * The buffer will be null-terminated. + * + * \param buffer The buffer to be filled with the client version string. + * \param len The length of the buffer supplied. + * \return 1 when successful or 0 when unsuccessful. + */ +sacapi_bool sqlany_client_version( char * buffer, size_t len ); +#if _SACAPI_VERSION+0 >= 2 + /** Returns the current client version. + * + * This method fills the buffer passed with the major, minor, patch, and build number of the client library. + * The buffer will be null-terminated. + * + * \param context object that was create with sqlany_init_ex() + * \param buffer The buffer to be filled with the client version string. + * \param len The length of the buffer supplied. + * \return 1 when successful or 0 when unsuccessful. + * \sa sqlany_init_ex() + */ + sacapi_bool sqlany_client_version_ex( a_sqlany_interface_context *context, char *buffer, size_t len ); +#endif + +/** Retrieves the last error code and message stored in the connection object. + * + * For more information on SQLCODE error messages, see + * \salink{SQL Anywhere error messages sorted by SQLCODE, "http://dcx.sybase.com/selectproduct?turl=1201en/saerrors/sa-errors-by-sqlcode.html", "errors", "sa-errors-by-sqlcode"}. + * + * \param sqlany_conn A connection object returned from sqlany_new_connection(). + * \param buffer A buffer to be filled with the error message. + * \param size The size of the supplied buffer. + * \return The last error code. Positive values are warnings, negative values are errors, and 0 indicates success. + * \sa sqlany_connect() + */ +sacapi_i32 sqlany_error( a_sqlany_connection * sqlany_conn, char * buffer, size_t size ); + +/** Retrieves the current SQLSTATE. + * + * For more information on SQLSTATE error messages, see + * \salink{SQL Anywhere error messages sorted by SQLSTATE, "http://dcx.sybase.com/selectproduct?turl=1201en/saerrors/sa-errors-by-sqlstate.html", "errors", "sa-errors-by-sqlstate"}. + * + * \param sqlany_conn A connection object returned from sqlany_new_connection(). + * \param buffer A buffer to be filled with the current 5-character SQLSTATE. + * \param size The buffer size. + * \return The number of bytes copied into the buffer. + * \sa sqlany_error() + */ +size_t sqlany_sqlstate( a_sqlany_connection * sqlany_conn, char * buffer, size_t size ); + +/** Clears the last stored error code + * + * \param sqlany_conn A connection object returned from sqlany_new_connection(). + * \sa sqlany_new_connection() + */ +void sqlany_clear_error( a_sqlany_connection * sqlany_conn ); + +#if defined(__cplusplus) +} +#endif + +/** \example connecting.cpp + * This is an example of how to create a connection object and connect with it to SQL Anywhere. + */ + +/** \example fetching_a_result_set.cpp + * This example shows how to fetch data from a result set. + */ + +/** \example preparing_statements.cpp + * This example shows how to prepare and execute a statement. + */ + +/** \example fetching_multiple_from_sp.cpp + * This example shows how to fetch multiple result sets from a stored procedure. + */ + +/** \example send_retrieve_part_blob.cpp + * This example shows how to insert a blob in chunks and retrieve it in chunks too. + */ + +/** \example send_retrieve_full_blob.cpp + * This example shows how to insert and retrieve a blob in one chunk . + */ + +/** \example dbcapi_isql.cpp + * This example shows how to write an ISQL application using dbcapi. + */ + +#endif diff --git a/libraries/SQLAPI/include/asa/sqlca.h b/libraries/SQLAPI/include/asa/sqlca.h new file mode 100644 index 000000000..62433b160 --- /dev/null +++ b/libraries/SQLAPI/include/asa/sqlca.h @@ -0,0 +1,399 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1988-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** + +#ifndef _SQLCA_H_INCLUDED +#define _SQLCA_H_INCLUDED +#define II_SQLCA + +#include "sqlos.h" +#ifndef UNDER_PALM_OS_GARNET + #include +#endif + +/******************************************************************/ +/* Define _SQL32 or _SQL64 based on target operating-system. */ +/******************************************************************/ + +#if defined( _SQL_OS_UNIX64 ) + #define _SQL64 +#else + #define _SQL32 +#endif + + +/******************************************************************/ +/* Define _sqlfar macro (definition left for compatibility reasons */ +/******************************************************************/ + +#define _sqlfar +#define _sqlfar_isfar 0 + +/*********************************************/ +/* Version check for sqlpp-to-dblib interface*/ +/*********************************************/ + +typedef unsigned short a_sqlpp_version_number; + +#define SQLPP_DBLIB_VERSION_INITIAL 1 +#define SQLPP_DBLIB_VERSION_WSQL32 2 +#define SQLPP_DBLIB_VERSION_REENTRANCY 3 +#define SQLPP_DBLIB_VERSION_WSQL40 4 +#define SQLPP_DBLIB_VERSION_SA50 4 +#define SQLPP_DBLIB_VERSION_ASA6 6 +#define SQLPP_DBLIB_VERSION_ASA7 7 +#define SQLPP_DBLIB_VERSION_ASA8 8 +#define SQLPP_DBLIB_VERSION_ASA9 9 +#define SQLPP_DBLIB_VERSION_SA10 10 +#define SQLPP_DBLIB_VERSION_SA11 11 +#define SQLPP_DBLIB_VERSION_SA12 12 +#define SQLPP_DBLIB_VERSION 12 + +#if defined( _SQL_SQLPP_VERSION_MAJOR ) \ +&& _SQL_SQLPP_VERSION_MAJOR != SQLPP_DBLIB_VERSION + #error Incorrect version of SQLPP used for this header file +#endif + +/******************************************************************/ +/* Define structure packing macro based on environment */ +/******************************************************************/ + +#if ( defined( _SQL_OS_WINNT ) && !defined( UNDER_CE ) && !defined( _WIN64 ) ) \ +|| defined( _SQL_OS_NETWARE ) + #define _SQL_PACK_STRUCTURES 1 +#endif + +/******************************************************************/ +/* Structure definitions */ +/******************************************************************/ + +#if defined( _SQL_PACK_STRUCTURES ) + #if defined( _MSC_VER ) && _MSC_VER > 800 + #pragma warning(push) + #pragma warning(disable:4103) + #endif + #include "pshpk1.h" +#endif + +typedef short a_sql_len; +typedef unsigned short a_sql_ulen; + +typedef a_sql_int32 an_sql_code; +typedef char an_sql_state[6]; + +struct sqlwarn{ + unsigned char sqlwarn0; + unsigned char sqlwarn1; + unsigned char sqlwarn2; + unsigned char sqlwarn3; + unsigned char sqlwarn4; + unsigned char sqlwarn5; + unsigned char sqlwarn6; + unsigned char sqlwarn7; + unsigned char sqlwarn8; + unsigned char sqlwarn9; +}; + +#if defined( _SQL_PACK_STRUCTURES ) + #include "poppk.h" + /* The SQLCA should be 4-byte aligned */ + #include "pshpk4.h" +#endif + +#ifdef __cplusplus +typedef struct _sqlca{ +#else +typedef struct sqlca{ +#endif + unsigned char sqlcaid[8]; + a_sql_int32 sqlcabc; + an_sql_code sqlcode; + short sqlerrml; + unsigned char sqlerrmc[70]; + unsigned char sqlerrp[8]; + a_sql_int32 sqlerrd[6]; + struct sqlwarn sqlwarn; + an_sql_state sqlstate; +} SQLCA; + +#ifndef SQLCAPTR + #define SQLCAPTR sqlcaptr +#endif + +#ifndef SQLCODE + #define SQLCODE SQLCAPTR->sqlcode + #define SQLWARN0 SQLCAPTR->sqlwarn.sqlwarn0 + #define SQLWARN1 SQLCAPTR->sqlwarn.sqlwarn1 + #define SQLWARN2 SQLCAPTR->sqlwarn.sqlwarn2 + #define SQLWARN3 SQLCAPTR->sqlwarn.sqlwarn3 + #define SQLWARN4 SQLCAPTR->sqlwarn.sqlwarn4 + #define SQLWARN5 SQLCAPTR->sqlwarn.sqlwarn5 + #define SQLWARN6 SQLCAPTR->sqlwarn.sqlwarn6 + #define SQLWARN7 SQLCAPTR->sqlwarn.sqlwarn7 + #define SQLWARN8 SQLCAPTR->sqlwarn.sqlwarn8 + #define SQLWARN9 SQLCAPTR->sqlwarn.sqlwarn9 + #define SQLSTATE SQLCAPTR->sqlstate + + #define SQLIOCOUNT_F sqlerrd[1] + #define SQLCOUNT_F sqlerrd[2] + #define SQLIOESTIMATE_F sqlerrd[3] + + #define SQLIOCOUNT SQLCAPTR->SQLIOCOUNT_F + #define SQLCOUNT SQLCAPTR->SQLCOUNT_F + #define SQLIOESTIMATE SQLCAPTR->SQLIOESTIMATE_F +#endif + +#if defined( _SQL_PACK_STRUCTURES ) + #include "poppk.h" + /* Everything else must be single-byte aligned */ + #include "pshpk1.h" +#endif + +#define DECL_NCHAR char + +#define DECL_VARCHAR( size ) \ + struct { a_sql_ulen len; \ + unsigned char array[size+1]; \ + } + +#define DECL_NVARCHAR( size ) \ + struct { a_sql_ulen len; \ + unsigned char array[size+1]; \ + } + +#define DECL_BINARY( size ) \ + struct { a_sql_ulen len; \ + unsigned char array[size]; \ + } + +#define DECL_LONGVARCHAR( size ) \ + struct { a_sql_uint32 array_len; \ + a_sql_uint32 stored_len; \ + a_sql_uint32 untrunc_len; \ + char array[size+1]; \ + } + +#define DECL_LONGNVARCHAR( size ) \ + struct { a_sql_uint32 array_len; \ + a_sql_uint32 stored_len; \ + a_sql_uint32 untrunc_len; \ + char array[size+1]; \ + } + +#define DECL_LONGBINARY( size ) \ + struct { a_sql_uint32 array_len; \ + a_sql_uint32 stored_len; \ + a_sql_uint32 untrunc_len; \ + char array[size]; \ + } + +#define DECL_DECIMAL( prec, scale ) \ + struct { char array[ ((prec)/2) + 1 ]; \ + } + +#define DECL_FIXCHAR( size ) \ + struct { char array[ size ]; \ + } + +#define DECL_NFIXCHAR( size ) \ + struct { char array[ size ]; \ + } + +#define DECL_DATETIME \ + struct sqldatetime + +#define DECL_BIT \ + unsigned char + +#if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__BORLANDC__) + +#define DECL_BIGINT __int64 +#define DECL_UNSIGNED_BIGINT unsigned __int64 + +#elif defined(_SQL64) + +#define DECL_BIGINT long +#define DECL_UNSIGNED_BIGINT unsigned long + +#else + +#define DECL_BIGINT long long +#define DECL_UNSIGNED_BIGINT unsigned long long + +#endif + +typedef struct VARCHAR { + a_sql_ulen len; + char array[1]; +} VARCHAR; + +typedef struct NVARCHAR { + a_sql_ulen len; + char array[1]; +} NVARCHAR; + +typedef struct BINARY { + a_sql_ulen len; + char array[1]; +} BINARY; + +typedef struct LONGVARCHAR { + a_sql_uint32 array_len; /* number of allocated bytes in array */ + a_sql_uint32 stored_len; /* number of bytes stored in array + * (never larger than array_len) */ + a_sql_uint32 untrunc_len;/* number of bytes in untruncated expression + * (may be larger than array_len) */ + char array[1]; /* the data */ +} LONGVARCHAR, LONGNVARCHAR, LONGBINARY; + +/* used by LONGVARCHARSIZE and LONGBINARYSIZE */ +#define _SQL_OFFSETOF(__typ,__id) ((size_t)&(((__typ*)0)->__id)) + +/* number of bytes to allocate for LONGVARCHAR or LONGBINARY structure + * with n bytes in array */ +#define LONGVARCHARSIZE( n ) ( _SQL_OFFSETOF( LONGVARCHAR, array[0] ) + n ) +#define LONGNVARCHARSIZE( n ) LONGVARCHARSIZE( n ) +#define LONGBINARYSIZE( n ) LONGVARCHARSIZE( n ) + +typedef struct TYPE_DECIMAL { + char array[1]; +} TYPE_DECIMAL; + +typedef short int a_sql_statement_number; + +/* Supported values for port_type in a_server_address + (used by db_locate_servers) */ +#define PORT_TYPE_TCP 6 + +typedef struct a_server_address { + a_sql_uint32 port_type; /* Only returns PORT_TYPE_TCP */ + a_sql_uint32 port_num; /* TCP Port number */ + char *name; /* Name of the database engine */ + char *address; /* IP address */ + char *dbname; /* Database name */ +} a_server_address; + +/* Supported flags for db_lookup_servers_ex */ +#define DB_LOOKUP_FLAG_NUMERIC 0x0001 +#define DB_LOOKUP_FLAG_DATABASES 0x0002 +#define DB_LOOKUP_FLAG_ADDRESS_INCLUDES_PORT 0x0004 + +/* Supported flags for fill_sqlda_ex */ +#define FILL_SQLDA_FLAG_RETURN_DT_LONG 0x0001 + +struct a_dblib_info; + +struct sqlda; + +#include "sqlcallback.h" + +#if defined( _SQL_PACK_STRUCTURES ) + #include "poppk.h" + #if defined( _MSC_VER ) && _MSC_VER > 800 + #pragma warning(pop) + #endif +#endif + +/******************************************************************/ +/* Define __SMALLDATA__ based on other compiler macros */ +/******************************************************************/ + +#ifndef __SMALLDATA__ + #ifdef M_I86SM + #define __SMALLDATA__ + #endif + #ifdef M_I86MM + #define __SMALLDATA__ + #endif + #ifdef __TURBOC__ + #if defined( __TINY__) || defined(__SMALL__) || defined(__MEDIUM__) + #define __SMALLDATA__ + #endif + #endif +#endif + + +/******************************************************************/ +/* PLATFORM specific definitions */ +/******************************************************************/ + +typedef enum { + SQLDA_CLEAR, + SQLDA_NOCLEAR, + SQLDA_NOEXEC +} a_descriptor_behaviour; + +typedef enum { + SQLDA_TYPE, + SQLDA_LENGTH, + SQLDA_RETURNED_LENGTH, + SQLDA_PRECISION, + SQLDA_SCALE, + SQLDA_NULLABLE, + SQLDA_INDICATOR +} a_descriptor_field; + +typedef enum { + DB_PROP_SERVER_ADDRESS, + DB_PROP_DBLIB_VERSION, + DB_PROP_CLIENT_CHARSET +} a_db_property; + +typedef enum { + DB_SET_PROP_CLIENT_API +} a_db_set_property; + +/* Standard functions emitted by sqlpp require covers for some platforms */ +#ifdef UNDER_PALM_OS_GARNET + #ifndef memcpy + #define memcpy MemMove + #endif +#endif + +#ifndef II_SQL_FUNCS +#define II_SQL_FUNCS + +#ifdef __cplusplus + extern "C" { +#endif + +/* external sqlca data structure */ + +extern SQLCA sqlca; +extern SQLCA *sqlcaptr; + +/* Macros for multiple sqlca management */ + +#define db_set_sqlca( sqlca ) sqlcaptr = sqlca +#define db_get_sqlca() sqlcaptr + + +/* Generate function pointers or function prototypes */ + +#ifndef UNDER_UL_SQLPP /* UltraLite uses its own sqlpp function headers*/ +#define UNDER_ASA_SQLPP +#ifndef _NO_FUNC_INFO +#ifdef _USE_ESQLDLL +#define FUNC_INFO( scope, rettype, call, fname, parms ) \ + extern rettype ( call * fname ) parms; +#include "sqlfuncs.h" +#undef FUNC_INFO +#else +#define FUNC_INFO( scope, rettype, call, fname, parms ) \ + scope rettype call fname parms; +#include "sqlfuncs.h" +#undef FUNC_INFO +#endif //_USE_ESQLDLL +#endif //_NO_FUNC_INFO +#endif //UNDER_UL_SQLPP + +#ifdef __cplusplus + } +#endif + +#endif + +#endif + diff --git a/libraries/SQLAPI/include/asa/sqlcallback.h b/libraries/SQLAPI/include/asa/sqlcallback.h new file mode 100644 index 000000000..152f7cb9b --- /dev/null +++ b/libraries/SQLAPI/include/asa/sqlcallback.h @@ -0,0 +1,76 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1988-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** + +#ifndef _SQLCB_H_INCLUDED +#define _SQLCB_H_INCLUDED +#define II_SQLCB + +#include "sqlos.h" + +/******************************************************************/ +/* PLATFORM specific definitions */ +/******************************************************************/ + +#if defined( _SQL_OS_WINNT ) + #define _esqlentry_ __stdcall +#endif + +#define _fd_ +#define _sql_ptrchk_(p) ((void *) (p)) +#define _sql_ptrtypechk_(p,t) ((t *)p) + +#ifndef _esqlentry_ + #define _esqlentry_ +#endif + +#ifdef __cplusplus + #define SQLNULL 0 + #define SQLFARNULL 0 +#else + #define SQLNULL (void *)0 + #define SQLFARNULL (void *)0 +#endif + +/* Windows callback index */ +typedef enum { + DB_CALLBACK_START = 0, + DB_CALLBACK_WAIT, + DB_CALLBACK_FINISH, + DB_CALLBACK_ASYNC_RESPONSE, + DB_CALLBACK_TRANSLATE_IN, + DB_CALLBACK_TRANSLATE_OUT, + DB_CALLBACK_UNKNOWN_EVENT, /* For Macintosh, initially */ + DB_CALLBACK_MESSAGE, // Messages from the engine during a request + DB_CALLBACK_CONN_DROPPED, + DB_CALLBACK_DEBUG_MESSAGE, + DB_CALLBACK_VALIDATE_FILE_TRANSFER, + DB_MAX_CALLBACK +} a_db_callback_index; + +/* Callback function type */ +#define SQL_CALLBACK _esqlentry_ + +typedef int (SQL_CALLBACK *SQL_CALLBACK_PARM)(); + +/****************************************/ +/* Define sqldatetime */ +/****************************************/ +typedef struct sqldatetime { + unsigned short year; /* e.g. 1992 */ + unsigned char month; /* 0-11 */ + unsigned char day_of_week; /* 0-6 0=Sunday, 1=Monday, ... */ + unsigned short day_of_year; /* 0-365 */ + unsigned char day; /* 1-31 */ + unsigned char hour; /* 0-23 */ + unsigned char minute; /* 0-59 */ + unsigned char second; /* 0-59 */ + a_sql_uint32 microsecond; /* 0-999999 */ +} SQLDATETIME; + +typedef SQLDATETIME DATETIME; + +#endif + diff --git a/libraries/SQLAPI/include/asa/sqlfuncs.h b/libraries/SQLAPI/include/asa/sqlfuncs.h new file mode 100644 index 000000000..db2a8fee5 --- /dev/null +++ b/libraries/SQLAPI/include/asa/sqlfuncs.h @@ -0,0 +1,104 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1997-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** +/* FUNC_INFO is in the following form: */ +/* FUNC_INFO( scope, return type, calling convention, name, parameters ) */ + +/* definitions of database interface procedures generated by */ +/* the SQL preprocessor */ + +FUNC_INFO( extern, void, _esqlentry_, sqlstop, (SQLCA *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_connect_40, (SQLCA *,char *,char *,char *, char *, char *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_disconnect, (SQLCA *, char * )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_setconnect, (SQLCA *, char * )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_commit, (SQLCA *,unsigned int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_rollback, (SQLCA *,unsigned int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_prepare_describe_12, (SQLCA *,char *,char *,short int *,char *,struct sqlda *,struct sqlda *,unsigned int, unsigned short int, a_sql_uint32 )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_prepare_describe_exec_12, (SQLCA *,char *,char *,short int *,char *,struct sqlda *,struct sqlda *,unsigned int, unsigned short int, a_sql_uint32 )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_prepare_exec_drop, (SQLCA *,char *,struct sqlda *,struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_dropstmt, (SQLCA *,char *,char *,short int *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_execute_into, (SQLCA *,char *,char *,short *,struct sqlda *,struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_execute_array, (SQLCA *,char *,char *,short *,struct sqlda *,struct sqlda *,unsigned short int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_execute_imm, (SQLCA *,char *,unsigned short int )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_describe, (SQLCA *,char *,char *,short int *,struct sqlda *,unsigned int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_describe_cursor, (SQLCA *,char *,struct sqlda *,unsigned int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_describe_names, (SQLCA *,char *,char*, short int*,char *,struct sqlda *,unsigned int, unsigned short int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_describe_usertypes, (SQLCA *,char *,char *,short int *,struct sqlda *,unsigned int,unsigned short int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_describe_usertypes_cursor, (SQLCA *,char *,struct sqlda *,unsigned int,unsigned short int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_describe_usertypes_names, (SQLCA *,char *,char*, short int*,char *,struct sqlda *,unsigned int, unsigned short int,unsigned short int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_declare, (SQLCA *,char *,char *,char *,short int *, a_sql_uint32)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_open, (SQLCA *,char *,char *,char *,short int *,struct sqlda *, short int, short int, a_sql_uint32)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_explain, (SQLCA *,char *,unsigned short int,struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_fetch, (SQLCA *,char *,unsigned short int,a_sql_int32,struct sqlda *, short int, unsigned short int )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_fetch_array, (SQLCA *,char *,unsigned short int,a_sql_int32,struct sqlda *, short int, unsigned short int, unsigned short int )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_get_data, (SQLCA *, char *, unsigned short int, a_sql_int32, struct sqlda *, unsigned short int )) +FUNC_INFO( extern, void, _esqlentry_, dbpp_put_into, (SQLCA *,char *,struct sqlda *,struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_put_array, (SQLCA *,char *,struct sqlda *,struct sqlda *,unsigned short int)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_update, (SQLCA *,char *,struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_delete, (SQLCA *,char *,char *,char *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_resume, (SQLCA *,char *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_close, (SQLCA *,char *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_setoption, (SQLCA *,int,char *,char *,struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, dbpp_getoption, (SQLCA *,int,char *,char *,struct sqlda *)) + +/* definitions of descriptor management functions called by */ +/* preprocessor-generated code. */ + +FUNC_INFO( extern, struct sqlda *, _esqlentry_, dealloc_descriptor, ( SQLCA *, struct sqlda * )) +FUNC_INFO( extern, struct sqlda *, _esqlentry_, alloc_descriptor, ( SQLCA *, unsigned short )) +FUNC_INFO( extern, void, _esqlentry_, get_descriptor_data, ( SQLCA *, struct sqlda *, unsigned short, unsigned short, void *, unsigned short, a_descriptor_behaviour, a_descriptor_behaviour )) +FUNC_INFO( extern, unsigned short, _esqlentry_, get_descriptor_count, ( SQLCA *, struct sqlda * )) +FUNC_INFO( extern, short, _esqlentry_, get_descriptor_field, ( SQLCA *, struct sqlda *, unsigned short, a_descriptor_field, a_descriptor_behaviour, a_descriptor_behaviour )) +FUNC_INFO( extern, void, _esqlentry_, check_descriptor_null_value, ( SQLCA *, struct sqlda *, unsigned short )) +FUNC_INFO( extern, short, _esqlentry_, set_descriptor_field, ( SQLCA *, struct sqlda *, unsigned short, a_descriptor_field, short, a_descriptor_behaviour, a_descriptor_behaviour )) +FUNC_INFO( extern, void, _esqlentry_, set_descriptor_count, ( SQLCA *, struct sqlda *, int )) +FUNC_INFO( extern, void, _esqlentry_, set_descriptor_data, ( SQLCA *, struct sqlda *, unsigned short, unsigned short, void *, unsigned short, a_descriptor_behaviour, a_descriptor_behaviour )) + +/* definitions for database utility routines */ + +FUNC_INFO( extern, unsigned int, _esqlentry_, db_string_connect, (SQLCA*,char *)) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_string_disconnect, (SQLCA*,char *)) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_start_engine, (SQLCA*, char*)) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_start_database, (SQLCA*, char*)) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_stop_engine, (SQLCA *, char *)) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_stop_database, (SQLCA *, char *)) +FUNC_INFO( extern, int, _esqlentry_, db_cancel_request, ( SQLCA * )) +FUNC_INFO( extern, struct sqlda *, _esqlentry_, alloc_sqlda_noind, (unsigned int )) +FUNC_INFO( extern, struct sqlda *, _esqlentry_, alloc_sqlda, (unsigned int )) +FUNC_INFO( extern, struct sqlda *, _esqlentry_, fill_sqlda, (struct sqlda *)) +FUNC_INFO( extern, struct sqlda *, _esqlentry_, fill_sqlda_ex, (struct sqlda *, unsigned int)) +FUNC_INFO( extern, struct sqlda *, _esqlentry_, fill_s_sqlda, (struct sqlda *, unsigned int)) +FUNC_INFO( extern, void, _esqlentry_, free_sqlda_noind, (struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, free_sqlda, (struct sqlda *)) +FUNC_INFO( extern, void, _esqlentry_, free_filled_sqlda, (struct sqlda *)) +FUNC_INFO( extern, a_sql_uint32, _esqlentry_, sqlda_storage, (struct sqlda *, int)) +FUNC_INFO( extern, a_sql_uint32, _esqlentry_, sqlda_string_length, (struct sqlda *, int)) +FUNC_INFO( extern, unsigned int, _esqlentry_, sql_needs_quotes, ( SQLCA *, char * )) +FUNC_INFO( extern, char *, _esqlentry_, sqlerror_message, ( SQLCA *, char *, int )) +FUNC_INFO( extern, unsigned short, _esqlentry_, db_find_engine, ( SQLCA *, char * )) +FUNC_INFO( extern, unsigned short, _esqlentry_, db_connection_info, ( SQLCA *, short int, struct sqlda * )) +FUNC_INFO( extern, unsigned short, _esqlentry_, db_is_working, ( SQLCA * )) +FUNC_INFO( extern, int, _esqlentry_, db_init, ( SQLCA * )) +FUNC_INFO( extern, int, _esqlentry_, db_fini, ( SQLCA * )) +FUNC_INFO( extern, void, _esqlentry_, db_interface_option, ( SQLCA *, int, a_sql_int32 )) +FUNC_INFO( extern, void, _esqlentry_, db_ping_server, ( SQLCA *, int, char *, struct sqlda *, struct sqlda * )) +FUNC_INFO( extern, void, _esqlentry_, db_backup, ( SQLCA *, int, int, a_sql_uint32, struct sqlda * )) +FUNC_INFO( extern, void, _esqlentry_, db_delete_file, ( SQLCA *, char * )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_string_ping_server, ( SQLCA *, char *, unsigned int )) +FUNC_INFO( extern, short, _esqlentry_, db_version_check, ( unsigned short )) +FUNC_INFO( extern, unsigned short, _esqlentry_, db_verify_version_12, ( void )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_locate_servers, ( SQLCA *, SQL_CALLBACK_PARM, void * )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_locate_servers_ex, ( SQLCA *, SQL_CALLBACK_PARM, void *, unsigned int )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_get_property, ( SQLCA *, a_db_property, char *, int )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_set_property, ( SQLCA *, a_db_set_property, char * )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_time_change, ( SQLCA * )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_change_char_charset, ( SQLCA *, const char * )) +FUNC_INFO( extern, unsigned int, _esqlentry_, db_change_nchar_charset, ( SQLCA *, const char * )) +FUNC_INFO( extern, void *, _esqlentry_, DBAlloc, ( size_t )) +FUNC_INFO( extern, void *, _esqlentry_, DBRealloc, ( void *, size_t )) +FUNC_INFO( extern, void, _esqlentry_, DBFree, ( void * )) + +/* Callback definitions */ +FUNC_INFO( extern, void, _esqlentry_, db_register_a_callback, ( SQLCA *, a_db_callback_index, SQL_CALLBACK_PARM )) diff --git a/libraries/SQLAPI/include/asa/sqlos.h b/libraries/SQLAPI/include/asa/sqlos.h new file mode 100644 index 000000000..82fa7c68a --- /dev/null +++ b/libraries/SQLAPI/include/asa/sqlos.h @@ -0,0 +1,134 @@ +// ***************************************************** +// Copyright (c) 2001-2011 iAnywhere Solutions, Inc. +// Portions copyright (c) 1988-2011 Sybase, Inc. +// All rights reserved. All unpublished rights reserved. +// ***************************************************** + +#ifndef _SQLOS_H_INCLUDED +#define _SQLOS_H_INCLUDED + +/******************************************************************/ +/* NOTE: _SQL_OS_ will be defined by the */ +/* preprocessor -o option. */ +/* - also use macros that are defined in various environments*/ +/* by various compilers to set the appropriate _SQL_OS */ +/* macro for those files that are not preprocessed */ +/******************************************************************/ + +#if !defined( UNIX ) && ( defined( _SQL_OS_UNIX ) || defined( _SQL_OS_UNIX64 ) || defined( __unix__ ) || defined( __APPLE__ ) || defined( __sun ) || defined( __hpux ) || defined( FREEBSD ) || defined( _AIX ) || defined( __linux__ ) ) +#if !defined( ULPLAT_UNIXBASE ) +#define UNIX +#endif +#endif + +#if !defined( UNIX64 ) && defined( UNIX ) && ( defined( _SQL_OS_UNIX64 ) || defined( __LP64__ ) || defined( __64BIT__ ) || defined( __sparcv9 ) || defined( __amd64 ) ) +#define UNIX64 +#endif + +#if defined( UNDER_PALM_OS ) + #define _SQL_OS_PALM +#endif + +#if defined( WINNT ) \ + || defined( _WINNT ) \ + || defined( __NT__ ) \ + || defined( WIN32 ) \ + || defined( _WIN32 ) \ + || defined( __WIN32__ ) \ + || defined( UNDER_CE ) + #define _SQL_OS_WINNT +#endif + +#if defined( UNIX64 ) + #define _SQL_OS_UNIX64 +#elif defined( UNIX ) \ +|| defined( UNDER_UNIX ) \ +|| defined( UNDER_VXW ) \ +|| defined( ULPLAT_UNIXBASE ) + #define _SQL_OS_UNIX +#endif + +/******************************************************************/ +/* Make sure that one of the _SQL_OS_ macros has been defined */ +/******************************************************************/ + +#if !defined( _SQL_OS_WINNT ) \ +&& !defined( _SQL_OS_PALM ) \ +&& !defined( _SQL_OS_UNIX ) \ +&& !defined( _SQL_OS_UNIX64 ) + #error The appropriate _SQL_OS macro has not been defined +#endif + +/******************************************************/ +/* Define the variant of UNIX being used */ +/******************************************************/ +#if defined( _SQL_OS_UNIX ) || defined( _SQL_OS_UNIX64 ) +#if defined( _AIX ) || defined( __aix__ ) +#define _SQL_OS_UNIX_VARIANT_AIX +#elif defined( __sun ) || defined( __sun__ ) +#define _SQL_OS_UNIX_VARIANT_SUN +#elif defined( __hpux ) || defined( __hpux__ ) +#define _SQL_OS_UNIX_VARIANT_HPUX +#elif defined( __linux__ ) +#define _SQL_OS_UNIX_VARIANT_LINUX +#elif defined( __APPLE__ ) +// (This is also on for iPhone.) +#define _SQL_OS_UNIX_VARIANT_MACOSX +#elif defined( FREEBSD ) +#define _SQL_OS_UNIX_VARIANT_FREEBSD +#elif defined( UNDER_VXW ) +// n/a +#else +#error Unknown UNIX variant used +#endif +#endif + +/****************************************************************************/ +/* Check for bitness mismatch */ +/****************************************************************************/ + +#if ( defined( _SQL_OS_UNIX_VARIANT_LINUX ) && defined( __INTEL_COMPILER ) ) || ( defined( _SQL_OS_UNIX_VARIANT_HPUX ) && ( defined( __HP_cc ) || defined( __HP_aCC ) ) ) +#if defined( UNIX64 ) && !defined( __LP64__ ) +#error "UNIX64 defined but 64-bit compilation not requested" +#elif !defined( UNIX64 ) && defined( __LP64__ ) +#error "64-bit compilation requested but UNIX64 is not defined" +#endif +#endif + +#if ( defined( _SQL_OS_UNIX_VARIANT_LINUX ) || defined( _SQL_OS_UNIX_VARIANT_SUN ) ) && ( defined( __SUNPRO_C ) || defined( __SUNPRO_CC ) ) +#if defined( UNIX64 ) && ! ( defined( __amd64 ) || defined( __sparcv9 ) ) +#error "UNIX64 defined but 64-bit compilation not requested" +#elif !defined( UNIX64 ) && ( defined( __amd64 ) || defined( __sparcv9 ) ) +#error "64-bit compilation requested but UNIX64 is not defined" +#endif +#endif + + +/****************************************/ +/* Define a_sql_int32/a_sql_uint32 */ +/****************************************/ + +#if defined( _SQL_OS_UNIX64 ) || defined( _SQL_OS_UNIX_VARIANT_AIX ) + typedef int a_sql_int32; + typedef unsigned int a_sql_uint32; + typedef long a_sql_int64; + typedef unsigned long a_sql_uint64; +#else +#if defined( _SQL_OS_UNIX_VARIANT_MACOSX ) + typedef int a_sql_int32; + typedef unsigned int a_sql_uint32; +#else + typedef long a_sql_int32; + typedef unsigned long a_sql_uint32; +#endif + #if ( defined( _MSC_VER ) && _MSC_VER < 1300 ) || ( defined(__BORLANDC__) && __BORLANDC__ <= 0x0560 ) + typedef __int64 a_sql_int64; + typedef unsigned __int64 a_sql_uint64; + #else + typedef long long a_sql_int64; + typedef unsigned long long a_sql_uint64; + #endif +#endif + + +#endif diff --git a/libraries/SQLAPI/include/asaAPI.h b/libraries/SQLAPI/include/asaAPI.h new file mode 100644 index 000000000..1f254379c --- /dev/null +++ b/libraries/SQLAPI/include/asaAPI.h @@ -0,0 +1,122 @@ +////////////////////////////////////////////////////////////////////// +// asaAPI.h +////////////////////////////////////////////////////////////////////// + +#if !defined(__ASAAPI_H__) +#define __ASAAPI_H__ + +#include +#include +#include + +extern void AddSQLAnywhereSupport(const SAConnection * pCon); +extern void ReleaseSQLAnywhereSupport(); + +typedef sacapi_bool (*sqlany_init_t)( const char * app_name, sacapi_u32 api_version, sacapi_u32 * max_version ); +typedef void (*sqlany_fini_t)(); +typedef a_sqlany_connection * (*sqlany_new_connection_t)( ); +typedef void (*sqlany_free_connection_t)( a_sqlany_connection *sqlany_conn ); +typedef a_sqlany_connection * (*sqlany_make_connection_t)( void * arg ); +typedef sacapi_bool (*sqlany_connect_t)( a_sqlany_connection * sqlany_conn, const char * str ); +typedef sacapi_bool (*sqlany_disconnect_t)( a_sqlany_connection * sqlany_conn ); +typedef sacapi_bool (*sqlany_execute_immediate_t)( a_sqlany_connection * sqlany_conn, const char * sql ); +typedef a_sqlany_stmt * (*sqlany_prepare_t)( a_sqlany_connection * sqlany_conn, const char * sql_str ); +typedef void (*sqlany_free_stmt_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_i32 (*sqlany_num_params_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_bool (*sqlany_describe_bind_param_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param * params ); +typedef sacapi_bool (*sqlany_bind_param_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param * params ); +typedef sacapi_bool (*sqlany_send_param_data_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, char * buffer, size_t size ); +typedef sacapi_bool (*sqlany_reset_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_bool (*sqlany_get_bind_param_info_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param_info * info ); +typedef sacapi_bool (*sqlany_execute_t)( a_sqlany_stmt * sqlany_stmt ); +typedef a_sqlany_stmt * (*sqlany_execute_direct_t)( a_sqlany_connection * sqlany_conn, const char * sql_str ); +typedef sacapi_bool (*sqlany_fetch_absolute_t)( a_sqlany_stmt * sqlany_result, sacapi_i32 row_num ); +typedef sacapi_bool (*sqlany_fetch_next_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_bool (*sqlany_get_next_result_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_i32 (*sqlany_affected_rows_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_i32 (*sqlany_num_cols_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_i32 (*sqlany_num_rows_t)( a_sqlany_stmt * sqlany_stmt ); +typedef sacapi_bool (*sqlany_get_column_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_data_value * buffer ); +typedef sacapi_i32 (*sqlany_get_data_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, size_t offset, void * buffer, size_t size ); +typedef sacapi_bool (*sqlany_get_data_info_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_data_info * buffer ); +typedef sacapi_bool (*sqlany_get_column_info_t)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_column_info * buffer ); +typedef sacapi_bool (*sqlany_commit_t)( a_sqlany_connection * sqlany_conn ); +typedef sacapi_bool (*sqlany_rollback_t)( a_sqlany_connection * sqlany_conn ); +typedef sacapi_bool (*sqlany_client_version_t)( char * buffer, size_t len ); +typedef sacapi_i32 (*sqlany_error_t)( a_sqlany_connection * sqlany_conn, char * buffer, size_t size ); +typedef size_t (*sqlany_sqlstate_t)( a_sqlany_connection * sqlany_conn, char * buffer, size_t size ); +typedef void (*sqlany_clear_error_t)( a_sqlany_connection * sqlany_conn ); +// newer API +typedef a_sqlany_interface_context *(*sqlany_init_ex_t)( const char *app_name, sacapi_u32 api_version, sacapi_u32 *max_version ); +typedef void (*sqlany_fini_ex_t)( a_sqlany_interface_context *context ); +typedef a_sqlany_connection *(*sqlany_new_connection_ex_t)( a_sqlany_interface_context *context ); +typedef a_sqlany_connection *(*sqlany_make_connection_ex_t)( a_sqlany_interface_context *context, void *arg ); +typedef sacapi_bool (*sqlany_client_version_ex_t)( a_sqlany_interface_context *context, char *buffer, size_t len ); +typedef void (*sqlany_cancel_t)( a_sqlany_connection * sqlany_conn ); + +// API declarations +class SQLAPI_API asaAPI : public saAPI +{ +public: + asaAPI(); + + sqlany_init_t sqlany_init; + sqlany_fini_t sqlany_fini; + sqlany_new_connection_t sqlany_new_connection; + sqlany_free_connection_t sqlany_free_connection; + sqlany_make_connection_t sqlany_make_connection; + sqlany_connect_t sqlany_connect; + sqlany_disconnect_t sqlany_disconnect; + sqlany_execute_immediate_t sqlany_execute_immediate; + sqlany_prepare_t sqlany_prepare; + sqlany_free_stmt_t sqlany_free_stmt; + sqlany_num_params_t sqlany_num_params; + sqlany_describe_bind_param_t sqlany_describe_bind_param; + sqlany_bind_param_t sqlany_bind_param; + sqlany_send_param_data_t sqlany_send_param_data; + sqlany_reset_t sqlany_reset; + sqlany_get_bind_param_info_t sqlany_get_bind_param_info; + sqlany_execute_t sqlany_execute; + sqlany_execute_direct_t sqlany_execute_direct; + sqlany_fetch_absolute_t sqlany_fetch_absolute; + sqlany_fetch_next_t sqlany_fetch_next; + sqlany_get_next_result_t sqlany_get_next_result; + sqlany_affected_rows_t sqlany_affected_rows; + sqlany_num_cols_t sqlany_num_cols; + sqlany_num_rows_t sqlany_num_rows; + sqlany_get_column_t sqlany_get_column; + sqlany_get_data_t sqlany_get_data; + sqlany_get_data_info_t sqlany_get_data_info; + sqlany_get_column_info_t sqlany_get_column_info; + sqlany_commit_t sqlany_commit; + sqlany_rollback_t sqlany_rollback; + sqlany_client_version_t sqlany_client_version; + sqlany_error_t sqlany_error; + sqlany_sqlstate_t sqlany_sqlstate; + sqlany_clear_error_t sqlany_clear_error; +// newer API + sqlany_init_ex_t sqlany_init_ex; + sqlany_fini_ex_t sqlany_fini_ex; + sqlany_new_connection_ex_t sqlany_new_connection_ex; + sqlany_make_connection_ex_t sqlany_make_connection_ex; + sqlany_client_version_ex_t sqlany_client_version_ex; + sqlany_cancel_t sqlany_cancel; +}; + +class SQLAPI_API asaConnectionHandles : public saConnectionHandles +{ +public: + asaConnectionHandles(); + a_sqlany_connection *pDb; +}; + +class SQLAPI_API asaCommandHandles : public saCommandHandles +{ +public: + asaCommandHandles(); + a_sqlany_stmt *pStmt; +}; + +extern asaAPI g_asaAPI; + +#endif //__ASAAPI_H__ diff --git a/libraries/SQLAPI/include/db2API.h b/libraries/SQLAPI/include/db2API.h new file mode 100644 index 000000000..24bec054d --- /dev/null +++ b/libraries/SQLAPI/include/db2API.h @@ -0,0 +1,593 @@ +// db2API.h +// + +#if !defined(__DB2API_H__) +#define __DB2API_H__ + +#include "SQLAPI.h" +#include +#include + +extern long g_nDB2DLLVersionLoaded; + +extern void AddDB2Support(const SAConnection * pCon); +extern void ReleaseDB2Support(); + +typedef SQLRETURN (SQL_API_FN *SQLAllocConnect_t)(SQLHENV henv, + SQLHDBC FAR *phdbc); +typedef SQLRETURN (SQL_API_FN *SQLAllocEnv_t)(SQLHENV FAR *phenv); +typedef SQLRETURN (SQL_API_FN *SQLAllocHandle_t)( SQLSMALLINT fHandleType, + SQLHANDLE hInput, + SQLHANDLE * phOutput ); +typedef SQLRETURN (SQL_API_FN *SQLAllocStmt_t)(SQLHDBC hdbc, + SQLHSTMT FAR *phstmt); +typedef SQLRETURN (SQL_API_FN *SQLBindCol_t)(SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLSMALLINT fCType, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN FAR *pcbValue); +typedef SQLRETURN (SQL_API_FN *SQLBindFileToCol_t)(SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLCHAR FAR *FileName, + SQLSMALLINT FAR *FileNameLength, + SQLUINTEGER FAR *FileOptions, + SQLSMALLINT MaxFileNameLength, + SQLINTEGER FAR *StringLength, + SQLINTEGER FAR *IndicatorValue); +typedef SQLRETURN (SQL_API_FN *SQLBindFileToParam_t)(SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fSqlType, + SQLCHAR FAR *FileName, + SQLSMALLINT FAR *FileNameLength, + SQLUINTEGER FAR *FileOptions, + SQLSMALLINT MaxFileNameLength, + SQLINTEGER FAR *IndicatorValue); +typedef SQLRETURN (SQL_API *SQLBindParameter_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN *pcbValue); + +typedef SQLRETURN (SQL_API *SQLBrowseConnect_t)( + SQLHDBC hdbc, + SQLTCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLTCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); +typedef SQLRETURN (SQL_API_FN *SQLBuildDataLink_t)( SQLHSTMT hStmt, + SQLCHAR FAR * pszLinkType, + SQLINTEGER cbLinkType, + SQLCHAR FAR * pszDataLocation, + SQLINTEGER cbDataLocation, + SQLCHAR FAR * pszComment, + SQLINTEGER cbComment, + SQLCHAR FAR * pDataLink, + SQLINTEGER cbDataLinkMax, + SQLINTEGER FAR * pcbDataLink ); +typedef SQLRETURN (SQL_API *SQLBulkOperations_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +typedef SQLRETURN (SQL_API_FN *SQLCancel_t)(SQLHSTMT hstmt); +typedef SQLRETURN (SQL_API_FN *SQLCloseCursor_t)( SQLHSTMT hStmt ); +#ifdef ODBC64 +typedef SQLRETURN (SQL_API_FN *SQLColAttribute_t)(SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT FAR *pcbDesc, + SQLLEN *pfDesc); +#else +typedef SQLRETURN (SQL_API_FN *SQLColAttribute_t)(SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT FAR *pcbDesc, + SQLPOINTER pfDesc); +#endif +typedef SQLRETURN (SQL_API *SQLColAttributes_t)( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); +typedef SQLRETURN (SQL_API *SQLColumnPrivileges_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLTCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API_FN *SQLColumns_t)(SQLHSTMT hstmt, + SQLTCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLTCHAR FAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API_FN *SQLConnect_t)(SQLHDBC hdbc, + SQLTCHAR FAR *szDSN, + SQLSMALLINT cbDSN, + SQLTCHAR FAR *szUID, + SQLSMALLINT cbUID, + SQLTCHAR FAR *szAuthStr, + SQLSMALLINT cbAuthStr); +typedef SQLRETURN (SQL_API_FN *SQLCopyDesc_t)( SQLHDESC hDescSource, + SQLHDESC hDescTarget ); +typedef SQLRETURN (SQL_API_FN *SQLDataSources_t)(SQLHENV henv, + SQLUSMALLINT fDirection, + SQLTCHAR FAR *szDSN, + SQLSMALLINT cbDSNMax, + SQLSMALLINT FAR *pcbDSN, + SQLTCHAR FAR *szDescription, + SQLSMALLINT cbDescriptionMax, + SQLSMALLINT FAR *pcbDescription); +typedef SQLRETURN (SQL_API *SQLDescribeCol_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLTCHAR *ColumnName, + SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, + SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable); +typedef SQLRETURN (SQL_API *SQLDescribeParam_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); +typedef SQLRETURN (SQL_API *SQLDisconnect_t)(SQLHDBC ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLDriverConnect_t)( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLTCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLTCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); +typedef SQLRETURN (SQL_API *SQLEndTran_t)(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT CompletionType); +typedef SQLRETURN (SQL_API_FN *SQLError_t)(SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + SQLTCHAR FAR *szSqlState, + SQLINTEGER FAR *pfNativeError, + SQLTCHAR FAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT FAR *pcbErrorMsg); + +typedef SQLRETURN (SQL_API_FN *SQLExecDirect_t)(SQLHSTMT hstmt, + SQLTCHAR FAR *szSqlStr, + SQLINTEGER cbSqlStr); +typedef SQLRETURN (SQL_API_FN *SQLExecute_t)(SQLHSTMT hstmt); +typedef SQLRETURN (SQL_API_FN *SQLExtendedBind_t)(SQLHSTMT hstmt, + SQLSMALLINT fBindCol, + SQLSMALLINT cRecords, + SQLSMALLINT * pfCType, + SQLPOINTER * rgbValue, + SQLINTEGER * cbValueMax, + SQLUINTEGER * puiPrecisionCType, + SQLSMALLINT * psScaleCType, + SQLINTEGER ** pcbValue, + SQLINTEGER ** piIndicatorPtr, + SQLSMALLINT * pfParamType, + SQLSMALLINT * pfSQLType, + SQLUINTEGER * pcbColDef, + SQLSMALLINT * pibScale ); +typedef SQLRETURN (SQL_API *SQLExtendedFetch_t)( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLLEN irow, + SQLULEN *pcrow, + SQLUSMALLINT *rgfRowStatus); +typedef SQLRETURN (SQL_API_FN *SQLExtendedPrepare_t)( SQLHSTMT hstmt, + SQLTCHAR * pszSqlStmt, + SQLINTEGER cbSqlStmt, + SQLINTEGER cPars, + SQLSMALLINT sStmtType, + SQLINTEGER cStmtAttrs, + SQLINTEGER * piStmtAttr, + SQLINTEGER * pvParams ); +typedef SQLRETURN (SQL_API_FN *SQLFetch_t)(SQLHSTMT hstmt); +typedef SQLRETURN (SQL_API *SQLFetchScroll_t)( SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, + SQLLEN FetchOffset); +typedef SQLRETURN (SQL_API *SQLForeignKeys_t)( + SQLHSTMT hstmt, + SQLTCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLTCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLTCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLTCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLTCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLTCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); +typedef SQLRETURN (SQL_API_FN *SQLFreeConnect_t)(SQLHDBC hdbc); +typedef SQLRETURN (SQL_API_FN *SQLFreeEnv_t)(SQLHENV henv); +typedef SQLRETURN (SQL_API_FN *SQLFreeHandle_t)( SQLSMALLINT fHandleType, + SQLHANDLE hHandle ); +typedef SQLRETURN (SQL_API_FN *SQLFreeStmt_t)(SQLHSTMT hstmt, + SQLUSMALLINT fOption); +typedef SQLRETURN (SQL_API *SQLGetConnectAttr_t)( SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API_FN *SQLGetConnectOption_t)( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); +typedef SQLRETURN (SQL_API_FN *SQLGetCursorName_t)(SQLHSTMT hstmt, + SQLTCHAR FAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT FAR *pcbCursor); +typedef SQLRETURN (SQL_API_FN *SQLGetData_t)(SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLSMALLINT fCType, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN FAR *pcbValue); +typedef SQLRETURN (SQL_API_FN *SQLGetDataLinkAttr_t)( SQLHSTMT hStmt, + SQLSMALLINT fAttrType, + SQLCHAR FAR * pDataLink, + SQLINTEGER cbDataLink, + SQLPOINTER pAttribute, + SQLINTEGER cbAttributeMax, + SQLINTEGER * pcbAttribute ); +typedef SQLRETURN (SQL_API_FN *SQLGetDescField_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength, + SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API_FN *SQLGetDescRec_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLTCHAR *Name, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, + SQLSMALLINT *Type, SQLSMALLINT *SubType, + SQLLEN *Length, SQLSMALLINT *Precision, + SQLSMALLINT *Scale, SQLSMALLINT *Nullable); +typedef SQLRETURN (SQL_API_FN *SQLGetDiagField_t)( SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT iRecNumber, + SQLSMALLINT fDiagIdentifier, + SQLPOINTER pDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT * pcbDiagInfo ); +typedef SQLRETURN (SQL_API_FN *SQLGetDiagRec_t)( SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT iRecNumber, + SQLTCHAR * pszSqlState, + SQLINTEGER * pfNativeError, + SQLTCHAR * pszErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT * pcbErrorMsg ); + +typedef SQLRETURN (SQL_API_FN *SQLGetEnvAttr_t)(SQLHENV henv, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER FAR *StringLength); +typedef SQLRETURN (SQL_API_FN *SQLGetFunctions_t)(SQLHDBC hdbc, + SQLUSMALLINT fFunction, + SQLUSMALLINT FAR *pfExists); +typedef SQLRETURN (SQL_API_FN *SQLGetInfo_t)(SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT FAR *pcbInfoValue); +typedef SQLRETURN (SQL_API_FN *SQLGetLength_t)(SQLHSTMT hstmt, + SQLSMALLINT LocatorCType, + SQLINTEGER Locator, + SQLINTEGER FAR *StringLength, + SQLINTEGER FAR *IndicatorValue); +typedef SQLRETURN (SQL_API_FN *SQLGetPosition_t)(SQLHSTMT hstmt, + SQLSMALLINT LocatorCType, + SQLINTEGER SourceLocator, + SQLINTEGER SearchLocator, + SQLCHAR FAR *SearchLiteral, + SQLINTEGER SearchLiteralLength, + SQLUINTEGER FromPosition, + SQLUINTEGER FAR *LocatedAt, + SQLINTEGER FAR *IndicatorValue); +typedef SQLRETURN (SQL_API_FN *SQLGetSQLCA_t)(SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + struct sqlca FAR *pSqlca ); +typedef SQLRETURN (SQL_API *SQLGetStmtAttr_t)( SQLHSTMT StatementHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API_FN *SQLGetStmtOption_t)(SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); +typedef SQLRETURN (SQL_API_FN *SQLGetSubString_t)(SQLHSTMT hstmt, + SQLSMALLINT LocatorCType, + SQLINTEGER SourceLocator, + SQLUINTEGER FromPosition, + SQLUINTEGER ForLength, + SQLSMALLINT TargetCType, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER FAR *StringLength, + SQLINTEGER FAR *IndicatorValue); +typedef SQLRETURN (SQL_API_FN *SQLGetTypeInfo_t)(SQLHSTMT hstmt, + SQLSMALLINT fSqlType); +typedef SQLRETURN (SQL_API *SQLMoreResults_t)( + SQLHSTMT hstmt); +typedef SQLRETURN (SQL_API *SQLNativeSql_t)( + SQLHDBC hdbc, + SQLTCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLTCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); +typedef SQLRETURN (SQL_API *SQLNumParams_t)( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); +typedef SQLRETURN (SQL_API_FN *SQLNumResultCols_t)(SQLHSTMT hstmt, + SQLSMALLINT FAR *pccol); +typedef SQLRETURN (SQL_API_FN *SQLParamData_t)(SQLHSTMT hstmt, + SQLPOINTER FAR *prgbValue); +typedef SQLRETURN (SQL_API *SQLParamOptions_t)( + SQLHSTMT hstmt, + SQLULEN crow, + SQLULEN *pirow); +typedef SQLRETURN (SQL_API_FN *SQLPrepare_t)(SQLHSTMT hstmt, + SQLTCHAR FAR *szSqlStr, + SQLINTEGER cbSqlStr); + +typedef SQLRETURN (SQL_API *SQLPrimaryKeys_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API *SQLProcedureColumns_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLTCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLProcedures_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szProcName, + SQLSMALLINT cbProcName); +typedef SQLRETURN (SQL_API_FN *SQLPutData_t)(SQLHSTMT hstmt, + SQLPOINTER rgbValue, + SQLLEN cbValue); +typedef SQLRETURN (SQL_API_FN *SQLRowCount_t)(SQLHSTMT hstmt, + SQLLEN FAR *pcrow); +typedef SQLRETURN (SQL_API_FN *SQLSetColAttributes_t)(SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLCHAR FAR *pszColName, + SQLSMALLINT cbColName, + SQLSMALLINT fSQLType, + SQLUINTEGER cbColDef, + SQLSMALLINT ibScale, + SQLSMALLINT fNullable); +typedef SQLRETURN (SQL_API_FN *SQLSetConnectAttr_t)( + SQLHDBC hdbc, + SQLINTEGER fOption, + SQLPOINTER pvParam, + SQLINTEGER fStrLen); +typedef SQLRETURN (SQL_API_FN *SQLSetConnection_t)(SQLHDBC hdbc); +typedef SQLRETURN (SQL_API_FN *SQLSetConnectOption_t)( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLULEN vParam); +typedef SQLRETURN (SQL_API_FN *SQLSetCursorName_t)(SQLHSTMT hstmt, + SQLTCHAR FAR *szCursor, + SQLSMALLINT cbCursor); +typedef SQLRETURN (SQL_API_FN *SQLSetDescField_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength); +typedef SQLRETURN (SQL_API_FN *SQLSetDescRec_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT Type, + SQLSMALLINT SubType, SQLLEN Length, + SQLSMALLINT Precision, SQLSMALLINT Scale, + SQLPOINTER Data, SQLLEN *StringLength, + SQLLEN *Indicator); +typedef SQLRETURN (SQL_API_FN *SQLSetEnvAttr_t)(SQLHENV henv, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API_FN *SQLSetParam_t)(SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbParamDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN FAR *pcbValue); +typedef SQLRETURN (SQL_API *SQLSetPos_t)( + SQLHSTMT hstmt, + SQLSETPOSIROW irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); +typedef SQLRETURN (SQL_API_FN *SQLSetStmtAttr_t)(SQLHSTMT hstmt, + SQLINTEGER fOption, + SQLPOINTER pvParam, + SQLINTEGER fStrLen); +typedef SQLRETURN (SQL_API_FN *SQLSetStmtOption_t)(SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLULEN vParam); +typedef SQLRETURN (SQL_API_FN *SQLSpecialColumns_t)(SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLTCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); +typedef SQLRETURN (SQL_API_FN *SQLStatistics_t)(SQLHSTMT hstmt, + SQLTCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + SQLUSMALLINT fAccuracy); +typedef SQLRETURN (SQL_API *SQLTablePrivileges_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API_FN *SQLTables_t)(SQLHSTMT hstmt, + SQLTCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLTCHAR FAR *szTableType, + SQLSMALLINT cbTableType); +typedef SQLRETURN (SQL_API_FN *SQLTransact_t)(SQLHENV henv, + SQLHDBC hdbc, + SQLUSMALLINT fType); + + +class SQLAPI_API db2API : public saAPI +{ +public: + db2API(); + + SQLAllocConnect_t SQLAllocConnect; + SQLAllocEnv_t SQLAllocEnv; + SQLAllocHandle_t SQLAllocHandle; + SQLAllocStmt_t SQLAllocStmt; + SQLBindCol_t SQLBindCol; + SQLBindFileToCol_t SQLBindFileToCol; + SQLBindFileToParam_t SQLBindFileToParam; + SQLBindParameter_t SQLBindParameter; + SQLBrowseConnect_t SQLBrowseConnect; + SQLBulkOperations_t SQLBulkOperations; + SQLCancel_t SQLCancel; + SQLCloseCursor_t SQLCloseCursor; + SQLColAttribute_t SQLColAttribute; + SQLColAttributes_t SQLColAttributes; + SQLColumnPrivileges_t SQLColumnPrivileges; + SQLColumns_t SQLColumns; + SQLConnect_t SQLConnect; + SQLCopyDesc_t SQLCopyDesc; + SQLDataSources_t SQLDataSources; + SQLDescribeCol_t SQLDescribeCol; + SQLDescribeParam_t SQLDescribeParam; + SQLDisconnect_t SQLDisconnect; + SQLDriverConnect_t SQLDriverConnect; + SQLEndTran_t SQLEndTran; + SQLError_t SQLError; + SQLExecDirect_t SQLExecDirect; + SQLExecute_t SQLExecute; + SQLExtendedBind_t SQLExtendedBind; + SQLExtendedFetch_t SQLExtendedFetch; + SQLExtendedPrepare_t SQLExtendedPrepare; + SQLFetch_t SQLFetch; + SQLFetchScroll_t SQLFetchScroll; + SQLForeignKeys_t SQLForeignKeys; + SQLFreeConnect_t SQLFreeConnect; + SQLFreeEnv_t SQLFreeEnv; + SQLFreeHandle_t SQLFreeHandle; + SQLFreeStmt_t SQLFreeStmt; + SQLGetConnectAttr_t SQLGetConnectAttr; + SQLGetConnectOption_t SQLGetConnectOption; + SQLGetCursorName_t SQLGetCursorName; + SQLGetData_t SQLGetData; + SQLGetDescField_t SQLGetDescField; + SQLGetDescRec_t SQLGetDescRec; + SQLGetDiagField_t SQLGetDiagField; + SQLGetDiagRec_t SQLGetDiagRec; + SQLGetEnvAttr_t SQLGetEnvAttr; + SQLGetFunctions_t SQLGetFunctions; + SQLGetInfo_t SQLGetInfo; + SQLGetLength_t SQLGetLength; + SQLGetPosition_t SQLGetPosition; + SQLGetSQLCA_t SQLGetSQLCA; + SQLGetStmtAttr_t SQLGetStmtAttr; + SQLGetStmtOption_t SQLGetStmtOption; + SQLGetSubString_t SQLGetSubString; + SQLGetTypeInfo_t SQLGetTypeInfo; + SQLMoreResults_t SQLMoreResults; + SQLNativeSql_t SQLNativeSql; + SQLNumParams_t SQLNumParams; + SQLNumResultCols_t SQLNumResultCols; + SQLParamData_t SQLParamData; + SQLParamOptions_t SQLParamOptions; + SQLPrepare_t SQLPrepare; + SQLPrimaryKeys_t SQLPrimaryKeys; + SQLProcedureColumns_t SQLProcedureColumns; + SQLProcedures_t SQLProcedures; + SQLPutData_t SQLPutData; + SQLRowCount_t SQLRowCount; + SQLSetColAttributes_t SQLSetColAttributes; + SQLSetConnectAttr_t SQLSetConnectAttr; + SQLSetConnection_t SQLSetConnection; + SQLSetConnectOption_t SQLSetConnectOption; + SQLSetCursorName_t SQLSetCursorName; + SQLSetDescField_t SQLSetDescField; + SQLSetDescRec_t SQLSetDescRec; + SQLSetEnvAttr_t SQLSetEnvAttr; + SQLSetParam_t SQLSetParam; + SQLSetPos_t SQLSetPos; + SQLSetStmtAttr_t SQLSetStmtAttr; + SQLSetStmtOption_t SQLSetStmtOption; + SQLSpecialColumns_t SQLSpecialColumns; + SQLStatistics_t SQLStatistics; + SQLTablePrivileges_t SQLTablePrivileges; + SQLTables_t SQLTables; + SQLTransact_t SQLTransact; +}; + +class SQLAPI_API db2ConnectionHandles : public saConnectionHandles +{ +public: + db2ConnectionHandles(); + + SQLHENV m_hevn; + SQLHDBC m_hdbc; +}; + +class SQLAPI_API db2CommandHandles : public saCommandHandles +{ +public: + db2CommandHandles(); + + SQLHSTMT m_hstmt; +}; + +extern db2API g_db2API; + +#endif // !defined(__DB2API_H__) diff --git a/libraries/SQLAPI/include/db2_win/sql.h b/libraries/SQLAPI/include/db2_win/sql.h new file mode 100644 index 000000000..90b1f9c0b --- /dev/null +++ b/libraries/SQLAPI/include/db2_win/sql.h @@ -0,0 +1,2845 @@ +/****************************************************************************** +** +** Source File Name: SQL +** +** (C) COPYRIGHT International Business Machines Corp. 1987, 2006 +** All Rights Reserved +** Licensed Materials - Property of IBM +** +** US Government Users Restricted Rights - Use, duplication or +** disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +** +** Function = Include File defining: +** System Constants +** National Language Support Information +** SQLCA / SQLDA Constants +** Interface to BINDER and PRECOMPILER +** Error Message Retrieval Interface +** Authorization Constants +** +** Operating System: Windows NT +** +*******************************************************************************/ +#ifndef SQL_H_SQL +#define SQL_H_SQL + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Note: _SQLOLDCHAR defaults to 'char'. See sqlsystm.h for details. */ + +#include +#include "sqlsystm.h" /* System dependent defines */ + +#ifndef SQLCODE +#include "sqlca.h" /* Required include file */ +#endif + +#ifdef _WIN64 +#pragma pack(8) +#else +#pragma pack(4) +#endif + +/* Release Identifier Constants */ + +#define SQL_RELPRE6 0 /* Pre Version 6.1.0.0 */ +#define SQL_REL6100 6010000 /* V6.1.0.0 */ +#define SQL_REL7100 7010000 /* V7.1.0.0 */ +#define SQL_REL7102 7010200 /* V7.1.2.0 */ +#define SQL_REL7200 7020100 /* V7.2.0.0 */ +#define SQL_REL7201 7020200 /* V7.2.1.0 */ +#define SQL_REL7204 7020400 /* V7.2.4.0 */ +#define SQL_REL8100 8010000 /* V8.1.0.0 */ +#define SQL_REL8101 8010100 /* V8.1.1.0 */ +#define SQL_REL8102 8010200 /* V8.1.2.0 */ +#define SQL_REL8103 8010300 /* V8.1.3.0 */ +#define SQL_REL8104 8010400 /* V8.1.4.0 */ +#define SQL_REL8105 8010500 /* V8.1.5.0 */ +#define SQL_REL8106 8010600 /* V8.1.6.0 */ +#define SQL_REL8200 8020000 /* V8.2.0.0 */ +#define SQL_REL8201 8020100 /* V8.2.1.0 */ +#define SQL_REL8202 8020200 /* V8.2.2.0 */ +#define SQL_REL9000 9000000 /* V9.0.0.0 */ +#define SQL_REL9100 9010000 /* V9.1.0.0 */ +#define SQL_FUTUREL 9999999 /* Future Release */ + +/* System Constants */ + +#ifndef SQL_RC_OK +#define SQL_RC_OK 0 /* successful execution */ +#endif + +#define SQL_KEYPMAX 64 /* Maximum nbr of key parts in Index */ +#define SQL_KEYLMAX 8192 /* Maximum key length */ +#define SQL_KEYLMAX_4KPAGE 1024 /* Maximum key length for 4K page */ +#define SQL_KEYLMAX_8KPAGE 2048 /* Maximum key length for 8K page */ +#define SQL_KEYLMAX_16KPAGE 4096 /* Maximum key length for 16K page */ +#define SQL_KEYLMAX_32KPAGE 8192 /* Maximum key length for 32K page */ +#define SQL_SORTFLDLMT 32677 /* Maximum size of field for sort */ +#define SQL_MAXRECL_4K 4005 /* Maximum record length on a 4K page */ +#define SQL_MAXRECL_8K 8101 /* Maximum record length on a 8K page */ +#define SQL_MAXRECL 32677 /* Maximum record length */ +#define SQL_MAXTABLES 15 /* Maximum nbr of tables in a SELECT */ +#define SQL_MAXVARS_STMT 32767 /* Maximum nbr of Host Vars per stmt */ +#define SQL_MAXCOLS 3000 /* Internal max nbr of columns in a */ + /* table */ +#define SQL_MAXCOLS_EXT 1012 /* External max nbr of columns in a */ + /* table */ +#define SQL_MAXSEL_ITEMS 1012 /* Maximum nbr of items in a SELECT */ +#define SQL_MAXPARMS 90 /* Maximum nbr of parms in a function */ +#define SQL_MAX_STMT_SIZ 2097152 /* Maximum statement size */ + +#define SQL_SMALL_LENGTH 2 /* Size of a SMALLINT */ +#define SQL_MAXSMALLVAL 32767 /* Maximum value of a SMALLINT */ +#define SQL_MINSMALLVAL (-(SQL_MAXSMALLVAL)-1) /* Minimum value of a SMALLINT */ +#define SQL_INT_LENGTH 4 /* Size of an INTEGER */ +#define SQL_MAXINTVAL 2147483647 /* Maximum value of an INTEGER */ +#define SQL_MININTVAL (-(SQL_MAXINTVAL)-1) /* Minimum value of an INTEGER */ + +#define SQL_BIGINT_LENGTH 8 /* Size of a BIGINT */ +#ifndef SQL_NO_NATIVE_BIGINT_SUPPORT +#define SQL_MAXBIGINTVAL DB2_CONSTRUCT_BIGINT_CONSTANT(9223372036854775807) /* Maximum value of a BIGINT */ +#define SQL_MINBIGINTVAL (-(SQL_MAXBIGINTVAL)-1) /* Minimum value of a BIGINT */ +#endif + +#define SQL_FLOAT_LENGTH 8 /* Size of a FLOAT */ +#define SQL_FLOAT4_LENGTH 4 /* Size of a 4-byte FLOAT */ +#define SQL_MAXSFLTPREC 24 /* Maximum prec for small float */ +#define SQL_MINSFLTPREC 1 /* Minimum prec for small float */ +#define SQL_MAXFLOATPREC 53 /* Minimum prec for any float */ +#define SQL_DEFDEC_PRECISION 5 /* Default precision for DECIMAL */ +#define SQL_DEFDEC_SCALE 0 /* Default scale for DECIMAL */ +#define SQL_MAXDECIMAL 31 /* Maximum scale/prec. for DECIMAL */ +#define SQL_DEFCHAR 1 /* Default length for a CHAR */ +#define SQL_DEFWCHAR 1 /* Default length for a graphic */ +#define SQL_MAXCHAR 254 /* Maximum length of a CHAR */ +#define SQL_MAXLSTR 255 /* Maximum length of an LSTRING */ +#define SQL_MAXVCHAR (SQL_MAXRECL - 5) /* Maximum length of a */ + /* VARCHAR */ +#define SQL_MAXVGRAPH SQL_MAXVCHAR/2 /* Maximum length of a */ + /* VARGRAPHIC */ +#define SQL_MAXBLOB 2147483647 /* Max. length of a BLOB host var */ +#define SQL_MAXCLOB 2147483647 /* Max. length of a CLOB host var */ +#define SQL_MAXDBCLOB 1073741823 /* Max. length of an DBCLOB host */ + /* var */ +#define SQL_LOBLOCATOR_LEN 4 /* Length of a LOB locator host var */ +#define SQL_LOBFILE_LEN 267 /* Length of a LOB file host var */ +#define SQL_VCHAROH 4 /* Overhead for VARCHAR in record */ +#define SQL_VARCOL_OH 4 /* Overhead for variable length type */ + /* in record */ +#define SQL_VARKEY_OH 2 /* Overhead for variable keyparts */ +#define SQL_LONGMAX 32700 /* Maximum length of a LONG VARCHAR */ +#define SQL_LONGGRMAX 16350 /* Max. length of a LONG VARGRAPHIC */ +#define SQL_LVCHAROH 24 /* Overhead for LONG VARCHAR in */ + /* record */ +#define SQL_LOBCHAROH 312 /* Overhead for LOB in record */ +#define SQL_BLOB_MAXLEN 2147483647 /* BLOB maximum length, in bytes */ +#define SQL_CLOB_MAXLEN 2147483647 /* CLOB maximum length, in chars */ +#define SQL_DBCLOB_MAXLEN 1073741823 /* maxlen for dbcs lobs */ +#define SQL_TIME_LENGTH 3 /* Size of a TIME field */ +#define SQL_TIME_STRLEN 8 /* Size of a TIME field output */ +#define SQL_TIME_MINSTRLEN 5 /* Size of a non-USA TIME field */ + /* output without seconds */ +#define SQL_DATE_LENGTH 4 /* Size of a DATE field */ +#define SQL_DATE_STRLEN 10 /* Size of a DATE field output */ +#define SQL_STAMP_LENGTH 10 /* Size of a TIMESTAMP field */ +#define SQL_STAMP_STRLEN 26 /* Size of a TIMESTAMP field output */ +#define SQL_STAMP_MINSTRLEN 19 /* Size of a TIMESTAMP field output */ + /* without microseconds */ +#define SQL_BOOLEAN_LENGTH 1 /* Size of a BOOLEAN field */ +#define SQL_DATALINK_LENGTH 254 /* Size of a DATALINK field */ +#define SQL_IND_LENGTH 2 /* Size of an indicator value */ + +#define SQL_DECFLOAT16_LENGTH 8 /* Size of a DECFLOAT16 field */ +#define SQL_DECFLOAT34_LENGTH 16 /* Size of a DECFLOAT34 field */ +#define SQL_MAXDECFLOAT 34 /* Maximum precision for DECFLOAT */ + +#define SQL_MAX_PNAME_LENGTH 254 /* Max size of Stored Proc Name */ +#define SQL_MAX_IDENT 128 /* Maximum length of Identifer */ +#define SQL_LG_IDENT 18 /* Maximum length of Long Identifer */ +#define SQL_SH_IDENT 8 /* Maximum length of Short Identifer */ +#define SQL_MN_IDENT 1 /* Minimum length of Identifiers */ +#define SQL_MAX_VAR_NAME 255 /* Max size of Host Variable Name */ +#define SQL_PDB_MAP_SIZE 4096 /* Number of partitions in a pmap */ +#define SQL_MAX_NUM_PART_KEYS 500 /* Max # of Partition Keys */ +#define SQL_ZONEDDECIMAL_FORMAT 0x20 /* decimal columns for sqlugrpn are */ + /* in zoneddecimal format */ +#define SQL_IMPLIEDDECIMAL_FORMAT 0x10 /* decimal columns for sqlugrpn are */ + /* in implieddecimal format */ +#define SQL_BINARYNUMERICS_FORMAT 0x4 /* numeric columns for sqlugrpn are */ + /* in binary format */ +#define SQL_PACKEDDECIMAL_FORMAT 0x8 /* decimal columns for sqlugrpn are */ + /* in packeddecimal format */ +#define SQL_CHARSTRING_FORMAT 0x0 /* numeric/decimal columns for */ + /* sqlugrpn are in character string */ + /* format */ +#define SQL_KILO_VALUE 1024 /* # of bytes in a kilobyte */ +#define SQL_MEGA_VALUE 1048576 /* # of bytes in a megabyte */ +#define SQL_GIGA_VALUE 1073741824 /* # of bytes in a gigabyte */ + +#define SQLB_MAX_CONTAIN_NAME_SZ 256 /* size of container name for api's */ + /* (includes 1 byte for C NULL */ + /* terminator) */ +/* System types */ +typedef signed short SQL_PDB_NODE_TYPE;/* Datatype of PDB node */ +typedef int SQL_PDB_PORT_TYPE;/* Datatype of PDB port */ +#define SQL_PDB_MAX_NUM_NODE 1000 /* limit for max. # of nodes */ +/* information related to logical node name */ +#define SQL_PDB_NODE_NUM_DIGIT 4 /* no. of digits for node number in */ + /* node name */ +#define SQL_PDB_NODE_NAME_LEN 8 /* length of logical node name */ +#define SQL_NODE_NUM_TO_NAME(name_p,node_num) \ + 0 <= node_num ? sprintf(name_p,"NODE%.*d", SQL_PDB_NODE_NUM_DIGIT, node_num) : \ + sprintf(name_p,"NODE%.*d", SQL_PDB_NODE_NUM_DIGIT-1, node_num) +/* Codepages */ +#define SQL_CP_367 367 /* Codepage 367 - EUC single byte */ +#define SQL_CP_420 420 /* CCSID x01A4, (CP420, ST4) */ +#define SQL_CP_424 424 /* CCSID x01A8, (CP424, ST4) */ +#define SQL_CP_425 425 /* CCSID x01A9, (CP420, ST5) */ +#define SQL_CP_437 437 /* Codepage 437 - US, Europe */ +#define SQL_CP_737 737 /* Codepage 737 - WIN Greece */ +#define SQL_CP_806 806 /* Codepage 806 - ISCII, India */ +#define SQL_CP_813 813 /* Codepage 813 - AIX Greece */ +#define SQL_CP_819 819 /* Codepage 819 - ISO 8859-1 */ +#define SQL_CP_850 850 /* Codepage 850 - International PC */ +#define SQL_CP_855 855 /* Codepage 855 - OS2 Cyrillic */ +#define SQL_CP_852 852 /* Codepage 852 - OS2 Latin2 */ +#define SQL_CP_856 856 /* Codepage 856 - Hebrew */ +#define SQL_CP_857 857 /* Codepage 857 - OS2 Turkey */ +#define SQL_CP_860 860 /* Codepage 860 - Portuguese */ +#define SQL_CP_862 862 /* Codepage 862 - OS2 Hebrew */ +#define SQL_CP_863 863 /* Codepage 863 - Canadian-French */ +#define SQL_CP_864 864 /* Codepage 864 - OS2 Arabic */ +#define SQL_CP_865 865 /* Codepage 865 - Norway, Denmark */ +#define SQL_CP_866 866 /* Codepage 866 - Russia */ +#define SQL_CP_867 867 /* Codepage 867 - OS2 Hebrew */ +#define SQL_CP_869 869 /* Codepage 869 - OS2 Greece */ +#define SQL_CP_874 874 /* Codepage 874 - OS2/AIX Thailand */ +#define SQL_CP_878 878 /* Codepage 878 - KOI-8R Russia */ +#define SQL_CP_891 891 /* Codepage 891 - Korean */ +#define SQL_CP_897 897 /* Codepage 897 - Japanese */ +#define SQL_CP_903 903 /* Codepage 903 - Chinese */ +#define SQL_CP_904 904 /* Codepage 904 - Taiwan */ +#define SQL_CP_912 912 /* Codepage 912 - AIX Latin2 */ +#define SQL_CP_915 915 /* Codepage 915 - AIX Cyrillic */ +#define SQL_CP_916 916 /* Codepage 916 - AIX Hebrew */ +#define SQL_CP_920 920 /* Codepage 920 - AIX Turkey */ +#define SQL_CP_921 921 /* Codepage 921 - Latvia, Lithuania */ +#define SQL_CP_922 922 /* Codepage 922 - Estonia */ +#define SQL_CP_923 923 /* Codepage 923 - ISO 8859-15 */ +#define SQL_CP_1004 1004 /* Codepage 1004 - MS-WINDOWS */ +#define SQL_CP_1040 1040 /* Codepage 1040 - Extended Korean */ +#define SQL_CP_1041 1041 /* Codepage 1041 - Extended Japanese */ +#define SQL_CP_1042 1042 /* Codepage 1042 - Extended Chinese */ +#define SQL_CP_1043 1043 /* Codepage 1043 - Extended Taiwan */ +#define SQL_CP_1046 1046 /* Codepage 1046 - AIX Arabic */ +#define SQL_CP_1051 1051 /* Codepage 1051 - HP Roman8 */ +#define SQL_CP_1088 1088 /* Codepage 1088 - Korea Std */ +#define SQL_CP_1089 1089 /* Codepage 1089 - AIX Arabic */ +#define SQL_CP_1114 1114 /* Codepage 1114 - Big-5 & GBK */ +#define SQL_CP_1115 1115 /* Codepage 1115 - China GB */ +#define SQL_CP_1124 1124 /* Codepage 1124 - AIX Ukraine */ +#define SQL_CP_1125 1125 /* Codepage 1125 - OS/2 Ukraine */ +#define SQL_CP_1126 1126 /* Codepage 1126 - Windows Korean Std */ +#define SQL_CP_1129 1129 /* Codepage 1129 - Vietnamese */ +#define SQL_CP_1131 1131 /* Codepage 1131 - OS/2 Belarus */ +#define SQL_CP_1163 1163 /* Codepage 1163 - Vietnamese */ +#define SQL_CP_1167 1167 /* KOI8-RU - Belarus */ +#define SQL_CP_1168 1168 /* KOI8-U - Ukraine */ +#define SQL_CP_1250 1250 /* Codepage 1250 - Windows Latin-2 */ +#define SQL_CP_1251 1251 /* Codepage 1251 - Windows Cyrillic */ +#define SQL_CP_1252 1252 /* Codepage 1252 - Windows Latin-1 */ +#define SQL_CP_1253 1253 /* Codepage 1253 - Windows Greek */ +#define SQL_CP_1254 1254 /* Codepage 1254 - Windows Turkish */ +#define SQL_CP_1255 1255 /* Codepage 1255 - Windows Hebrew */ +#define SQL_CP_1256 1256 /* Codepage 1256 - Windows Arabic */ +#define SQL_CP_1257 1257 /* Codepage 1257 - Windows Baltic */ +#define SQL_CP_1258 1258 /* Codepage 1258 - Windows Vietnamese */ +#define SQL_CP_1275 1275 /* Codepage 1275 - Mac Latin-1 */ +#define SQL_CP_1280 1280 /* Codepage 1280 - Mac Greek */ +#define SQL_CP_1281 1281 /* Codepage 1281 - Mac Turkish */ +#define SQL_CP_1282 1282 /* Codepage 1282 - Mac Latin-2 */ +#define SQL_CP_1283 1283 /* Codepage 1283 - Mac Cyrillic */ +#define SQL_CP_62208 62208 /* CCSID xF300, (CP856, ST4) */ +#define SQL_CP_62209 62209 /* CCSID xF301, (CP862, ST4) */ +#define SQL_CP_62210 62210 /* CCSID xF302, (CP916, ST4) */ +#define SQL_CP_62213 62213 /* CCSID xF305, (CP862, ST5) */ +#define SQL_CP_62220 62220 /* CCSID xF30C, (CP856, ST6) */ +#define SQL_CP_62221 62221 /* CCSID xF30D, (CP862, ST6) */ +#define SQL_CP_62222 62222 /* CCSID xF30E, (CP916, ST6) */ +#define SQL_CP_62223 62223 /* CCSID xF30F, (CP1255, ST6) */ +#define SQL_CP_62225 62225 /* CCSID xF311, (CP864, ST6) */ +#define SQL_CP_62226 62226 /* CCSID xF312, (CP1046, ST6) */ +#define SQL_CP_62227 62227 /* CCSID xF313, (CP1089, ST6) */ +#define SQL_CP_62228 62228 /* CCSID xF314, (CP1256, ST6) */ +#define SQL_CP_62230 62230 /* CCSID xF316, (CP856, ST8) */ +#define SQL_CP_62231 62231 /* CCSID xF317, (CP862, ST8) */ +#define SQL_CP_62232 62232 /* CCSID xF318, (CP916, ST8) */ +#define SQL_CP_62236 62236 /* CCSID xF31C, (CP856, ST10) */ +#define SQL_CP_62238 62238 /* CCSID xF31E, (CP916, ST10) */ +#define SQL_CP_62239 62239 /* CCSID xF31F, (CP1255, ST10) */ +#define SQL_CP_62241 62241 /* CCSID xF321, (CP856, ST11) */ +#define SQL_CP_62242 62242 /* CCSID xF322, (CP862, ST11) */ +#define SQL_CP_62243 62243 /* CCSID xF323, (CP916, ST11) */ +#define SQL_CP_62244 62244 /* CCSID xF324, (CP1255, ST11) */ +#define SQL_CP_UNKNOWN 57344 /* CCSID xE000, (Unknown or */ + /* unsupported) */ +#define SQL_CP_1162 1162 /* CCSID 1162 - Windows Thailand */ + /* (with Euro) */ +#define SQL_CP_5222 5222 /* CCSID 5222 - Windows Korea */ +#define SQL_CP_5346 5346 /* CCSID 5346 - Windows Latin-2 (v2 */ + /* with Euro) */ +#define SQL_CP_5347 5347 /* CCSID 5347 - Windows Cyrillic (v2 */ + /* with Euro) */ +#define SQL_CP_5348 5348 /* CCSID 5348 - Windows Latin-1 (v2 */ + /* with Euro) */ +#define SQL_CP_5349 5349 /* CCSID 5349 - Windows Greece (v2 */ + /* with Euro) */ +#define SQL_CP_5350 5350 /* CCSID 5350 - Windows Turkey (v2 */ + /* with Euro) */ +#define SQL_CP_5351 5351 /* CCSID 5351 - Windows Hebrew ST5 */ + /* (v2 with Euro) */ +#define SQL_CP_5352 5352 /* CCSID 5352 - Windows Arabic ST5 */ + /* (v2 with Euro) */ +#define SQL_CP_5353 5353 /* CCSID 5353 - Windows Baltic (v2 */ + /* with Euro) */ +#define SQL_CP_5354 5354 /* CCSID 5354 - Windows Vietnam (v2 */ + /* with Euro) */ +#define SQL_CP_62215 62215 /* CCSID 62215 - Windows Hebrew ST4 */ +#define SQL_CP_62237 62237 /* CCSID 62237 - Windows Hebrew ST8 */ +#define SQL_CP_895 895 /* CCSID 895 - Japan 7-bit Latin */ +#define SQL_CP_901 901 /* CCSID 901 - Baltic 8-bit (with */ + /* Euro) */ +#define SQL_CP_902 902 /* CCSID 902 - Estonia ISO-8 (with */ + /* Euro) */ +#define SQL_CP_1008 1008 /* CCSID 1008 - Arabic 8-bit ISO */ + /* ASCII */ +#define SQL_CP_1155 1155 /* CCSID 1155 - Turkey Latin-5 (with */ + /* Euro) */ +#define SQL_CP_4909 4909 /* CCSID 4909 - Greece, Latin ISO-8 */ + /* (with Euro) */ +#define SQL_CP_5104 5104 /* CCSID 5104 - Arabic 8-bit ISO */ + /* ASCII (with Euro) */ +#define SQL_CP_9005 9005 /* CCSID 9005 - Greece, Latin ISO */ + /* 8859-7:2003 (with Euro) */ +#define SQL_CP_21427 21427 /* CCSID 21427 - Taiwan IBM Big-5 */ + /* (with 13493 CNS, 566, 6204 UDC, */ + /* Euro) */ +#define SQL_CP_62212 62212 /* CCSID 62212 - CP867 Hebrew ST10 */ +#define SQL_CP_62214 62214 /* CCSID 62214 - CP867 Hebrew ST5 */ +#define SQL_CP_62216 62216 /* CCSID 62216 - CP867 Hebrew ST6 */ +#define SQL_CP_62217 62217 /* CCSID 62217 - CP867 Hebrew ST8 */ +#define SQL_CP_62219 62219 /* CCSID 62219 - CP867 Hebrew ST11 */ +#define SQL_CP_62240 62240 /* CCSID 62240 - CP856 Hebrew ST11 */ + +/* DBCS Codepages */ +#define SQL_CP_926 926 /* Codepage 926 - Korean */ +#define SQL_CP_951 951 /* Codepage 951 - New Korean */ +#define SQL_CP_301 301 /* Codepage 301 - Japanese */ +#define SQL_CP_928 928 /* Codepage 928 - Chinese */ +#define SQL_CP_927 927 /* Codepage 927 - Taiwan */ +#define SQL_CP_941 941 /* Codepage 941 - Japanese */ +#define SQL_CP_947 947 /* Codepage 947 - Taiwan Big-5 */ +#define SQL_CP_971 971 /* Codepage 971 - Korean 5601 */ +#define SQL_CP_1351 1351 /* Codepage 1351 - Japanese */ +#define SQL_CP_1362 1362 /* Codepage 1362 - Korean Windows */ +#define SQL_CP_1380 1380 /* Codepage1380 - China GB */ +#define SQL_CP_1382 1382 /* Codepage1382 - Simp Chinese GB */ +#define SQL_CP_1385 1385 /* Codepage1385 - Simp Chinese GBK */ +#define SQL_CP_1393 1393 /* Codepage 1393 - Japanese */ + +/* Combined Codepages */ +#define SQL_CP_934 934 /* Codepage 891 + 926 - Korean */ +#define SQL_CP_949 949 /* CP 1088 + 951 - Korean Std */ +#define SQL_CP_932 932 /* Codepage 897 + 301 - Japanese */ +#define SQL_CP_936 936 /* Codepage 903 + 928 - Chinese */ +#define SQL_CP_938 938 /* Codepage 904 + 927 - Taiwan */ +#define SQL_CP_944 944 /* Codepage 1040 + 926 - Ext.Korean */ +#define SQL_CP_942 942 /* Codepage 1041 + 301 - Ext.Japanese */ +#define SQL_CP_943 943 /* Codepage 897 + 941 - Ext.Japanese */ +#define SQL_CP_946 946 /* Codepage 1042 + 928 - Ext.Chinese */ +#define SQL_CP_948 948 /* Codepage 1043 + 927 - Ext.Taiwan */ +#define SQL_CP_950 950 /* Codepage 1114 + 947 - Taiwan Big5 */ +#define SQL_CP_954 954 /* Codepage 954 + 13488 - euc Japan */ +#define SQL_CP_964 964 /* Codepage 964 + 13488 - euc Taiwan */ +#define SQL_CP_970 970 /* Codepage 367 + 971 - Korean 5601 */ +#define SQL_CP_1363 1363 /* Codepage 1363 - Korean Windows */ +#define SQL_CP_1381 1381 /* Codepage 1115 +1380 - China GB */ +#define SQL_CP_1383 1383 /* Codepage 367 +1382 - Chinese GB */ +#define SQL_CP_1386 1386 /* Codepage 1114 +1385 - Chinese GBK */ +#define SQL_CP_5488 5488 /* Codepage - Chinese GB18030 */ +#define SQL_CP_1392 1392 /* Codepage - Chinese GB18030 */ +#define SQL_CP_1394 1394 /* Codepage - Japanese Shift */ + /* JISX0213 */ +#define SQL_CP_5039 5039 /* Codepage 1041 + 1351 - Japanese */ +#define SQL_CP_8612 8612 /* CCSID x21A4, (CP420, ST5) */ +#define SQL_CP_62218 62218 /* CCSID xF30A, (CP864, ST8) */ +#define SQL_CP_62224 62224 /* CCSID xF310, (CP420, ST6) */ +#define SQL_CP_62233 62233 /* CCSID xF319, (CP420, ST8) */ +#define SQL_CP_62234 62234 /* CCSID xF31A, (CP1255, ST9) */ +#define SQL_CP_62246 62246 /* CCSID xF326, (CP1046, ST8) */ +#define SQL_CP_62247 62247 /* CCSID xF327, (CP1046, ST9) */ +#define SQL_CP_62248 62248 /* CCSID xF328, (CP1046, ST4) */ +#define SQL_CP_62249 62249 /* CCSID xF329, (CP1046, ST2) */ +#define SQL_CP_62250 62250 /* CCSID xF32A, (CP420, ST12) */ + +/* Unicode CCSIDs */ +#define SQL_CP_1200 1200 /* Codepage1200 - UCS-2 (big-endian) */ +#define SQL_CP_1202 1202 /* Codepage1202 - UCS-2 (little */ + /* endian) */ +#define SQL_CP_1204 1204 /* Codepage1204 - UCS-2 (BOM) */ +#define SQL_CP_1208 1208 /* Codepage1208 - UTF-8 */ +#define SQL_CP_1232 1232 /* Codepage1232 - UTF-32 (big-endian) */ +#define SQL_CP_1234 1234 /* Codepage1234 - UTF-32 (little */ + /* endian) */ +#define SQL_CP_UTF32BE SQL_CP_1232 /* Big-endian UTF-32 */ +#define SQL_CP_UTF32LE SQL_CP_1234 /* Little-endian UTF-32 */ +#define SQL_CP_1236 1236 /* Codepage1236 - UTF-32 (BOM) */ +#define SQL_CP_13488 13488 /* Codepg13488 - UCS-2 (Unicode v2, */ + /* big-endian) */ +#define SQL_CP_13490 13490 /* Codepg13490 - UCS-2 (Unicode v2, */ + /* little-endiant) */ +#define SQL_CP_17584 17584 /* Codepg17584 - UCS-2 (Unicode v3, */ + /* big-endian) */ +#define SQL_CP_17586 17586 /* Codepg17586 - UCS-2 (Unicode v3, */ + /* little-endiant) */ +#define SQL_CP_UTF8 SQL_CP_1208 /* UTF-8 */ +#define SQL_CP_UTF16BE SQL_CP_1200 /* Big-endian UTF-16 */ +#define SQL_CP_UTF16LE SQL_CP_1202 /* Little-endian UTF-16 */ + +/* EBCDIC, PCDATA and ECECP CCSIDs */ +#define SQL_CP_37 37 /* CCSID 37 - EBCDIC - Common */ + /* European */ +#define SQL_CP_273 273 /* CCSID 273 - EBCDIC Austria, */ + /* Germany */ +#define SQL_CP_274 274 /* CCSID 274 - EBCDIC Belgium */ +#define SQL_CP_277 277 /* CCSID 277 - EBCDIC Denmark, Norway */ +#define SQL_CP_278 278 /* CCSID 278 - EBCDIC Finland, Sweden */ +#define SQL_CP_280 280 /* CCSID 280 - EBCDIC Italy */ +#define SQL_CP_284 284 /* CCSID 284 - EBCDIC Spain, Latin */ + /* America */ +#define SQL_CP_285 285 /* CCSID 285 - EBCDIC UK */ +#define SQL_CP_290 290 /* CCSID 290 - EBCDIC Japan */ +#define SQL_CP_297 297 /* CCSID 297 - EBCDIC France */ +#define SQL_CP_300 300 /* CCSID 300 - EBCDIC Japan DBCS */ +#define SQL_CP_423 423 /* CCSID 423 - EBCDIC Greece */ +#define SQL_CP_500 500 /* CCSID 500 - EBCDIC Latin-1 */ +#define SQL_CP_803 803 /* CCSID 803 - EBCDIC Hebrew Set-A, */ + /* ST4 */ +#define SQL_CP_833 833 /* CCSID 833 - EBCDIC Korea Extended */ + /* SBCS */ +#define SQL_CP_834 834 /* CCSID 834 - EBCDIC Korea DBCS */ + /* (with 1880 UDC) */ +#define SQL_CP_835 835 /* CCSID 835 - EBCDIC Taiwan DBCS */ + /* (with 6204 UDC) */ +#define SQL_CP_836 836 /* CCSID 836 - EBCDIC China SBCS */ +#define SQL_CP_837 837 /* CCSID 837 - EBCDIC China DBCS */ + /* (with 1880 UDC) */ +#define SQL_CP_838 838 /* CCSID 838 - EBCDIC Thailand */ + /* Extended SBCS */ +#define SQL_CP_870 870 /* CCSID 870 - EBCDIC Latin-2 */ +#define SQL_CP_871 871 /* CCSID 871 - EBCDIC Iceland */ +#define SQL_CP_875 875 /* CCSID 875 - EBCDIC Greece */ +#define SQL_CP_924 924 /* CCSID 924 - EBCDIC Latin-9 */ +#define SQL_CP_930 930 /* CCSID 930 - EBCDIC Japan mix (with */ + /* 4370 UDC, Extended SBCS) */ +#define SQL_CP_933 933 /* CCSID 933 - EBCDIC Korea mix (with */ + /* 1880 UDC, Extended SBCS) */ +#define SQL_CP_935 935 /* CCSID 935 - EBCDIC China mix (with */ + /* 1880 UDC, Extended SBCS) */ +#define SQL_CP_937 937 /* CCSID 937 - EBCDIC Taiwan mix */ + /* (with 6204 UDC, Extended SBCS) */ +#define SQL_CP_939 939 /* CCSID 939 - EBCDIC Japan mix (with */ + /* 4370 UDC, Extended SBCS) */ +#define SQL_CP_1025 1025 /* CCSID 1025 - EBCDIC Cyrillic */ +#define SQL_CP_1026 1026 /* CCSID 1026 - EBCDIC Turkey Latin-5 */ +#define SQL_CP_1027 1027 /* CCSID 1027 - EBCDIC Japan Extended */ + /* SBCS */ +#define SQL_CP_1047 1047 /* CCSID 1047 - EBCDIC Open Systems */ + /* Latin-1 */ +#define SQL_CP_1112 1112 /* CCSID 1112 - EBCDIC Baltic */ +#define SQL_CP_1122 1122 /* CCSID 1122 - EBCDIC Estonia */ +#define SQL_CP_1123 1123 /* CCSID 1123 - EBCDIC Ukraine */ +#define SQL_CP_1130 1130 /* CCSID 1130 - EBCDIC Vietnam */ +#define SQL_CP_1137 1137 /* CCSID 1137 - EBCDIC Devangari */ + /* (Based on Unicode) */ +#define SQL_CP_1153 1153 /* CCSID 1153 - EBCDIC Latin-2 (with */ + /* Euro) */ +#define SQL_CP_1154 1154 /* CCSID 1154 - EBCDIC Cyrillic (with */ + /* Euro) */ +#define SQL_CP_1156 1156 /* CCSID 1156 - EBCDIC Baltic */ +#define SQL_CP_1157 1157 /* CCSID 1157 - EBCDIC Estonia */ +#define SQL_CP_1158 1158 /* CCSID 1158 - EBCDIC Ukraine */ +#define SQL_CP_1159 1159 /* CCSID 1159 - EBCDIC Taiwan */ + /* Extended SBCS (with Euro) */ +#define SQL_CP_1160 1160 /* CCSID 1160 - EBCDIC Thailanf (with */ + /* Euro) */ +#define SQL_CP_1164 1164 /* CCSID 1164 - EBCDIC Vietnam (with */ + /* Euro) */ +#define SQL_CP_1364 1364 /* CCSID 1364 - EBCDIC Korea mix */ + /* (with Full Hangul) */ +#define SQL_CP_1371 1371 /* CCSID 1371 - EBCDIC Taiwan mix */ + /* (with 6204 UDC, Extended SBCS) */ +#define SQL_CP_1388 1388 /* CCSID 1388 - EBCDIC China mix */ +#define SQL_CP_1390 1390 /* CCSID 1390 - EBCDIC Japan mix */ + /* (with 6205 UDC, Extended SBCS, */ + /* Euro) */ +#define SQL_CP_1399 1399 /* CCSID 1399 - EBCDIC Japan max */ + /* (with 6205 UDC, Exnteded SBCS, */ + /* Euro) */ +#define SQL_CP_4369 4369 /* CCSID 4369 - EBCDIC Austria, */ + /* German (DP94) */ +#define SQL_CP_4396 4396 /* CCSID 4396 - EBCDIC Japan DBCS */ + /* (with 1880 UCD) */ +#define SQL_CP_4899 4899 /* CCSID 4899 - EBCDIC Hebrew Set-A, */ + /* ST4 (with Euro, Sheqel) */ +#define SQL_CP_4930 4930 /* CCSID 4930 - EBCDIC Korea DBCS */ + /* (with Full Hangul) */ +#define SQL_CP_4933 4933 /* CCSID 4933 - EBCDIC China DBCS */ + /* (with all GBK) */ +#define SQL_CP_4971 4971 /* CCSID 4971 - EBCDIC Greece (with */ + /* Euro) */ +#define SQL_CP_5026 5026 /* CCSID 5026 - EBCDIC Japan mix */ + /* (with 1880 UDC, Extended SBCS) */ +#define SQL_CP_5035 5035 /* CCSID 5035 - EBCDIC Japan mix */ + /* (with 1880 UDC, Extended SBCS) */ +#define SQL_CP_5123 5123 /* CCSID 5123 - EBCDIC Japan Latin */ + /* (with Extended SBCS, Euro) */ +#define SQL_CP_8482 8482 /* CCSID 8482 - EBCDIC Japan SBCS */ + /* (with Euro) */ +#define SQL_CP_8616 8616 /* CCSID 8616 - EBCDIC Hebrew subset */ + /* ST10 */ +#define SQL_CP_9027 9027 /* CCSID 9027 - EBCDIC Taiwan (with */ + /* 6204 UDC, Euro) */ +#define SQL_CP_12708 12708 /* CCSID 12708 - EBCDIC Arabic ST7 */ +#define SQL_CP_12712 12712 /* CCSID 12712 - EBCDIC Hebrew ST10 */ + /* (with Euro, Sheqel) */ +#define SQL_CP_13121 13121 /* CCSID 13121 - EBCDIC Korea (with */ + /* Extended SBCS) */ +#define SQL_CP_13124 13124 /* CCSID 13124 - EBCDIC China SBCS */ +#define SQL_CP_16684 16684 /* CCSID 16684 - EBCDIC Japan (with */ + /* 6295 UDC, Euro) */ +#define SQL_CP_16804 16804 /* CCSID 16804 - EBCDIC Arabic ST4 */ + /* (with Euro) */ +#define SQL_CP_28709 28709 /* CCSID 28709 - EBCDIC Taiwan SBCS */ +#define SQL_CP_62211 62211 /* CCSID 62211 - EBCDIC Hebrew ST5 */ +#define SQL_CP_62229 62229 /* CCSID 62229 - EBCDIC Hebrew ST8 */ +#define SQL_CP_62235 62235 /* CCSID 62235 - EBCDIC Hebrew ST6 */ +#define SQL_CP_62245 62245 /* CCSID 62245 - EBCDIC Hebrew ST10 */ +#define SQL_CP_62251 62251 /* CCSID 62251 - zOS Arabic/Latin ST6 */ +#define SQL_CP_808 808 /* CCSID 808 - PCDATA Cyrillic */ + /* (Russian with Euro) */ +#define SQL_CP_848 848 /* CCSID 848 - PCDATA Uktaine (with */ + /* Euro) */ +#define SQL_CP_849 849 /* CCSID 849 - PCDATA Belarus (with */ + /* Euro) */ +#define SQL_CP_858 858 /* CCSID 858 - PCDATA Latin-1E (with */ + /* Euro) */ +#define SQL_CP_872 872 /* CCSID 872 - PCDATA Cyrillic (with */ + /* Euro) */ +#define SQL_CP_1161 1161 /* CCSID 1161 - PCDATA Thailand (with */ + /* Euero) */ +#define SQL_CP_1370 1370 /* CCSID 1370 - PCDATA Taiwan mix */ + /* (with Euro) */ +#define SQL_CP_5210 5210 /* CCSID 5210 - PCDATA China SBCS */ +#define SQL_CP_9044 9044 /* CCSID 9044 - PCDATA Latin-2 (with */ + /* Euro) */ +#define SQL_CP_9048 9048 /* CCSID 9048 - PCDATA Hebrew ST5 */ + /* (with Euro, Sheqel) */ +#define SQL_CP_9049 9049 /* CCSID 9049 - PCDATA Turkey Latin-5 */ + /* (with Euro) */ +#define SQL_CP_9061 9061 /* CCSID 9061 - PCDATA Greece (with */ + /* Euro) */ +#define SQL_CP_9238 9238 /* CCSID 9238 - PCDATA Arabic ST5 */ + /* (with Euro) */ +#define SQL_CP_17248 17248 /* CCSID 17248 - PCDATA Arabic ST5 */ + /* (with Euro) */ +#define SQL_CP_1140 1140 /* CCSID 1140 - ECECP Common */ + /* European, US, Canada */ +#define SQL_CP_1141 1141 /* CCSID 1141 - ECECP Austria, */ + /* Germany */ +#define SQL_CP_1142 1142 /* CCSID 1142 - ECECP Denmakr, Norway */ +#define SQL_CP_1143 1143 /* CCSID 1143 - ECECP Finalnd, Sweden */ +#define SQL_CP_1144 1144 /* CCSID 1144 - ECECP Italy */ +#define SQL_CP_1145 1145 /* CCSID 1145 - ECECP Spanish, Latin */ + /* America */ +#define SQL_CP_1146 1146 /* CCSID 1146 - ECECP UK */ +#define SQL_CP_1147 1147 /* CCSID 1147 - ECECP France */ +#define SQL_CP_1148 1148 /* CCSID 1148 - ECECP International 1 */ +#define SQL_CP_1149 1149 /* CCSID 1149 - ECECP Iceland */ +#define SQL_CP_65535 65535 /* CCSID 65535 - Reserved */ + +/* Datastream Types */ +#define SQL_SBC_PC 0 /* Single byte PC */ +#define SQL_JPN_PC 1 /* Japanese-PC */ +#define SQL_CHN_PC 2 /* Chinese-PC */ +#define SQL_KOR_PC 3 /* Korean-PC */ +#define SQL_KSC_PC 4 /* New Korean-PC */ +#define SQL_KR5_PC 5 /* Korean 5601 */ +#define SQL_TWN_PC 6 /* Taiwan Big-5 */ +#define SQL_CGB_PC 7 /* China GB */ +#define SQL_CGBA_PC 8 /* China GB on AIX */ +#define SQL_EUCJP_PC 9 /* Japan euc */ +#define SQL_EUCTW_PC 10 /* Taiwan euc */ +#define SQL_UCS2_PC 11 /* UCS-2 */ +#define SQL_KSC2_PC 12 /* Korean Windows */ +#define SQL_CGBK_PC 13 /* China GBK */ +#define SQL_UTF8_PC 14 /* UTF-8 */ +#define SQL_CGB18030_PC 15 /* China GB18030 */ +#define SQL_UNKN_PC 255 /* Unknown */ + +/* AIX codeset & locale lengths */ +#define SQL_CODESET_LEN 9 +#define SQL_LOCALE_LEN 5 + +/* Codeset & locale lengths for sqle_db_territory_info struct */ +#define SQL_CODESET_SIZE 17 +#define SQL_LOCALE_SIZE 33 + +/* SQLCA Constants */ +#ifndef SQL_RC_INVALID_SQLCA +#endif + +/* Size of SQLCA */ +#define SQLCA_SIZE sizeof(struct sqlca) + +/* SQL Error message token delimiter */ +#define SQL_ERRMC_PRES ((char) 0xFF) /* delimiter for string entry */ + +/* Offset in SQLERRD - Diagnostic information */ +#define SQL_ERRD_RC 0 /* return code */ +#define SQL_ERRD_REAS 1 /* reason code */ +#define SQL_ERRD_CNT 2 /* nbr rows inserted/updated/deleted */ +#define SQL_ERRD_OPT_CARD 2 /* optimizer estimate of # rows */ +#define SQL_ERRD_OPTM 3 /* obsolete -- do not use -- */ +#define SQL_ERRD_OPT_TOTCOST 3 /* optimzer estimate of total cost */ +#define SQL_ERRD_DCNT 4 /* nbr of cascaded deletes/updates */ +#define SQL_ERRD_LINE 4 /* line number for recompile error */ +#define SQL_ERRD_AUTHTYPE 4 /* authentication type returned for */ + /* CONNECT/ATTACH */ +#define SQL_ERRD_DIAG 5 /* diagnostics */ + +/* Indexes in SQLWARN - Warning flags */ +#define SQL_WARN_ANY 0 /* composite - set if any warnings */ +#define SQL_WARN_TRUNC 1 /* string column truncated */ +#define SQL_WARN_NUL 2 /* null values eliminated */ +#define SQL_WARN_MISM 3 /* nbr of columns/host vars mismatch */ +#define SQL_WARN_ALLR 4 /* no WHERE clause in update/delete */ +#define SQL_WARN_ETO 5 /* error is tolerated */ +#define SQL_WARN_DATE 6 /* date has been truncated */ +#define SQL_WARN_SUB 8 /* character conversion substitution */ +#define SQL_WARN_NUL2 9 /* arithmetic error nulls eliminated */ +#define SQL_WARN_SQLCA 10 /* SQLCA conversion error */ + +/* Values for Warning flags in SQLWARN */ +#define SQL_WARNING 'W' /* warning indicator */ +#define SQL_NULL_TRN 'N' /* null terminator truncated warning */ +#define SQL_TRN_APP_LEN 'X' /* truncation warning with */ + /* application context length */ + /* returned in sqlind */ +#define SQL_NO_WARN ' ' /* no warning indicator */ +#define SQL_ETO 'E' /* error has been tolerated */ + +#define SQL_PREPARE_ESTIMATE_WARNING 'P' /* Compiler estimate warning */ + /* indicator */ +/* SQLDA Constants */ + +/* Increment for type with null indicator */ +#define SQL_TYP_NULINC 1 + +/* Variable Types */ +#define SQL_TYP_DATE 384 /* DATE */ +#define SQL_TYP_NDATE (SQL_TYP_DATE+SQL_TYP_NULINC) + +#define SQL_TYP_TIME 388 /* TIME */ +#define SQL_TYP_NTIME (SQL_TYP_TIME+SQL_TYP_NULINC) + +#define SQL_TYP_STAMP 392 /* TIMESTAMP */ +#define SQL_TYP_NSTAMP (SQL_TYP_STAMP+SQL_TYP_NULINC) + +#define SQL_TYP_DATALINK 396 /* DATALINK */ +#define SQL_TYP_NDATALINK (SQL_TYP_DATALINK+SQL_TYP_NULINC) + +#define SQL_TYP_CGSTR 400 /* C NUL-terminated graphic str */ +#define SQL_TYP_NCGSTR (SQL_TYP_CGSTR+SQL_TYP_NULINC) + +#define SQL_TYP_BLOB 404 /* BLOB - varying length string */ +#define SQL_TYP_NBLOB (SQL_TYP_BLOB+SQL_TYP_NULINC) + +#define SQL_TYP_CLOB 408 /* CLOB - varying length string */ +#define SQL_TYP_NCLOB (SQL_TYP_CLOB+SQL_TYP_NULINC) + +#define SQL_TYP_DBCLOB 412 /* DBCLOB - varying length string */ +#define SQL_TYP_NDBCLOB (SQL_TYP_DBCLOB+SQL_TYP_NULINC) + +#define SQL_TYP_VARCHAR 448 /* VARCHAR(i) - varying length string */ + /* (2 byte length) */ +#define SQL_TYP_NVARCHAR (SQL_TYP_VARCHAR+SQL_TYP_NULINC) + +#define SQL_TYP_CHAR 452 /* CHAR(i) - fixed length string */ +#define SQL_TYP_NCHAR (SQL_TYP_CHAR+SQL_TYP_NULINC) + +#define SQL_TYP_LONG 456 /* LONG VARCHAR - varying length */ + /* string */ +#define SQL_TYP_NLONG (SQL_TYP_LONG+SQL_TYP_NULINC) + +#define SQL_TYP_CSTR 460 /* varying length string for C (null */ + /* terminated) */ +#define SQL_TYP_NCSTR (SQL_TYP_CSTR+SQL_TYP_NULINC) + +#define SQL_TYP_VARGRAPH 464 /* VARGRAPHIC(i) - varying length */ + /* graphic string (2 byte length) */ +#define SQL_TYP_NVARGRAPH (SQL_TYP_VARGRAPH+SQL_TYP_NULINC) + +#define SQL_TYP_GRAPHIC 468 /* GRAPHIC(i) - fixed length graphic */ + /* string */ +#define SQL_TYP_NGRAPHIC (SQL_TYP_GRAPHIC+SQL_TYP_NULINC) + +#define SQL_TYP_LONGRAPH 472 /* LONG VARGRAPHIC(i) - varying */ + /* length graphic string */ +#define SQL_TYP_NLONGRAPH (SQL_TYP_LONGRAPH+SQL_TYP_NULINC) + +#define SQL_TYP_LSTR 476 /* varying length string for Pascal */ + /* (1-byte length) */ +#define SQL_TYP_NLSTR (SQL_TYP_LSTR+SQL_TYP_NULINC) + +#define SQL_TYP_FLOAT 480 /* FLOAT - 4 or 8 byte floating point */ +#define SQL_TYP_NFLOAT (SQL_TYP_FLOAT+SQL_TYP_NULINC) + +#define SQL_TYP_DECIMAL 484 /* DECIMAL (m,n) */ +#define SQL_TYP_NDECIMAL (SQL_TYP_DECIMAL+SQL_TYP_NULINC) + +#define SQL_TYP_ZONED 488 /* Zoned Decimal -> DECIMAL (m,n) */ +#define SQL_TYP_NZONED (SQL_TYP_ZONED+SQL_TYP_NULINC) + +#define SQL_TYP_BIGINT 492 /* BIGINT - 8-byte signed integer */ +#define SQL_TYP_NBIGINT (SQL_TYP_BIGINT+SQL_TYP_NULINC) + +#define SQL_TYP_INTEGER 496 /* INTEGER - 4-byte signed integer */ +#define SQL_TYP_NINTEGER (SQL_TYP_INTEGER+SQL_TYP_NULINC) + +#define SQL_TYP_SMALL 500 /* SMALLINT - 2-byte signed integer */ +#define SQL_TYP_NSMALL (SQL_TYP_SMALL+SQL_TYP_NULINC) + +#define SQL_TYP_NUMERIC 504 /* NUMERIC -> DECIMAL (m,n) */ +#define SQL_TYP_NNUMERIC (SQL_TYP_NUMERIC+SQL_TYP_NULINC) + +#define SQL_TYP_BLOB_FILE_OBSOLETE 804 /* Obsolete Value */ +#define SQL_TYP_NBLOB_FILE_OBSOLETE (SQL_TYP_BLOB_FILE_OBSOLETE+SQL_TYP_NULINC) + +#define SQL_TYP_CLOB_FILE_OBSOLETE 808 /* Obsolete Value */ +#define SQL_TYP_NCLOB_FILE_OBSOLETE (SQL_TYP_CLOB_FILE_OBSOLETE+SQL_TYP_NULINC) + +#define SQL_TYP_DBCLOB_FILE_OBSOLETE 812 /* Obsolete Value */ +#define SQL_TYP_NDBCLOB_FILE_OBSOLETE (SQL_TYP_DBCLOB_FILE_OBSOLETE+SQL_TYP_NULINC) + +#define SQL_TYP_VARBINARY 908 /* Variable Binary */ +#define SQL_TYP_NVARBINARY (SQL_TYP_VARBINARY+SQL_TYP_NULINC) + +#define SQL_TYP_BINARY 912 /* Fixed Binary */ +#define SQL_TYP_NBINARY (SQL_TYP_BINARY+SQL_TYP_NULINC) + +#define SQL_TYP_BLOB_FILE 916 /* BLOB File - Binary Large Object */ + /* File */ +#define SQL_TYP_NBLOB_FILE (SQL_TYP_BLOB_FILE+SQL_TYP_NULINC) + +#define SQL_TYP_CLOB_FILE 920 /* CLOB File - Char Large Object File */ +#define SQL_TYP_NCLOB_FILE (SQL_TYP_CLOB_FILE+SQL_TYP_NULINC) + +#define SQL_TYP_DBCLOB_FILE 924 /* DBCLOB File - Double Byte Char */ + /* Large Object File */ +#define SQL_TYP_NDBCLOB_FILE (SQL_TYP_DBCLOB_FILE+SQL_TYP_NULINC) + +#define SQL_TYP_BLOB_LOCATOR 960 /* BLOB locator */ +#define SQL_TYP_NBLOB_LOCATOR (SQL_TYP_BLOB_LOCATOR+SQL_TYP_NULINC) + +#define SQL_TYP_CLOB_LOCATOR 964 /* CLOB locator */ +#define SQL_TYP_NCLOB_LOCATOR (SQL_TYP_CLOB_LOCATOR+SQL_TYP_NULINC) + +#define SQL_TYP_DBCLOB_LOCATOR 968 /* DBCLOB locator */ +#define SQL_TYP_NDBCLOB_LOCATOR (SQL_TYP_DBCLOB_LOCATOR+SQL_TYP_NULINC) + +#define SQL_TYP_XML 988 /* XML */ +#define SQL_TYP_NXML (SQL_TYP_XML+SQL_TYP_NULINC) + +#define SQL_TYP_DECFLOAT 996 /* Decimal Float (16/34) */ +#define SQL_TYP_NDECFLOAT (SQL_TYP_DECFLOAT+SQL_TYP_NULINC) + +#define SQL_LOBTOKEN_LEN SQL_LOBLOCATOR_LEN +#define SQL_TYP_BLOB_TOKEN SQL_TYP_BLOB_LOCATOR +#define SQL_TYP_NBLOB_TOKEN SQL_TYP_NBLOB_LOCATOR +#define SQL_TYP_CLOB_TOKEN SQL_TYP_CLOB_LOCATOR +#define SQL_TYP_NCLOB_TOKEN SQL_TYP_NCLOB_LOCATOR +#define SQL_TYP_DBCLOB_TOKEN SQL_TYP_DBCLOB_LOCATOR +#define SQL_TYP_NDBCLOB_TOKEN SQL_TYP_NDBCLOB_LOCATOR +#define SQL_NCLOB_MAXLEN SQL_DBCLOB_MAXLEN +#define SQL_LOBHANDLE_LEN SQL_LOBTOKEN_LEN +#define SQL_TYP_BLOB_HANDLE SQL_TYP_BLOB_TOKEN +#define SQL_TYP_NBLOB_HANDLE SQL_TYP_NBLOB_TOKEN +#define SQL_TYP_CLOB_HANDLE SQL_TYP_CLOB_TOKEN +#define SQL_TYP_NCLOB_HANDLE SQL_TYP_NCLOB_TOKEN +#define SQL_TYP_DBCLOB_HANDLE SQL_TYP_DBCLOB_TOKEN +#define SQL_TYP_NDBCLOB_HANDLE SQL_TYP_NDBCLOB_TOKEN + +/* Values for 30th byte of sqlname */ +#define SQL_SQLNAME_SYSGEN ((char) 0xFF) /* sqlname is system generated */ +#define SQL_SQLNAME_NOT_SYSGEN ((char) 0x00) /* sqlname is directly derived */ + /* from a single column or */ + /* specified in the AS clause */ + +/* Return Codes for sqlabndx, sqlaprep and sqlarbnd */ +#define SQLA_RC_OPT_IGNORED 20 /* The option(s) specified are not */ + /* supported by the target database */ + /* and will be ignored */ +#define SQLA_RC_BINDWARN 25 /* Bind execution succeeded with */ + /* warnings. */ +#define SQLA_RC_PREPWARN 25 /* Precompilation succeeded with */ + /* warnings. */ +#define SQLA_RC_BINDERROR -1 /* Bind execution failed */ +#define SQLA_RC_PREPERROR -1 /* Precompilation failed */ +#define SQLA_RC_BAD_BINDNAME -2 /* Invalid bind file */ +#define SQLA_RC_BAD_DBNAME -3 /* Invalid database */ +#define SQLA_RC_BAD_MSGNAME -5 /* Invalid message file */ +#define SQLA_RC_BAD_FORMAT -6 /* Invalid format */ +#define SQLA_RC_OPEN_ERROR -31 /* Error opening list file */ +#define SQLA_RC_MFILE_OPEN_ERR -35 /* Error opening message file */ +#define SQLA_RC_FILE_NAME_BAD -36 /* Source file name is invalid */ +#define SQLA_RC_BAD_BNDFILE -39 /* Bind file corrupted */ +#define SQLA_RC_LIST_ERROR -40 /* Bind list errors */ +#define SQLA_RC_INTERRUPT -94 /* Interrupt */ +#define SQLA_RC_OSERROR -1086 /* System error */ +#define SQLA_RC_PREP_BIND_BUSY -1392 /* Prep/Bind already in use */ +#define SQLA_RC_OPTION_LEN_BAD -4903 /* Invalid parm. length */ +#define SQLA_RC_OPTION_PTR_BAD -4904 /* Invalid parm. ptr */ +#define SQLA_RC_OPTION_SIZE_BAD -4905 /* Invalid parm. size */ +#define SQLA_RC_OPTION_DATA_BAD -4917 /* Invalid parm. data */ +#define SQLA_RC_OPTION_INVALID -30104 /* Invalid option or option value */ +#define SQLA_RC_SDK_LICENSE -8005 /* No SDK/6000 license */ + +/* Values used for the date/time format parameter of sqlabind() ** OBSOLETE */ +/* ** */ +#define SQL_FMT_DEF "DEF" /* FORMAT = Default for Country Code */ +#define SQL_FMT_USA "USA" /* FORMAT = USA */ +#define SQL_FMT_EUR "EUR" /* FORMAT = EUR */ +#define SQL_FMT_ISO "ISO" /* FORMAT = ISO */ +#define SQL_FMT_JIS "JIS" /* FORMAT = JIS */ +#define SQL_FMT_LOC "LOC" /* FORMAT = LOCAL */ + +/* The size of a date/time format buffer */ +#define SQL_FMT_LENGTH 3 + +/* Structures used system wide */ + +#ifndef SQL_SQLDBCHAR_DEFN +#define SQL_SQLDBCHAR_DEFN + typedef unsigned short sqldbchar; +#endif + +/****************************************************************************** +** sqlchar data structure +** This structure is used to pass variable length data to the database manager. +** +** Table: Fields in the SQLCHAR Structure +** ---------------------------------------------------------------------------- +** |Field Name |Data Type |Description | +** |---------------------|---------------|------------------------------------| +** |LENGTH |SMALLINT |Length of the character string | +** | | |pointed to by DATA. | +** |---------------------|---------------|------------------------------------| +** |DATA |CHAR(n) |An array of characters of length | +** | | |LENGTH. | +** |---------------------|---------------|------------------------------------| +** +** COBOL Structure +** +** This is not defined in any header file. The following is an example that +** shows how to define the structure in COBOL: +** +** * Replace maxlen with the appropriate value: +** 01 SQLCHAR. +** 49 SQLCHAR-LEN PIC S9(4) COMP-5. +** 49 SQLCHAR-DATA PIC X(maxlen). +*******************************************************************************/ +SQL_STRUCTURE sqlchar /* General-purpose VARCHAR for */ + /* casting */ +{ + short length; + _SQLOLDCHAR data[1]; +}; + +/****************************************************************************** +** sqlgraphic data structure +*******************************************************************************/ +SQL_STRUCTURE sqlgraphic /* General-purpose VARGRAPHIC for */ + /* casting */ +{ + short length; +#ifdef SQL_WCHART_CONVERT + wchar_t data[1]; +#else + sqldbchar data[1]; +#endif +}; + +/****************************************************************************** +** sqllob data structure +** This structure is used to represent a LOB data type in a host +** programming language. +** +** Table: Fields in the sqllob structure +** ---------------------------------------------------------------- +** |Field name |Data type |Description | +** |--------------|-------------|---------------------------------| +** |length |sqluint32 |Length in bytes of the data | +** | | |parameter. | +** |--------------|-------------|---------------------------------| +** |data |char(1) |Data being passed in. | +** |--------------|-------------|---------------------------------| +** +*******************************************************************************/ +SQL_STRUCTURE sqllob /* General-purpose LOB for casting */ +{ + sqluint32 length; + char data[1]; +}; + +/****************************************************************************** +** sqldbclob data structure +*******************************************************************************/ +SQL_STRUCTURE sqldbclob /* General-purpose DBCLOB for casting */ +{ + sqluint32 length; +#ifdef SQL_WCHART_CONVERT + wchar_t data[1]; +#else + sqldbchar data[1]; +#endif +}; + +/****************************************************************************** +** sqlfile data structure +*******************************************************************************/ +SQL_STRUCTURE sqlfile /* File reference structure for LOBs */ +{ + sqluint32 name_length; + sqluint32 data_length; + sqluint32 file_options; + char name[255]; +}; + +SQL_STRUCTURE sqlfile2 /* Extended file reference structure */ + /* for LOBs */ +{ + sqluint32 name_length; + sqluint32 data_length; + sqluint32 file_options; + char name[255]; + char reserved[5]; + sqluint64 offset; +}; + +/* Values used for SQLVAR.SQLLEN with sqlfile structures */ +#define SQL_SQLFILE_LEN SQL_LOBFILE_LEN /* Length of an sqlfile LOB */ + /* file host var */ +#define SQL_SQLFILE2_LEN 280 /* Length of an sqlfile2 LOB file */ + /* host var */ + +/* Values used for file_options in the sqlfile structures */ +#define SQL_FILE_READ 2 /* Input file to read from */ +#define SQL_FILE_CREATE 8 /* Output file - new file to be */ + /* created */ +#define SQL_FILE_OVERWRITE 16 /* Output file - overwrite existing */ + /* file or create a new file if it */ + /* doesn't exist */ +#define SQL_FILE_APPEND 32 /* Output file - append to an */ + /* existing file or create a new file */ + /* if it doesn't exist */ + +/* Structure used to store binder options when calling sqlabndr() */ +/* or sqlabndx(), or to store precompile options when calling */ +/* sqlaprep(), or to store rebind options when calling sqlarbnd(). */ + +#define sqlbindopt sqloptions + +#ifndef SQL_BIND_OPTS + +/****************************************************************************** +** sqloptheader data structure +** Table: Fields in the SQLOPTHEADER Structure +** |----------------------------------------------------------------| +** |Field Name|Data Type|Description | +** |----------|---------|-------------------------------------------| +** |ALLOCATED |INTEGER |Number of elements in the option array | +** | | |of the sqlopt structure. | +** |----------|---------|-------------------------------------------| +** |USED |INTEGER |Number of elements in the option array | +** | | |of the sqlopt structure actually used. | +** | | |This is the number of option pairs (TYPE | +** | | |and VAL) supplied. | +** |----------|---------|-------------------------------------------| +*******************************************************************************/ +SQL_STRUCTURE sqloptheader /* Header for sqlopt structure */ +{ + sqluint32 allocated; /* Number of options allocated */ + sqluint32 used; /* Number of options used */ +}; + +/****************************************************************************** +** sqloptions data structure +** Table: Fields in the SQLOPTIONS Structure +** |----------------------------------------------------------------| +** |Field Name| Data Type | Description | +** |----------------------------------------------------------------| +** |TYPE | INTEGER | Bind/precompile/rebind option type. | +** |VAL | INTEGER | Bind/precompile/rebind option value. | +** |----------------------------------------------------------------| +** |Note: | +** |The TYPE and VAL fields are repeated for each bind/precompile/ | +** |rebind option specified. | +** |----------------------------------------------------------------| +*******************************************************************************/ +SQL_STRUCTURE sqloptions /* bind/prep/rebind option */ +{ + sqluint32 type; /* Type of bind/prep/rebind option */ + sqluintptr val; /* Value of bind/prep/rebind option */ +}; + +/****************************************************************************** +** sqlopt data structure +** This structure is used to pass bind options to the sqlabndx API, +** precompile options to the sqlaprep API, and rebind options to the +** sqlarbnd API. + +** Table: Fields in the SQLOPT Structure +** |----------------------------------------------------------------| +** |Field Name| Data Type|Description | +** |----------|----------|------------------------------------------| +** |HEADER | Structure|An sqloptheader structure. | +** |----------|----------|------------------------------------------| +** |OPTION | Array |An array of sqloptions structures. The | +** | | |number of elements in this array is | +** | | |determined by the value of the allocated | +** | | |field of the header. | +** |----------|----------|------------------------------------------| + +** COBOL Structure + +** * File: sql.cbl +** 01 SQLOPT. +** 05 SQLOPTHEADER. +** 10 ALLOCATED PIC 9(9) COMP-5. +** 10 USED PIC 9(9) COMP-5. +** 05 SQLOPTIONS OCCURS 1 TO 50 DEPENDING ON ALLOCATED. +** 10 SQLOPT-TYPE PIC 9(9) COMP-5. +** 10 SQLOPT-VAL PIC 9(9) COMP-5. +** 10 SQLOPT-VAL-PTR REDEFINES SQLOPT-VAL +** * +*******************************************************************************/ +SQL_STRUCTURE sqlopt +{ + SQL_STRUCTURE sqloptheader header; /* Header for sqlopt structure */ + SQL_STRUCTURE sqloptions option[1]; /* Array of bind/prep/rebind options */ +}; + +#define SQL_BIND_OPTS +#endif + +/* Values used for option[n].type in the sqloptions structure */ +/* of sqlabndx(), sqlaprep() and sqlarbnd(). */ +#define SQL_DATETIME_OPT 1 /* Option for date/time format - bind */ + /* and precompile option */ +#define SQL_STANDARDS_OPT 2 /* Option for standards level */ + /* compliance - precompile option */ + /* only */ +#define SQL_ISO_OPT 4 /* Option for isolation level - bind */ + /* and precompile option */ +#define SQL_BLOCK_OPT 5 /* Option for record blocking - bind */ + /* and precompile option */ +#define SQL_GRANT_OPT 6 /* Option for granting privileges - */ + /* bind option only */ +#define SQL_FLAG_OPT 8 /* Option for the Flagger - */ + /* precompile option only */ +#define SQL_GRANT_USER_OPT 9 /* Option for granting privileges to */ + /* a user - bind option only */ +#define SQL_GRANT_GROUP_OPT 10 /* Option for granting privileges to */ + /* a group - bind option only */ +#define SQL_CNULREQD_OPT 11 /* Option for adding NULLs to strings */ + /* - bind option only */ +#define SQL_GENERIC_OPT 12 /* Generic option for DRDA servers - */ + /* bind option only */ +#define SQL_DEFERRED_PREPARE_OPT 15 /* Option for Deferred Prepare - */ + /* precompile option only */ +#define SQL_CONNECT_OPT 16 /* Specifies whether one or multiple */ + /* connections are allowed */ + /* similtaneously within a unit of */ + /* work. */ +#define SQL_RULES_OPT 17 /* Specifies the set of rules used */ + /* for connection to multiple */ + /* databases within a single unit of */ + /* work */ +#define SQL_DISCONNECT_OPT 18 /* Specifies which of multiple */ + /* databases connected to will be */ + /* disconnected when a COMMIT or */ + /* ROLLBACK is issued. */ +#define SQL_SYNCPOINT_OPT 19 /* Specifies what syncpoint option */ + /* (for example one phase or two */ + /* phase) will be used */ +#define SQL_BIND_OPT 20 /* Option to create a bind file - */ + /* precompile option only */ +#define SQL_SAA_OPT 21 /* Option specifies SAA/non-SAA */ + /* compatibility - FORTRAN precompile */ + /* option only */ +#define SQL_PKG_OPT 23 /* Option to create a package with a */ + /* specific name - precompile option */ + /* only */ +#define SQL_OPTIM_OPT 24 /* Option to specify SQLDA */ + /* optimization - precompile option */ + /* only */ +#define SQL_SYNTAX_OPT 25 /* Option to not create a package or */ + /* bind file - precompile option only */ +#define SQL_SQLERROR_OPT SQL_SYNTAX_OPT /* Indicates under what */ + /* conditions a package will be be */ + /* created - bind and precompile */ + /* option */ +#define SQL_LINEMACRO_OPT 26 /* Option to suppress #line macro */ + /* generation in modified source file */ + /* - C precompile option only */ +#define SQL_NO_OPT 27 /* 'No-op' option - ignore this entry */ + /* in the option array - bind, */ + /* precompile and rebind option */ +#define SQL_LEVEL_OPT 30 /* Level of a module - precompile */ + /* option only */ +#define SQL_COLLECTION_OPT 31 /* Package collection identifier - */ + /* precompile option only */ +#define SQL_VERSION_OPT 32 /* Package version identifier - */ + /* precompile and rebind option only */ +#define SQL_OWNER_OPT 33 /* Package owner authorization */ + /* identifier - bind and precompile */ + /* option */ +#define SQL_SCHEMA_OPT SQL_OWNER_OPT /* Synonym for owner - bind and */ + /* precompile option */ +#define SQL_QUALIFIER_OPT 34 /* Authorization identifier that is */ + /* to be used as a qualifier for */ + /* unqualified objects - bind and */ + /* precompile option */ +#define SQL_CATALOG_OPT SQL_QUALIFIER_OPT /* Synonym for qualifier - */ + /* bind and precompile option */ +#define SQL_TEXT_OPT 35 /* Package description - bind and */ + /* precompile option */ +#define SQL_VALIDATE_OPT 40 /* Indicates when object validation */ + /* occurs - bind and precompile */ + /* option */ +#define SQL_EXPLAIN_OPT 41 /* Determines whether information */ + /* will be produced about how the SQL */ + /* statements in a package will be */ + /* executed - bind and precompile */ + /* option */ +#define SQL_ACTION_OPT 42 /* Indicates whether a package is to */ + /* be added or replaced - bind and */ + /* precompile option */ +#define SQL_REPLVER_OPT 44 /* Replaces a specific version of a */ + /* package - bind and precompile */ + /* option */ +#define SQL_RETAIN_OPT 45 /* Indicates whether EXECUTE */ + /* authorities are to be preserved */ + /* when a package is replaced - bind */ + /* and precompile option */ +#define SQL_RELEASE_OPT 46 /* Indicates whether resources are */ + /* released at each COMMIT or when */ + /* the application terminates - bind */ + /* and precompile option */ +#define SQL_DEGREE_OPT 47 /* Specifies whether or not the query */ + /* is executed using I/O parallelism */ + /* bind and precompile option */ +#define SQL_STRDEL_OPT 50 /* Designates whether an apostrophe */ + /* or quote will be used as a string */ + /* delimiter - bind and precompile */ + /* option */ +#define SQL_DECDEL_OPT 51 /* Designates whether a period or */ + /* comma will be used as a decimal */ + /* point indicator - bind and */ + /* precompile option */ +#define SQL_CHARSUB_OPT 55 /* Designates default character */ + /* subtype that is to be used for */ + /* column definitions in the CREATE */ + /* and ALTER TABLE SQL statements - */ + /* bind and precompile option */ +#define SQL_CCSIDS_OPT 56 /* Designates what CCSID will be used */ + /* for single byte characters for */ + /* character column definitions */ + /* without a specific CCSID clause in */ + /* the CREATE and ALTER TABLE SQL */ + /* statements - bind and precompile */ + /* option */ +#define SQL_CCSIDM_OPT 57 /* Designates what CCSID will be used */ + /* for mixed byte characters for */ + /* character column definitions */ + /* without a specific CCSID clause in */ + /* the CREATE and ALTER TABLE SQL */ + /* statements - bind and precompile */ + /* option */ +#define SQL_CCSIDG_OPT 58 /* Designates what CCSID will be used */ + /* for double byte characters for */ + /* character column definitions */ + /* without a specific CCSID clause in */ + /* the CREATE and ALTER TABLE SQL */ + /* statements - bind and precompile */ + /* option */ +#define SQL_DEC_OPT 59 /* Specifies maximum precision to be */ + /* used in decimal arithmetic */ + /* operations - bind and precompile */ + /* option */ +#define SQL_WCHAR_OPT 60 /* Specifies handling of graphic */ + /* vars. - precompile only */ +#define SQL_DYNAMICRULES_OPT 61 /* Specifies which authorization */ + /* identifier to use when dynamic SQL */ + /* in a package is executed - bind */ + /* and precompile option */ +#define SQL_INSERT_OPT 62 /* Buffers VALUE inserts - bind and */ + /* precompile option for DB2/PE */ + /* servers only */ +#define SQL_EXPLSNAP_OPT 63 /* Capture explain snapshot - bind */ + /* and precompile option */ +#define SQL_FUNCTION_PATH 64 /* Path for user-defined function */ + /* resolution - bind and precompile */ + /* option */ +#define SQL_SQLWARN_OPT 65 /* Disable prepare-time SQL warnings */ + /* bind and precompile option */ +#define SQL_QUERYOPT_OPT 66 /* Set query optimization class - */ + /* bind and precompile option */ +#define SQL_TARGET_OPT 67 /* Target compiler - precompile */ + /* option */ +#define SQL_PREP_OUTPUT_OPT 68 /* Name of precompiler output file - */ + /* precompile option */ +#define SQL_PREPROCESSOR_OPT 69 /* Preprocessor command - precompile */ + /* option only */ +#define SQL_RESOLVE_OPT 70 /* Indicates whether function and */ + /* type resolution should or should */ + /* not use conservative binding */ + /* semantics - rebind option only */ +#define SQL_CLIPKG_OPT 71 /* CLIPKG option - bind option only */ +#define SQL_FEDERATED_OPT 72 /* FEDERATED option - bind and */ + /* precompile option */ +#define SQL_TRANSFORMGROUP_OPT 73 /* Transform Group - precompile and */ + /* bind option */ +#define SQL_LONGERROR_OPT 74 /* Option to treat long host variable */ + /* declarations as errors - */ + /* precompile option only */ +#define SQL_DECTYPE_OPT 75 /* DECTYPE Option to convert decimals */ + /* precompile option only */ +#define SQL_KEEPDYNAMIC_OPT 76 /* Specifies whether dynamic SQL */ + /* statements are to be kept after */ + /* commit points - bind and */ + /* precompile option */ +#define SQL_DBPROTOCOL_OPT 77 /* Specifies what protocol to use */ + /* when connecting to a remote site */ + /* that is identified by a three-part */ + /* name statement - bind and */ + /* precompile option */ +#define SQL_OPTHINT_OPT 78 /* Controls whether query */ + /* optimization hints are used for */ + /* static SQL - bind and precompile */ + /* option */ +#define SQL_IMMEDWRITE_OPT 79 /* Tells whether immediate writes */ + /* will be done for updates made to */ + /* group buffer pool dependent */ + /* pagesets or partitions - bind and */ + /* precompile option */ +#define SQL_ENCODING_OPT 80 /* Specifies the encoding for all */ + /* host variables in static */ + /* statements in the plan or package */ + /* (bind and precompile option) */ +#define SQL_OS400NAMING_OPT 81 /* Specifies which naming option is */ + /* to be used when accessing DB2 UDB */ + /* for iSeries data - bind and */ + /* precompile option */ +#define SQL_SORTSEQ_OPT 82 /* Specifies which sort sequence */ + /* table to use on the iSeries system */ + /* - bind and precompile option */ +#define SQL_REOPT_OPT 83 /* Specifies whether to have DB2 */ + /* determine an access path at run */ + /* time using values for host */ + /* variables, parameter markers, and */ + /* special registers - bind and */ + /* precompile option */ +#define SQL_PSM_OPT 84 /* PSM option - bind option */ +#define SQL_CALL_RES_OPT 85 /* Specifies whether to use immediate */ + /* ordeferred procedure */ + /* resolutionprecompile option */ +#define SQL_TIMESTAMP_OPT 86 /* Option for date/time format - bind */ + /* and precompile option */ +#define SQL_STATICREADONLY_OPT 87 /* Specifies whether static cursors */ + /* will be treated as read-only if */ + /* they are ambiguous - precompile */ + /* and bind option */ +#define SQL_OPTPROFILE_OPT 88 /* Specifies a two-part name of the */ + /* form [schemaname.]basename where */ + /* basename is a character string of */ + /* up to 128 chars in length used to */ + /* uniquely identify the optimization */ + /* profile within a particular */ + /* schema. Schemaname is a character */ + /* string identifier of up to 30 */ + /* bytes used to explicitelyqualify */ + /* an optimization profile schema. */ +#define SQL_FEDASYNC_OPT 89 /* Specifies whether or not the query */ + /* is executed using asynchrony */ +#define SQL_NODB_OPT 90 /* Specifies that a database should */ + /* not be used during precompile. */ + /* The BINDFILE and VALIDATE RUN */ + /* options will be implicitely */ + /* specified. */ + +#define SQL_NUM_OPTS 90 /* # of PREP/BIND/REBIND options */ + +/* Values used for option[n].val when option[n].type is */ +/* SQL_DATETIME_OPT. These can also be used for the date/time */ +/* format parameter of sqlabind(). */ + +#define SQL_DATETIME_DEF 48 /* FORMAT = Default for Country Code */ +#define SQL_DATETIME_USA 49 /* FORMAT = USA */ +#define SQL_DATETIME_EUR 50 /* FORMAT = EUR */ +#define SQL_DATETIME_ISO 51 /* FORMAT = ISO */ +#define SQL_DATETIME_JIS 52 /* FORMAT = JIS */ +#define SQL_DATETIME_LOC 53 /* FORMAT = LOCAL */ + +/* The following constants are here for backwards compatbility with earlier */ +/* releases. */ + +#define SQL_FRMT_OPT SQL_DATETIME_OPT +#define SQL_FMT_0 SQL_DATETIME_DEF +#define SQL_FMT_1 SQL_DATETIME_USA +#define SQL_FMT_2 SQL_DATETIME_EUR +#define SQL_FMT_3 SQL_DATETIME_ISO +#define SQL_FMT_4 SQL_DATETIME_JIS +#define SQL_FMT_5 SQL_DATETIME_LOC + +/* Values used for option[n].val when option[n].type is SQL_STANDARDS_OPT. */ +#define SQL_SAA_COMP 0 /* SAA Level 1 Database CPI */ +#define SQL_MIA_COMP 1 /* MIA */ +#define SQL_SQL92E_COMP 2 /* SQL92 Entry */ + +/* Values used for option[n].val when option[n].type is SQL_ISO_OPT */ +#define SQL_REP_READ 0 /* Repeatable read level */ +#define SQL_CURSOR_STAB 1 /* Cursor stability level */ +#define SQL_UNCOM_READ 2 /* Uncommitted read level */ +#define SQL_READ_STAB 3 /* Read stability level */ +#define SQL_NO_COMMIT 4 /* No Commit level l */ + +/* Values used for option[n].val when option[n].type is SQL_BLOCK_OPT */ +#define SQL_BL_UNAMBIG 0 /* Block Unambiguous cursors */ +#define SQL_BL_ALL 1 /* Block All cursors */ +#define SQL_NO_BL 2 /* Block No cursors */ + +/* Values used for option[n].val when option[n].type is SQL_FLAG_OPT */ +#define SQL_MVSDB2V23_SYNTAX 4 /* Flagger check against MVS */ +#define SQL_MVSDB2V31_SYNTAX 5 /* DB2 V2.3, V3.1 or V4.1 SQL */ +#define SQL_MVSDB2V41_SYNTAX 6 /* syntax */ +#define SQL_SQL92E_SYNTAX 7 /* FIPS flagger SQL92E syntax */ + +/* Values used for option[n].val when option[n].type is SQL_CNULREQD_OPT */ +#define SQL_CNULREQD_NO 0 /* C NULL value not required */ +#define SQL_CNULREQD_YES 1 /* C NULL value required */ + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* GENERIC_OPT */ +#define SQL_MAX_GENERIC 1023 + +/* Values used for option[n].val when option[n].type is SQL_SAA_OPT. */ +#define SQL_SAA_NO 0 /* SQLCA definition not SAA */ + /* compatible */ +#define SQL_SAA_YES 1 /* SQLCA definition is SAA compatible */ + +/* Values used for option[n].val when option[n].type is SQL_OPTIM_OPT. */ +#define SQL_DONT_OPTIMIZE 0 /* Do not optimize SQLDA */ + /* initialization */ +#define SQL_OPTIMIZE 1 /* Optimize SQLDA initialization */ + +/* Values used for option[n].val when option[n].type is SQL_SYNTAX_OPT. */ +#define SQL_NO_SYNTAX_CHECK 0 /* Create a package and/or a bind */ + /* file */ +#define SQL_SYNTAX_CHECK 1 /* Do not create a package or bind */ + /* file */ + +/* Values used for option[n].val when option[n].type is SQL_LINEMACRO_OPT. */ +#define SQL_NO_LINE_MACROS 0 /* Do not generate #line macros in */ + /* modified source file */ +#define SQL_LINE_MACROS 1 /* Generate #line macros in modified */ + /* source file */ + +/* Values used for option[n].val when option[n].type is SQL_WCHAR_OPT. */ +#define SQL_WCHAR_NOCONVERT 0 /* graphic variable not converted */ +#define SQL_WCHAR_CONVERT 1 /* graphic variable converted */ + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL_LEVEL */ +/* OPT */ +#define SQL_MAX_LEVEL 8 + +/* Values used for option[n].val when option[n].type is SQL_CONNECT_OPT */ +#define SQL_DEFERRED_PREPARE_YES 1 /* Dynamic SQL statements will be */ + /* chained. */ +#define SQL_DEFERRED_PREPARE_NO 2 /* Dynamic SQL statements will not be */ + /* chained. */ +#define SQL_DEFERRED_PREPARE_ALL 3 /* Dynamic SQL statements will be */ + /* chained in all cases. The */ + /* application must not allocate host */ + /* vars a FETCH SQLDA until after the */ + /* OPEN statement for the cursor. */ + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* COLLECTION_OPT */ +#define SQL_MAX_COLLECTION 30 + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* VERSION_OPT */ +#define SQL_MAX_VERSION 254 + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL_OWNER */ +/* OPT */ +#define SQL_MAX_OWNER 30 + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* SCHEMA_OPT */ +#define SQL_MAX_SCHEMA SQL_MAX_OWNER + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* QUALIFIER_OPT */ +#define SQL_MAX_QUALIFIER 30 + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* CATALOG_OPT */ +#define SQL_MAX_CATALOG SQL_MAX_QUALIFIER + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL_TEXT */ +/* OPT */ +#define SQL_MAX_TEXT 255 + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* PREPROCESSOR_OPT */ +#define SQL_MAX_PREPROCESSOR 1024 + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* TRANSFORMGROUP_OPT */ +#define SQL_MAX_TRANSFORMGROUP 18 + +/* Values used for option[n].val when option[n].type is SQL_VALIDATE_OPT */ +#define SQL_VALIDATE_BIND 0 /* Validate objects during BIND */ +#define SQL_VALIDATE_RUN 1 /* Validate objects during execution */ + +/* Values used for option[n].val when option[n].type is SQL_EXPLAIN_OPT */ +#define SQL_EXPLAIN_NO 0 /* No Explain output saved */ +#define SQL_EXPLAIN_YES 1 /* Explain output saved */ +#define SQL_EXPLAIN_ALL 2 /* Explain output saved for all */ + /* static and dynamic statements */ +#define SQL_EXPLAIN_REOPT 3 /* Explain output saved for static */ + /* reoptimizable statements */ + +/* Values used for option[n].val when option[n].type is SQL_ACTION_OPT */ +#define SQL_ACTION_ADD 0 /* Package is to be added */ +#define SQL_ACTION_REPLACE 1 /* Package is to be replaced */ + +/* Max/Min value of CLIPKG for option[n].val when option[n].type is SQL */ +/* CLIPKG_OPT */ +#define SQL_MIN_CLIPKG 3 +#define SQL_MAX_CLIPKG 30 + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* REPLVER_OPT */ +#define SQL_MAX_REPLVER 254 + +/* Values used for option[n].val when option[n].type is SQL_SQLERROR_OPT */ +#define SQL_SQLERROR_NOPACKAGE SQL_NO_SYNTAX_CHECK /* Do not create a */ + /* package if errors are encountered */ +#define SQL_SQLERROR_CHECK SQL_SYNTAX_CHECK /* Do not create a package */ +#define SQL_SQLERROR_CONTINUE 2 /* Create a package even if errors */ + /* are encountered */ + +/* Values used for option[n].val when option[n].type is SQL_RETAIN_OPT */ +#define SQL_RETAIN_NO 0 /* Do not preserve EXECUTE */ + /* authorities when a package is */ + /* replaced */ +#define SQL_RETAIN_YES 1 /* Preserve EXECUTE authorities when */ + /* a package is replaced */ + +/* Values used for option[n].val when option[n].type is SQL_RELEASE_OPT */ +#define SQL_RELEASE_COMMIT 0 /* Release resources at COMMIT */ +#define SQL_RELEASE_DEALLOCATE 1 /* Release resources when the program */ + /* terminates */ + +/* Values used for option[n].val when option[n].type is SQL_STRDEL_OPT */ +#define SQL_STRDEL_APOSTROPHE 0 /* Apostrophe string delimiter */ +#define SQL_STRDEL_QUOTE 1 /* Quote string delimiter */ + +/* Values used for option[n].val when option[n].type is SQL_DECDEL_OPT */ +#define SQL_DECDEL_PERIOD 0 /* Period is used as a decimal point */ + /* indicator in decimal and floating */ + /* point literals */ +#define SQL_DECDEL_COMMA 1 /* Comma is used as a decimal point */ + /* indicator in decimal and floating */ + /* point literals */ + +/* Values used for option[n].val when option[n].type is SQL_CHARSUB_OPT */ +#define SQL_CHARSUB_DEFAULT 0 /* Use the target system defined */ + /* default for all new character */ + /* columns for which an explicit */ + /* subtype is not specified */ +#define SQL_CHARSUB_BIT 1 /* Use the BIT character subtype for */ + /* all new character columns for */ + /* which an explicit subtype is not */ + /* specified */ +#define SQL_CHARSUB_SBCS 2 /* Use the SBCS character subtype for */ + /* all new character columns for */ + /* which an explicit subtype is not */ + /* specified */ +#define SQL_CHARSUB_MIXED 3 /* Use the mixed character subtype */ + /* for all new character columns for */ + /* which an explicit subtype is not */ + /* specified */ + +/* Values used for option[n].val when option[n].type is SQL_DEC_OPT */ +#define SQL_DEC_15 15 /* 15 bit precision is used in */ + /* decimal arithmetic operations */ +#define SQL_DEC_31 31 /* 31 bit precision is used in */ + /* decimal arithmetic operations */ + +/* Values used for option[n].val when option[n].type is SQL_DEGREE_OPT */ +#define SQL_DEGREE_1 1 /* Prohibits parallel I/O operations */ +#define SQL_DEGREE_ANY 0 /* Allows the target database system */ + /* to determine the degree of */ + /* parallel I/O operations */ +#define SQL_MAX_DEGREE_VAL 32767 /* Maximum value */ + +/* Values used for option[n].val when option[n].type is SQL_VERSION_OPT */ +#define SQL_VERSION_AUTO "AUTO" /* Use the timestamp to generate the */ + /* package VERSION */ + +/* The next four option values (for CONNECT type, SQLRULES, DISCONNECT and */ +/* SYNCPOINT) are used not only by the precompiler but also by the sqlesetc */ +/* and sqleqryc APIs. */ + +/* Values used for option[n].val when option[n].type is SQL_CONNECT_OPT */ +#define SQL_CONNECT_1 1 /* Indicates that only one connection */ + /* to a database can exist at any */ + /* given time. */ +#define SQL_CONNECT_2 2 /* Indicates that multiple */ + /* connections can exist */ + /* simultaneously, with one being */ + /* active and the others dormant. */ + +/* Values used for option[n].val when option[n].type is SQL_RULES_OPT */ +#define SQL_RULES_DB2 1 /* Indicates that CONNECT TO can be */ + /* used to make a dormant connection */ + /* the current connection. */ +#define SQL_RULES_STD 2 /* Indicates that CONNECT TO is not */ + /* valid for making a dormant */ + /* connection current, and SET */ + /* CONNECTION must be used instead. */ + +/* Values used for option[n].val when option[n].type is SQL_DISCONNECT_OPT */ +#define SQL_DISCONNECT_EXPL 1 /* Indicates that all connections */ + /* marked by the RELEASE statement */ + /* will be the only connections */ + /* released when a COMMIT is issued. */ +#define SQL_DISCONNECT_COND 2 /* Indicates that all connections */ + /* that do not have open WITH HOLD */ + /* cursors will be the only */ + /* connections released when a COMMIT */ + /* is issued. */ +#define SQL_DISCONNECT_AUTO 3 /* Indicates that all connections */ + /* will be released when a COMMIT is */ + /* issued. */ + +/* Values used for option[n].val when option[n].type is SQL_SYNCPOINT_OPT */ +#define SQL_SYNC_ONEPHASE 1 /* Do not use a transaction manager */ + /* to perform two phase commit, but */ + /* enforce that there is only one */ + /* database is updated when multiple */ + /* databases are accessed within a */ + /* single transaction. */ +#define SQL_SYNC_TWOPHASE 2 /* Use a transaction manager to */ + /* coordinate two phase commit. */ +#define SQL_SYNC_NONE 0 /* No update enforcement or two phase */ + /* commit protocol will be used. */ + +/* The next option value (for SQL_CONNECT_NODE) is used only by the sqlesetc */ +/* and sqleqryc APIs. */ +#define SQL_CONN_CATALOG_NODE 0xfffe /* Connect to the catalog node */ + +/* Values used for option[n].val when option[n].type is SQL_DYNAMICRULES_OPT */ +#define SQL_DYNAMICRULES_RUN 0 /* Dynamic SQL in package will use */ + /* authid of person running the */ + /* package */ +#define SQL_DYNAMICRULES_BIND 1 /* Dynamic SQL in package will use */ + /* authid of person who owns the */ + /* package */ +#define SQL_DYNAMICRULES_INVOKERUN 2 /* Dynamic SQL in a routine will use */ + /* authid of invoker of routine */ +#define SQL_DYNAMICRULES_DEFINERUN 3 /* Dynamic SQL in a routine will use */ + /* authid of definer of routine */ +#define SQL_DYNAMICRULES_INVOKEBIND 4 /* Dynamic SQL in a routine will use */ + /* authid of invoker of routine */ +#define SQL_DYNAMICRULES_DEFINEBIND 5 /* Dynamic SQL in a routine will use */ + /* authid of definer of routine */ + +/* Values used for option[n].val when option[n].type is SQL_INSERT_OPT */ +#define SQL_INSERT_DEF 0 /* Do not buffer VALUE inserts */ +#define SQL_INSERT_BUF 1 /* Buffer VALUE inserts */ + +/* Values used for option[n].val when option[n].type is SQL_EXPLSNAP_OPT */ +#define SQL_EXPLSNAP_NO 0 /* No Explain snapshot saved */ +#define SQL_EXPLSNAP_YES 1 /* Explain snapshot saved */ +#define SQL_EXPLSNAP_ALL 2 /* Explain snapshot saved for all */ + /* static and dynamic statements */ +#define SQL_EXPLSNAP_REOPT 3 /* Explain snapshot saved for static */ + /* reoptimizable statements */ + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* FUNCTION_PATH */ +#define SQL_MAX_FUNCPATH 254 + +/* Values used for option[n].val when option[n].type is SQL_SQLWARN_OPT */ +#define SQL_SQLWARN_NO 0 /* Suppress prepare-time warning */ + /* SQLCODEs */ +#define SQL_SQLWARN_YES 1 /* Permit prepare-time warning */ + /* SQLCODEs */ + +/* Values used for option[n].val when option[n].type is SQL_QUERYOPT_OPT */ +#define SQL_QUERYOPT_0 0 /* Class 0 query optimization */ +#define SQL_QUERYOPT_1 1 /* Class 1 query optimization */ +#define SQL_QUERYOPT_2 2 /* Class 2 query optimization */ +#define SQL_QUERYOPT_3 3 /* Class 3 query optimization */ +#define SQL_QUERYOPT_5 5 /* Class 5 query optimization */ +#define SQL_QUERYOPT_7 7 /* Class 7 query optimization */ +#define SQL_QUERYOPT_9 9 /* Class 9 query optimization */ + +/* Maximum sqlchar length for option[n].val when option[n].type is SQL */ +/* TARGET_OPT */ +#define SQL_MAX_TARGET_LEN 32 + +/* Values used for option[n].val when option[n].type is SQL_RESOLVE_OPT */ +#define SQL_RESOLVE_ANY 0 /* Conservative binding semantics are */ + /* not used */ +#define SQL_RESOLVE_CONSERVATIVE 1 /* Conservative binding semantics are */ + /* used */ + +/* Values used for option[n].val when option[n].type is SQL_FEDERATED_OPT */ +#define SQL_FEDERATED_NO 0 /* Federated systems are not */ + /* supported */ +#define SQL_FEDERATED_YES 1 /* Federated systems are supported */ +/* Values used for option[n].val when option[n].type is SQL_PSM_OPT */ +#define SQL_PSM_NO 0 /* PSM no */ +#define SQL_PSM_YES 1 /* PSM yes */ + +/* Values used for option[n].val when option[n].type is SQL_LONGERROR_OPT. */ +#define SQL_LONGERROR_NO 0 /* Do not generate errors for the use */ + /* of long host variable declarations */ +#define SQL_LONGERROR_YES 1 /* Generate errors for the use of */ + /* long host variable declarations */ + +/* Values used for option[n].val when option[n].type is SQL_DECTYPE_OPT. */ +#define SQL_DECTYPE_NOCONVERT 0 /* Decimal type not converted */ +#define SQL_DECTYPE_CONVERT 1 /* Decimal type converted */ + +/* Values used for option[n].val when option[n].type is SQL_KEEPDYNAMIC_OPT */ +#define SQL_KEEPDYNAMIC_NO 0 /* Do not keep dynamic SQL statements */ + /* after commit points */ +#define SQL_KEEPDYNAMIC_YES 1 /* Keep dynamic SQL statements after */ + /* commit points */ + +/* Values used for option[n].val when option[n].type is SQL_DBPROTOCOL_OPT */ +#define SQL_DBPROTOCOL_DRDA 0 /* Use DRDA protocol when connecting */ + /* to a remote site that is */ + /* identified by a three-part name */ + /* statement */ +#define SQL_DBPROTOCOL_PRIVATE 1 /* Use a private protocol when */ + /* connecting to a remote site that */ + /* is identified by a three-part name */ + /* statement */ + +/* Values used for option[n].val when option[n].type is SQL_IMMEDWRITE_OPT */ +#define SQL_IMMEDWRITE_NO 0 /* Updated pages are written at or */ + /* before phase two of commit */ +#define SQL_IMMEDWRITE_YES 1 /* Updated pages are written as soon */ + /* as the buffer update completes */ +#define SQL_IMMEDWRITE_PH1 2 /* Updated pages are written at or */ + /* before phase one of commit */ + +/* Values used for option[n].val when option[n].type is SQL_ENCODING_OPT */ +#define SQL_ENCODING_ASCII 0 /* Host variables in static */ + /* statements are encoded in ascii */ +#define SQL_ENCODING_EBCDIC 1 /* Host variables in static */ + /* statements are encoded in ebcdic */ +#define SQL_ENCODING_UNICODE 2 /* Host variables in static */ + /* statements are encoded in unicode */ + +/* Values used for option[n].val when option[n].type is SQL_OS400NAMING_OPT */ +#define SQL_OS400NAMING_SYSTEM 0 /* Use the iSeries system naming */ + /* option when accessing DB2 UDB for */ + /* iSeries data */ +#define SQL_OS400NAMING_SQL 1 /* Use the SQL naming option when */ + /* accessing DB2 UDB for iSeries data */ + +/* Values used for option[n].val when option[n].type is SQL_SORTSEQ_OPT */ +#define SQL_SORTSEQ_JOBRUN 0 /* Use the NLSS sort sequence table */ + /* of the DRDA job on the iSeries */ + /* system */ +#define SQL_SORTSEQ_HEX 1 /* Use the EBCDIC sort sequence table */ + /* of the DRDA job on the iSeries */ + /* system */ + +/* Values used for option[n].val when option[n].type is SQL_REOPT_OPT */ +#define SQL_REOPT_NO 0 /* Do not determine an access path at */ + /* run time using values for host */ + /* variables, parameter markers, and */ + /* special registers */ +#define SQL_REOPT_YES 1 /* Re-determine an access path at run */ + /* time using values for host */ + /* variables, parameter markers, and */ + /* special registers */ +#define SQL_REOPT_NONE 2 /* The access path is determined */ + /* based on the default estimates for */ + /* host variables, parameter markers, */ + /* and special registers */ +#define SQL_REOPT_ONCE 3 /* Re-determine an access path only */ + /* once at run time using values for */ + /* host variables, parameter markers, */ + /* and special registers */ +#define SQL_REOPT_ALWAYS 4 /* Re-determine an access path at */ + /* every execution values for host */ + /* variables, parameter markers, and */ + /* special registers */ + +/* Values used for option[n].val when option[n].type is SQL_CALL_RES_OPT */ +#define SQL_CALL_RES_IMMED 0 /* Immediate SP call resolution */ +#define SQL_CALL_RES_DEFERRED 1 /* Deferred SP call resolution */ + +/* Values used for option[n].val when option[n].type is SQL_STATICREADONLY */ +/* OPT */ +#define SQL_STATICRO_NO 0 /* Static cursors take on attributes */ + /* as wouldnormally be generated */ + /* given the statementtext and */ + /* setting of the LANGLEVEL option. */ +#define SQL_STATICRO_YES 1 /* Any static cursor that does not */ + /* contain theFOR UPDATE or FOR READ */ + /* ONLY clause will beconsidered READ */ + /* ONLY. */ + +/* Values used for option[n].val when option[n].type is SQL_NODB_OPT. */ +#define SQL_USEDB 0 /* Use a database to precompiler. */ +#define SQL_NODB 1 /* Do not use a database to */ + /* precompile. */ + +/* Values used for option[n].val when option[n].type is SQL_FEDASYNC_OPT */ +#define SQL_FEDASYNC_MIN 0 /* No asynchrony is used */ +#define SQL_FEDASYNC_ANY -1 /* Allows the optimizer to determine */ + /* the level of asynchrony */ +#define SQL_FEDASYNC_MAX 64000 /* Maximum value */ + +/* Binder Interface Parameters/Return Codes */ + +/****************************************************************************** +** sqlabndx API +** Invokes the bind utility, which prepares SQL statements stored in the +** bind file generated by the precompiler, and creates a package that is +** stored in the database. +** +** Scope +** +** This API can be called from any database partition server in db2nodes.cfg. It +** updates the database catalogs on the catalog partition. Its effects are +** visible to all database partition servers. +** +** Authorization +** +** One of the following: +** - sysadm or dbadm authority +** - BINDADD privilege if a package does not exist and one of: +** -- IMPLICIT_SCHEMA authority on the database if the schema name +** of the package does not exist +** -- CREATEIN privilege on the schema if the schema name of the +** package exists +** - ALTERIN privilege on the schema if the package exists +** - BIND privilege on the package if it exists. +** +** The user also needs all privileges required to compile any static SQL +** statements in the application. Privileges granted to groups are not used for +** authorization checking of static statements. If the user has sysadm +** authority, but not explicit privileges to complete the bind, the database +** manager grants explicit dbadm authority automatically. +** +** Required connection +** +** Database +** +** API include file +** +** sql.h +** +** sqlabndx API parameters +** +** pBindFileName +** Input. A string containing the name of the bind file, or the name of a file +** containing a list of bind file names. The bind file names must contain the +** extension .bnd. A path for these files can be specified. +** +** Precede the name of a bind list file with the at sign (@). For example, a +** fully qualified bind list file name might be: /u/user1/bnd/@all.lst +** +** The bind list file should contain one or more bind file names, and must have +** the extension .lst. +** +** Precede all but the first bind file name with a plus symbol (+). The bind +** file names may be on one or more lines. For example, the bind list file +** all.lst might contain: +** mybind1.bnd+mybind2.bnd+ +** mybind3.bnd+ +** mybind4.bnd +** +** Path specifications on bind file names in the list file can be used. +** If no path is specified, the database manager takes path information +** from the bind list file. +** +** pMsgFileName +** Input. A string containing the destination for error, warning, and +** informational messages. Can be the path and the name of an operating system +** file, or a standard device. If a file already exists, it is overwritten. +** If it does not exist, a file is created. +** +** pBindOptions +** Input. A structure used to pass bind options to the API. For more information +** about this structure, see SQLOPT. +** +** pSqlca +** Output. A pointer to the sqlca structure. +** +** Usage notes +** +** Binding can be done as part of the precompile process for an application +** program source file, or as a separate step at a later time. Use BIND when +** binding is performed as a separate process. +** +** The name used to create the package is stored in the bind file, and is +** based on the source file name from which it was generated (existing paths +** or extensions are discarded). For example, a precompiled source file +** called myapp.sqc generates a default bind file called myapp.bnd and a +** default package name of MYAPP. (However, +** the bind file name and the +** package name can be overridden at precompile time by using the +** SQL_BIND_OPT and the SQL_PKG_OPT options of sqlaprep.) +** +** BIND executes under the transaction that the user has started. After +** performing the bind, BIND issues a COMMIT (if bind is successful) or a +** ROLLBACK (if bind is unsuccessful) operation to terminate the current +** transaction and start another one. +** +** Binding halts if a fatal error or more than 100 errors occur. If a +** fatal error occurs during binding, BIND stops binding, attempts to +** close all files, and discards the package. +** +** Binding application programs have prerequisite requirements and restrictions +** beyond the scope of this manual. For example, an application cannot be bound +** from a V8 client to a V8 server, and then executed against a V7 server. +** +** The Bind option types and values are defined in sql. +** +** REXX API syntax +** +** This API can be called from REXX through the SQLDB2 interface. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Bind */ + sqlabndx ( + _SQLOLDCHAR * pBindFileName, /* bind file name */ + _SQLOLDCHAR * pMsgFileName, /* message file */ + struct sqlopt * pBindOptions, /* bind options */ + struct sqlca * pSqlca); /* SQLCA */ + +/****************************************************************************** +** sqlarbnd API +** Allows the user to recreate a package stored in the database without the need +** for a bind file. +** +** Authorization +** +** One of the following: +** - sysadm or dbadm authority +** - ALTERIN privilege on the schema +** - BIND privilege on the package. +** +** The authorization ID logged in the BOUNDBY column of the SYSCAT.PACKAGES +** system catalog table, which is the ID of the most recent binder of the +** package, is used as the binder authorization ID for the rebind, and for +** the default schema for table references in the package. Note that this +** default qualifier may be different from the authorization ID of the +** user executing the rebind request. REBIND will use the same bind +** options that were specified when the package was created. +** +** Required connection +** +** Database +** +** API include file +** +** sql.h +** +** sqlarbnd API parameters +** +** pPackageName +** Input. A string containing the qualified or unqualified name that designates +** the package to be rebound. An unqualified package-name is implicitly +** qualified by the current authorization ID. This name does not include the +** package version. When specifying a package that has a version that is not +** the empty string, then the version-id must be specified using the +** SQL_VERSION_OPT rebind option. +** +** pSqlca +** Output. A pointer to the sqlca structure. +** +** pRebindOptions +** Input. A pointer to the SQLOPT structure, used to pass rebind options to the +** API. For more information about this structure, see SQLOPT. +** +** Usage notes +** +** REBIND does not automatically commit the transaction following a successful +** rebind. The user must explicitly commit the transaction. This enables +** "what if " analysis, in which the user updates certain statistics, and +** then tries to rebind the package to see what changes. It also permits +** multiple rebinds within a unit of work. +** +** This API: +** +** - Provides a quick way to recreate a package. This enables the user to take +** advantage of a change in the system without a need for the original +** bind file.fs. For example, if it is likely that a particular SQL +** statement can take advantage of a newly created index, REBIND can be +** used to recreate the package. REBIND can also be used to recreate +** packages after db2Runstats has been executed, thereby taking advantage +** of the new statistics. +** +** - Provides a method to recreate inoperative packages. Inoperative packages +** must be explicitly rebound by invoking either the bind utility or the rebind +** utility. A package will be marked inoperative (the VALID column of the +** SYSCAT.PACKAGES system catalog will be set to X) if a function instance on +** which the package depends is dropped. The rebind conservative option is +** not supported for inoperative packages. +** +** - Gives users control over the rebinding of invalid packages. Invalid +** packages will be automatically (or implicitly) rebound by the database +** manager when they are executed. This may result in a noticeable delay +** in the execution of the first SQL request for the invalid package. It +** may be desirable to explicitly rebind invalid packages, rather than +** allow the system to automatically rebind them, in order to eliminate +** the initial delay and to prevent unexpected SQL error messages which +** may be returned in case the implicit rebind fails. For example, +** following migration, all packages stored in the database will be +** invalidated by the DB2 Version 5 migration process. Given that this +** may involve a large number of packages, it may be desirable to +** explicitly rebind all of the invalid packages at one time. This +** explicit rebinding can be accomplished using BIND, REBIND, or the +** db2rbind tool. +** +** The choice of whether to use BIND or REBIND to explicitly rebind a package +** depends on the circumstances. It is recommended that REBIND be used +** whenever the situation does not specifically require the use of BIND, +** since the performance of REBIND is significantly better than that of +** BIND. BIND must be used, however: +** +** - When there have been modifications to the program (for example, when +** SQL statements have been added or deleted, or when the package does +** not match the executable for the program). +** +** - When the user wishes to modify any of the bind options as part of the +** rebind. REBIND does not support any bind options. For example, if the user +** wishes to have privileges on the package granted as part of the bind +** process, BIND must be used, since it has an SQL_GRANT_OPT option. +** +** - When the package does not currently exist in the database. +** +** - When detection of all bind errors is desired. REBIND only returns the first +** error it detects, and then ends, whereas the BIND command returns the +** first 100 errors that occur during binding. +** +** REBIND is supported by DB2 Connect. +** +** If REBIND is executed on a package that is in use by another user, the rebind +** will not occur until the other user's logical unit of work ends, because an +** exclusive lock is held on the package's record in the SYSCAT.PACKAGES system +** catalog table during the rebind. +** +** When REBIND is executed, the database manager recreates the package from +** the SQL statements stored in the SYSCAT.STATEMENTS system catalog table. +** If many versions with the same package number and creator exist, only one +** version can be bound at once. If not specified using the SQL_VERSION_OPT +** rebind option, the VERSION defaults to be "". Even if there is only one +** package with a name and creator that matches the name and creator specified +** in the rebind request, it will not rebound unless its VERSION matches the +** VERSION specified explicitly or implicitly. +** +** If REBIND encounters an error, processing stops, and an error message is +** returned. +** +** The Explain tables are populated during REBIND if either SQL_EXPLSNAP_OPT +** or SQL_EXPLAIN_OPT have been set to YES or ALL (check +** EXPLAIN_SNAPSHOT and EXPLAIN_MODE columns in the catalog). The Explain +** tables used are those of the REBIND requester, not the original binder. +** The Rebind option types and values are defined in sql.h. +** +** REXX API syntax +** +** This API can be called from REXX through the SQLDB2 interface. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Rebind */ + sqlarbnd ( + char * pPackageName, /* package name */ + struct sqlca * pSqlca, /* SQLCA */ + struct sqlopt * pRebindOptions); /* rebind options */ + +/****************************************************************************** +** sqlaprep API +** Processes an application program source file containing embedded SQL +** statements. A modified source file is produced containing host language calls +** for the SQL statements and, by default, a package is created in the database. +** +** Scope +** +** This API can be called from any database partition server in db2nodes.cfg. It +** updates the database catalogs on the catalog partition. Its effects +** are visible to all database partition servers. +** +** Authorization +** +** One of the following: +** - sysadm or dbadm authority +** - BINDADD privilege if a package does not exist and one of: +** -- IMPLICIT_SCHEMA authority on the database if the schema name +** of the package does not exist +** -- CREATEIN privilege on the schema if the schema name of the +** package exists +** - ALTERIN privilege on the schema if the package exists +** - BIND privilege on the package if it exists. +** +** The user also needs all privileges required to compile any static SQL +** statements in the application. Privileges granted to groups are not +** used for authorization checking of static statements. If the user +** has sysadm authority, but not explicit privileges to complete the +** bind, the database manager grants explicit dbadm authority +** automatically. +** +** Required connection +** +** Database +** +** API include file +** +** sql.h +** +** sqlaprep API parameters +** +** pProgramName +** Input. A string containing the name of the application to be precompiled. Use +** the following extensions: +** - .sqb - for COBOL applications +** - .sqc - for C applications +** - .sqC - for UNIX C++ applications +** - .sqf - for FORTRAN applications +** - .sqx - for C++ applications +** +** When the TARGET option is used, the input file name extension does not have +** to be from this predefined list. +** +** The preferred extension for C++ applications containing embedded SQL on UNIX +** based systems is sqC; however, the sqx convention, which was invented for +** systems that are not case sensitive, is tolerated by UNIX based systems. +** +** pMsgFileName +** Input. A string containing the destination for error, warning, and +** informational messages. Can be the path and the name of an operating +** system file, or a standard device. If a file already exists, it is +** overwritten. If it does not exist, a file is created. +** +** pPrepOptions +** Input. A structure used to pass precompile options to the API. For more +** information about this structure, see SQLOPT. +** +** pSqlca +** Output. A pointer to the sqlca structure. +** +** Usage notes +** +** A modified source file is produced, which contains host language +** equivalents to the SQL statements. By default, a package is created +** in the database to which a connection has been established. The name +** of the package is the same as the program file name (minus the +** extension and folded to uppercase), up to a maximum of 8 characters. +** +** Following connection to a database, sqlaprep executes under the +** transaction that was started. PRECOMPILE PROGRAM then issues a COMMIT +** or a ROLLBACK operation to terminate the current transaction and start +** another one. +** +** Precompiling stops if a fatal error or more than 100 errors occur. If a fatal +** error does occur, PRECOMPILE PROGRAM stops precompiling, attempts to +** close all files, and discards the package. +** +** The Precompile option types and values are defined in sql.h. +** +** REXX API syntax +** +** This API can be called from REXX through the SQLDB2 interface. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Precompile Program */ + sqlaprep ( + _SQLOLDCHAR * pProgramName, /* source file name */ + _SQLOLDCHAR * pMsgFileName, /* message file name */ + struct sqlopt * pPrepOptions, /* precompile options */ + struct sqlca * pSqlca); /* SQLCA */ + +/* Generic Interfaces to the Binder and Precompiler */ + +/****************************************************************************** +** sqlgbndx API +** sqlgbndx API-specific parameters +** +** pMsgFileName +** Input. A string containing the destination for error, warning, and +** informational messages. Can be the path and the name of an operating +** system file, or a standard device. If a file already exists, it is +** overwritten. If it does not exist, a file is created. +** +** BindFileNameLen +** Input. Length in bytes of the pBindFileName parameter. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Bind */ + sqlgbndx ( + unsigned short MsgFileNameLen, /* message file name length */ + unsigned short BindFileNameLen, /* bind file name length */ + struct sqlca * pSqlca, /* SQLCA */ + struct sqlopt * pBindOptions, /* binder options */ + _SQLOLDCHAR * pMsgFileName, /* message file */ + _SQLOLDCHAR * pBindFileName); /* bind file name */ + +/****************************************************************************** +** sqlgrbnd API +** sqlgrbnd API-specific parameters +** +** PackageNameLen +** Input. Length in bytes of the pPackageName parameter. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Rebind */ + sqlgrbnd ( + unsigned short PackageNameLen, /* package name length */ + char * pPackageName, /* package name */ + struct sqlca * pSqlca, /* SQLCA */ + struct sqlopt * pRebindOptions); /* rebind options */ + +/****************************************************************************** +** sqlgprep API +** sqlgprep API-specific parameters +** +** MsgFileNameLen +** Input. Length in bytes of the pMsgFileName parameter. +** +** ProgramNameLen +** Input. Length in bytes of the pProgramName parameter. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Precompile Program */ + sqlgprep ( + unsigned short MsgFileNameLen, /* message file name length */ + unsigned short ProgramNameLen, /* source file name length */ + struct sqlca * pSqlca, /* SQLCA */ + struct sqlopt * pPrepOptions, /* precompile options */ + _SQLOLDCHAR * pMsgFileName, /* message file name */ + _SQLOLDCHAR * pProgramName); /* source file name */ + +/* Application Context apis */ + + +#define SQL_CTX_ORIGINAL 0 /* serial access */ +#define SQL_CTX_MULTI_MANUAL 1 /* concurrent access */ +#define SQL_CTX_TRUSTED_ROUTINE 2 /* trusted routine (internal) */ +/****************************************************************************** +** sqleSetTypeCtx API +** Sets the application context type. This API should be the first database API +** called inside an application. +** +** Scope +** +** The scope of this API is limited to the immediate process. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqleSetTypeCtx API parameters +** +** lOptions +** Input. Valid values are: +** +** - SQL_CTX_ORIGINAL +** All threads will use the same context, and concurrent access will be blocked. +** This is the default if none of these APIs is called. +** +** - SQL_CTX_MULTI_MANUAL +** All threads will use separate contexts, and it is up to the application to +** manage the context for each thread. See +** - sqleBeginCtx API +** - sqleAttachToCtx API +** - sqleDetachFromCtx API +** - sqleEndCtx API +** +** The following restrictions/changes apply when this option is used: +** - When termination is normal, automatic COMMIT at process termination is +** disabled. All outstanding transactions are rolled back, and all COMMITs must +** be done explicitly. +** - sqleintr API interrupts all contexts. To interrupt a specific context, use +** sqleInterruptCtx. +** +** Usage notes +** +** This API must be called before any other database call, and only the +** first call is effective. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Set Application Context */ + sqleSetTypeCtx ( + sqlint32 lOptions); /* options */ + + +#define SQL_CTX_BEGIN_ALL 0 /* create & attach */ +#define SQL_CTX_CREATE_ONLY 1 /* create only */ +/****************************************************************************** +** sqleBeginCtx API +** Creates an application context, or creates and then attaches to an +** application context. More than one application context can be +** created. Each context has its own commit scope. Different threads +** can attach to different contexts (see the sqleAttachToCtx API). +** Any database API calls made by such threads will not be serialized +** with one another. +** +** Scope +** +** The scope of this API is limited to the immediate process. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqleBeginCtx API parameters +** +** ppCtx +** Output. A data area allocated out of private memory for the storage +** of context information. +** +** lOptions +** Input. Valid values are: +** - SQL_CTX_CREATE_ONLY +** The context memory will be allocated, but there will be no attachment. +** - SQL_CTX_BEGIN_ALL +** The context memory will be allocated, and then a call to sqleAttachToCtx will +** be made for the current thread. If this option is used, the ppCtx +** parameter can be NULL. If the thread is already attached to a context, +** the call will fail. +** +** reserved +** Reserved for future use. Must be set to NULL. +** +** pSqlca +** Output. A pointer to the sqlca structure. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Create Application Context */ + sqleBeginCtx ( + void ** ppCtx, /* pointer to a pointer to ctx */ + sqlint32 lOptions, /* lOptions */ + void * reserved, /* reserved */ + struct sqlca * pSqlca); /* SQLCA */ + + +#define SQL_CTX_END_ALL 0 /* detach & free */ +#define SQL_CTX_FREE_ONLY 1 /* free only */ +/****************************************************************************** +** sqleEndCtx API +** Frees all memory associated with a given context. +** +** Scope +** +** The scope of this API is limited to the immediate process. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqleEndCtx API parameters +** +** ppCtx +** Output. A data area in private memory (used for the storage of context +** information) that is freed. +** +** lOptions +** Input. Valid values are: +** - SQL_CTX_FREE_ONLY +** The context memory will be freed only if a prior detach has been done. +** Note: +** pCtx must be a valid context previously allocated by sqleBeginCtx. +** - SQL_CTX_END_ALL +** If necessary, a call to sqleDetachFromCtx will be made before the memory is +** freed. +** Note: +** A detach will be done even if the context is still in use. If this option is +** used, the ppCtx parameter can be NULL, but if passed, it must be a valid +** context previously allocated by sqleBeginCtx. A call to +** sqleGetCurrentCtx will be made, and the current context freed from there. +** +** reserved +** Reserved for future use. Must be set to NULL. +** +** pSqlca +** Output. A pointer to the sqlca structure. +** +** Usage notes +** +** If a database connection exists, or the context has been attached by another +** thread, this call will fail. +** Note: +** If a context calls an API that establishes an instance attachment +** (for example, db2CfgGet, it is necessary to detach from the instance +** using sqledtin before calling sqleEndCtx. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Destroy Application Context */ + sqleEndCtx ( + void ** ppCtx, /* pointer to a pointer to ctx */ + sqlint32 lOptions, /* lOptions */ + void * reserved, /* reserved */ + struct sqlca * pSqlca); /* SQLCA */ + + +/****************************************************************************** +** sqleAttachToCtx API +** Makes the current thread use a specified context. All subsequent +** database calls made on this thread will use this context. If more +** than one thread is attached to a given context, access is serialized +** for these threads, and they share a commit scope. +** +** Scope +** +** The scope of this API is limited to the immediate process. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqleAttachToCtx API parameters +** +** pCtx +** Input. A valid context previously allocated by sqleBeginCtx. +** +** reserved +** Reserved for future use. Must be set to NULL. +** +** pSqlca +** Output. A pointer to the sqlca structure. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Attach to Application Context */ + sqleAttachToCtx ( + void * pCtx, /* pointer to ctx */ + void * reserved, /* reserved */ + struct sqlca * pSqlca); /* SQLCA */ + + +/****************************************************************************** +** sqleDetachFromCtx API +** Detaches the context being used by the current thread. The context will be +** detached only if an attach to that context has previously been made. +** +** Scope +** +** The scope of this API is limited to the immediate process. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqleDetachFromCtx API parameters +** +** pCtx +** Input. A valid context previously allocated by sqleBeginCtx. +** +** reserved +** Reserved for future use. Must be set to NULL. +** +** pSqlca +** Output. A pointer to the sqlca structure. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Detach Application Context */ + sqleDetachFromCtx ( + void * pCtx, /* pointer to ctx */ + void * reserved, /* reserved */ + struct sqlca * pSqlca); /* SQLCA */ + + +/****************************************************************************** +** sqleGetCurrentCtx API +** Returns the current context associated with a thread. +** +** Scope +** +** The scope of this API is limited to the immediate process. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqleGetCurrentCtx API parameters +** +** ppCtx +** Output. A data area allocated out of private memory for the storage +** of context information. +** +** reserved +** Reserved for future use. Must be set to NULL. +** +** pSqlca +** Output. A pointer to the sqlca structure. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Return Application Context */ + sqleGetCurrentCtx ( + void ** ppCtx, /* pointer to a pointer to ctx */ + void * reserved, /* reserved */ + struct sqlca * pSqlca); /* SQLCA */ + + +/****************************************************************************** +** sqleInterruptCtx API +** Interrupts the specified context. +** +** Scope +** +** The scope of this API is limited to the immediate process. +** +** Authorization +** +** None +** +** Required connection +** +** Database +** +** API include file +** +** sql.h +** +** sqleInterruptCtx API parameters +** +** pCtx +** Input. A valid context previously allocated by sqleBeginCtx. +** +** reserved +** Reserved for future use. Must be set to NULL. +** +** pSqlca +** Output. A pointer to the sqlca structure. +** +** Usage notes +** +** During processing, this API: +** - Switches to the context that has been passed in +** - Sends an interrupt +** - Switches to the original context +** - Exits. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Interrupt Context */ + sqleInterruptCtx ( + void * pCtx, /* pointer to ctx */ + void * reserved, /* reserved */ + struct sqlca * pSqlca); /* SQLCA */ + + +/****************************************************************************** +** Error/SQLSTATE Message Retrieval Interface Parameters/Return Codes +*******************************************************************************/ + +/* Get Error Message Macro */ +#define sqlaintp(msgbuf,bufsize,linesize,sqlcaptr) \ +sqlaintp_api(msgbuf,bufsize,linesize, \ +(char *)"db2sql.mo", sqlcaptr) +/****************************************************************************** +** sqlaintp API +** Retrieves the message associated with an error condition specified by the +** sqlcode field of the sqlca structure. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqlaintp API parameters +** +** pBuffer +** Output. A pointer to a string buffer where the message text is placed. If the +** message must be truncated to fit in the buffer, the truncation allows for the +** null string terminator character. +** +** BufferSize +** Input. Size, in bytes, of a string buffer to hold the retrieved message text. +** +** LineWidth +** Input. The maximum line width for each line of message text. Lines are broken +** on word boundaries. A value of zero indicates that the message text +** is returned without line breaks. +** +** pSqlca +** Output. A pointer to the sqlca structure. +** +** Usage notes +** +** One message is returned per call. +** +** A new line (line feed, LF, or carriage return/line feed, CR/LF) sequence is +** placed at the end of each message. +** +** If a positive line width is specified, new line sequences are inserted +** between words so that the lines do not exceed the line width. +** +** If a word is longer than a line width, the line is filled with as many +** characters as will fit, a new line is inserted, and the remaining characters +** are placed on the next line. +** +** In a multi-threaded application, sqlaintp must be attached to a +** valid context; otherwise, the message text for SQLCODE - 1445 cannot +** be obtained +** +** Return codes +** +** Code +** +** Message +** +** +i +** Positive integer indicating the number of bytes in the formatted message. If +** this is greater than the buffer size input by the caller, the message is +** truncated. +** +** -1 +** Insufficient memory available for message formatting services to +** function. The requested message is not returned. +** +** -2 +** No error. The sqlca did not contain an error code (SQLCODE = 0). +** +** -3 +** Message file inaccessible or incorrect. +** +** -4 +** Line width is less than zero. +** +** -5 +** Invalid sqlca, bad buffer address, or bad buffer length. +** +** If the return code is -1 or -3, the message buffer will contain additional +** information about the problem. +** +** REXX API syntax +** +** GET MESSAGE INTO :msg [LINEWIDTH width] +** +** REXX API parameters +** +** msg +** REXX variable into which the text message is placed. +** +** width +** Maximum line width for each line in the text message. The line is broken on +** word boundaries. If width is not given or set to 0, the message text returns +** without line breaks. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Get Error Message */ + sqlaintp_api ( + char * pBuffer, /* buffer for message text */ + short BufferSize, /* buffer size */ + short LineWidth, /* line width */ + const char * pMsgFileName, /* message file */ + struct sqlca * pSqlca); /* SQLCA */ + +/* Generic Interface to Error Message Retrieval */ +/****************************************************************************** +** sqlgintp API +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Get Error Message */ + sqlgintp ( + short BufferSize, /* buffer size */ + short LineWidth, /* line width */ + struct sqlca * pSqlca, /* SQLCA */ + _SQLOLDCHAR * pBuffer); /* buffer */ + +/****************************************************************************** +** sqlogstt API +** Retrieves the message text associated with an SQLSTATE value. +** +** Authorization +** +** None +** +** Required connection +** +** None +** +** API include file +** +** sql.h +** +** sqlogstt API parameters +** +** pBuffer +** Output. A pointer to a string buffer where the message text is to be +** placed. If the message must be truncated to fit in the buffer, the +** truncation allows for the null string terminator character. +** +** BufferSize +** Input. Size, in bytes, of a string buffer to hold the retrieved message text. +** +** LineWidth +** Input. The maximum line width for each line of message text. Lines are broken +** on word boundaries. A value of zero indicates that the message text is +** returned without line breaks. +** +** pSqlstate +** Input. A string containing the SQLSTATE for which the message text is to be +** retrieved. This field is alphanumeric and must be either five-digit (specific +** SQLSTATE) or two-digit (SQLSTATE class, first two digits of an +** SQLSTATE). This field does not need to be NULL-terminated if 5 digits +** are being passed in, but must be NULL-terminated if 2 digits are being +** passed. +** +** Usage notes +** +** One message is returned per call. +** +** A LF/NULL sequence is placed at the end of each message. +** +** If a positive line width is specified, LF/NULL sequences are inserted between +** words so that the lines do not exceed the line width. +** +** If a word is longer than a line width, the line is filled with as many +** characters as will fit, a LF/NULL is inserted, and the remaining +** characters are placed on the next line. +** +** Return codes +** +** Code +** +** Message +** +** +i +** Positive integer indicating the number of bytes in the formatted message. If +** this is greater than the buffer size input by the caller, the message is +** truncated. +** +** -1 +** Insufficient memory available for message formatting services to +** function. The requested message is not returned. +** +** -2 +** The SQLSTATE is in the wrong format. It must be alphanumeric and be +** either 2 or 5 digits in length. +** +** -3 +** Message file inaccessible or incorrect. +** +** -4 +** Line width is less than zero. +** +** -5 +** Invalid sqlca, bad buffer address, or bad buffer length. +** +** If the return code is -1 or -3, the message buffer will contain further +** information about the problem. +** +** REXX API syntax +** +** GET MESSAGE FOR SQLSTATE sqlstate INTO :msg [LINEWIDTH width] +** +** REXX API parameters +** +** sqlstate +** The SQLSTATE for which the message text is to be retrieved. +** +** msg +** REXX variable into which the message is placed. +** +** width +** Maximum line width for each line of the message text. The line is broken on +** word boundaries. If a value is not specified, or this parameter is set to 0, +** the message text returns without line breaks. +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Sqlstate Message Retrieval */ + sqlogstt ( + char * pBuffer, /* buffer for message text */ + short BufferSize, /* buffer size */ + short LineWidth, /* line width */ + char * pSqlstate); /* sqlstate */ + +/* Generic Interface to SQLSTATE Message Retrieval */ +/****************************************************************************** +** sqlggstt API +*******************************************************************************/ +SQL_API_RC SQL_API_FN /* Sqlstate Message Retrieval */ + sqlggstt ( + short BufferSize, /* buffer size */ + short LineWidth, /* line width */ + char * pSqlstate, /* sqlstate */ + char * pBuffer); /* buffer */ + +/* Return Codes for sqlaintp/sqlogstt */ +#define SQLA_ERR_BADCC -1 /* insufficient memory for msg file */ +#define SQLA_ERR_NOCOD -2 /* no error code in SQLCA */ +#define SQLA_ERR_NOMSG -3 /* message file inaccessible or */ + /* incorrect */ +#define SQLA_ERR_BADLL -4 /* specified line length negative */ +#define SQLA_ERR_BADCA -5 /* invalid sqlca/buffer addr/length */ + +/* Administrative/Database Authorizations returned from Get Administrative */ +/* Authorizations function */ +/* Authorizations granted explicitly to user */ +#define SQL_SYSADM 0x1 /* SYSADM Authority */ +#define SQL_DBADM 0x2 /* DBADM Authority */ +#define SQL_CREATETAB 0x4 /* CREATETAB Privilege */ +#define SQL_BINDADD 0x8 /* BINDADD Privilege */ +#define SQL_CONNECT 0x10 /* CONNECT Privilege */ +#define SQL_CREATE_NOT_FENC 0x20 /* CREATE_NOT_FENCED Privilege */ +#define SQL_SYSCTRL 0x40 /* SYSCTRL Authority */ +#define SQL_SYSMAINT 0x80 /* SYSMAINT Authority */ +#define SQL_IMPLICIT_SCHEMA 0x10000 /* IMPLICIT_SCHEMA Privilege */ +#define SQL_LOAD 0x20000 /* LOAD Privilege */ +#define SQL_CREATE_EXT_RT 0x40000 /* CREATE_EXTERNAL_ROUTINE Privilege */ +#define SQL_LIBADM 0x80000 /* LIBRARYADM Privilege */ +#define SQL_QUIESCE_CONN 0x100000 /* QUIESCE_CONNECT Privilege */ +#define SQL_SECADM 0x200000 /* SECURITYADM Privilege */ +#define SQL_SYSQUIESCE 0x400000 /* SYSQUIESCE Authority */ +#define SQL_SYSMON 0x800000 /* SYSMON Authority */ + +/* Composite of authorizations granted explicitly to user, to groups of */ +/* which user is a member, and to PUBLIC */ +#define SQL_SYSADM_GRP 0x100 +#define SQL_DBADM_GRP 0x200 +#define SQL_CREATETAB_GRP 0x400 +#define SQL_BINDADD_GRP 0x800 +#define SQL_CONNECT_GRP 0x1000 +#define SQL_CREATE_NOT_FENC_GRP 0x2000 +#define SQL_SYSCTRL_GRP 0x4000 +#define SQL_SYSMAINT_GRP 0x8000 +#define SQL_IMPLICIT_SCHEMA_GRP 0x1000000 +#define SQL_LOAD_GRP 0x2000000 +#define SQL_CREATE_EXT_RT_GRP 0x4000000 +#define SQL_LIBADM_GRP 0x8000000 +#define SQL_QUIESCE_CONN_GRP 0x10000000 +#define SQL_SECADM_GRP 0x20000000 +#define SQL_SYSQUIESCE_GRP 0x40000000 +#define SQL_SYSMON_GRP 0x80000000 + +/* Table/View Authorizations/Dependencies Bit definitions in */ +/* SYSTABAUTH.TABAUTH and SYSPLANDEP.TABAUTH */ +#define SQL_TAB_CTL 0x1 /* Control Authority */ +#define SQL_TAB_ALT 0x2 /* Alter Privilege */ +#define SQL_TAB_DEL 0x4 /* Delete Privilege/Dependency */ +#define SQL_TAB_IDX 0x8 /* Index Privilege */ +#define SQL_TAB_INS 0x10 /* Insert Privilege/Dependency */ +#define SQL_TAB_SEL 0x20 /* Select Privilege/Dependency */ +#define SQL_TAB_UPD 0x40 /* Update Privilege/Dependency */ +#define SQL_TAB_REF 0x80 /* Reference Privilege */ +#define SQL_TAB_KEY 0x2000 /* Key Dependency */ +#define SQL_TAB_CAS 0x4000 /* Cascade Dependency */ + +/* Bit definitions for SYSTABAUTH.TABAUTH indicating the specified table or */ +/* view privilege is grantable. */ +#define SQL_TAB_ALT_G 0x200 /* Alter Privilege Grantable */ +#define SQL_TAB_DEL_G 0x400 /* Delete Privilege Grantable */ +#define SQL_TAB_IDX_G 0x800 /* Index Privilege Grantable */ +#define SQL_TAB_INS_G 0x1000 /* Insert Privilege Grantable */ +#define SQL_TAB_SEL_G 0x2000 /* Select Privilege Grantable */ +#define SQL_TAB_UPD_G 0x4000 /* Update Privilege Grantable */ +#define SQL_TAB_REF_G 0x8000 /* References Privilege Grantable */ + +/* Definitions for application remote interface */ +#define SQLZ_DISCONNECT_PROC 1 /* Unload Progam */ +#define SQLZ_HOLD_PROC 2 /* Keep program loaded */ +/* The following functions and symbols are obsolete and may not be supported */ +/* in future releases. The obsolete functions are provided for backward */ +/* compatibility and exported from DB2API.LIB. All applications should be */ +/* migrated to use new APIs. */ +#define SQLA_RC_BAD_PASSWD -4 /* Invalid password */ +#define SQL_MAXSTMTS 32767 /* Maximum statements (see SQL */ + /* reference) */ +#define SQL_MAXVARS 32767 /* Maximum host variables per */ + /* precompile unit (see SQL */ + /* reference) */ +#define SQL_DYNAMICRULES_INVOKE SQL_DYNAMICRULES_INVOKERUN /* Dynamic SQL in */ + /* UDF or stored procedure will use */ + /* authid of invoker of UDF or stored */ + /* procedure */ +#define SQL_DYNAMICRULES_DEFINE SQL_DYNAMICRULES_DEFINERUN /* Dynamic SQL in */ + /* UDF or stored procedure will use */ + /* authid of definer of UDF or stored */ + /* procedure */ +#pragma pack() + +#ifdef __cplusplus +} +#endif + +#endif /* SQL_H_SQL */ diff --git a/libraries/SQLAPI/include/db2_win/sqlca.h b/libraries/SQLAPI/include/db2_win/sqlca.h new file mode 100644 index 000000000..a016ea0bf --- /dev/null +++ b/libraries/SQLAPI/include/db2_win/sqlca.h @@ -0,0 +1,119 @@ +/****************************************************************************** + * + * Source File Name = SQLCA.H + * + * (C) COPYRIGHT International Business Machines Corp. 1987, 1997 + * All Rights Reserved + * Licensed Materials - Property of IBM + * + * US Government Users Restricted Rights - Use, duplication or + * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. + * + * Function = Include File defining: + * SQL Communications Area + * + * Operating System = Common C Include File + * + *****************************************************************************/ + + +#if !(defined(SQLCODE) || defined(SQLCADE)) /* Permit Duplicate Includes */ + +#include "sqlsystm.h" /* System dependent defines */ + +#if defined(DB2NT) +#if defined _WIN64 +#pragma pack(8) +#else +#pragma pack(4) +#endif +#elif (defined(DB2AIX) && defined(__64BIT__)) +#pragma options align=natural +#elif (defined(DB2AIX)) +#pragma options align=power +#endif + +/* SQL Communication Area - SQLCA */ +/* _SQLOLDCHAR defaults to 'char'. See sqlsystm.h for details. */ + +SQL_STRUCTURE sqlca +{ + _SQLOLDCHAR sqlcaid[8]; /* Eyecatcher = 'SQLCA ' */ + sqlint32 sqlcabc; /* SQLCA size in bytes = 136 */ +#ifdef DB2_SQL92E + sqlint32 sqlcade; /* SQL return code */ +#else + sqlint32 sqlcode; /* SQL return code */ +#endif + short sqlerrml; /* Length for SQLERRMC */ + _SQLOLDCHAR sqlerrmc[70]; /* Error message tokens */ + + _SQLOLDCHAR sqlerrp[8]; /* Diagnostic information */ + + sqlint32 sqlerrd[6]; /* Diagnostic information */ + _SQLOLDCHAR sqlwarn[11]; /* Warning flags */ + +#ifdef DB2_SQL92E + _SQLOLDCHAR sqlstat[5]; /* State corresponding to SQLCODE */ +#else + _SQLOLDCHAR sqlstate[5]; /* State corresponding to SQLCODE */ +#endif + +}; + +#ifdef DB2_SQL92E +#define SQLCADE sqlca.sqlcade +#else +#define SQLCODE sqlca.sqlcode +#endif +#define SQLWARN0 sqlca.sqlwarn[0] +#define SQLWARN1 sqlca.sqlwarn[1] +#define SQLWARN2 sqlca.sqlwarn[2] +#define SQLWARN3 sqlca.sqlwarn[3] +#define SQLWARN4 sqlca.sqlwarn[4] +#define SQLWARN5 sqlca.sqlwarn[5] +#define SQLWARN6 sqlca.sqlwarn[6] +#define SQLWARN7 sqlca.sqlwarn[7] +#define SQLWARN8 sqlca.sqlwarn[8] +#define SQLWARN9 sqlca.sqlwarn[9] +#define SQLWARNA sqlca.sqlwarn[10] + + +/* sqlerrd tokens updated when compound SQL statements processed */ + +#define SQL_CMP_NA_ERRORS 1 +#define SQL_CMP_ROWS_AFFECTED 2 +#define SQL_CMP_STMTS_COMPLETED 3 +#define SQL_CMP_REF_INT_ROWS 4 + + +/* sqlerrd tokens updated when CONNECT statements processed */ + +#define SQL_CONNECT_DB_APP2DB_CONVFACTOR 0 +#define SQL_CONNECT_DB_DB2APP_CONVFACTOR 1 +#define SQL_CONNECT_DB_UPDATEABILITY_IN_UOW 2 +#define SQL_CONNECT_DB_COMMIT_TYPE 3 + + +/* Values returned for sqlerrd[SQL_CONNECT_DB_UPDATEABILITY_IN_UOW] */ + +#define SQL_DB_UPDATEABLE 1 +#define SQL_DB_READ_ONLY 2 + + +/* Values returned for sqlerrd[SQL_CONNECT_DB_COMMIT_TYPE] */ + +#define SQL_DB_ONE_PHASE_COMMIT 1 +#define SQL_DB_ONE_PHASE_READ_ONLY 2 +#define SQL_DB_TWO_PHASE_COMMIT 3 + +/* sqlerrd tokens updated when MPP statements processed */ +#define SQL_ERRD_NODE_NUM 1 + +#if defined(DB2NT) +#pragma pack() +#elif defined(DB2AIX) +#pragma options align=reset +#endif + +#endif /* SQLCODE */ diff --git a/libraries/SQLAPI/include/db2_win/sqlcli.h b/libraries/SQLAPI/include/db2_win/sqlcli.h new file mode 100644 index 000000000..633545625 --- /dev/null +++ b/libraries/SQLAPI/include/db2_win/sqlcli.h @@ -0,0 +1,807 @@ +/****************************************************************************** + * + * Source File Name = sqlcli.h + * + * (C) COPYRIGHT International Business Machines Corp. 1993, 1999 + * All Rights Reserved + * Licensed Materials - Property of IBM + * + * US Government Users Restricted Rights - Use, duplication or + * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. + * + * Function = Include File defining: + * DB2 CLI Interface - Constants + * DB2 CLI Interface - Data Structures + * DB2 CLI Interface - Function Prototypes + * + * Operating System = Common C Include File + * + *****************************************************************************/ + +#ifndef SQL_H_SQLCLI +#define SQL_H_SQLCLI /* Permit duplicate Includes */ + +/* Prevent inclusion of winsock.h in windows.h */ +#ifndef _WINSOCKAPI_ +#define _WINSOCKAPI_ +#define DB2_WINSOCKAPI_ +#endif + +/* DB2CLI_VER DB2 Call Level Interface Version Number (0x0210). + * To revert to Version 1.0 definitions, + * issue #define DB2CLI_VER 0x0110 before including + * sqlcli.h and sqlcli1.h + */ + +/* If DB2CLI_VER is not defined, assume version 2.10 */ +#ifndef DB2CLI_VER +#define DB2CLI_VER 0x0310 +#endif + +/* ODBC64 should be used instead of CLI_WIN64 for linking with libdb2o.dll */ +#ifndef ODBC64 +#ifdef CLI_WIN64 +#define ODBC64 +#endif +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sqlsystm.h" /* System dependent defines */ + +#if defined(DB2NT) +#include +#else +#define FAR +#endif + +#define SQL_API SQL_API_FN + + +/* generally useful constants */ +#define SQL_MAX_MESSAGE_LENGTH 1024 /* message buffer size */ +#define SQL_MAX_ID_LENGTH 128 /* maximum identifier name size, + e.g. cursor names */ + +/* date/time length constants */ +#define SQL_DATE_LEN 10 +#define SQL_TIME_LEN 8 /* add P+1 if precision is nonzero */ +#define SQL_TIMESTAMP_LEN 19 /* add P+1 if precision is nonzero */ + +/* handle type identifiers */ +#define SQL_HANDLE_ENV 1 +#define SQL_HANDLE_DBC 2 +#define SQL_HANDLE_STMT 3 +#define SQL_HANDLE_DESC 4 + +/* RETCODE values */ +#define SQL_SUCCESS 0 +#define SQL_SUCCESS_WITH_INFO 1 +#define SQL_NEED_DATA 99 +#define SQL_NO_DATA 100 +#define SQL_STILL_EXECUTING 2 +#define SQL_ERROR -1 +#define SQL_INVALID_HANDLE -2 + +/* test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO */ +#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) + +/* SQLFreeStmt option values */ +#define SQL_CLOSE 0 +#define SQL_DROP 1 +#define SQL_UNBIND 2 +#define SQL_RESET_PARAMS 3 + +/* SQLTransact option values */ +#define SQL_COMMIT 0 +#define SQL_ROLLBACK 1 + +/* Standard SQL data types */ +#define SQL_UNKNOWN_TYPE 0 +#define SQL_CHAR 1 +#define SQL_NUMERIC 2 +#define SQL_DECIMAL 3 +#define SQL_INTEGER 4 +#define SQL_SMALLINT 5 +#define SQL_FLOAT 6 +#define SQL_REAL 7 +#define SQL_DOUBLE 8 +#define SQL_DATETIME 9 +#define SQL_VARCHAR 12 +#define SQL_WCHAR (-8) +#define SQL_WVARCHAR (-9) +#define SQL_WLONGVARCHAR (-10) +#define SQL_DECFLOAT (-360) +/* One-parameter shortcuts for date/time data types */ +#define SQL_TYPE_DATE 91 +#define SQL_TYPE_TIME 92 +#define SQL_TYPE_TIMESTAMP 93 + +/* Statement attribute values for cursor sensitivity */ +#define SQL_UNSPECIFIED 0 +#define SQL_INSENSITIVE 1 +#define SQL_SENSITIVE 2 + +/* Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */ +#define SQL_DEFAULT 99 + +/* SQLGetData() code indicating that the application row descriptor + * specifies the data type + */ +#define SQL_ARD_TYPE (-99) + +/* SQL date/time type subcodes */ +#define SQL_CODE_DATE 1 +#define SQL_CODE_TIME 2 +#define SQL_CODE_TIMESTAMP 3 + +/* SQL extended data types */ +#define SQL_GRAPHIC -95 +#define SQL_VARGRAPHIC -96 +#define SQL_LONGVARGRAPHIC -97 +#define SQL_BLOB -98 +#define SQL_CLOB -99 +#define SQL_DBCLOB -350 +#define SQL_XML -370 +#define SQL_DATALINK -400 +#define SQL_USER_DEFINED_TYPE -450 + +/* C data type to SQL data type mapping */ +#define SQL_C_DBCHAR SQL_DBCLOB +#define SQL_C_DECIMAL_IBM SQL_DECIMAL +#define SQL_C_DATALINK SQL_C_CHAR +#define SQL_C_PTR 2463 +#define SQL_C_DECIMAL_OLEDB 2514 +#define SQL_C_DECIMAL64 SQL_DECFLOAT +#define SQL_C_DECIMAL128 -361 + +/* + * locator type identifier + */ + +#define SQL_BLOB_LOCATOR 31 +#define SQL_CLOB_LOCATOR 41 +#define SQL_DBCLOB_LOCATOR -351 + +/* + * C Data Type for the LOB locator types + */ +#define SQL_C_BLOB_LOCATOR SQL_BLOB_LOCATOR +#define SQL_C_CLOB_LOCATOR SQL_CLOB_LOCATOR +#define SQL_C_DBCLOB_LOCATOR SQL_DBCLOB_LOCATOR + +/* + * NULL status defines; these are used in SQLColAttributes, SQLDescribeCol, + * to describe the nullability of a column in a table. + */ + +#define SQL_NO_NULLS 0 +#define SQL_NULLABLE 1 +#define SQL_NULLABLE_UNKNOWN 2 + +/* values of UNNAMED field in descriptor used in SQLColAttribute */ +#define SQL_NAMED 0 +#define SQL_UNNAMED 1 + +/* values of ALLOC_TYPE field in descriptor */ +#define SQL_DESC_ALLOC_AUTO 1 +#define SQL_DESC_ALLOC_USER 2 + +/* values of USER_DEFINED_TYPE_CODE */ +#define SQL_TYPE_BASE 0 +#define SQL_TYPE_DISTINCT 1 +#define SQL_TYPE_STRUCTURED 2 +#define SQL_TYPE_REFERENCE 3 + +/* Special length values */ +#define SQL_NULL_DATA -1 +#define SQL_DATA_AT_EXEC -2 +#define SQL_NTS -3 /* NTS = Null Terminated String */ +#define SQL_NTSL -3L /* NTS = Null Terminated String */ + +/* SQLColAttributes defines */ +#define SQL_COLUMN_SCHEMA_NAME 16 +#define SQL_COLUMN_CATALOG_NAME 17 +#define SQL_COLUMN_DISTINCT_TYPE 1250 +#define SQL_DESC_DISTINCT_TYPE SQL_COLUMN_DISTINCT_TYPE +#define SQL_COLUMN_REFERENCE_TYPE 1251 +#define SQL_DESC_REFERENCE_TYPE SQL_COLUMN_REFERENCE_TYPE +#define SQL_DESC_STRUCTURED_TYPE 1252 +#define SQL_DESC_USER_TYPE 1253 +#define SQL_DESC_BASE_TYPE 1254 +#define SQL_DESC_KEY_TYPE 1255 +#define SQL_DESC_KEY_MEMBER 1266 + +/* identifiers of fields in the SQL descriptor */ +#define SQL_DESC_COUNT 1001 +#define SQL_DESC_TYPE 1002 +#define SQL_DESC_LENGTH 1003 +#define SQL_DESC_OCTET_LENGTH_PTR 1004 +#define SQL_DESC_PRECISION 1005 +#define SQL_DESC_SCALE 1006 +#define SQL_DESC_DATETIME_INTERVAL_CODE 1007 +#define SQL_DESC_NULLABLE 1008 +#define SQL_DESC_INDICATOR_PTR 1009 +#define SQL_DESC_DATA_PTR 1010 +#define SQL_DESC_NAME 1011 +#define SQL_DESC_UNNAMED 1012 +#define SQL_DESC_OCTET_LENGTH 1013 +#define SQL_DESC_ALLOC_TYPE 1099 +#define SQL_DESC_USER_DEFINED_TYPE_CODE 1098 + + +/* Defines for SQL_DESC_KEY_TYPE */ +#define SQL_KEYTYPE_NONE 0 +#define SQL_KEYTYPE_PRIMARYKEY 1 +#define SQL_KEYTYPE_UNIQUEINDEX 2 + + +/* SQLColAttribute defines for SQL_COLUMN_UPDATABLE condition */ +#define SQL_UPDT_READONLY 0 +#define SQL_UPDT_WRITE 1 +#define SQL_UPDT_READWRITE_UNKNOWN 2 + +/* + * SQLColAttribute defines for SQL_COLUMN_SEARCHABLE condition. + */ +#define SQL_PRED_NONE 0 +#define SQL_PRED_CHAR 1 +#define SQL_PRED_BASIC 2 + +/* NULL handle defines */ +#define SQL_NULL_HENV 0L +#define SQL_NULL_HDBC 0L +#define SQL_NULL_HSTMT 0L +#define SQL_NULL_HDESC 0L +#define SQL_NULL_HANDLE 0L + +/* identifiers of fields in the diagnostics area */ +#define SQL_DIAG_RETURNCODE 1 +#define SQL_DIAG_NUMBER 2 +#define SQL_DIAG_ROW_COUNT 3 +#define SQL_DIAG_SQLSTATE 4 +#define SQL_DIAG_NATIVE 5 +#define SQL_DIAG_MESSAGE_TEXT 6 +#define SQL_DIAG_DYNAMIC_FUNCTION 7 +#define SQL_DIAG_CLASS_ORIGIN 8 +#define SQL_DIAG_SUBCLASS_ORIGIN 9 +#define SQL_DIAG_CONNECTION_NAME 10 +#define SQL_DIAG_SERVER_NAME 11 +#define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12 + +/* dynamic function codes */ +#define SQL_DIAG_ALTER_TABLE 4 +#define SQL_DIAG_CALL 7 +#define SQL_DIAG_CREATE_INDEX (-1) +#define SQL_DIAG_CREATE_TABLE 77 +#define SQL_DIAG_CREATE_VIEW 84 +#define SQL_DIAG_DELETE_WHERE 19 +#define SQL_DIAG_DROP_INDEX (-2) +#define SQL_DIAG_DROP_TABLE 32 +#define SQL_DIAG_DROP_VIEW 36 +#define SQL_DIAG_DYNAMIC_DELETE_CURSOR 38 +#define SQL_DIAG_DYNAMIC_UPDATE_CURSOR 81 +#define SQL_DIAG_GRANT 48 +#define SQL_DIAG_INSERT 50 +#define SQL_DIAG_MERGE 128 +#define SQL_DIAG_REVOKE 59 +#define SQL_DIAG_SELECT_CURSOR 85 +#define SQL_DIAG_UNKNOWN_STATEMENT 0 +#define SQL_DIAG_UPDATE_WHERE 82 + +/* + * IBM specific SQLGetDiagField values. + */ + +#define SQL_DIAG_DEFERRED_PREPARE_ERROR 1279 + +/* SQL_DIAG_ROW_NUMBER values */ +#define SQL_ROW_NO_ROW_NUMBER (-1) +#define SQL_ROW_NUMBER_UNKNOWN (-2) + +/* SQL_DIAG_COLUMN_NUMBER values */ +#define SQL_COLUMN_NO_COLUMN_NUMBER (-1) +#define SQL_COLUMN_NUMBER_UNKNOWN (-2) + +/* + * The following are provided to enhance portability and compatibility + * with ODBC + */ + +typedef signed char SCHAR; +typedef unsigned char UCHAR; + +typedef short int SWORD; +typedef unsigned short USHORT; + +typedef signed short SSHORT; +typedef unsigned short int UWORD; + +#if defined(DB2NT) + typedef long SDWORD; + typedef unsigned long ULONG; + typedef unsigned long UDWORD; + typedef long SLONG; +#else + typedef sqlint32 SDWORD; + typedef sqluint32 ULONG; + typedef sqluint32 UDWORD; + typedef sqlint32 SLONG; +#endif +typedef double SDOUBLE; +typedef float SFLOAT; +typedef unsigned char SQLDATE; +typedef unsigned char SQLTIME; +typedef unsigned char SQLTIMESTAMP; +typedef unsigned char SQLDECIMAL; +typedef unsigned char SQLNUMERIC; + + + +#if defined(WINDOWS) +typedef long double LDOUBLE; +#else +typedef double LDOUBLE; +#endif + +typedef void FAR * PTR; +typedef void FAR * HENV; +typedef void FAR * HDBC; +typedef void FAR * HSTMT; + +typedef signed short RETCODE; + + + +/* SQL portable types for C */ +typedef UCHAR SQLCHAR; +typedef UCHAR SQLVARCHAR; +typedef SCHAR SQLSCHAR; +typedef SDWORD SQLINTEGER; +typedef SWORD SQLSMALLINT; +typedef SDOUBLE SQLDOUBLE; +typedef SDOUBLE SQLFLOAT; +typedef SFLOAT SQLREAL; + +typedef SQLSMALLINT SQLRETURN; + +#if (DB2CLI_VER >= 0x0200) +typedef UDWORD SQLUINTEGER; +typedef UWORD SQLUSMALLINT; +#else +typedef SQLINTEGER SQLUINTEGER; +typedef SQLSMALLINT SQLUSMALLINT; +#endif + +/* 64-bit Length Defines */ +#ifdef ODBC64 +typedef sqlint64 SQLLEN; +typedef sqluint64 SQLULEN; +typedef sqluint64 SQLSETPOSIROW; +#else +#define SQLLEN SQLINTEGER +#define SQLULEN SQLUINTEGER +#define SQLSETPOSIROW SQLUSMALLINT +#endif + +typedef PTR SQLPOINTER; + +/* + * Double Byte Character Set support + */ + +/* + * Do not support SQL_WCHART_CONVERT in UNICODE + */ +#ifdef UNICODE +#undef SQL_WCHART_CONVERT +#endif + +#ifdef SQL_WCHART_CONVERT +typedef wchar_t SQLDBCHAR; +#else +typedef unsigned short SQLDBCHAR; +#endif + +#ifdef DB2WIN +typedef wchar_t SQLWCHAR; +#else +typedef unsigned short SQLWCHAR; +#endif + +#ifdef DB2WIN + +typedef SQLINTEGER SQLHANDLE; +typedef HENV SQLHENV; +typedef HDBC SQLHDBC; +typedef HSTMT SQLHSTMT; +typedef HWND SQLHWND; + +#else +#if ((defined DB2NT && defined _WIN64) || defined ODBC64) +typedef void * SQLHANDLE; +typedef SQLHANDLE SQLHENV; +typedef SQLHANDLE SQLHDBC; +typedef SQLHANDLE SQLHSTMT; +#else + +#ifndef __SQLTYPES +typedef SQLINTEGER SQLHANDLE; +typedef SQLINTEGER SQLHENV; +typedef SQLINTEGER SQLHDBC; +typedef SQLINTEGER SQLHSTMT; +#endif +#endif + +#if defined (DB2NT) +typedef HWND SQLHWND; +#else +typedef SQLPOINTER SQLHWND; +#endif + +#endif +typedef SQLHANDLE SQLHDESC; + +#ifndef __SQLTYPES + +/* + * SQL_NO_NATIVE_BIGINT_SUPPORT and SQL_BIGINT_TYPE are defined in sqlsystm.h + * + */ + +#if defined(SQL_NO_NATIVE_BIGINT_SUPPORT) +typedef struct SQLBIGINT +{ + SQLUINTEGER dwLowWord; + SQLINTEGER dwHighWord; +} SQLBIGINT; +typedef struct SQLUBIGINT +{ + SQLUINTEGER dwLowWord; + SQLUINTEGER dwHighWord; +} SQLUBIGINT; +#elif defined(SQL_BIGINT_TYPE) +typedef SQL_BIGINT_TYPE SQLBIGINT; +typedef SQL_BIGUINT_TYPE SQLUBIGINT; +#endif + +typedef struct DATE_STRUCT + { + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; + } DATE_STRUCT; + +typedef DATE_STRUCT SQL_DATE_STRUCT; + +typedef struct TIME_STRUCT + { + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + } TIME_STRUCT; + +typedef TIME_STRUCT SQL_TIME_STRUCT; + +typedef struct TIMESTAMP_STRUCT + { + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + SQLUINTEGER fraction; /* fraction of a second */ + } TIMESTAMP_STRUCT; + + +typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT; + +typedef enum +{ + SQL_IS_YEAR = 1, + SQL_IS_MONTH = 2, + SQL_IS_DAY = 3, + SQL_IS_HOUR = 4, + SQL_IS_MINUTE = 5, + SQL_IS_SECOND = 6, + SQL_IS_YEAR_TO_MONTH = 7, + SQL_IS_DAY_TO_HOUR = 8, + SQL_IS_DAY_TO_MINUTE = 9, + SQL_IS_DAY_TO_SECOND = 10, + SQL_IS_HOUR_TO_MINUTE = 11, + SQL_IS_HOUR_TO_SECOND = 12, + SQL_IS_MINUTE_TO_SECOND = 13 +} SQLINTERVAL; + +typedef struct tagSQL_YEAR_MONTH +{ + SQLUINTEGER year; + SQLUINTEGER month; +} SQL_YEAR_MONTH_STRUCT; + +typedef struct tagSQL_DAY_SECOND +{ + SQLUINTEGER day; + SQLUINTEGER hour; + SQLUINTEGER minute; + SQLUINTEGER second; + SQLUINTEGER fraction; +} SQL_DAY_SECOND_STRUCT; + +typedef struct tagSQL_INTERVAL_STRUCT +{ + SQLINTERVAL interval_type; + SQLSMALLINT interval_sign; + union { + SQL_YEAR_MONTH_STRUCT year_month; + SQL_DAY_SECOND_STRUCT day_second; + } intval; + +} SQL_INTERVAL_STRUCT; + +/* Maximum precision (in base 10) of an SQL_C_NUMERIC value */ +#define SQL_MAX_C_NUMERIC_PRECISION 38 + +/* internal representation of numeric data type */ +#define SQL_MAX_NUMERIC_LEN 16 +typedef struct tagSQL_NUMERIC_STRUCT +{ + SQLCHAR precision; + SQLSCHAR scale; + SQLCHAR sign; /* 1 if positive, 0 if negative */ + SQLCHAR val[SQL_MAX_NUMERIC_LEN]; +} SQL_NUMERIC_STRUCT; + +#endif + + +#define SQL_DECIMAL64_LEN 8 +#define SQL_DECIMAL128_LEN 16 + +typedef struct tagSQLDECIMAL64 { + union { + SQLDOUBLE dummy; /* Dummy member for alignment purposes */ + SQLCHAR dec64[SQL_DECIMAL64_LEN]; + } udec64; +} SQLDECIMAL64; + +typedef struct tagSQLDECIMAL128 { + union { + SQLDOUBLE dummy; /* Dummy member for alignment purposes */ + SQLCHAR dec128[SQL_DECIMAL128_LEN]; + } udec128; +} SQLDECIMAL128; + +/* Core Function Prototypes */ + + + + +SQLRETURN SQL_API_FN SQLAllocConnect (SQLHENV henv, + SQLHDBC FAR *phdbc); + + +SQLRETURN SQL_API_FN SQLAllocEnv (SQLHENV FAR *phenv); + +SQLRETURN SQL_API_FN SQLAllocStmt (SQLHDBC hdbc, + SQLHSTMT FAR *phstmt); + +SQLRETURN SQL_API_FN SQLAllocHandle( SQLSMALLINT fHandleType, + SQLHANDLE hInput, + SQLHANDLE * phOutput ); + +SQLRETURN SQL_API_FN SQLBindCol (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLSMALLINT fCType, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN FAR *pcbValue); + +SQLRETURN SQL_API_FN SQLCancel (SQLHSTMT hstmt); + + +#ifdef ODBC64 +SQLRETURN SQL_API_FN SQLColAttribute (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT FAR *pcbDesc, + SQLLEN *pfDesc); +#else +SQLRETURN SQL_API_FN SQLColAttribute (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT FAR *pcbDesc, + SQLPOINTER pfDesc); +#endif + + + +SQLRETURN SQL_API_FN SQLConnect (SQLHDBC hdbc, + SQLCHAR FAR *szDSN, + SQLSMALLINT cbDSN, + SQLCHAR FAR *szUID, + SQLSMALLINT cbUID, + SQLCHAR FAR *szAuthStr, + SQLSMALLINT cbAuthStr); + +SQLRETURN SQL_API_FN SQLDescribeCol (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLCHAR FAR *szColName, + SQLSMALLINT cbColNameMax, + SQLSMALLINT FAR *pcbColName, + SQLSMALLINT FAR *pfSqlType, + SQLULEN FAR *pcbColDef, + SQLSMALLINT FAR *pibScale, + SQLSMALLINT FAR *pfNullable); + +SQLRETURN SQL_API_FN SQLDisconnect (SQLHDBC hdbc); + +SQLRETURN SQL_API_FN SQLError (SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + SQLCHAR FAR *szSqlState, + SQLINTEGER FAR *pfNativeError, + SQLCHAR FAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT FAR *pcbErrorMsg); + +SQLRETURN SQL_API_FN SQLExecDirect (SQLHSTMT hstmt, + SQLCHAR FAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API_FN SQLExecute (SQLHSTMT hstmt); + +SQLRETURN SQL_API_FN SQLFetch (SQLHSTMT hstmt); + +SQLRETURN SQL_API_FN SQLFreeConnect (SQLHDBC hdbc); + +SQLRETURN SQL_API_FN SQLFreeEnv (SQLHENV henv); + +SQLRETURN SQL_API_FN SQLFreeStmt (SQLHSTMT hstmt, + SQLUSMALLINT fOption); + +SQLRETURN SQL_API_FN SQLCloseCursor( SQLHSTMT hStmt ); + +SQLRETURN SQL_API_FN SQLGetCursorName (SQLHSTMT hstmt, + SQLCHAR FAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT FAR *pcbCursor); + +SQLRETURN SQL_API_FN SQLGetData (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLSMALLINT fCType, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN FAR *pcbValue); + +SQLRETURN SQL_API_FN SQLNumResultCols (SQLHSTMT hstmt, + SQLSMALLINT FAR *pccol); + +SQLRETURN SQL_API_FN SQLPrepare (SQLHSTMT hstmt, + SQLCHAR FAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API_FN SQLRowCount (SQLHSTMT hstmt, + SQLLEN FAR *pcrow); + +SQLRETURN SQL_API_FN SQLSetCursorName (SQLHSTMT hstmt, + SQLCHAR FAR *szCursor, + SQLSMALLINT cbCursor); + +SQLRETURN SQL_API_FN SQLSetParam (SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbParamDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN FAR *pcbValue); + +SQLRETURN SQL_API_FN SQLTransact (SQLHENV henv, + SQLHDBC hdbc, + SQLUSMALLINT fType); + +SQLRETURN SQL_API_FN SQLEndTran( SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT fType ); + +SQLRETURN SQL_API_FN SQLFreeHandle( SQLSMALLINT fHandleType, + SQLHANDLE hHandle ); + +SQLRETURN SQL_API_FN SQLGetDiagRec( SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT iRecNumber, + SQLCHAR * pszSqlState, + SQLINTEGER * pfNativeError, + SQLCHAR * pszErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT * pcbErrorMsg ); + +SQLRETURN SQL_API_FN SQLGetDiagField( SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT iRecNumber, + SQLSMALLINT fDiagIdentifier, + SQLPOINTER pDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT * pcbDiagInfo ); + +SQLRETURN SQL_API_FN SQLCopyDesc( SQLHDESC hDescSource, + SQLHDESC hDescTarget ); + +SQLRETURN SQL_API_FN SQLGetDescField( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN SQL_API_FN SQLGetDescRec( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLCHAR *Name, + SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, + SQLSMALLINT *Type, + SQLSMALLINT *SubType, + SQLLEN *Length, + SQLSMALLINT *Precision, + SQLSMALLINT *Scale, + SQLSMALLINT *Nullable); + +SQLRETURN SQL_API_FN SQLSetDescField( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength); + +SQLRETURN SQL_API_FN SQLSetDescRec( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT Type, + SQLSMALLINT SubType, + SQLLEN Length, + SQLSMALLINT Precision, + SQLSMALLINT Scale, + SQLPOINTER Data, + SQLLEN *StringLength, + SQLLEN *Indicator); + + + +#ifdef __cplusplus +} +#endif + +/* + * Include ODBC header files for + * functions that are not specified in the X/Open Call Level Interface. + * This is included with permission from Microsoft. + * Do not modify (i.e. must not add, remove, rearrange) any part of the + * contents of sqlext.h + * Note: SQLDrivers is not supported by DB2 CLI. + */ +#ifndef __SQL +#define __SQL +#define ODBCVER 0x0351 +#endif +#if !defined(WINDOWS) && !defined(WIN32) && !defined(SQLWINT) +typedef SQLWCHAR * LPWSTR; +typedef sqluint32 DWORD; +#endif + +#include "sqlext.h" + + +#ifdef DB2_WINSOCKAPI_ +#undef _WINSOCKAPI_ +#undef DB2_WINSOCKAPI_ +#endif + +#endif /* SQL_H_SQLCLI */ diff --git a/libraries/SQLAPI/include/db2_win/sqlcli1.h b/libraries/SQLAPI/include/db2_win/sqlcli1.h new file mode 100644 index 000000000..39d6c01b2 --- /dev/null +++ b/libraries/SQLAPI/include/db2_win/sqlcli1.h @@ -0,0 +1,1549 @@ +/****************************************************************************** + * + * Source File Name = sqlcli1.h + * + * (C) COPYRIGHT International Business Machines Corp. 1993, 2004 + * All Rights Reserved + * Licensed Materials - Property of IBM + * + * US Government Users Restricted Rights - Use, duplication or + * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. + * + * Function = Include File defining: + * DB2 CLI Interface - Constants + * DB2 CLI Interface - Function Prototypes + * + * Operating System = Common C Include File + * + *****************************************************************************/ + +#ifndef SQL_H_SQLCLI1 + #define SQL_H_SQLCLI1 /* Permit duplicate Includes */ + +/* Prevent inclusion of winsock.h in windows.h */ +#ifndef _WINSOCKAPI_ +#define _WINSOCKAPI_ +#define DB2_WINSOCKAPI_ +#endif + +/* ODBC64 should be used instead of CLI_WIN64 for linking with libdb2o.dll */ +#ifndef ODBC64 +#ifdef CLI_WIN64 +#define ODBC64 +#endif +#endif + +#include "sqlsystm.h" /* System dependent defines */ + + +#if defined(DB2NT) +#include +#endif + +#include "sqlca.h" +#include "sqlcli.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* SQLGetFunction defines - supported functions */ +#define SQL_API_SQLALLOCCONNECT 1 +#define SQL_API_SQLALLOCENV 2 +#define SQL_API_SQLALLOCSTMT 3 +#define SQL_API_SQLBINDCOL 4 +#define SQL_API_SQLBINDPARAM 1002 +#define SQL_API_SQLCANCEL 5 +#define SQL_API_SQLCONNECT 7 +#define SQL_API_SQLCOPYDESC 1004 +#define SQL_API_SQLDESCRIBECOL 8 +#define SQL_API_SQLDISCONNECT 9 +#define SQL_API_SQLERROR 10 +#define SQL_API_SQLEXECDIRECT 11 +#define SQL_API_SQLEXECUTE 12 +#define SQL_API_SQLFETCH 13 +#define SQL_API_SQLFREECONNECT 14 +#define SQL_API_SQLFREEENV 15 +#define SQL_API_SQLFREESTMT 16 +#define SQL_API_SQLGETCURSORNAME 17 +#define SQL_API_SQLNUMRESULTCOLS 18 +#define SQL_API_SQLPREPARE 19 +#define SQL_API_SQLROWCOUNT 20 +#define SQL_API_SQLSETCURSORNAME 21 +#define SQL_API_SQLSETDESCFIELD 1017 +#define SQL_API_SQLSETDESCREC 1018 +#define SQL_API_SQLSETENVATTR 1019 +#define SQL_API_SQLSETPARAM 22 +#define SQL_API_SQLTRANSACT 23 + +#define SQL_API_SQLCOLUMNS 40 +#define SQL_API_SQLGETCONNECTOPTION 42 +#define SQL_API_SQLGETDATA 43 +#define SQL_API_SQLGETDATAINTERNAL 174 +#define SQL_API_SQLGETDESCFIELD 1008 +#define SQL_API_SQLGETDESCREC 1009 +#define SQL_API_SQLGETDIAGFIELD 1010 +#define SQL_API_SQLGETDIAGREC 1011 +#define SQL_API_SQLGETENVATTR 1012 +#define SQL_API_SQLGETFUNCTIONS 44 +#define SQL_API_SQLGETINFO 45 +#define SQL_API_SQLGETSTMTOPTION 46 +#define SQL_API_SQLGETTYPEINFO 47 +#define SQL_API_SQLPARAMDATA 48 +#define SQL_API_SQLPUTDATA 49 +#define SQL_API_SQLSETCONNECTOPTION 50 +#define SQL_API_SQLSETSTMTOPTION 51 +#define SQL_API_SQLSPECIALCOLUMNS 52 +#define SQL_API_SQLSTATISTICS 53 +#define SQL_API_SQLTABLES 54 +#define SQL_API_SQLDATASOURCES 57 +#define SQL_API_SQLSETCONNECTATTR 1016 +#define SQL_API_SQLSETSTMTATTR 1020 + +#define SQL_API_SQLBINDFILETOCOL 1250 +#define SQL_API_SQLBINDFILETOPARAM 1251 +#define SQL_API_SQLSETCOLATTRIBUTES 1252 +#define SQL_API_SQLGETSQLCA 1253 +#define SQL_API_SQLSETCONNECTION 1254 +#define SQL_API_SQLGETDATALINKATTR 1255 +#define SQL_API_SQLBUILDDATALINK 1256 +#define SQL_API_SQLNEXTRESULT 1257 +#define SQL_API_SQLEXTENDEDPREPARE 1296 +#define SQL_API_SQLEXTENDEDBIND 1297 + +#define SQL_API_SQLFETCHSCROLL 1021 +#define SQL_API_SQLGETLENGTH 1022 +#define SQL_API_SQLGETPOSITION 1023 +#define SQL_API_SQLGETSUBSTRING 1024 + + +#define SQL_API_SQLALLOCHANDLE 1001 +#define SQL_API_SQLFREEHANDLE 1006 +#define SQL_API_SQLCLOSECURSOR 1003 +#define SQL_API_SQLENDTRAN 1005 +#define SQL_API_SQLCOLATTRIBUTE 6 +#define SQL_API_SQLGETSTMTATTR 1014 +#define SQL_API_SQLGETCONNECTATTR 1007 + +/* SQLGetFunction defines - unsupported functions */ +#define SQL_EXT_API_LAST 72 + +/* Information requested by SQLGetInfo() */ +#define SQL_MAX_DRIVER_CONNECTIONS 0 +#define SQL_MAXIMUM_DRIVER_CONNECTIONS SQL_MAX_DRIVER_CONNECTIONS +#define SQL_MAX_CONCURRENT_ACTIVITIES 1 +#define SQL_MAXIMUM_CONCURRENT_ACTIVITIES SQL_MAX_CONCURRENT_ACTIVITIES +#define SQL_ATTR_ANSI_APP 115 + + +/* + * Defines for SQLGetDataLinkAttr. + */ +#define SQL_DATALINK_URL "URL" + +/* + * Datalink attribute values for SQLGetDataLinkAttr. + */ + +#define SQL_ATTR_DATALINK_COMMENT 1 +#define SQL_ATTR_DATALINK_LINKTYPE 2 +#define SQL_ATTR_DATALINK_URLCOMPLETE 3 +#define SQL_ATTR_DATALINK_URLPATH 4 +#define SQL_ATTR_DATALINK_URLPATHONLY 5 +#define SQL_ATTR_DATALINK_URLSCHEME 6 +#define SQL_ATTR_DATALINK_URLSERVER 7 + + +/* SQLGetInfo defines - Info Type */ +#define SQL_DATA_SOURCE_NAME 2 +#define SQL_FETCH_DIRECTION 8 +#define SQL_SERVER_NAME 13 +#define SQL_SEARCH_PATTERN_ESCAPE 14 +#define SQL_DBMS_NAME 17 +#define SQL_DBMS_VER 18 +#define SQL_ACCESSIBLE_TABLES 19 +#define SQL_ACCESSIBLE_PROCEDURES 20 +#define SQL_CURSOR_COMMIT_BEHAVIOR 23 +#define SQL_DATA_SOURCE_READ_ONLY 25 +#define SQL_DEFAULT_TXN_ISOLATION 26 +#define SQL_IDENTIFIER_CASE 28 +#define SQL_IDENTIFIER_QUOTE_CHAR 29 +#define SQL_MAX_COLUMN_NAME_LEN 30 +#define SQL_MAXIMUM_COLUMN_NAME_LENGTH SQL_MAX_COLUMN_NAME_LEN +#define SQL_MAX_CURSOR_NAME_LEN 31 +#define SQL_MAXIMUM_CURSOR_NAME_LENGTH SQL_MAX_CURSOR_NAME_LEN +#define SQL_MAX_TABLE_NAME_LEN 35 +#define SQL_SCROLL_CONCURRENCY 43 +#define SQL_TXN_CAPABLE 46 +#define SQL_TRANSACTION_CAPABLE SQL_TXN_CAPABLE +#define SQL_USER_NAME 47 +#define SQL_TXN_ISOLATION_OPTION 72 +#define SQL_TRANSACTION_ISOLATION_OPTION SQL_TXN_ISOLATION_OPTION +#define SQL_GETDATA_EXTENSIONS 81 +#define SQL_NULL_COLLATION 85 +#define SQL_ALTER_TABLE 86 +#define SQL_ORDER_BY_COLUMNS_IN_SELECT 90 +#define SQL_SPECIAL_CHARACTERS 94 +#define SQL_MAX_COLUMNS_IN_GROUP_BY 97 +#define SQL_MAXIMUM_COLUMNS_IN_GROUP_BY SQL_MAX_COLUMNS_IN_GROUP_BY +#define SQL_MAX_COLUMNS_IN_INDEX 98 +#define SQL_MAXIMUM_COLUMNS_IN_INDEX SQL_MAX_COLUMNS_IN_INDEX +#define SQL_MAX_COLUMNS_IN_ORDER_BY 99 +#define SQL_MAXIMUM_COLUMNS_IN_ORDER_BY SQL_MAX_COLUMNS_IN_ORDER_BY +#define SQL_MAX_COLUMNS_IN_SELECT 100 +#define SQL_MAXIMUM_COLUMNS_IN_SELECT SQL_MAX_COLUMNS_IN_SELECT +#define SQL_MAX_COLUMNS_IN_TABLE 101 +#define SQL_MAX_INDEX_SIZE 102 +#define SQL_MAXIMUM_INDEX_SIZE SQL_MAX_INDEX_SIZE +#define SQL_MAX_ROW_SIZE 104 +#define SQL_MAXIMUM_ROW_SIZE SQL_MAX_ROW_SIZE +#define SQL_MAX_STATEMENT_LEN 105 +#define SQL_MAXIMUM_STATEMENT_LENGTH SQL_MAX_STATEMENT_LEN +#define SQL_MAX_TABLES_IN_SELECT 106 +#define SQL_MAXIMUM_TABLES_IN_SELECT SQL_MAX_TABLES_IN_SELECT +#define SQL_MAX_USER_NAME_LEN 107 +#define SQL_MAXIMUM_USER_NAME_LENGTH SQL_MAX_USER_NAME_LEN +#define SQL_MAX_SCHEMA_NAME_LEN SQL_MAX_OWNER_NAME_LEN +#define SQL_MAXIMUM_SCHEMA_NAME_LENGTH SQL_MAX_SCHEMA_NAME_LEN +#define SQL_MAX_CATALOG_NAME_LEN SQL_MAX_QUALIFIER_NAME_LEN +#define SQL_MAXIMUM_CATALOG_NAME_LENGTH SQL_MAX_CATALOG_NAME_LEN +#define SQL_OJ_CAPABILITIES 115 +#define SQL_OUTER_JOIN_CAPABILITIES SQL_OJ_CAPABILITIES +#define SQL_XOPEN_CLI_YEAR 10000 +#define SQL_CURSOR_SENSITIVITY 10001 +#define SQL_DESCRIBE_PARAMETER 10002 +#define SQL_CATALOG_NAME 10003 +#define SQL_COLLATION_SEQ 10004 +#define SQL_MAX_IDENTIFIER_LEN 10005 +#define SQL_MAXIMUM_IDENTIFIER_LENGTH SQL_MAX_IDENTIFIER_LEN +#define SQL_INTEGRITY 73 +#define SQL_DATABASE_CODEPAGE 2519 +#define SQL_APPLICATION_CODEPAGE 2520 +#define SQL_CONNECT_CODEPAGE 2521 +#define SQL_ATTR_DB2_APPLICATION_ID 2532 +#define SQL_ATTR_DB2_APPLICATION_HANDLE 2533 +#define SQL_ATTR_HANDLE_XA_ASSOCIATED 2535 +#define SQL_DB2_DRIVER_VER 2550 +#define SQL_ATTR_XML_DECLARATION 2552 +#define SQL_ATTR_CURRENT_IMPLICIT_XMLPARSE_OPTION 2553 +#define SQL_ATTR_XQUERY_STATEMENT 2557 +#define SQL_DB2_DRIVER_TYPE 2567 + + +#define SQL_INFO_LAST 114 +#define SQL_INFO_DRIVER_START 1000 + +/* + * SQLExtendedPrepare statement types. + */ + +#define SQL_CLI_STMT_UNDEFINED 0 +#define SQL_CLI_STMT_ALTER_TABLE 1 +#define SQL_CLI_STMT_CREATE_INDEX 5 +#define SQL_CLI_STMT_CREATE_TABLE 6 +#define SQL_CLI_STMT_CREATE_VIEW 7 +#define SQL_CLI_STMT_DELETE_SEARCHED 8 +#define SQL_CLI_STMT_DELETE_POSITIONED 9 +#define SQL_CLI_STMT_DROP_PACKAGE 10 +#define SQL_CLI_STMT_DROP_INDEX 11 +#define SQL_CLI_STMT_DROP_TABLE 12 +#define SQL_CLI_STMT_DROP_VIEW 13 +#define SQL_CLI_STMT_GRANT 14 +#define SQL_CLI_STMT_INSERT 15 +#define SQL_CLI_STMT_REVOKE 16 +#define SQL_CLI_STMT_SELECT 18 +#define SQL_CLI_STMT_UPDATE_SEARCHED 19 +#define SQL_CLI_STMT_UPDATE_POSITIONED 20 +#define SQL_CLI_STMT_CALL 24 +#define SQL_CLI_STMT_SELECT_FOR_UPDATE 29 +#define SQL_CLI_STMT_WITH 30 +#define SQL_CLI_STMT_SELECT_FOR_FETCH 31 +#define SQL_CLI_STMT_VALUES 32 +#define SQL_CLI_STMT_CREATE_TRIGGER 34 +#define SQL_CLI_STMT_SELECT_OPTIMIZE_FOR_NROWS 39 +#define SQL_CLI_STMT_SELECT_INTO 40 +#define SQL_CLI_STMT_CREATE_PROCEDURE 41 +#define SQL_CLI_STMT_CREATE_FUNCTION 42 +#define SQL_CLI_STMT_INSERT_VALUES 45 +#define SQL_CLI_STMT_SET_CURRENT_QUERY_OPT 46 +#define SQL_CLI_STMT_MERGE 56 +#define SQL_CLI_STMT_XQUERY 59 + +/* + * IBM specific SQLGetInfo values. + */ + +#define SQL_IBM_ALTERTABLEVARCHAR 1000 + +/* SQL_ALTER_TABLE bitmasks */ +#define SQL_AT_ADD_COLUMN 0x00000001L +#define SQL_AT_DROP_COLUMN 0x00000002L +#define SQL_AT_ADD_CONSTRAINT 0x00000008L + +/* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */ + +#define SQL_CB_DELETE 0x0000 +#define SQL_CB_CLOSE 0x0001 +#define SQL_CB_PRESERVE 0x0002 + +/* SQL_IDENTIFIER_CASE values */ + +#define SQL_IC_UPPER 0x0001 +#define SQL_IC_LOWER 0x0002 +#define SQL_IC_SENSITIVE 0x0003 +#define SQL_IC_MIXED 0x0004 + +/* SQL_TXN_CAPABLE values */ + +#define SQL_TC_NONE 0x0000 +#define SQL_TC_DML 0x0001 +#define SQL_TC_ALL 0x0002 +#define SQL_TC_DDL_COMMIT 0x0003 +#define SQL_TC_DDL_IGNORE 0x0004 + +/* SQL_SCROLL_CONCURRENCY masks */ + +#define SQL_SCCO_READ_ONLY 0x00000001L +#define SQL_SCCO_LOCK 0x00000002L +#define SQL_SCCO_OPT_ROWVER 0x00000004L +#define SQL_SCCO_OPT_VALUES 0x00000008L + +/* SQL_FETCH_DIRECTION masks */ + +#define SQL_FD_FETCH_NEXT 0x00000001L +#define SQL_FD_FETCH_FIRST 0x00000002L +#define SQL_FD_FETCH_LAST 0x00000004L +#define SQL_FD_FETCH_PRIOR 0x00000008L +#define SQL_FD_FETCH_ABSOLUTE 0x00000010L +#define SQL_FD_FETCH_RELATIVE 0x00000020L +#define SQL_FD_FETCH_RESUME 0x00000040L + +/* SQL_TXN_ISOLATION_OPTION masks */ +#define SQL_TXN_READ_UNCOMMITTED 0x00000001L +#define SQL_TRANSACTION_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED +#define SQL_TXN_READ_COMMITTED 0x00000002L +#define SQL_TRANSACTION_READ_COMMITTED SQL_TXN_READ_COMMITTED +#define SQL_TXN_REPEATABLE_READ 0x00000004L +#define SQL_TRANSACTION_REPEATABLE_READ SQL_TXN_REPEATABLE_READ +#define SQL_TXN_SERIALIZABLE 0x00000008L +#define SQL_TRANSACTION_SERIALIZABLE SQL_TXN_SERIALIZABLE +#define SQL_TXN_NOCOMMIT 0x00000020L +#define SQL_TRANSACTION_NOCOMMIT SQL_TXN_NOCOMMIT + +/* SQL_GETDATA_EXTENSIONS values */ + +#define SQL_GD_ANY_COLUMN 0x00000001L +#define SQL_GD_ANY_ORDER 0x00000002L + +/* SQL_OJ_CAPABILITIES values */ + +#define SQL_OJ_LEFT 0x00000001L +#define SQL_OJ_RIGHT 0x00000002L +#define SQL_OJ_FULL 0x00000004L +#define SQL_OJ_NESTED 0x00000008L +#define SQL_OJ_NOT_ORDERED 0x00000010L +#define SQL_OJ_INNER 0x00000020L +#define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L + +/* SQL_DB2_DRIVER_TYPE values */ +#define SQL_CLI_DRIVER_TYPE_UNDEFINED 0 +#define SQL_CLI_DRIVER_RUNTIME_CLIENT 1 +#define SQL_CLI_DRIVER_CLI_DRIVER 2 + + +/* SQLGetTypeInfo define */ +#define SQL_ALL_TYPES 0 + +/* Options for SQLGetStmtOption/SQLSetStmtOption */ + +#define SQL_ATTR_AUTO_IPD 10001 +#define SQL_ATTR_APP_ROW_DESC 10010 +#define SQL_ATTR_APP_PARAM_DESC 10011 +#define SQL_ATTR_IMP_ROW_DESC 10012 +#define SQL_ATTR_IMP_PARAM_DESC 10013 +#define SQL_ATTR_METADATA_ID 10014 +#define SQL_ATTR_CURSOR_SCROLLABLE (-1) +#define SQL_ATTR_CURSOR_SENSITIVITY (-2) + +/* SQL_ATTR_CURSOR_SCROLLABLE values */ +#define SQL_NONSCROLLABLE 0 +#define SQL_SCROLLABLE 1 + + +/* Options for SQLGetStmtOption/SQLSetStmtOption extensions */ +#define SQL_CURSOR_HOLD 1250 +#define SQL_ATTR_CURSOR_HOLD 1250 +#define SQL_NODESCRIBE_OUTPUT 1251 +#define SQL_ATTR_NODESCRIBE_OUTPUT 1251 + +#define SQL_NODESCRIBE_INPUT 1264 +#define SQL_ATTR_NODESCRIBE_INPUT 1264 +#define SQL_NODESCRIBE SQL_NODESCRIBE_OUTPUT +#define SQL_ATTR_NODESCRIBE SQL_NODESCRIBE_OUTPUT +#define SQL_CLOSE_BEHAVIOR 1257 +#define SQL_ATTR_CLOSE_BEHAVIOR 1257 +#define SQL_ATTR_CLOSE_BEHAVIOR 1257 +#define SQL_ATTR_CLOSEOPEN 1265 +#define SQL_ATTR_CURRENT_PACKAGE_SET 1276 +#define SQL_ATTR_DEFERRED_PREPARE 1277 +#define SQL_ATTR_EARLYCLOSE 1268 +#define SQL_ATTR_PROCESSCTL 1278 +#define SQL_ATTR_PREFETCH 1285 +#define SQL_ATTR_ENABLE_IPD_SETTING 1286 +/* + * Descriptor value for setting the descriptor type. + */ + +#define SQL_DESC_DESCRIPTOR_TYPE 1287 + +#define SQL_ATTR_OPTIMIZE_SQLCOLUMNS 1288 +#define SQL_ATTR_MEM_DEBUG_DUMP 1289 +#define SQL_ATTR_CONNECT_NODE 1290 +#define SQL_ATTR_CONNECT_WITH_XA 1291 +#define SQL_ATTR_GET_XA_RESOURCE 1292 +#define SQL_ATTR_DB2_SQLERRP 2451 +#define SQL_ATTR_SERVER_MSGTXT_SP 2452 +#define SQL_ATTR_OPTIMIZE_FOR_NROWS 2450 +#define SQL_ATTR_QUERY_OPTIMIZATION_LEVEL 1293 +#define SQL_ATTR_USE_LIGHT_OUTPUT_SQLDA 1298 +#define SQL_ATTR_CURSOR_BLOCK_NUM_ROWS 2453 +#define SQL_ATTR_CURSOR_BLOCK_EARLY_CLOSE 2454 +#define SQL_ATTR_SERVER_MSGTXT_MASK 2455 +#define SQL_ATTR_USE_LIGHT_INPUT_SQLDA 2458 +#define SQL_ATTR_BLOCK_FOR_NROWS 2459 +#define SQL_ATTR_OPTIMIZE_ROWS_FOR_BLOCKING 2460 +#define SQL_ATTR_STATICMODE 2467 +#define SQL_ATTR_DB2_MESSAGE_PREFIX 2468 +#define SQL_ATTR_CALL_RETVAL_AS_PARM 2469 +#define SQL_ATTR_CALL_RETURN 2470 +#define SQL_ATTR_RETURN_USER_DEFINED_TYPES 2471 +#define SQL_ATTR_ENABLE_EXTENDED_PARAMDATA 2472 +#define SQL_ATTR_APP_TYPE 2473 +#define SQL_ATTR_TRANSFORM_GROUP 2474 +#define SQL_ATTR_DESCRIBE_CALL 2476 +#define SQL_ATTR_AUTOCOMMCLEANUP 2477 +#define SQL_ATTR_USEMALLOC 2478 +#define SQL_ATTR_PRESERVE_LOCALE 2479 +#define SQL_ATTR_MAPGRAPHIC 2480 +#define SQL_ATTR_INSERT_BUFFERING 2481 + +#define SQL_ATTR_USE_LOAD_API 2482 +#define SQL_ATTR_LOAD_RECOVERABLE 2483 +#define SQL_ATTR_LOAD_COPY_LOCATION 2484 +#define SQL_ATTR_LOAD_MESSAGE_FILE 2485 +#define SQL_ATTR_LOAD_SAVECOUNT 2486 +#define SQL_ATTR_LOAD_CPU_PARALLELISM 2487 +#define SQL_ATTR_LOAD_DISK_PARALLELISM 2488 +#define SQL_ATTR_LOAD_INDEXING_MODE 2489 +#define SQL_ATTR_LOAD_STATS_MODE 2490 +#define SQL_ATTR_LOAD_TEMP_FILES_PATH 2491 +#define SQL_ATTR_LOAD_DATA_BUFFER_SIZE 2492 +#define SQL_ATTR_LOAD_MODIFIED_BY 2493 +#define SQL_ATTR_DB2_RESERVED_2494 2494 +#define SQL_ATTR_DESCRIBE_BEHAVIOR 2495 +#define SQL_ATTR_FETCH_SENSITIVITY 2496 +#define SQL_ATTR_DB2_RESERVED_2497 2497 +#define SQL_ATTR_CLIENT_LOB_BUFFERING 2498 +#define SQL_ATTR_SKIP_TRACE 2499 +#define SQL_ATTR_LOAD_INFO 2501 +#define SQL_ATTR_DESCRIBE_INPUT_ON_PREPARE 2505 +#define SQL_ATTR_DESCRIBE_OUTPUT_LEVEL 2506 +#define SQL_ATTR_CURRENT_PACKAGE_PATH 2509 +#define SQL_ATTR_INFO_PROGRAMID 2511 +#define SQL_ATTR_INFO_PROGRAMNAME 2516 +#define SQL_ATTR_FREE_LOCATORS_ON_FETCH 2518 +#define SQL_ATTR_KEEP_DYNAMIC 2522 +#define SQL_ATTR_LOAD_ROWS_READ_PTR 2524 +#define SQL_ATTR_LOAD_ROWS_SKIPPED_PTR 2525 +#define SQL_ATTR_LOAD_ROWS_COMMITTED_PTR 2526 +#define SQL_ATTR_LOAD_ROWS_LOADED_PTR 2527 +#define SQL_ATTR_LOAD_ROWS_REJECTED_PTR 2528 +#define SQL_ATTR_LOAD_ROWS_DELETED_PTR 2529 +#define SQL_ATTR_LOAD_INFO_VER 2530 +#define SQL_ATTR_SET_SSA 2531 +#define SQL_ATTR_BLOCK_LOBS 2534 +#define SQL_ATTR_LOAD_ACCESS_LEVEL 2536 +#define SQL_ATTR_MAPCHAR 2546 +#define SQL_ATTR_ARM_CORRELATOR 2554 +#define SQL_ATTR_CLIENT_DEBUGINFO 2556 + +/* + * SQL_ATTR_DESCRIBE_INPUT / SQL_ATTR_DESCRIBE_OUTPUT values + */ +#define SQL_DESCRIBE_NONE 0 +#define SQL_DESCRIBE_LIGHT 1 +#define SQL_DESCRIBE_REGULAR 2 +#define SQL_DESCRIBE_EXTENDED 3 + +/* + * Use load values. + */ + +#define SQL_USE_LOAD_OFF 0 +#define SQL_USE_LOAD_INSERT 1 +#define SQL_USE_LOAD_REPLACE 2 +#define SQL_USE_LOAD_RESTART 3 +#define SQL_USE_LOAD_TERMINATE 4 + +/* + * SQL_ATTR_PREFETCH_ENABLE values. + */ + +#define SQL_PREFETCH_ON 1 +#define SQL_PREFETCH_OFF 0 +#define SQL_PREFETCH_DEFAULT SQL_PREFETCH_OFF + +/* SQL_CLOSE_BEHAVIOR values. */ + +#define SQL_CC_NO_RELEASE 0 +#define SQL_CC_RELEASE 1 +#define SQL_CC_DEFAULT SQL_CC_NO_RELEASE + +/* SQL_ATTR_DEFERRED_PREPARE values */ + +#define SQL_DEFERRED_PREPARE_ON 1 +#define SQL_DEFERRED_PREPARE_OFF 0 +#define SQL_DEFERRED_PREPARE_DEFAULT SQL_DEFERRED_PREPARE_ON + +/* SQL_ATTR_EARLYCLOSE values */ + +#define SQL_EARLYCLOSE_ON 1 +#define SQL_EARLYCLOSE_OFF 0 +#define SQL_EARLYCLOSE_SERVER 2 +#define SQL_EARLYCLOSE_DEFAULT SQL_EARLYCLOSE_ON + +/* SQL_ATTR_APP_TYPE values */ + +#define SQL_APP_TYPE_ODBC 1 +#define SQL_APP_TYPE_OLEDB 2 +#define SQL_APP_TYPE_JDBC 3 +#define SQL_APP_TYPE_ADONET 4 +#define SQL_APP_TYPE_DEFAULT SQL_APP_TYPE_ODBC + +/* SQL_ATTR_PROCESSCTL masks */ + +#define SQL_PROCESSCTL_NOTHREAD 0x00000001L +#define SQL_PROCESSCTL_NOFORK 0x00000002L +#define SQL_PROCESSCTL_SHARESTMTDESC 0x00000004L + +/* CLI attribute/option values */ +#define SQL_FALSE 0 +#define SQL_TRUE 1 + +/* Options for SQL_CURSOR_HOLD */ +#define SQL_CURSOR_HOLD_ON 1 +#define SQL_CURSOR_HOLD_OFF 0 +#define SQL_CURSOR_HOLD_DEFAULT SQL_CURSOR_HOLD_ON + + +/* Options for SQL_NODESCRIBE_INPUT/SQL_NODESCRIBE_OUTPUT */ +#define SQL_NODESCRIBE_ON 1 +#define SQL_NODESCRIBE_OFF 0 +#define SQL_NODESCRIBE_DEFAULT SQL_NODESCRIBE_OFF + +/* Options for SQL_ATTR_DESCRIBE_CALL */ +#define SQL_DESCRIBE_CALL_NEVER 0 +#define SQL_DESCRIBE_CALL_BEFORE 1 +#define SQL_DESCRIBE_CALL_ON_ERROR 2 +#define SQL_DESCRIBE_CALL_DEFAULT (-1) + +/* Options for SQL_ATTR_CLIENT_LOB_BUFFERING */ +#define SQL_CLIENTLOB_USE_LOCATORS 0 +#define SQL_CLIENTLOB_BUFFER_UNBOUND_LOBS 1 +#define SQL_CLIENTLOB_DEFAULT SQL_CLIENTLOB_USE_LOCATORS + +/* Options for SQL_ATTR_PREPDESC_BEHAVIOR */ +/* To be determined */ + +/* Options for SQLGetConnectOption/SQLSetConnectOption extensions */ +#define SQL_WCHARTYPE 1252 +#define SQL_LONGDATA_COMPAT 1253 +#define SQL_CURRENT_SCHEMA 1254 +#define SQL_DB2EXPLAIN 1258 +#define SQL_DB2ESTIMATE 1259 +#define SQL_PARAMOPT_ATOMIC 1260 +#define SQL_STMTTXN_ISOLATION 1261 +#define SQL_MAXCONN 1262 +#define SQL_ATTR_CLISCHEMA 1280 +#define SQL_ATTR_INFO_USERID 1281 +#define SQL_ATTR_INFO_WRKSTNNAME 1282 +#define SQL_ATTR_INFO_APPLNAME 1283 +#define SQL_ATTR_INFO_ACCTSTR 1284 +#define SQL_ATTR_AUTOCOMMIT_NOCOMMIT 2462 +#define SQL_ATTR_QUERY_PATROLLER 2466 +#define SQL_ATTR_CHAINING_BEGIN 2464 +#define SQL_ATTR_CHAINING_END 2465 +#define SQL_ATTR_EXTENDEDBIND 2475 +#define SQL_ATTR_GRAPHIC_UNICODESERVER 2503 +#define SQL_ATTR_RETURN_CHAR_AS_WCHAR_OLEDB 2517 +#define SQL_ATTR_GATEWAY_CONNECTED 2537 +#define SQL_ATTR_SQLCOLUMNS_SORT_BY_ORDINAL_OLEDB 2542 +#define SQL_ATTR_REPORT_ISLONG_FOR_LONGTYPES_OLEDB 2543 +#define SQL_ATTR_PING_DB 2545 +#define SQL_ATTR_RECEIVE_TIMEOUT 2547 +#define SQL_ATTR_REOPT 2548 +#define SQL_ATTR_LOB_CACHE_SIZE 2555 +#define SQL_ATTR_STREAM_GETDATA 2558 +#define SQL_ATTR_APP_USES_LOB_LOCATOR 2559 +#define SQL_ATTR_MAX_LOB_BLOCK_SIZE 2560 +#define SQL_ATTR_USE_TRUSTED_CONTEXT 2561 +#define SQL_ATTR_TRUSTED_CONTEXT_USERID 2562 +#define SQL_ATTR_TRUSTED_CONTEXT_PASSWORD 2563 +#define SQL_ATTR_USER_REGISTRY_NAME 2564 +#define SQL_ATTR_DECFLOAT_ROUNDING_MODE 2565 +#define SQL_ATTR_APPEND_FOR_FETCH_ONLY 2573 +#define SQL_ATTR_ONLY_USE_BIG_PACKAGES 2577 + +#define SQL_ATTR_WCHARTYPE SQL_WCHARTYPE +#define SQL_ATTR_LONGDATA_COMPAT SQL_LONGDATA_COMPAT +#define SQL_ATTR_CURRENT_SCHEMA SQL_CURRENT_SCHEMA +#define SQL_ATTR_DB2EXPLAIN SQL_DB2EXPLAIN +#define SQL_ATTR_DB2ESTIMATE SQL_DB2ESTIMATE +#define SQL_ATTR_PARAMOPT_ATOMIC SQL_PARAMOPT_ATOMIC +#define SQL_ATTR_STMTTXN_ISOLATION SQL_STMTTXN_ISOLATION +#define SQL_ATTR_MAXCONN SQL_MAXCONN + +/* Options for SQLSetConnectOption, SQLSetEnvAttr */ +#define SQL_CONNECTTYPE 1255 +#define SQL_SYNC_POINT 1256 +#define SQL_MINMEMORY_USAGE 1263 +#define SQL_CONN_CONTEXT 1269 +#define SQL_ATTR_INHERIT_NULL_CONNECT 1270 +#define SQL_ATTR_FORCE_CONVERSION_ON_CLIENT 1275 +#define SQL_ATTR_INFO_KEYWORDLIST 2500 + +#define SQL_ATTR_CONNECTTYPE SQL_CONNECTTYPE +#define SQL_ATTR_SYNC_POINT SQL_SYNC_POINT +#define SQL_ATTR_MINMEMORY_USAGE SQL_MINMEMORY_USAGE +#define SQL_ATTR_CONN_CONTEXT SQL_CONN_CONTEXT + +/* Options for SQL_LONGDATA_COMPAT */ +#define SQL_LD_COMPAT_YES 1 +#define SQL_LD_COMPAT_NO 0 +#define SQL_LD_COMPAT_DEFAULT SQL_LD_COMPAT_NO + +/* Options for SQL_ATTR_EXTENDEDBIND */ +#define SQL_ATTR_EXTENDEDBIND_COPY 1 +#define SQL_ATTR_EXTENDEDBIND_NOCOPY 0 +#define SQL_ATTR_EXTENDEDBIND_DEFAULT SQL_ATTR_EXTENDEDBIND_NOCOPY + +/* SQL_NULL_COLLATION values */ +#define SQL_NC_HIGH 0 +#define SQL_NC_LOW 1 + +/* Options for SQLGetInfo extentions */ +#define CLI_MAX_LONGVARCHAR 1250 +#define CLI_MAX_VARCHAR 1251 +#define CLI_MAX_CHAR 1252 +#define CLI_MAX_LONGVARGRAPHIC 1253 +#define CLI_MAX_VARGRAPHIC 1254 +#define CLI_MAX_GRAPHIC 1255 + +/* + * Private SQLGetDiagField extensions. + */ + +#define SQL_DIAG_MESSAGE_TEXT_PTR 2456 +#define SQL_DIAG_LINE_NUMBER 2461 +#define SQL_DIAG_ERRMC 2467 +#define SQL_DIAG_BYTES_PROCESSED 2477 +#define SQL_DIAG_RELATIVE_COST_ESTIMATE 2504 +#define SQL_DIAG_ROW_COUNT_ESTIMATE 2507 +#define SQL_DIAG_ELAPSED_SERVER_TIME 2538 +#define SQL_DIAG_ELAPSED_NETWORK_TIME 2539 +#define SQL_DIAG_ACCUMULATED_SERVER_TIME 2540 +#define SQL_DIAG_ACCUMULATED_NETWORK_TIME 2541 +#define SQL_DIAG_QUIESCE 2549 +#define SQL_DIAG_TOLERATED_ERROR 2559 + +/* + * Values for SQL_DIAG_QUIESCE + */ + +#define SQL_DIAG_QUIESCE_NO 0 +#define SQL_DIAG_QUIESCE_DATABASE 1 +#define SQL_DIAG_QUIESCE_INSTANCE 2 + +/* + * Private SQLSetEnvAttr extensions. + */ + +#define SQL_ATTR_LITTLE_ENDIAN_UNICODE 2457 +#define SQL_ATTR_DIAGLEVEL 2574 +#define SQL_ATTR_NOTIFYLEVEL 2575 +#define SQL_ATTR_DIAGPATH 2576 + +/* + * Options for SQL_PARAMOPT_ATOMIC + */ + +#define SQL_ATOMIC_YES 1 +#define SQL_ATOMIC_NO 0 +#define SQL_ATOMIC_DEFAULT SQL_ATOMIC_YES + +/* Options for SQL_CONNECT_TYPE */ +#define SQL_CONCURRENT_TRANS 1 +#define SQL_COORDINATED_TRANS 2 +#define SQL_CONNECTTYPE_DEFAULT SQL_CONCURRENT_TRANS + +/* Options for SQL_SYNCPOINT */ +#define SQL_ONEPHASE 1 +#define SQL_TWOPHASE 2 +#define SQL_SYNCPOINT_DEFAULT SQL_ONEPHASE + +/* Options for SQL_DB2ESTIMATE */ +#define SQL_DB2ESTIMATE_ON 1 +#define SQL_DB2ESTIMATE_OFF 0 +#define SQL_DB2ESTIMATE_DEFAULT SQL_DB2ESTIMATE_OFF + +/* Options for SQL_DB2EXPLAIN */ +#define SQL_DB2EXPLAIN_OFF 0x00000000L +#define SQL_DB2EXPLAIN_SNAPSHOT_ON 0x00000001L +#define SQL_DB2EXPLAIN_MODE_ON 0x00000002L +#define SQL_DB2EXPLAIN_SNAPSHOT_MODE_ON SQL_DB2EXPLAIN_SNAPSHOT_ON+SQL_DB2EXPLAIN_MODE_ON +#define SQL_DB2EXPLAIN_ON SQL_DB2EXPLAIN_SNAPSHOT_ON +#define SQL_DB2EXPLAIN_DEFAULT SQL_DB2EXPLAIN_OFF + +/* Options for SQL_WCHARTYPE + * Note that you can only specify SQL_WCHARTYPE_CONVERT if you have an + * external compile flag SQL_WCHART_CONVERT defined + */ +#ifdef SQL_WCHART_CONVERT +#define SQL_WCHARTYPE_CONVERT 1 +#endif +#define SQL_WCHARTYPE_NOCONVERT 0 +#define SQL_WCHARTYPE_DEFAULT SQL_WCHARTYPE_NOCONVERT + +/* Options for SQL_ATTR_OPTIMIZE_SQLCOLUMNS + * + */ +#define SQL_OPTIMIZE_SQLCOLUMNS_OFF 0 +#define SQL_OPTIMIZE_SQLCOLUMNS_ON 1 +#define SQL_OPTIMIZE_SQLCOLUMNS_DEFAULT SQL_OPTIMIZE_SQLCOLUMNS_OFF + +/* Options for SQL_ATTR_CONNECT_WITH_XA + * + */ +#define SQL_CONNECT_WITH_XA_OFF 0 +#define SQL_CONNECT_WITH_XA_ON 1 +#define SQL_CONNECT_WITH_XA_DEFAULT SQL_CONNECT_WITH_XA_OFF + +/* + * Options for SQL_ATTR_SERVER_MSGTXT_MASK + */ +#define SQL_ATTR_SERVER_MSGTXT_MASK_LOCAL_FIRST 0x00000000 +#define SQL_ATTR_SERVER_MSGTXT_MASK_WARNINGS 0x00000001 +#define SQL_ATTR_SERVER_MSGTXT_MASK_ERRORS 0xFFFFFFFE +#define SQL_ATTR_SERVER_MSGTXT_MASK_ALL 0xFFFFFFFF +#define SQL_ATTR_SERVER_MSGTXT_MASK_DEFAULT SQL_ATTR_SERVER_MSGTXT_MASK_LOCAL_FIRST + +/* + * Options for SQL_ATTR_QUERY_PATROLLER + */ +#define SQL_ATTR_QUERY_PATROLLER_DISABLE 1 +#define SQL_ATTR_QUERY_PATROLLER_ENABLE 2 +#define SQL_ATTR_QUERY_PATROLLER_BYPASS 3 + +/* + * Options for SQL_ATTR_STATICMODE + */ +#define SQL_STATICMODE_DISABLED 0 +#define SQL_STATICMODE_CAPTURE 1 +#define SQL_STATICMODE_MATCH 2 + +/* + * Options for SQL_ATTR_DB2_MESSAGE_PREFIX + */ +#define SQL_ATTR_DB2_MESSAGE_PREFIX_OFF 0 +#define SQL_ATTR_DB2_MESSAGE_PREFIX_ON 1 +#define SQL_ATTR_DB2_MESSAGE_PREFIX_DEFAULT SQL_ATTR_DB2_MESSAGE_PREFIX_ON + +/* + * Options for SQL_ATTR_INSERT_BUFFERING + */ +#define SQL_ATTR_INSERT_BUFFERING_OFF 0 +#define SQL_ATTR_INSERT_BUFFERING_ON 1 +#define SQL_ATTR_INSERT_BUFFERING_IGD 2 + +/* Column types and scopes in SQLSpecialColumns */ + +#define SQL_SCOPE_CURROW 0 +#define SQL_SCOPE_TRANSACTION 1 +#define SQL_SCOPE_SESSION 2 + +/* Defines for SQLStatistics */ +#define SQL_INDEX_UNIQUE 0 +#define SQL_INDEX_ALL 1 + +/* Defines for SQLStatistics (returned in the result set) */ +#define SQL_INDEX_CLUSTERED 1 +#define SQL_INDEX_HASHED 2 +#define SQL_INDEX_OTHER 3 + +/* Defines for SQLSpecialColumns (returned in the result set) */ +#define SQL_PC_UNKNOWN 0 +#define SQL_PC_NON_PSEUDO 1 +#define SQL_PC_PSEUDO 2 + +/* Reserved value for the IdentifierType argument of SQLSpecialColumns() */ +#define SQL_ROW_IDENTIFIER 1 + +/* Options for SQL_ATTR_MAPGRAPHIC */ +#define SQL_MAPGRAPHIC_DEFAULT -1 +#define SQL_MAPGRAPHIC_GRAPHIC 0 +#define SQL_MAPGRAPHIC_WCHAR 1 + +/* Options for SQL_ATTR_MAPCHAR */ +#define SQL_MAPCHAR_DEFAULT 0 +#define SQL_MAPCHAR_WCHAR 1 + +/* SQLDataSources "fDirection" values, also used on SQLExtendedFetch() */ +/* See sqlext.h for additional SQLExtendedFetch fetch direction defines */ +#define SQL_FETCH_NEXT 1 +#define SQL_FETCH_FIRST 2 + +/* OTHER CODES USED FOR FETCHORIENTATION IN SQLFETCHSCROLL() */ +#define SQL_FETCH_LAST 3 +#define SQL_FETCH_PRIOR 4 +#define SQL_FETCH_ABSOLUTE 5 +#define SQL_FETCH_RELATIVE 6 + +/* SQL_ATTR_XML_DECLARATION bitmask values */ +#define SQL_XML_DECLARATION_NONE 0x00000000 +#define SQL_XML_DECLARATION_BOM 0x00000001 +#define SQL_XML_DECLARATION_BASE 0x00000002 +#define SQL_XML_DECLARATION_ENCATTR 0x00000004 + +/* + * Environment attributes; note SQL_CONNECTTYPE, SQL_SYNC_POINT are also + * environment attributes that are settable at the connection level + */ + +#define SQL_ATTR_OUTPUT_NTS 10001 + + +/* LOB file reference options */ +#ifndef SQL_H_SQL /* if sql.h is not included, then... */ +#define SQL_FILE_READ 2 /* Input file to read from */ +#define SQL_FILE_CREATE 8 /* Output file - new file to be */ + /* created */ +#define SQL_FILE_OVERWRITE 16 /* Output file - overwrite existing */ + /* file or create a new file if it */ + /* doesn't exist */ +#define SQL_FILE_APPEND 32 /* Output file - append to an */ + /* existing file or create a new file */ + /* if it doesn't exist */ +#endif + +/* + * Source of string for SQLGetLength(), SQLGetPosition(), + * and SQLGetSubstring(). + */ +#define SQL_FROM_LOCATOR 2 +#define SQL_FROM_LITERAL 3 + +/* + * Options for Rounding Modes. These numeric values can + * be set with SQLSetConnectAttr() API for the attribute + * SQL_ATTR_DECFLOAT_ROUNDING_MODE. The SQLGetConnectAttr() + * API will return these values for the + * SQL_ATTR_DECFLOAT_ROUNDING_MODE attribute. + */ +#define SQL_ROUND_HALF_EVEN 0 +#define SQL_ROUND_HALF_UP 1 +#define SQL_ROUND_DOWN 2 +#define SQL_ROUND_CEILING 3 +#define SQL_ROUND_FLOOR 4 +#define SQL_ROUND_HALF_DOWN 5 +#define SQL_ROUND_UP 6 + +/* + * Function definitions of APIs in both X/Open CLI and ODBC + */ + +SQLRETURN SQL_API_FN SQLColumns (SQLHSTMT hstmt, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR FAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API_FN SQLDataSources (SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR FAR *szDSN, + SQLSMALLINT cbDSNMax, + SQLSMALLINT FAR *pcbDSN, + SQLCHAR FAR *szDescription, + SQLSMALLINT cbDescriptionMax, + SQLSMALLINT FAR *pcbDescription); +SQLRETURN SQL_API SQLFetchScroll( SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, + SQLLEN FetchOffset); +SQLRETURN SQL_API SQLGetConnectAttr( SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN SQL_API_FN SQLGetConnectOption ( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); + +SQLRETURN SQL_API_FN SQLGetFunctions (SQLHDBC hdbc, + SQLUSMALLINT fFunction, + SQLUSMALLINT FAR *pfExists); + +SQLRETURN SQL_API_FN SQLGetInfo (SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT FAR *pcbInfoValue); + +SQLRETURN SQL_API SQLGetStmtAttr( SQLHSTMT StatementHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN SQL_API_FN SQLGetStmtOption (SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); + +SQLRETURN SQL_API_FN SQLGetTypeInfo (SQLHSTMT hstmt, + SQLSMALLINT fSqlType); + + +SQLRETURN SQL_API_FN SQLParamData (SQLHSTMT hstmt, + SQLPOINTER FAR *prgbValue); + +SQLRETURN SQL_API_FN SQLPutData (SQLHSTMT hstmt, + SQLPOINTER rgbValue, + SQLLEN cbValue); + +SQLRETURN SQL_API_FN SQLSetConnectAttr( + SQLHDBC hdbc, + SQLINTEGER fOption, + SQLPOINTER pvParam, + SQLINTEGER fStrLen); + +SQLRETURN SQL_API_FN SQLSetConnectOption( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLULEN vParam); + +SQLRETURN SQL_API_FN SQLSetStmtAttr (SQLHSTMT hstmt, + SQLINTEGER fOption, + SQLPOINTER pvParam, + SQLINTEGER fStrLen); + +SQLRETURN SQL_API_FN SQLSetStmtOption (SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLULEN vParam); + +SQLRETURN SQL_API_FN SQLSpecialColumns(SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); + +SQLRETURN SQL_API_FN SQLStatistics (SQLHSTMT hstmt, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + + SQLUSMALLINT fAccuracy); + +SQLRETURN SQL_API_FN SQLTables (SQLHSTMT hstmt, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR FAR *szTableType, + SQLSMALLINT cbTableType); + +SQLRETURN SQL_API SQLNextResult (SQLHSTMT hstmtSource, + SQLHSTMT hstmtTarget); +/* UNICODE versions */ + +#ifdef ODBC64 +SQLRETURN SQL_API SQLColAttributeW( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLLEN *pNumAttr); +#else + SQLRETURN SQL_API SQLColAttributeW( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLPOINTER pNumAttr); +#endif + +SQLRETURN SQL_API SQLColAttributesW( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); + +SQLRETURN SQL_API SQLConnectW( + SQLHDBC hdbc, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSN, + SQLWCHAR *szUID, + SQLSMALLINT cbUID, + SQLWCHAR *szAuthStr, + SQLSMALLINT cbAuthStr); + +SQLRETURN SQL_API SQLConnectWInt( + SQLHDBC hdbc, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSN, + SQLWCHAR *szUID, + SQLSMALLINT cbUID, + SQLWCHAR *szAuthStr, + SQLSMALLINT cbAuthStr); + + +SQLRETURN SQL_API SQLDescribeColW( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLWCHAR *szColName, + SQLSMALLINT cbColNameMax, + SQLSMALLINT *pcbColName, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbColDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + + +SQLRETURN SQL_API SQLErrorW( + SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + SQLWCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLWCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + +SQLRETURN SQL_API SQLExecDirectW( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API SQLGetConnectAttrW( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetCursorNameW( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT *pcbCursor); + +SQLRETURN SQL_API SQLSetDescFieldW(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength); + + + +SQLRETURN SQL_API SQLGetDescFieldW( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLSMALLINT iField, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetDescRecW( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLWCHAR *szName, + SQLSMALLINT cbNameMax, + SQLSMALLINT *pcbName, + SQLSMALLINT *pfType, + SQLSMALLINT *pfSubType, + SQLLEN *pLength, + SQLSMALLINT *pPrecision, + SQLSMALLINT *pScale, + SQLSMALLINT *pNullable); + +SQLRETURN SQL_API SQLGetDiagFieldW( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLSMALLINT fDiagField, + SQLPOINTER rgbDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT *pcbDiagInfo); + +SQLRETURN SQL_API SQLGetDiagRecW( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLWCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLWCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + +SQLRETURN SQL_API_FN SQLGetEnvAttrW( + SQLHENV hEnv, + SQLINTEGER fAttribute, + SQLPOINTER pParam, + SQLINTEGER cbParamMax, + SQLINTEGER * pcbParam ); + +SQLRETURN SQL_API SQLPrepareW( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API_FN SQLExtendedPrepareW( SQLHSTMT hStmt, + SQLWCHAR * pszSqlStrIn, + SQLINTEGER cbSqlStr, + SQLINTEGER cPars, + SQLSMALLINT sStmtType, + SQLINTEGER cStmtAttrs, + SQLINTEGER * piStmtAttr, + SQLINTEGER * pvParams ); + +SQLRETURN SQL_API SQLSetConnectAttrW( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValue); + +SQLRETURN SQL_API SQLSetCursorNameW( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursor); + +SQLRETURN SQL_API_FN SQLSetEnvAttrW( + SQLHENV hEnv, + SQLINTEGER fAttribute, + SQLPOINTER pParam, + SQLINTEGER cbParam ); + +SQLRETURN SQL_API SQLColumnsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLGetInfoW( + SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT *pcbInfoValue); + +SQLRETURN SQL_API_FN SQLGetConnectOptionW( + SQLHDBC hDbc, + SQLUSMALLINT fOptionIn, + SQLPOINTER pvParam ); + +SQLRETURN SQL_API_FN SQLSetConnectOptionW( + SQLHDBC hDbc, + SQLUSMALLINT fOptionIn, + SQLULEN vParam ); + +SQLRETURN SQL_API_FN SQLGetTypeInfoW( + SQLHSTMT hstmt, + SQLSMALLINT fSqlType); + +SQLRETURN SQL_API SQLSpecialColumnsW( + SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); + +SQLRETURN SQL_API SQLStatisticsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + SQLUSMALLINT fAccuracy); + +SQLRETURN SQL_API SQLTablesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szTableType, + SQLSMALLINT cbTableType); + + + +SQLRETURN SQL_API SQLDataSourcesW( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSNMax, + SQLSMALLINT *pcbDSN, + SQLWCHAR *szDescription, + SQLSMALLINT cbDescriptionMax, + SQLSMALLINT *pcbDescription); + + + + +SQLRETURN SQL_API SQLDriverConnectW( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + + +SQLRETURN SQL_API SQLBrowseConnectW( + SQLHDBC hdbc, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +SQLRETURN SQL_API SQLColumnPrivilegesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLGetStmtAttrW( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLSetStmtAttrW( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax); + +SQLRETURN SQL_API SQLForeignKeysW( + SQLHSTMT hstmt, + SQLWCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLWCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLWCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLWCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLWCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLWCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + + +SQLRETURN SQL_API SQLNativeSqlW( + SQLHDBC hdbc, + SQLWCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + + +SQLRETURN SQL_API SQLPrimaryKeysW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLProcedureColumnsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLProceduresW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName); + + +SQLRETURN SQL_API SQLTablePrivilegesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); + + +/* + * DB2 specific CLI APIs + */ + +SQLRETURN SQL_API_FN SQLBindFileToCol (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLCHAR FAR *FileName, + SQLSMALLINT FAR *FileNameLength, + SQLUINTEGER FAR *FileOptions, + SQLSMALLINT MaxFileNameLength, + SQLINTEGER FAR *StringLength, + SQLINTEGER FAR *IndicatorValue); + +SQLRETURN SQL_API_FN SQLBindFileToParam(SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fSqlType, + SQLCHAR FAR *FileName, + SQLSMALLINT FAR *FileNameLength, + SQLUINTEGER FAR *FileOptions, + SQLSMALLINT MaxFileNameLength, + SQLINTEGER FAR *IndicatorValue); + +SQLRETURN SQL_API_FN SQLGetLength (SQLHSTMT hstmt, + SQLSMALLINT LocatorCType, + SQLINTEGER Locator, + SQLINTEGER FAR *StringLength, + SQLINTEGER FAR *IndicatorValue); + +SQLRETURN SQL_API_FN SQLGetPosition (SQLHSTMT hstmt, + SQLSMALLINT LocatorCType, + SQLINTEGER SourceLocator, + SQLINTEGER SearchLocator, + SQLCHAR FAR *SearchLiteral, + SQLINTEGER SearchLiteralLength, + SQLUINTEGER FromPosition, + SQLUINTEGER FAR *LocatedAt, + SQLINTEGER FAR *IndicatorValue); + + +SQLRETURN SQL_API_FN SQLGetSQLCA (SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + struct sqlca FAR *pSqlca ); + +SQLRETURN SQL_API_FN SQLGetSubString (SQLHSTMT hstmt, + SQLSMALLINT LocatorCType, + SQLINTEGER SourceLocator, + SQLUINTEGER FromPosition, + SQLUINTEGER ForLength, + SQLSMALLINT TargetCType, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER FAR *StringLength, + SQLINTEGER FAR *IndicatorValue); + +SQLRETURN SQL_API_FN SQLSetColAttributes (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLCHAR FAR *pszColName, + SQLSMALLINT cbColName, + SQLSMALLINT fSQLType, + SQLUINTEGER cbColDef, + SQLSMALLINT ibScale, + SQLSMALLINT fNullable); + +/* + * Set active connection API, for use in conjunction with embedded + * SQL programming only. + */ +SQLRETURN SQL_API_FN SQLSetConnection (SQLHDBC hdbc); + +/* + * APIs defined only by X/Open CLI + */ + +SQLRETURN SQL_API_FN SQLGetEnvAttr (SQLHENV henv, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER FAR *StringLength); + +SQLRETURN SQL_API_FN SQLSetEnvAttr (SQLHENV henv, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER StringLength); + +SQLRETURN SQL_API_FN SQLBindParam( SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, + SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, + SQLPOINTER ParameterValue, + SQLLEN *StrLen_or_Ind); + +/* + * Data link functions. + */ + +SQLRETURN SQL_API_FN SQLBuildDataLink( SQLHSTMT hStmt, + SQLCHAR FAR * pszLinkType, + SQLINTEGER cbLinkType, + SQLCHAR FAR * pszDataLocation, + SQLINTEGER cbDataLocation, + SQLCHAR FAR * pszComment, + SQLINTEGER cbComment, + SQLCHAR FAR * pDataLink, + SQLINTEGER cbDataLinkMax, + SQLINTEGER FAR * pcbDataLink ); + +SQLRETURN SQL_API_FN SQLGetDataLinkAttr( SQLHSTMT hStmt, + SQLSMALLINT fAttrType, + SQLCHAR FAR * pDataLink, + SQLINTEGER cbDataLink, + SQLPOINTER pAttribute, + SQLINTEGER cbAttributeMax, + SQLINTEGER * pcbAttribute ); + +/* + * DB2 CLI APIs + */ + +SQLRETURN SQL_API_FN SQLExtendedPrepare( SQLHSTMT hstmt, + SQLCHAR * pszSqlStmt, + SQLINTEGER cbSqlStmt, + SQLINTEGER cPars, + SQLSMALLINT sStmtType, + SQLINTEGER cStmtAttrs, + SQLINTEGER * piStmtAttr, + SQLINTEGER * pvParams ); + +SQLRETURN SQL_API_FN SQLExtendedBind (SQLHSTMT hstmt, + SQLSMALLINT fBindCol, + SQLSMALLINT cRecords, + SQLSMALLINT * pfCType, + SQLPOINTER * rgbValue, + SQLINTEGER * cbValueMax, + SQLUINTEGER * puiPrecisionCType, + SQLSMALLINT * psScaleCType, + SQLINTEGER ** pcbValue, + SQLINTEGER ** piIndicatorPtr, + SQLSMALLINT * pfParamType, + SQLSMALLINT * pfSQLType, + SQLUINTEGER * pcbColDef, + SQLSMALLINT * pibScale ); + +#ifdef __cplusplus +} +#endif + +#define SQL_C_WCHAR SQL_WCHAR +#ifdef UNICODE +#define SQL_C_TCHAR SQL_C_WCHAR +typedef SQLWCHAR SQLTCHAR; +#else +#define SQL_C_TCHAR SQL_C_CHAR +typedef SQLCHAR SQLTCHAR; +#endif + +#define SQLConnectWInt SQLConnectW + +#ifdef UNICODE +#define SQLColAttribute SQLColAttributeW +#define SQLColAttributes SQLColAttributesW +#define SQLConnect SQLConnectW +#define SQLDescribeCol SQLDescribeColW +#define SQLError SQLErrorW +#define SQLExecDirect SQLExecDirectW +#define SQLGetConnectAttr SQLGetConnectAttrW +#define SQLGetCursorName SQLGetCursorNameW +#define SQLGetDescField SQLGetDescFieldW +#define SQLGetDescRec SQLGetDescRecW +#define SQLGetDiagField SQLGetDiagFieldW +#define SQLGetDiagRec SQLGetDiagRecW +#define SQLGetEnvAttr SQLGetEnvAttrW +#define SQLPrepare SQLPrepareW +#define SQLSetConnectAttr SQLSetConnectAttrW +#define SQLSetCursorName SQLSetCursorNameW +#define SQLSetDescField SQLSetDescFieldW +#define SQLSetEnvAttr SQLSetEnvAttrW +#define SQLSetStmtAttr SQLSetStmtAttrW +#define SQLGetStmtAttr SQLGetStmtAttrW +#define SQLColumns SQLColumnsW +#define SQLGetInfo SQLGetInfoW +#define SQLSpecialColumns SQLSpecialColumnsW +#define SQLStatistics SQLStatisticsW +#define SQLTables SQLTablesW +#define SQLDataSources SQLDataSourcesW +#define SQLDriverConnect SQLDriverConnectW +#define SQLBrowseConnect SQLBrowseConnectW +#define SQLColumnPrivileges SQLColumnPrivilegesW +#define SQLForeignKeys SQLForeignKeysW +#define SQLNativeSql SQLNativeSqlW +#define SQLPrimaryKeys SQLPrimaryKeysW +#define SQLProcedureColumns SQLProcedureColumnsW +#define SQLProcedures SQLProceduresW +#define SQLTablePrivileges SQLTablePrivilegesW +#endif /* UNICODE */ + +#ifdef DB2_WINSOCKAPI_ +#undef _WINSOCKAPI_ +#undef DB2_WINSOCKAPI_ +#endif + +#endif /* SQL_H_SQLCLI1 */ diff --git a/libraries/SQLAPI/include/db2_win/sqlext.h b/libraries/SQLAPI/include/db2_win/sqlext.h new file mode 100644 index 000000000..1dcf5d7e4 --- /dev/null +++ b/libraries/SQLAPI/include/db2_win/sqlext.h @@ -0,0 +1,2065 @@ +/***************************************************************** +** SQLEXT.H - This is the include for applications using +** the Microsoft SQL Extensions +** +** (C) Copyright 1990 - 1998 By Microsoft Corp. +** +** Updated 05/12/93 for 2.00 specification +** Updated 05/23/94 for 2.01 specification +** Updated 10/27/94 for 2.10 specification +** Updated 04/10/95 for 2.50 specification +** Updated 07/25/95 for 3.00 specification +** Updated 01/12/96 for 3.00 preliminary release +** Updated 10/22/97 for 3.51 specification +*********************************************************************/ + +#ifndef __SQLEXT +#define __SQLEXT + +/* ODBC64 should be used instead of CLI_WIN64 for linking with libdb2o.dll */ +#ifndef ODBC64 +#ifdef CLI_WIN64 +#define ODBC64 +#endif +#endif + +#ifndef __SQL +#include "sql.h" +#endif + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +/* generally useful constants */ +#define SQL_SPEC_MAJOR 3 /* Major version of specification */ +#define SQL_SPEC_MINOR 51 /* Minor version of specification */ +#define SQL_SPEC_STRING "03.51" /* String constant for version */ + +#define SQL_SQLSTATE_SIZE 5 /* size of SQLSTATE */ +#define SQL_MAX_DSN_LENGTH 32 /* maximum data source name size */ + +#define SQL_MAX_OPTION_STRING_LENGTH 256 + +/* return code SQL_NO_DATA_FOUND is the same as SQL_NO_DATA */ +#if (ODBCVER < 0x0300) +#define SQL_NO_DATA_FOUND 100 +#else +#define SQL_NO_DATA_FOUND SQL_NO_DATA +#endif + +/* an end handle type */ +#if (ODBCVER >= 0x0300) +#define SQL_HANDLE_SENV 5 +#endif /* ODBCVER >= 0x0300 */ + +/* env attribute */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ODBC_VERSION 200 +#define SQL_ATTR_CONNECTION_POOLING 201 +#define SQL_ATTR_CP_MATCH 202 +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER >= 0x0300) +/* values for SQL_ATTR_CONNECTION_POOLING */ +#define SQL_CP_OFF 0UL +#define SQL_CP_ONE_PER_DRIVER 1UL +#define SQL_CP_ONE_PER_HENV 2UL +#define SQL_CP_DEFAULT SQL_CP_OFF + +/* values for SQL_ATTR_CP_MATCH */ +#define SQL_CP_STRICT_MATCH 0UL +#define SQL_CP_RELAXED_MATCH 1UL +#define SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH + +/* values for SQL_ATTR_ODBC_VERSION */ +#define SQL_OV_ODBC2 2UL +#define SQL_OV_ODBC3 3UL +#endif /* ODBCVER >= 0x0300 */ + +/* connection attributes */ +#define SQL_ACCESS_MODE 101 +#define SQL_AUTOCOMMIT 102 +#define SQL_LOGIN_TIMEOUT 103 +#define SQL_OPT_TRACE 104 +#define SQL_OPT_TRACEFILE 105 +#define SQL_TRANSLATE_DLL 106 +#define SQL_TRANSLATE_OPTION 107 +#define SQL_TXN_ISOLATION 108 +#define SQL_CURRENT_QUALIFIER 109 +#define SQL_ODBC_CURSORS 110 +#define SQL_QUIET_MODE 111 +#define SQL_PACKET_SIZE 112 + +/* connection attributes with new names */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE +#define SQL_ATTR_AUTOCOMMIT SQL_AUTOCOMMIT +#define SQL_ATTR_CONNECTION_TIMEOUT 113 +#define SQL_ATTR_CURRENT_CATALOG SQL_CURRENT_QUALIFIER +#define SQL_ATTR_DISCONNECT_BEHAVIOR 114 +#define SQL_ATTR_ENLIST_IN_DTC 1207 +#define SQL_ATTR_ENLIST_IN_XA 1208 +#define SQL_ATTR_LOGIN_TIMEOUT SQL_LOGIN_TIMEOUT +#define SQL_ATTR_ODBC_CURSORS SQL_ODBC_CURSORS +#define SQL_ATTR_PACKET_SIZE SQL_PACKET_SIZE +#define SQL_ATTR_QUIET_MODE SQL_QUIET_MODE +#define SQL_ATTR_TRACE SQL_OPT_TRACE +#define SQL_ATTR_TRACEFILE SQL_OPT_TRACEFILE +#define SQL_ATTR_TRANSLATE_LIB SQL_TRANSLATE_DLL +#define SQL_ATTR_TRANSLATE_OPTION SQL_TRANSLATE_OPTION +#define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION +#endif /* ODBCVER >= 0x0300 */ + +#define SQL_ATTR_CONNECTION_DEAD 1209 /* GetConnectAttr only */ + +#if (ODBCVER >= 0x0351) +/* ODBC Driver Manager sets this connection attribute to a unicode driver + (which supports SQLConnectW) when the application is an ANSI application + (which calls SQLConnect, SQLDriverConnect, or SQLBrowseConnect). + This is SetConnectAttr only and application does not set this attribute + This attribute was introduced because some unicode driver's some APIs may + need to behave differently on ANSI or Unicode applications. A unicode + driver, which has same behavior for both ANSI or Unicode applications, + should return SQL_ERROR when the driver manager sets this connection + attribute. When a unicode driver returns SQL_SUCCESS on this attribute, + the driver manager treates ANSI and Unicode connections differently in + connection pooling. +*/ +#define SQL_ATTR_ANSI_APP 115 +#endif + +/* SQL_CONNECT_OPT_DRVR_START is not meaningful for 3.0 driver */ +#if (ODBCVER < 0x0300) +#define SQL_CONNECT_OPT_DRVR_START 1000 +#endif /* ODBCVER < 0x0300 */ + +#if (ODBCVER < 0x0300) +#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE +#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE +#endif /* ODBCVER < 0x0300 */ + +/* SQL_ACCESS_MODE options */ +#define SQL_MODE_READ_WRITE 0UL +#define SQL_MODE_READ_ONLY 1UL +#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE + +/* SQL_AUTOCOMMIT options */ +#define SQL_AUTOCOMMIT_OFF 0UL +#define SQL_AUTOCOMMIT_ON 1UL +#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON + +/* SQL_LOGIN_TIMEOUT options */ +#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL + +/* SQL_OPT_TRACE options */ +#define SQL_OPT_TRACE_OFF 0UL +#define SQL_OPT_TRACE_ON 1UL +#define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF +#define SQL_OPT_TRACE_FILE_DEFAULT "\\SQL.LOG" + +/* SQL_ODBC_CURSORS options */ +#define SQL_CUR_USE_IF_NEEDED 0UL +#define SQL_CUR_USE_ODBC 1UL +#define SQL_CUR_USE_DRIVER 2UL +#define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER + +#if (ODBCVER >= 0x0300) +/* values for SQL_ATTR_DISCONNECT_BEHAVIOR */ +#define SQL_DB_RETURN_TO_POOL 0UL +#define SQL_DB_DISCONNECT 1UL +#define SQL_DB_DEFAULT SQL_DB_RETURN_TO_POOL + +/* values for SQL_ATTR_ENLIST_IN_DTC */ +#define SQL_DTC_DONE 0L +#endif /* ODBCVER >= 0x0300 */ + +/* values for SQL_ATTR_CONNECTION_DEAD */ +#define SQL_CD_TRUE 1L /* Connection is closed/dead */ +#define SQL_CD_FALSE 0L /* Connection is open/available */ + +/* values for SQL_ATTR_ANSI_APP */ +#if (ODBCVER >= 0x0351) +#define SQL_AA_TRUE 1L /* the application is an ANSI app */ +#define SQL_AA_FALSE 0L /* the application is a Unicode app */ +#endif + +/* statement attributes */ +#define SQL_QUERY_TIMEOUT 0 +#define SQL_MAX_ROWS 1 +#define SQL_NOSCAN 2 +#define SQL_MAX_LENGTH 3 +#define SQL_ASYNC_ENABLE 4 /* same as SQL_ATTR_ASYNC_ENABLE */ +#define SQL_BIND_TYPE 5 +#define SQL_CURSOR_TYPE 6 +#define SQL_CONCURRENCY 7 +#define SQL_KEYSET_SIZE 8 +#define SQL_ROWSET_SIZE 9 +#define SQL_SIMULATE_CURSOR 10 +#define SQL_RETRIEVE_DATA 11 +#define SQL_USE_BOOKMARKS 12 +#define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */ +#define SQL_ROW_NUMBER 14 /* GetStmtOption Only */ + +/* statement attributes for ODBC 3.0 */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ASYNC_ENABLE 4 +#define SQL_ATTR_CONCURRENCY SQL_CONCURRENCY +#define SQL_ATTR_CURSOR_TYPE SQL_CURSOR_TYPE +#define SQL_ATTR_ENABLE_AUTO_IPD 15 +#define SQL_ATTR_FETCH_BOOKMARK_PTR 16 +#define SQL_ATTR_KEYSET_SIZE SQL_KEYSET_SIZE +#define SQL_ATTR_MAX_LENGTH SQL_MAX_LENGTH +#define SQL_ATTR_MAX_ROWS SQL_MAX_ROWS +#define SQL_ATTR_NOSCAN SQL_NOSCAN +#define SQL_ATTR_PARAM_BIND_OFFSET_PTR 17 +#define SQL_ATTR_PARAM_BIND_TYPE 18 +#define SQL_ATTR_PARAM_OPERATION_PTR 19 +#define SQL_ATTR_PARAM_STATUS_PTR 20 +#define SQL_ATTR_PARAMS_PROCESSED_PTR 21 +#define SQL_ATTR_PARAMSET_SIZE 22 +#define SQL_ATTR_QUERY_TIMEOUT SQL_QUERY_TIMEOUT +#define SQL_ATTR_RETRIEVE_DATA SQL_RETRIEVE_DATA +#define SQL_ATTR_ROW_BIND_OFFSET_PTR 23 +#define SQL_ATTR_ROW_BIND_TYPE SQL_BIND_TYPE +#define SQL_ATTR_ROW_NUMBER SQL_ROW_NUMBER /*GetStmtAttr*/ +#define SQL_ATTR_ROW_OPERATION_PTR 24 +#define SQL_ATTR_ROW_STATUS_PTR 25 +#define SQL_ATTR_ROWS_FETCHED_PTR 26 +#define SQL_ATTR_ROW_ARRAY_SIZE 27 +#define SQL_ATTR_SIMULATE_CURSOR SQL_SIMULATE_CURSOR +#define SQL_ATTR_USE_BOOKMARKS SQL_USE_BOOKMARKS + +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER < 0x0300) +#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER +#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT +#endif /* ODBCVER < 0x0300 */ + +/* New defines for SEARCHABLE column in SQLGetTypeInfo */ + +#if (ODBCVER >= 0x0300) +#define SQL_COL_PRED_CHAR SQL_LIKE_ONLY +#define SQL_COL_PRED_BASIC SQL_ALL_EXCEPT_LIKE +#endif /* ODBCVER >= 0x0300 */ + + + +/* whether an attribute is a pointer or not */ +#if (ODBCVER >= 0x0300) +#define SQL_IS_POINTER (-4) +#define SQL_IS_UINTEGER (-5) +#define SQL_IS_INTEGER (-6) +#define SQL_IS_USMALLINT (-7) +#define SQL_IS_SMALLINT (-8) +#endif /* ODBCVER >= 0x0300 */ + +/* the value of SQL_ATTR_PARAM_BIND_TYPE */ +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_BIND_BY_COLUMN 0UL +#define SQL_PARAM_BIND_TYPE_DEFAULT SQL_PARAM_BIND_BY_COLUMN +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_QUERY_TIMEOUT options */ +#define SQL_QUERY_TIMEOUT_DEFAULT 0UL + +/* SQL_MAX_ROWS options */ +#define SQL_MAX_ROWS_DEFAULT 0UL + +/* SQL_NOSCAN options */ +#define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */ +#define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */ +#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF + +/* SQL_MAX_LENGTH options */ +#define SQL_MAX_LENGTH_DEFAULT 0UL + +/* values for SQL_ATTR_ASYNC_ENABLE */ +#define SQL_ASYNC_ENABLE_OFF 0UL +#define SQL_ASYNC_ENABLE_ON 1UL +#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF + +/* SQL_BIND_TYPE options */ +#define SQL_BIND_BY_COLUMN 0UL +#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN /* Default value */ + +/* SQL_CONCURRENCY options */ +#define SQL_CONCUR_READ_ONLY 1 +#define SQL_CONCUR_LOCK 2 +#define SQL_CONCUR_ROWVER 3 +#define SQL_CONCUR_VALUES 4 +#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY /* Default value */ + +/* SQL_CURSOR_TYPE options */ +#define SQL_CURSOR_FORWARD_ONLY 0UL +#define SQL_CURSOR_KEYSET_DRIVEN 1UL +#define SQL_CURSOR_DYNAMIC 2UL +#define SQL_CURSOR_STATIC 3UL +#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY /* Default value */ + +/* SQL_ROWSET_SIZE options */ +#define SQL_ROWSET_SIZE_DEFAULT 1UL + +/* SQL_KEYSET_SIZE options */ +#define SQL_KEYSET_SIZE_DEFAULT 0UL + +/* SQL_SIMULATE_CURSOR options */ +#define SQL_SC_NON_UNIQUE 0UL +#define SQL_SC_TRY_UNIQUE 1UL +#define SQL_SC_UNIQUE 2UL + +/* SQL_RETRIEVE_DATA options */ +#define SQL_RD_OFF 0UL +#define SQL_RD_ON 1UL +#define SQL_RD_DEFAULT SQL_RD_ON + +/* SQL_USE_BOOKMARKS options */ +#define SQL_UB_OFF 0UL +#define SQL_UB_ON 01UL +#define SQL_UB_DEFAULT SQL_UB_OFF + +/* New values for SQL_USE_BOOKMARKS attribute */ +#if (ODBCVER >= 0x0300) +#define SQL_UB_FIXED SQL_UB_ON +#define SQL_UB_VARIABLE 2UL +#endif /* ODBCVER >= 0x0300 */ + +/* extended descriptor field */ +#if (ODBCVER >= 0x0300) +#define SQL_DESC_ARRAY_SIZE 20 +#define SQL_DESC_ARRAY_STATUS_PTR 21 +#define SQL_DESC_AUTO_UNIQUE_VALUE SQL_COLUMN_AUTO_INCREMENT +#define SQL_DESC_BASE_COLUMN_NAME 22 +#define SQL_DESC_BASE_TABLE_NAME 23 +#define SQL_DESC_BIND_OFFSET_PTR 24 +#define SQL_DESC_BIND_TYPE 25 +#define SQL_DESC_CASE_SENSITIVE SQL_COLUMN_CASE_SENSITIVE +#define SQL_DESC_CATALOG_NAME SQL_COLUMN_QUALIFIER_NAME +#define SQL_DESC_CONCISE_TYPE SQL_COLUMN_TYPE +#define SQL_DESC_DATETIME_INTERVAL_PRECISION 26 +#define SQL_DESC_DISPLAY_SIZE SQL_COLUMN_DISPLAY_SIZE +#define SQL_DESC_FIXED_PREC_SCALE SQL_COLUMN_MONEY +#define SQL_DESC_LABEL SQL_COLUMN_LABEL +#define SQL_DESC_LITERAL_PREFIX 27 +#define SQL_DESC_LITERAL_SUFFIX 28 +#define SQL_DESC_LOCAL_TYPE_NAME 29 +#define SQL_DESC_MAXIMUM_SCALE 30 +#define SQL_DESC_MINIMUM_SCALE 31 +#define SQL_DESC_NUM_PREC_RADIX 32 +#define SQL_DESC_PARAMETER_TYPE 33 +#define SQL_DESC_ROWS_PROCESSED_PTR 34 +#if (ODBCVER >= 0x0350) +#define SQL_DESC_ROWVER 35 +#endif /* ODBCVER >= 0x0350 */ +#define SQL_DESC_SCHEMA_NAME SQL_COLUMN_OWNER_NAME +#define SQL_DESC_SEARCHABLE SQL_COLUMN_SEARCHABLE +#define SQL_DESC_TYPE_NAME SQL_COLUMN_TYPE_NAME +#define SQL_DESC_TABLE_NAME SQL_COLUMN_TABLE_NAME +#define SQL_DESC_UNSIGNED SQL_COLUMN_UNSIGNED +#define SQL_DESC_UPDATABLE SQL_COLUMN_UPDATABLE +#endif /* ODBCVER >= 0x0300 */ + + +/* defines for diagnostics fields */ +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_CURSOR_ROW_COUNT (-1249) +#define SQL_DIAG_ROW_NUMBER (-1248) +#define SQL_DIAG_COLUMN_NUMBER (-1247) +#endif /* ODBCVER >= 0x0300 */ + +/* SQL extended datatypes */ +#define SQL_DATE 9 +#if (ODBCVER >= 0x0300) +#define SQL_INTERVAL 10 +#endif /* ODBCVER >= 0x0300 */ +#define SQL_TIME 10 +#define SQL_TIMESTAMP 11 +#define SQL_LONGVARCHAR (-1) +#define SQL_BINARY (-2) +#define SQL_VARBINARY (-3) +#define SQL_LONGVARBINARY (-4) +#define SQL_BIGINT (-5) +#define SQL_TINYINT (-6) +#define SQL_BIT (-7) +#if (ODBCVER >= 0x0350) +#define SQL_GUID (-11) +#endif /* ODBCVER >= 0x0350 */ + +#if (ODBCVER >= 0x0300) +/* interval code */ +#define SQL_CODE_YEAR 1 +#define SQL_CODE_MONTH 2 +#define SQL_CODE_DAY 3 +#define SQL_CODE_HOUR 4 +#define SQL_CODE_MINUTE 5 +#define SQL_CODE_SECOND 6 +#define SQL_CODE_YEAR_TO_MONTH 7 +#define SQL_CODE_DAY_TO_HOUR 8 +#define SQL_CODE_DAY_TO_MINUTE 9 +#define SQL_CODE_DAY_TO_SECOND 10 +#define SQL_CODE_HOUR_TO_MINUTE 11 +#define SQL_CODE_HOUR_TO_SECOND 12 +#define SQL_CODE_MINUTE_TO_SECOND 13 + +#define SQL_INTERVAL_YEAR (100 + SQL_CODE_YEAR) +#define SQL_INTERVAL_MONTH (100 + SQL_CODE_MONTH) +#define SQL_INTERVAL_DAY (100 + SQL_CODE_DAY) +#define SQL_INTERVAL_HOUR (100 + SQL_CODE_HOUR) +#define SQL_INTERVAL_MINUTE (100 + SQL_CODE_MINUTE) +#define SQL_INTERVAL_SECOND (100 + SQL_CODE_SECOND) +#define SQL_INTERVAL_YEAR_TO_MONTH (100 + SQL_CODE_YEAR_TO_MONTH) +#define SQL_INTERVAL_DAY_TO_HOUR (100 + SQL_CODE_DAY_TO_HOUR) +#define SQL_INTERVAL_DAY_TO_MINUTE (100 + SQL_CODE_DAY_TO_MINUTE) +#define SQL_INTERVAL_DAY_TO_SECOND (100 + SQL_CODE_DAY_TO_SECOND) +#define SQL_INTERVAL_HOUR_TO_MINUTE (100 + SQL_CODE_HOUR_TO_MINUTE) +#define SQL_INTERVAL_HOUR_TO_SECOND (100 + SQL_CODE_HOUR_TO_SECOND) +#define SQL_INTERVAL_MINUTE_TO_SECOND (100 + SQL_CODE_MINUTE_TO_SECOND) + +#else +#define SQL_INTERVAL_YEAR (-80) +#define SQL_INTERVAL_MONTH (-81) +#define SQL_INTERVAL_YEAR_TO_MONTH (-82) +#define SQL_INTERVAL_DAY (-83) +#define SQL_INTERVAL_HOUR (-84) +#define SQL_INTERVAL_MINUTE (-85) +#define SQL_INTERVAL_SECOND (-86) +#define SQL_INTERVAL_DAY_TO_HOUR (-87) +#define SQL_INTERVAL_DAY_TO_MINUTE (-88) +#define SQL_INTERVAL_DAY_TO_SECOND (-89) +#define SQL_INTERVAL_HOUR_TO_MINUTE (-90) +#define SQL_INTERVAL_HOUR_TO_SECOND (-91) +#define SQL_INTERVAL_MINUTE_TO_SECOND (-92) +#endif /* ODBCVER >= 0x0300 */ + + +#if (ODBCVER <= 0x0300) +#define SQL_UNICODE (-95) +#define SQL_UNICODE_VARCHAR (-96) +#define SQL_UNICODE_LONGVARCHAR (-97) +#define SQL_UNICODE_CHAR SQL_UNICODE +#else +/* The previous definitions for SQL_UNICODE_ are historical and obsolete */ + +#define SQL_UNICODE SQL_WCHAR +#define SQL_UNICODE_VARCHAR SQL_WVARCHAR +#define SQL_UNICODE_LONGVARCHAR SQL_WLONGVARCHAR +#define SQL_UNICODE_CHAR SQL_WCHAR +#endif + +#if (ODBCVER < 0x0300) +#define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR +#define SQL_TYPE_DRIVER_END SQL_UNICODE_LONGVARCHAR +#endif /* ODBCVER < 0x0300 */ + +/* C datatype to SQL datatype mapping SQL types + ------------------- */ +#define SQL_C_CHAR SQL_CHAR /* CHAR, VARCHAR, DECIMAL, NUMERIC */ +#define SQL_C_LONG SQL_INTEGER /* INTEGER */ +#define SQL_C_SHORT SQL_SMALLINT /* SMALLINT */ +#define SQL_C_FLOAT SQL_REAL /* REAL */ +#define SQL_C_DOUBLE SQL_DOUBLE /* FLOAT, DOUBLE */ +#if (ODBCVER >= 0x0300) +#define SQL_C_NUMERIC SQL_NUMERIC +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_DEFAULT 99 + +#define SQL_SIGNED_OFFSET (-20) +#define SQL_UNSIGNED_OFFSET (-22) + +/* C datatype to SQL datatype mapping */ +#define SQL_C_DATE SQL_DATE +#define SQL_C_TIME SQL_TIME +#define SQL_C_TIMESTAMP SQL_TIMESTAMP +#if (ODBCVER >= 0x0300) +#define SQL_C_TYPE_DATE SQL_TYPE_DATE +#define SQL_C_TYPE_TIME SQL_TYPE_TIME +#define SQL_C_TYPE_TIMESTAMP SQL_TYPE_TIMESTAMP +#define SQL_C_INTERVAL_YEAR SQL_INTERVAL_YEAR +#define SQL_C_INTERVAL_MONTH SQL_INTERVAL_MONTH +#define SQL_C_INTERVAL_DAY SQL_INTERVAL_DAY +#define SQL_C_INTERVAL_HOUR SQL_INTERVAL_HOUR +#define SQL_C_INTERVAL_MINUTE SQL_INTERVAL_MINUTE +#define SQL_C_INTERVAL_SECOND SQL_INTERVAL_SECOND +#define SQL_C_INTERVAL_YEAR_TO_MONTH SQL_INTERVAL_YEAR_TO_MONTH +#define SQL_C_INTERVAL_DAY_TO_HOUR SQL_INTERVAL_DAY_TO_HOUR +#define SQL_C_INTERVAL_DAY_TO_MINUTE SQL_INTERVAL_DAY_TO_MINUTE +#define SQL_C_INTERVAL_DAY_TO_SECOND SQL_INTERVAL_DAY_TO_SECOND +#define SQL_C_INTERVAL_HOUR_TO_MINUTE SQL_INTERVAL_HOUR_TO_MINUTE +#define SQL_C_INTERVAL_HOUR_TO_SECOND SQL_INTERVAL_HOUR_TO_SECOND +#define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_BINARY SQL_BINARY +#define SQL_C_BIT SQL_BIT +#if (ODBCVER >= 0x0300) +#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) /* SIGNED BIGINT */ +#define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED BIGINT */ +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_TINYINT SQL_TINYINT +#define SQL_C_SLONG (SQL_C_LONG+SQL_SIGNED_OFFSET) /* SIGNED INTEGER */ +#define SQL_C_SSHORT (SQL_C_SHORT+SQL_SIGNED_OFFSET) /* SIGNED SMALLINT */ +#define SQL_C_STINYINT (SQL_TINYINT+SQL_SIGNED_OFFSET) /* SIGNED TINYINT */ +#define SQL_C_ULONG (SQL_C_LONG+SQL_UNSIGNED_OFFSET) /* UNSIGNED INTEGER*/ +#define SQL_C_USHORT (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED SMALLINT*/ +#define SQL_C_UTINYINT (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED TINYINT*/ + +#ifdef ODBC64 +#define SQL_C_BOOKMARK SQL_C_UBIGINT /* BOOKMARK */ +#else +#define SQL_C_BOOKMARK SQL_C_ULONG /* BOOKMARK */ +#endif + +#if (ODBCVER >= 0x0350) +#define SQL_C_GUID SQL_GUID +#endif /* ODBCVER >= 0x0350 */ + +#define SQL_TYPE_NULL 0 +#if (ODBCVER < 0x0300) +#define SQL_TYPE_MIN SQL_BIT +#define SQL_TYPE_MAX SQL_VARCHAR +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_C_VARBOOKMARK SQL_C_BINARY +#endif /* ODBCVER >= 0x0300 */ + +/* define for SQL_DIAG_ROW_NUMBER and SQL_DIAG_COLUMN_NUMBER */ +#if (ODBCVER >= 0x0300) +#define SQL_NO_ROW_NUMBER (-1) +#define SQL_NO_COLUMN_NUMBER (-1) +#define SQL_ROW_NUMBER_UNKNOWN (-2) +#define SQL_COLUMN_NUMBER_UNKNOWN (-2) +#endif + +/* SQLBindParameter extensions */ +#define SQL_DEFAULT_PARAM (-5) +#define SQL_IGNORE (-6) +#if (ODBCVER >= 0x0300) +#define SQL_COLUMN_IGNORE SQL_IGNORE +#endif /* ODBCVER >= 0x0300 */ +#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) +#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET) + +/* binary length for driver specific attributes */ +#define SQL_LEN_BINARY_ATTR_OFFSET (-100) +#define SQL_LEN_BINARY_ATTR(length) (-(length)+SQL_LEN_BINARY_ATTR_OFFSET) + +/* Defines used by Driver Manager when mapping SQLSetParam to SQLBindParameter +*/ +#define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT +#define SQL_SETPARAM_VALUE_MAX (-1L) + +/* SQLColAttributes defines */ +#define SQL_COLUMN_COUNT 0 +#define SQL_COLUMN_NAME 1 +#define SQL_COLUMN_TYPE 2 +#define SQL_COLUMN_LENGTH 3 +#define SQL_COLUMN_PRECISION 4 +#define SQL_COLUMN_SCALE 5 +#define SQL_COLUMN_DISPLAY_SIZE 6 +#define SQL_COLUMN_NULLABLE 7 +#define SQL_COLUMN_UNSIGNED 8 +#define SQL_COLUMN_MONEY 9 +#define SQL_COLUMN_UPDATABLE 10 +#define SQL_COLUMN_AUTO_INCREMENT 11 +#define SQL_COLUMN_CASE_SENSITIVE 12 +#define SQL_COLUMN_SEARCHABLE 13 +#define SQL_COLUMN_TYPE_NAME 14 +#define SQL_COLUMN_TABLE_NAME 15 +#define SQL_COLUMN_OWNER_NAME 16 +#define SQL_COLUMN_QUALIFIER_NAME 17 +#define SQL_COLUMN_LABEL 18 +#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL +#if (ODBCVER < 0x0300) +#define SQL_COLUMN_DRIVER_START 1000 +#endif /* ODBCVER < 0x0300 */ + +#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT + +/* SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE */ +#define SQL_ATTR_READONLY 0 +#define SQL_ATTR_WRITE 1 +#define SQL_ATTR_READWRITE_UNKNOWN 2 + +/* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */ +/* These are also used by SQLGetInfo */ +#define SQL_UNSEARCHABLE 0 +#define SQL_LIKE_ONLY 1 +#define SQL_ALL_EXCEPT_LIKE 2 +#define SQL_SEARCHABLE 3 +#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE + + +/* Special return values for SQLGetData */ +#define SQL_NO_TOTAL (-4) + +/********************************************/ +/* SQLGetFunctions: additional values for */ +/* fFunction to represent functions that */ +/* are not in the X/Open spec. */ +/********************************************/ + +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLALLOCHANDLESTD 73 +#define SQL_API_SQLBULKOPERATIONS 24 +#endif /* ODBCVER >= 0x0300 */ +#define SQL_API_SQLBINDPARAMETER 72 +#define SQL_API_SQLBROWSECONNECT 55 +#define SQL_API_SQLCOLATTRIBUTES 6 +#define SQL_API_SQLCOLUMNPRIVILEGES 56 +#define SQL_API_SQLDESCRIBEPARAM 58 +#define SQL_API_SQLDRIVERCONNECT 41 +#define SQL_API_SQLDRIVERS 71 +#define SQL_API_SQLEXTENDEDFETCH 59 +#define SQL_API_SQLFOREIGNKEYS 60 +#define SQL_API_SQLMORERESULTS 61 +#define SQL_API_SQLNATIVESQL 62 +#define SQL_API_SQLNUMPARAMS 63 +#define SQL_API_SQLPARAMOPTIONS 64 +#define SQL_API_SQLPRIMARYKEYS 65 +#define SQL_API_SQLPROCEDURECOLUMNS 66 +#define SQL_API_SQLPROCEDURES 67 +#define SQL_API_SQLSETPOS 68 +#define SQL_API_SQLSETSCROLLOPTIONS 69 +#define SQL_API_SQLTABLEPRIVILEGES 70 + +/*-------------------------------------------*/ +/* SQL_EXT_API_LAST is not useful with ODBC */ +/* version 3.0 because some of the values */ +/* from X/Open are in the 10000 range. */ +/*-------------------------------------------*/ + +#if (ODBCVER < 0x0300) +#define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER +#define SQL_NUM_FUNCTIONS 23 +#define SQL_EXT_API_START 40 +#define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1) +#endif + +/*--------------------------------------------*/ +/* SQL_API_ALL_FUNCTIONS returns an array */ +/* of 'booleans' representing whether a */ +/* function is implemented by the driver. */ +/* */ +/* CAUTION: Only functions defined in ODBC */ +/* version 2.0 and earlier are returned, the */ +/* new high-range function numbers defined by */ +/* X/Open break this scheme. See the new */ +/* method -- SQL_API_ODBC3_ALL_FUNCTIONS */ +/*--------------------------------------------*/ + +#define SQL_API_ALL_FUNCTIONS 0 /* See CAUTION above */ + +/*----------------------------------------------*/ +/* 2.X drivers export a dummy function with */ +/* ordinal number SQL_API_LOADBYORDINAL to speed*/ +/* loading under the windows operating system. */ +/* */ +/* CAUTION: Loading by ordinal is not supported */ +/* for 3.0 and above drivers. */ +/*----------------------------------------------*/ + +#define SQL_API_LOADBYORDINAL 199 /* See CAUTION above */ + +/*----------------------------------------------*/ +/* SQL_API_ODBC3_ALL_FUNCTIONS */ +/* This returns a bitmap, which allows us to */ +/* handle the higher-valued function numbers. */ +/* Use SQL_FUNC_EXISTS(bitmap,function_number) */ +/* to determine if the function exists. */ +/*----------------------------------------------*/ + + +#if (ODBCVER >= 0x0300) +#define SQL_API_ODBC3_ALL_FUNCTIONS 999 +#define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE 250 /* array of 250 words */ + +#define SQL_FUNC_EXISTS(pfExists, uwAPI) \ + ((*(((UWORD*) (pfExists)) + ((uwAPI) >> 4)) \ + & (1 << ((uwAPI) & 0x000F)) \ + ) ? SQL_TRUE : SQL_FALSE \ + ) +#endif /* ODBCVER >= 0x0300 */ + + +/************************************************/ +/* Extended definitions for SQLGetInfo */ +/************************************************/ + +/*---------------------------------*/ +/* Values in ODBC 2.0 that are not */ +/* in the X/Open spec */ +/*---------------------------------*/ + +#define SQL_INFO_FIRST 0 +#define SQL_ACTIVE_CONNECTIONS 0 /* MAX_DRIVER_CONNECTIONS */ +#define SQL_ACTIVE_STATEMENTS 1 /* MAX_CONCURRENT_ACTIVITIES */ +#define SQL_DRIVER_HDBC 3 +#define SQL_DRIVER_HENV 4 +#define SQL_DRIVER_HSTMT 5 +#define SQL_DRIVER_NAME 6 +#define SQL_DRIVER_VER 7 +#define SQL_ODBC_API_CONFORMANCE 9 +#define SQL_ODBC_VER 10 +#define SQL_ROW_UPDATES 11 +#define SQL_ODBC_SAG_CLI_CONFORMANCE 12 +#define SQL_ODBC_SQL_CONFORMANCE 15 +#define SQL_PROCEDURES 21 +#define SQL_CONCAT_NULL_BEHAVIOR 22 +#define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 +#define SQL_EXPRESSIONS_IN_ORDERBY 27 +#define SQL_MAX_OWNER_NAME_LEN 32 /* MAX_SCHEMA_NAME_LEN */ +#define SQL_MAX_PROCEDURE_NAME_LEN 33 +#define SQL_MAX_QUALIFIER_NAME_LEN 34 /* MAX_CATALOG_NAME_LEN */ +#define SQL_MULT_RESULT_SETS 36 +#define SQL_MULTIPLE_ACTIVE_TXN 37 +#define SQL_OUTER_JOINS 38 +#define SQL_OWNER_TERM 39 +#define SQL_PROCEDURE_TERM 40 +#define SQL_QUALIFIER_NAME_SEPARATOR 41 +#define SQL_QUALIFIER_TERM 42 +#define SQL_SCROLL_OPTIONS 44 +#define SQL_TABLE_TERM 45 +#define SQL_CONVERT_FUNCTIONS 48 +#define SQL_NUMERIC_FUNCTIONS 49 +#define SQL_STRING_FUNCTIONS 50 +#define SQL_SYSTEM_FUNCTIONS 51 +#define SQL_TIMEDATE_FUNCTIONS 52 +#define SQL_CONVERT_BIGINT 53 +#define SQL_CONVERT_BINARY 54 +#define SQL_CONVERT_BIT 55 +#define SQL_CONVERT_CHAR 56 +#define SQL_CONVERT_DATE 57 +#define SQL_CONVERT_DECIMAL 58 +#define SQL_CONVERT_DOUBLE 59 +#define SQL_CONVERT_FLOAT 60 +#define SQL_CONVERT_INTEGER 61 +#define SQL_CONVERT_LONGVARCHAR 62 +#define SQL_CONVERT_NUMERIC 63 +#define SQL_CONVERT_REAL 64 +#define SQL_CONVERT_SMALLINT 65 +#define SQL_CONVERT_TIME 66 +#define SQL_CONVERT_TIMESTAMP 67 +#define SQL_CONVERT_TINYINT 68 +#define SQL_CONVERT_VARBINARY 69 +#define SQL_CONVERT_VARCHAR 70 +#define SQL_CONVERT_LONGVARBINARY 71 +#define SQL_ODBC_SQL_OPT_IEF 73 /* SQL_INTEGRITY */ +#define SQL_CORRELATION_NAME 74 +#define SQL_NON_NULLABLE_COLUMNS 75 +#define SQL_DRIVER_HLIB 76 +#define SQL_DRIVER_ODBC_VER 77 +#define SQL_LOCK_TYPES 78 +#define SQL_POS_OPERATIONS 79 +#define SQL_POSITIONED_STATEMENTS 80 +#define SQL_BOOKMARK_PERSISTENCE 82 +#define SQL_STATIC_SENSITIVITY 83 +#define SQL_FILE_USAGE 84 +#define SQL_COLUMN_ALIAS 87 +#define SQL_GROUP_BY 88 +#define SQL_KEYWORDS 89 +#define SQL_OWNER_USAGE 91 +#define SQL_QUALIFIER_USAGE 92 +#define SQL_QUOTED_IDENTIFIER_CASE 93 +#define SQL_SUBQUERIES 95 +#define SQL_UNION 96 +#define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103 +#define SQL_MAX_CHAR_LITERAL_LEN 108 +#define SQL_TIMEDATE_ADD_INTERVALS 109 +#define SQL_TIMEDATE_DIFF_INTERVALS 110 +#define SQL_NEED_LONG_DATA_LEN 111 +#define SQL_MAX_BINARY_LITERAL_LEN 112 +#define SQL_LIKE_ESCAPE_CLAUSE 113 +#define SQL_QUALIFIER_LOCATION 114 + +#if (ODBCVER >= 0x0201 && ODBCVER < 0x0300) +#define SQL_OJ_CAPABILITIES 65003 /* Temp value until ODBC 3.0 */ +#endif /* ODBCVER >= 0x0201 && ODBCVER < 0x0300 */ + +/*----------------------------------------------*/ +/* SQL_INFO_LAST and SQL_INFO_DRIVER_START are */ +/* not useful anymore, because X/Open has */ +/* values in the 10000 range. You */ +/* must contact X/Open directly to get a range */ +/* of numbers for driver-specific values. */ +/*----------------------------------------------*/ + +#if (ODBCVER < 0x0300) +#define SQL_INFO_LAST SQL_QUALIFIER_LOCATION +#define SQL_INFO_DRIVER_START 1000 +#endif /* ODBCVER < 0x0300 */ + +/*-----------------------------------------------*/ +/* ODBC 3.0 SQLGetInfo values that are not part */ +/* of the X/Open standard at this time. X/Open */ +/* standard values are in sql.h. */ +/*-----------------------------------------------*/ + +#if (ODBCVER >= 0x0300) +#define SQL_ACTIVE_ENVIRONMENTS 116 +#define SQL_ALTER_DOMAIN 117 + +#define SQL_SQL_CONFORMANCE 118 +#define SQL_DATETIME_LITERALS 119 + +#define SQL_ASYNC_MODE 10021 /* new X/Open spec */ +#define SQL_BATCH_ROW_COUNT 120 +#define SQL_BATCH_SUPPORT 121 +#define SQL_CATALOG_LOCATION SQL_QUALIFIER_LOCATION +#define SQL_CATALOG_NAME_SEPARATOR SQL_QUALIFIER_NAME_SEPARATOR +#define SQL_CATALOG_TERM SQL_QUALIFIER_TERM +#define SQL_CATALOG_USAGE SQL_QUALIFIER_USAGE +#define SQL_CONVERT_WCHAR 122 +#define SQL_CONVERT_INTERVAL_DAY_TIME 123 +#define SQL_CONVERT_INTERVAL_YEAR_MONTH 124 +#define SQL_CONVERT_WLONGVARCHAR 125 +#define SQL_CONVERT_WVARCHAR 126 +#define SQL_CREATE_ASSERTION 127 +#define SQL_CREATE_CHARACTER_SET 128 +#define SQL_CREATE_COLLATION 129 +#define SQL_CREATE_DOMAIN 130 +#define SQL_CREATE_SCHEMA 131 +#define SQL_CREATE_TABLE 132 +#define SQL_CREATE_TRANSLATION 133 +#define SQL_CREATE_VIEW 134 +#define SQL_DRIVER_HDESC 135 +#define SQL_DROP_ASSERTION 136 +#define SQL_DROP_CHARACTER_SET 137 +#define SQL_DROP_COLLATION 138 +#define SQL_DROP_DOMAIN 139 +#define SQL_DROP_SCHEMA 140 +#define SQL_DROP_TABLE 141 +#define SQL_DROP_TRANSLATION 142 +#define SQL_DROP_VIEW 143 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES1 144 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES2 145 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 146 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 147 +#define SQL_INDEX_KEYWORDS 148 +#define SQL_INFO_SCHEMA_VIEWS 149 +#define SQL_KEYSET_CURSOR_ATTRIBUTES1 150 +#define SQL_KEYSET_CURSOR_ATTRIBUTES2 151 +#define SQL_MAX_ASYNC_CONCURRENT_STATEMENTS 10022 /* new X/Open spec */ +#define SQL_ODBC_INTERFACE_CONFORMANCE 152 +#define SQL_PARAM_ARRAY_ROW_COUNTS 153 +#define SQL_PARAM_ARRAY_SELECTS 154 +#define SQL_SCHEMA_TERM SQL_OWNER_TERM +#define SQL_SCHEMA_USAGE SQL_OWNER_USAGE +#define SQL_SQL92_DATETIME_FUNCTIONS 155 +#define SQL_SQL92_FOREIGN_KEY_DELETE_RULE 156 +#define SQL_SQL92_FOREIGN_KEY_UPDATE_RULE 157 +#define SQL_SQL92_GRANT 158 +#define SQL_SQL92_NUMERIC_VALUE_FUNCTIONS 159 +#define SQL_SQL92_PREDICATES 160 +#define SQL_SQL92_RELATIONAL_JOIN_OPERATORS 161 +#define SQL_SQL92_REVOKE 162 +#define SQL_SQL92_ROW_VALUE_CONSTRUCTOR 163 +#define SQL_SQL92_STRING_FUNCTIONS 164 +#define SQL_SQL92_VALUE_EXPRESSIONS 165 +#define SQL_STANDARD_CLI_CONFORMANCE 166 +#define SQL_STATIC_CURSOR_ATTRIBUTES1 167 +#define SQL_STATIC_CURSOR_ATTRIBUTES2 168 + +#define SQL_AGGREGATE_FUNCTIONS 169 +#define SQL_DDL_INDEX 170 +#define SQL_DM_VER 171 +#define SQL_INSERT_STATEMENT 172 +#define SQL_UNION_STATEMENT SQL_UNION +#endif /* ODBCVER >= 0x0300 */ + +#define SQL_DTC_TRANSITION_COST 1750 + +/* SQL_ALTER_TABLE bitmasks */ +#if (ODBCVER >= 0x0300) +/* the following 5 bitmasks are defined in sql.h +*#define SQL_AT_ADD_COLUMN 0x00000001L +*#define SQL_AT_DROP_COLUMN 0x00000002L +*#define SQL_AT_ADD_CONSTRAINT 0x00000008L +*/ +#define SQL_AT_ADD_COLUMN_SINGLE 0x00000020L +#define SQL_AT_ADD_COLUMN_DEFAULT 0x00000040L +#define SQL_AT_ADD_COLUMN_COLLATION 0x00000080L +#define SQL_AT_SET_COLUMN_DEFAULT 0x00000100L +#define SQL_AT_DROP_COLUMN_DEFAULT 0x00000200L +#define SQL_AT_DROP_COLUMN_CASCADE 0x00000400L +#define SQL_AT_DROP_COLUMN_RESTRICT 0x00000800L +#define SQL_AT_ADD_TABLE_CONSTRAINT 0x00001000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE 0x00002000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT 0x00004000L +#define SQL_AT_CONSTRAINT_NAME_DEFINITION 0x00008000L +#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED 0x00010000L +#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00020000L +#define SQL_AT_CONSTRAINT_DEFERRABLE 0x00040000L +#define SQL_AT_CONSTRAINT_NON_DEFERRABLE 0x00080000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_CONVERT_* return value bitmasks */ + +#define SQL_CVT_CHAR 0x00000001L +#define SQL_CVT_NUMERIC 0x00000002L +#define SQL_CVT_DECIMAL 0x00000004L +#define SQL_CVT_INTEGER 0x00000008L +#define SQL_CVT_SMALLINT 0x00000010L +#define SQL_CVT_FLOAT 0x00000020L +#define SQL_CVT_REAL 0x00000040L +#define SQL_CVT_DOUBLE 0x00000080L +#define SQL_CVT_VARCHAR 0x00000100L +#define SQL_CVT_LONGVARCHAR 0x00000200L +#define SQL_CVT_BINARY 0x00000400L +#define SQL_CVT_VARBINARY 0x00000800L +#define SQL_CVT_BIT 0x00001000L +#define SQL_CVT_TINYINT 0x00002000L +#define SQL_CVT_BIGINT 0x00004000L +#define SQL_CVT_DATE 0x00008000L +#define SQL_CVT_TIME 0x00010000L +#define SQL_CVT_TIMESTAMP 0x00020000L +#define SQL_CVT_LONGVARBINARY 0x00040000L +#if (ODBCVER >= 0x0300) +#define SQL_CVT_INTERVAL_YEAR_MONTH 0x00080000L +#define SQL_CVT_INTERVAL_DAY_TIME 0x00100000L +#define SQL_CVT_WCHAR 0x00200000L +#define SQL_CVT_WLONGVARCHAR 0x00400000L +#define SQL_CVT_WVARCHAR 0x00800000L + +#endif /* ODBCVER >= 0x0300 */ + + +/* SQL_CONVERT_FUNCTIONS functions */ +#define SQL_FN_CVT_CONVERT 0x00000001L +#if (ODBCVER >= 0x0300) +#define SQL_FN_CVT_CAST 0x00000002L +#endif /* ODBCVER >= 0x0300 */ + + +/* SQL_STRING_FUNCTIONS functions */ + +#define SQL_FN_STR_CONCAT 0x00000001L +#define SQL_FN_STR_INSERT 0x00000002L +#define SQL_FN_STR_LEFT 0x00000004L +#define SQL_FN_STR_LTRIM 0x00000008L +#define SQL_FN_STR_LENGTH 0x00000010L +#define SQL_FN_STR_LOCATE 0x00000020L +#define SQL_FN_STR_LCASE 0x00000040L +#define SQL_FN_STR_REPEAT 0x00000080L +#define SQL_FN_STR_REPLACE 0x00000100L +#define SQL_FN_STR_RIGHT 0x00000200L +#define SQL_FN_STR_RTRIM 0x00000400L +#define SQL_FN_STR_SUBSTRING 0x00000800L +#define SQL_FN_STR_UCASE 0x00001000L +#define SQL_FN_STR_ASCII 0x00002000L +#define SQL_FN_STR_CHAR 0x00004000L +#define SQL_FN_STR_DIFFERENCE 0x00008000L +#define SQL_FN_STR_LOCATE_2 0x00010000L +#define SQL_FN_STR_SOUNDEX 0x00020000L +#define SQL_FN_STR_SPACE 0x00040000L +#if (ODBCVER >= 0x0300) +#define SQL_FN_STR_BIT_LENGTH 0x00080000L +#define SQL_FN_STR_CHAR_LENGTH 0x00100000L +#define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L +#define SQL_FN_STR_OCTET_LENGTH 0x00400000L +#define SQL_FN_STR_POSITION 0x00800000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SQL92_STRING_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SSF_CONVERT 0x00000001L +#define SQL_SSF_LOWER 0x00000002L +#define SQL_SSF_UPPER 0x00000004L +#define SQL_SSF_SUBSTRING 0x00000008L +#define SQL_SSF_TRANSLATE 0x00000010L +#define SQL_SSF_TRIM_BOTH 0x00000020L +#define SQL_SSF_TRIM_LEADING 0x00000040L +#define SQL_SSF_TRIM_TRAILING 0x00000080L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_NUMERIC_FUNCTIONS functions */ + +#define SQL_FN_NUM_ABS 0x00000001L +#define SQL_FN_NUM_ACOS 0x00000002L +#define SQL_FN_NUM_ASIN 0x00000004L +#define SQL_FN_NUM_ATAN 0x00000008L +#define SQL_FN_NUM_ATAN2 0x00000010L +#define SQL_FN_NUM_CEILING 0x00000020L +#define SQL_FN_NUM_COS 0x00000040L +#define SQL_FN_NUM_COT 0x00000080L +#define SQL_FN_NUM_EXP 0x00000100L +#define SQL_FN_NUM_FLOOR 0x00000200L +#define SQL_FN_NUM_LOG 0x00000400L +#define SQL_FN_NUM_MOD 0x00000800L +#define SQL_FN_NUM_SIGN 0x00001000L +#define SQL_FN_NUM_SIN 0x00002000L +#define SQL_FN_NUM_SQRT 0x00004000L +#define SQL_FN_NUM_TAN 0x00008000L +#define SQL_FN_NUM_PI 0x00010000L +#define SQL_FN_NUM_RAND 0x00020000L +#define SQL_FN_NUM_DEGREES 0x00040000L +#define SQL_FN_NUM_LOG10 0x00080000L +#define SQL_FN_NUM_POWER 0x00100000L +#define SQL_FN_NUM_RADIANS 0x00200000L +#define SQL_FN_NUM_ROUND 0x00400000L +#define SQL_FN_NUM_TRUNCATE 0x00800000L + +/* SQL_SQL92_NUMERIC_VALUE_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SNVF_BIT_LENGTH 0x00000001L +#define SQL_SNVF_CHAR_LENGTH 0x00000002L +#define SQL_SNVF_CHARACTER_LENGTH 0x00000004L +#define SQL_SNVF_EXTRACT 0x00000008L +#define SQL_SNVF_OCTET_LENGTH 0x00000010L +#define SQL_SNVF_POSITION 0x00000020L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_TIMEDATE_FUNCTIONS functions */ + +#define SQL_FN_TD_NOW 0x00000001L +#define SQL_FN_TD_CURDATE 0x00000002L +#define SQL_FN_TD_DAYOFMONTH 0x00000004L +#define SQL_FN_TD_DAYOFWEEK 0x00000008L +#define SQL_FN_TD_DAYOFYEAR 0x00000010L +#define SQL_FN_TD_MONTH 0x00000020L +#define SQL_FN_TD_QUARTER 0x00000040L +#define SQL_FN_TD_WEEK 0x00000080L +#define SQL_FN_TD_YEAR 0x00000100L +#define SQL_FN_TD_CURTIME 0x00000200L +#define SQL_FN_TD_HOUR 0x00000400L +#define SQL_FN_TD_MINUTE 0x00000800L +#define SQL_FN_TD_SECOND 0x00001000L +#define SQL_FN_TD_TIMESTAMPADD 0x00002000L +#define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L +#define SQL_FN_TD_DAYNAME 0x00008000L +#define SQL_FN_TD_MONTHNAME 0x00010000L +#if (ODBCVER >= 0x0300) +#define SQL_FN_TD_CURRENT_DATE 0x00020000L +#define SQL_FN_TD_CURRENT_TIME 0x00040000L +#define SQL_FN_TD_CURRENT_TIMESTAMP 0x00080000L +#define SQL_FN_TD_EXTRACT 0x00100000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SQL92_DATETIME_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SDF_CURRENT_DATE 0x00000001L +#define SQL_SDF_CURRENT_TIME 0x00000002L +#define SQL_SDF_CURRENT_TIMESTAMP 0x00000004L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SYSTEM_FUNCTIONS functions */ + +#define SQL_FN_SYS_USERNAME 0x00000001L +#define SQL_FN_SYS_DBNAME 0x00000002L +#define SQL_FN_SYS_IFNULL 0x00000004L + +/* SQL_TIMEDATE_ADD_INTERVALS and SQL_TIMEDATE_DIFF_INTERVALS functions */ + +#define SQL_FN_TSI_FRAC_SECOND 0x00000001L +#define SQL_FN_TSI_SECOND 0x00000002L +#define SQL_FN_TSI_MINUTE 0x00000004L +#define SQL_FN_TSI_HOUR 0x00000008L +#define SQL_FN_TSI_DAY 0x00000010L +#define SQL_FN_TSI_WEEK 0x00000020L +#define SQL_FN_TSI_MONTH 0x00000040L +#define SQL_FN_TSI_QUARTER 0x00000080L +#define SQL_FN_TSI_YEAR 0x00000100L + +/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES1, + * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1, + * SQL_KEYSET_CURSOR_ATTRIBUTES1, and SQL_STATIC_CURSOR_ATTRIBUTES1 + */ +#if (ODBCVER >= 0x0300) +/* supported SQLFetchScroll FetchOrientation's */ +#define SQL_CA1_NEXT 0x00000001L +#define SQL_CA1_ABSOLUTE 0x00000002L +#define SQL_CA1_RELATIVE 0x00000004L +#define SQL_CA1_BOOKMARK 0x00000008L + +/* supported SQLSetPos LockType's */ +#define SQL_CA1_LOCK_NO_CHANGE 0x00000040L +#define SQL_CA1_LOCK_EXCLUSIVE 0x00000080L +#define SQL_CA1_LOCK_UNLOCK 0x00000100L + +/* supported SQLSetPos Operations */ +#define SQL_CA1_POS_POSITION 0x00000200L +#define SQL_CA1_POS_UPDATE 0x00000400L +#define SQL_CA1_POS_DELETE 0x00000800L +#define SQL_CA1_POS_REFRESH 0x00001000L + +/* positioned updates and deletes */ +#define SQL_CA1_POSITIONED_UPDATE 0x00002000L +#define SQL_CA1_POSITIONED_DELETE 0x00004000L +#define SQL_CA1_SELECT_FOR_UPDATE 0x00008000L + +/* supported SQLBulkOperations operations */ +#define SQL_CA1_BULK_ADD 0x00010000L +#define SQL_CA1_BULK_UPDATE_BY_BOOKMARK 0x00020000L +#define SQL_CA1_BULK_DELETE_BY_BOOKMARK 0x00040000L +#define SQL_CA1_BULK_FETCH_BY_BOOKMARK 0x00080000L +#endif /* ODBCVER >= 0x0300 */ + +/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES2, + * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2, + * SQL_KEYSET_CURSOR_ATTRIBUTES2, and SQL_STATIC_CURSOR_ATTRIBUTES2 + */ +#if (ODBCVER >= 0x0300) +/* supported values for SQL_ATTR_SCROLL_CONCURRENCY */ +#define SQL_CA2_READ_ONLY_CONCURRENCY 0x00000001L +#define SQL_CA2_LOCK_CONCURRENCY 0x00000002L +#define SQL_CA2_OPT_ROWVER_CONCURRENCY 0x00000004L +#define SQL_CA2_OPT_VALUES_CONCURRENCY 0x00000008L + +/* sensitivity of the cursor to its own inserts, deletes, and updates */ +#define SQL_CA2_SENSITIVITY_ADDITIONS 0x00000010L +#define SQL_CA2_SENSITIVITY_DELETIONS 0x00000020L +#define SQL_CA2_SENSITIVITY_UPDATES 0x00000040L + +/* semantics of SQL_ATTR_MAX_ROWS */ +#define SQL_CA2_MAX_ROWS_SELECT 0x00000080L +#define SQL_CA2_MAX_ROWS_INSERT 0x00000100L +#define SQL_CA2_MAX_ROWS_DELETE 0x00000200L +#define SQL_CA2_MAX_ROWS_UPDATE 0x00000400L +#define SQL_CA2_MAX_ROWS_CATALOG 0x00000800L +#define SQL_CA2_MAX_ROWS_AFFECTS_ALL (SQL_CA2_MAX_ROWS_SELECT | \ + SQL_CA2_MAX_ROWS_INSERT | SQL_CA2_MAX_ROWS_DELETE | \ + SQL_CA2_MAX_ROWS_UPDATE | SQL_CA2_MAX_ROWS_CATALOG) + +/* semantics of SQL_DIAG_CURSOR_ROW_COUNT */ +#define SQL_CA2_CRC_EXACT 0x00001000L +#define SQL_CA2_CRC_APPROXIMATE 0x00002000L + +/* the kinds of positioned statements that can be simulated */ +#define SQL_CA2_SIMULATE_NON_UNIQUE 0x00004000L +#define SQL_CA2_SIMULATE_TRY_UNIQUE 0x00008000L +#define SQL_CA2_SIMULATE_UNIQUE 0x00010000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_ODBC_API_CONFORMANCE values */ + +#define SQL_OAC_NONE 0x0000 +#define SQL_OAC_LEVEL1 0x0001 +#define SQL_OAC_LEVEL2 0x0002 + +/* SQL_ODBC_SAG_CLI_CONFORMANCE values */ + +#define SQL_OSCC_NOT_COMPLIANT 0x0000 +#define SQL_OSCC_COMPLIANT 0x0001 + +/* SQL_ODBC_SQL_CONFORMANCE values */ + +#define SQL_OSC_MINIMUM 0x0000 +#define SQL_OSC_CORE 0x0001 +#define SQL_OSC_EXTENDED 0x0002 + + +/* SQL_CONCAT_NULL_BEHAVIOR values */ + +#define SQL_CB_NULL 0x0000 +#define SQL_CB_NON_NULL 0x0001 + +/* SQL_SCROLL_OPTIONS masks */ + +#define SQL_SO_FORWARD_ONLY 0x00000001L +#define SQL_SO_KEYSET_DRIVEN 0x00000002L +#define SQL_SO_DYNAMIC 0x00000004L +#define SQL_SO_MIXED 0x00000008L +#define SQL_SO_STATIC 0x00000010L + +/* SQL_FETCH_DIRECTION masks */ + +/* SQL_FETCH_RESUME is no longer supported +#define SQL_FD_FETCH_RESUME 0x00000040L +*/ +#define SQL_FD_FETCH_BOOKMARK 0x00000080L + +/* SQL_TXN_ISOLATION_OPTION masks */ +/* SQL_TXN_VERSIONING is no longer supported +#define SQL_TXN_VERSIONING 0x00000010L +*/ + +/* SQL_CORRELATION_NAME values */ + +#define SQL_CN_NONE 0x0000 +#define SQL_CN_DIFFERENT 0x0001 +#define SQL_CN_ANY 0x0002 + +/* SQL_NON_NULLABLE_COLUMNS values */ + +#define SQL_NNC_NULL 0x0000 +#define SQL_NNC_NON_NULL 0x0001 + +/* SQL_NULL_COLLATION values */ + +#define SQL_NC_START 0x0002 +#define SQL_NC_END 0x0004 + +/* SQL_FILE_USAGE values */ + +#define SQL_FILE_NOT_SUPPORTED 0x0000 +#define SQL_FILE_TABLE 0x0001 +#define SQL_FILE_QUALIFIER 0x0002 +#define SQL_FILE_CATALOG SQL_FILE_QUALIFIER // ODBC 3.0 + + +/* SQL_GETDATA_EXTENSIONS values */ + +#define SQL_GD_BLOCK 0x00000004L +#define SQL_GD_BOUND 0x00000008L + +/* SQL_POSITIONED_STATEMENTS masks */ + +#define SQL_PS_POSITIONED_DELETE 0x00000001L +#define SQL_PS_POSITIONED_UPDATE 0x00000002L +#define SQL_PS_SELECT_FOR_UPDATE 0x00000004L + +/* SQL_GROUP_BY values */ + +#define SQL_GB_NOT_SUPPORTED 0x0000 +#define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001 +#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002 +#define SQL_GB_NO_RELATION 0x0003 +#if (ODBCVER >= 0x0300) +#define SQL_GB_COLLATE 0x0004 + +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_OWNER_USAGE masks */ + +#define SQL_OU_DML_STATEMENTS 0x00000001L +#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_OU_TABLE_DEFINITION 0x00000004L +#define SQL_OU_INDEX_DEFINITION 0x00000008L +#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L + +/* SQL_SCHEMA_USAGE masks */ +#if (ODBCVER >= 0x0300) +#define SQL_SU_DML_STATEMENTS SQL_OU_DML_STATEMENTS +#define SQL_SU_PROCEDURE_INVOCATION SQL_OU_PROCEDURE_INVOCATION +#define SQL_SU_TABLE_DEFINITION SQL_OU_TABLE_DEFINITION +#define SQL_SU_INDEX_DEFINITION SQL_OU_INDEX_DEFINITION +#define SQL_SU_PRIVILEGE_DEFINITION SQL_OU_PRIVILEGE_DEFINITION +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_QUALIFIER_USAGE masks */ + +#define SQL_QU_DML_STATEMENTS 0x00000001L +#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_QU_TABLE_DEFINITION 0x00000004L +#define SQL_QU_INDEX_DEFINITION 0x00000008L +#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L + +#if (ODBCVER >= 0x0300) +/* SQL_CATALOG_USAGE masks */ +#define SQL_CU_DML_STATEMENTS SQL_QU_DML_STATEMENTS +#define SQL_CU_PROCEDURE_INVOCATION SQL_QU_PROCEDURE_INVOCATION +#define SQL_CU_TABLE_DEFINITION SQL_QU_TABLE_DEFINITION +#define SQL_CU_INDEX_DEFINITION SQL_QU_INDEX_DEFINITION +#define SQL_CU_PRIVILEGE_DEFINITION SQL_QU_PRIVILEGE_DEFINITION +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SUBQUERIES masks */ + +#define SQL_SQ_COMPARISON 0x00000001L +#define SQL_SQ_EXISTS 0x00000002L +#define SQL_SQ_IN 0x00000004L +#define SQL_SQ_QUANTIFIED 0x00000008L +#define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L + +/* SQL_UNION masks */ + +#define SQL_U_UNION 0x00000001L +#define SQL_U_UNION_ALL 0x00000002L + +/* SQL_BOOKMARK_PERSISTENCE values */ + +#define SQL_BP_CLOSE 0x00000001L +#define SQL_BP_DELETE 0x00000002L +#define SQL_BP_DROP 0x00000004L +#define SQL_BP_TRANSACTION 0x00000008L +#define SQL_BP_UPDATE 0x00000010L +#define SQL_BP_OTHER_HSTMT 0x00000020L +#define SQL_BP_SCROLL 0x00000040L + +/* SQL_STATIC_SENSITIVITY values */ + +#define SQL_SS_ADDITIONS 0x00000001L +#define SQL_SS_DELETIONS 0x00000002L +#define SQL_SS_UPDATES 0x00000004L + +/* SQL_VIEW values */ +#define SQL_CV_CREATE_VIEW 0x00000001L +#define SQL_CV_CHECK_OPTION 0x00000002L +#define SQL_CV_CASCADED 0x00000004L +#define SQL_CV_LOCAL 0x00000008L + +/* SQL_LOCK_TYPES masks */ + +#define SQL_LCK_NO_CHANGE 0x00000001L +#define SQL_LCK_EXCLUSIVE 0x00000002L +#define SQL_LCK_UNLOCK 0x00000004L + +/* SQL_POS_OPERATIONS masks */ + +#define SQL_POS_POSITION 0x00000001L +#define SQL_POS_REFRESH 0x00000002L +#define SQL_POS_UPDATE 0x00000004L +#define SQL_POS_DELETE 0x00000008L +#define SQL_POS_ADD 0x00000010L + +/* SQL_QUALIFIER_LOCATION values */ + +#define SQL_QL_START 0x0001 +#define SQL_QL_END 0x0002 + +/* Here start return values for ODBC 3.0 SQLGetInfo */ + +#if (ODBCVER >= 0x0300) +/* SQL_AGGREGATE_FUNCTIONS bitmasks */ +#define SQL_AF_AVG 0x00000001L +#define SQL_AF_COUNT 0x00000002L +#define SQL_AF_MAX 0x00000004L +#define SQL_AF_MIN 0x00000008L +#define SQL_AF_SUM 0x00000010L +#define SQL_AF_DISTINCT 0x00000020L +#define SQL_AF_ALL 0x00000040L + +/* SQL_SQL_CONFORMANCE bit masks */ +#define SQL_SC_SQL92_ENTRY 0x00000001L +#define SQL_SC_FIPS127_2_TRANSITIONAL 0x00000002L +#define SQL_SC_SQL92_INTERMEDIATE 0x00000004L +#define SQL_SC_SQL92_FULL 0x00000008L + +/* SQL_DATETIME_LITERALS masks */ +#define SQL_DL_SQL92_DATE 0x00000001L +#define SQL_DL_SQL92_TIME 0x00000002L +#define SQL_DL_SQL92_TIMESTAMP 0x00000004L +#define SQL_DL_SQL92_INTERVAL_YEAR 0x00000008L +#define SQL_DL_SQL92_INTERVAL_MONTH 0x00000010L +#define SQL_DL_SQL92_INTERVAL_DAY 0x00000020L +#define SQL_DL_SQL92_INTERVAL_HOUR 0x00000040L +#define SQL_DL_SQL92_INTERVAL_MINUTE 0x00000080L +#define SQL_DL_SQL92_INTERVAL_SECOND 0x00000100L +#define SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH 0x00000200L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR 0x00000400L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE 0x00000800L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND 0x00001000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE 0x00002000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND 0x00004000L +#define SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND 0x00008000L + +/* SQL_CATALOG_LOCATION values */ +#define SQL_CL_START SQL_QL_START +#define SQL_CL_END SQL_QL_END + +/* values for SQL_BATCH_ROW_COUNT */ +#define SQL_BRC_PROCEDURES 0x0000001 +#define SQL_BRC_EXPLICIT 0x0000002 +#define SQL_BRC_ROLLED_UP 0x0000004 + +/* bitmasks for SQL_BATCH_SUPPORT */ +#define SQL_BS_SELECT_EXPLICIT 0x00000001L +#define SQL_BS_ROW_COUNT_EXPLICIT 0x00000002L +#define SQL_BS_SELECT_PROC 0x00000004L +#define SQL_BS_ROW_COUNT_PROC 0x00000008L + +/* Values for SQL_PARAM_ARRAY_ROW_COUNTS getinfo */ +#define SQL_PARC_BATCH 1 +#define SQL_PARC_NO_BATCH 2 + +/* values for SQL_PARAM_ARRAY_SELECTS */ +#define SQL_PAS_BATCH 1 +#define SQL_PAS_NO_BATCH 2 +#define SQL_PAS_NO_SELECT 3 + +/* Bitmasks for SQL_INDEX_KEYWORDS */ +#define SQL_IK_NONE 0x00000000L +#define SQL_IK_ASC 0x00000001L +#define SQL_IK_DESC 0x00000002L +#define SQL_IK_ALL (SQL_IK_ASC | SQL_IK_DESC) + +/* Bitmasks for SQL_INFO_SCHEMA_VIEWS */ + +#define SQL_ISV_ASSERTIONS 0x00000001L +#define SQL_ISV_CHARACTER_SETS 0x00000002L +#define SQL_ISV_CHECK_CONSTRAINTS 0x00000004L +#define SQL_ISV_COLLATIONS 0x00000008L +#define SQL_ISV_COLUMN_DOMAIN_USAGE 0x00000010L +#define SQL_ISV_COLUMN_PRIVILEGES 0x00000020L +#define SQL_ISV_COLUMNS 0x00000040L +#define SQL_ISV_CONSTRAINT_COLUMN_USAGE 0x00000080L +#define SQL_ISV_CONSTRAINT_TABLE_USAGE 0x00000100L +#define SQL_ISV_DOMAIN_CONSTRAINTS 0x00000200L +#define SQL_ISV_DOMAINS 0x00000400L +#define SQL_ISV_KEY_COLUMN_USAGE 0x00000800L +#define SQL_ISV_REFERENTIAL_CONSTRAINTS 0x00001000L +#define SQL_ISV_SCHEMATA 0x00002000L +#define SQL_ISV_SQL_LANGUAGES 0x00004000L +#define SQL_ISV_TABLE_CONSTRAINTS 0x00008000L +#define SQL_ISV_TABLE_PRIVILEGES 0x00010000L +#define SQL_ISV_TABLES 0x00020000L +#define SQL_ISV_TRANSLATIONS 0x00040000L +#define SQL_ISV_USAGE_PRIVILEGES 0x00080000L +#define SQL_ISV_VIEW_COLUMN_USAGE 0x00100000L +#define SQL_ISV_VIEW_TABLE_USAGE 0x00200000L +#define SQL_ISV_VIEWS 0x00400000L + +/* Bitmasks for SQL_ASYNC_MODE */ + +#define SQL_AM_NONE 0 +#define SQL_AM_CONNECTION 1 +#define SQL_AM_STATEMENT 2 + +/* Bitmasks for SQL_ALTER_DOMAIN */ +#define SQL_AD_CONSTRAINT_NAME_DEFINITION 0x00000001L +#define SQL_AD_ADD_DOMAIN_CONSTRAINT 0x00000002L +#define SQL_AD_DROP_DOMAIN_CONSTRAINT 0x00000004L +#define SQL_AD_ADD_DOMAIN_DEFAULT 0x00000008L +#define SQL_AD_DROP_DOMAIN_DEFAULT 0x00000010L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_AD_ADD_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE 0x00000100L + + +/* SQL_CREATE_SCHEMA bitmasks */ +#define SQL_CS_CREATE_SCHEMA 0x00000001L +#define SQL_CS_AUTHORIZATION 0x00000002L +#define SQL_CS_DEFAULT_CHARACTER_SET 0x00000004L + +/* SQL_CREATE_TRANSLATION bitmasks */ +#define SQL_CTR_CREATE_TRANSLATION 0x00000001L + +/* SQL_CREATE_ASSERTION bitmasks */ +#define SQL_CA_CREATE_ASSERTION 0x00000001L +#define SQL_CA_CONSTRAINT_INITIALLY_DEFERRED 0x00000010L +#define SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000020L +#define SQL_CA_CONSTRAINT_DEFERRABLE 0x00000040L +#define SQL_CA_CONSTRAINT_NON_DEFERRABLE 0x00000080L + +/* SQL_CREATE_CHARACTER_SET bitmasks */ +#define SQL_CCS_CREATE_CHARACTER_SET 0x00000001L +#define SQL_CCS_COLLATE_CLAUSE 0x00000002L +#define SQL_CCS_LIMITED_COLLATION 0x00000004L + +/* SQL_CREATE_COLLATION bitmasks */ +#define SQL_CCOL_CREATE_COLLATION 0x00000001L + +/* SQL_CREATE_DOMAIN bitmasks */ +#define SQL_CDO_CREATE_DOMAIN 0x00000001L +#define SQL_CDO_DEFAULT 0x00000002L +#define SQL_CDO_CONSTRAINT 0x00000004L +#define SQL_CDO_COLLATION 0x00000008L +#define SQL_CDO_CONSTRAINT_NAME_DEFINITION 0x00000010L +#define SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CDO_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CDO_CONSTRAINT_NON_DEFERRABLE 0x00000100L + +/* SQL_CREATE_TABLE bitmasks */ +#define SQL_CT_CREATE_TABLE 0x00000001L +#define SQL_CT_COMMIT_PRESERVE 0x00000002L +#define SQL_CT_COMMIT_DELETE 0x00000004L +#define SQL_CT_GLOBAL_TEMPORARY 0x00000008L +#define SQL_CT_LOCAL_TEMPORARY 0x00000010L +#define SQL_CT_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CT_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CT_CONSTRAINT_NON_DEFERRABLE 0x00000100L +#define SQL_CT_COLUMN_CONSTRAINT 0x00000200L +#define SQL_CT_COLUMN_DEFAULT 0x00000400L +#define SQL_CT_COLUMN_COLLATION 0x00000800L +#define SQL_CT_TABLE_CONSTRAINT 0x00001000L +#define SQL_CT_CONSTRAINT_NAME_DEFINITION 0x00002000L + +/* SQL_DDL_INDEX bitmasks */ +#define SQL_DI_CREATE_INDEX 0x00000001L +#define SQL_DI_DROP_INDEX 0x00000002L + +/* SQL_DROP_COLLATION bitmasks */ +#define SQL_DC_DROP_COLLATION 0x00000001L + +/* SQL_DROP_DOMAIN bitmasks */ +#define SQL_DD_DROP_DOMAIN 0x00000001L +#define SQL_DD_RESTRICT 0x00000002L +#define SQL_DD_CASCADE 0x00000004L + +/* SQL_DROP_SCHEMA bitmasks */ +#define SQL_DS_DROP_SCHEMA 0x00000001L +#define SQL_DS_RESTRICT 0x00000002L +#define SQL_DS_CASCADE 0x00000004L + +/* SQL_DROP_CHARACTER_SET bitmasks */ +#define SQL_DCS_DROP_CHARACTER_SET 0x00000001L + +/* SQL_DROP_ASSERTION bitmasks */ +#define SQL_DA_DROP_ASSERTION 0x00000001L + +/* SQL_DROP_TABLE bitmasks */ +#define SQL_DT_DROP_TABLE 0x00000001L +#define SQL_DT_RESTRICT 0x00000002L +#define SQL_DT_CASCADE 0x00000004L + +/* SQL_DROP_TRANSLATION bitmasks */ +#define SQL_DTR_DROP_TRANSLATION 0x00000001L + +/* SQL_DROP_VIEW bitmasks */ +#define SQL_DV_DROP_VIEW 0x00000001L +#define SQL_DV_RESTRICT 0x00000002L +#define SQL_DV_CASCADE 0x00000004L + +/* SQL_INSERT_STATEMENT bitmasks */ +#define SQL_IS_INSERT_LITERALS 0x00000001L +#define SQL_IS_INSERT_SEARCHED 0x00000002L +#define SQL_IS_SELECT_INTO 0x00000004L + +/* SQL_ODBC_INTERFACE_CONFORMANCE values */ +#define SQL_OIC_CORE 1UL +#define SQL_OIC_LEVEL1 2UL +#define SQL_OIC_LEVEL2 3UL + +/* SQL_SQL92_FOREIGN_KEY_DELETE_RULE bitmasks */ +#define SQL_SFKD_CASCADE 0x00000001L +#define SQL_SFKD_NO_ACTION 0x00000002L +#define SQL_SFKD_SET_DEFAULT 0x00000004L +#define SQL_SFKD_SET_NULL 0x00000008L + +/* SQL_SQL92_FOREIGN_KEY_UPDATE_RULE bitmasks */ +#define SQL_SFKU_CASCADE 0x00000001L +#define SQL_SFKU_NO_ACTION 0x00000002L +#define SQL_SFKU_SET_DEFAULT 0x00000004L +#define SQL_SFKU_SET_NULL 0x00000008L + +/* SQL_SQL92_GRANT bitmasks */ +#define SQL_SG_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SG_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SG_USAGE_ON_COLLATION 0x00000004L +#define SQL_SG_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SG_WITH_GRANT_OPTION 0x00000010L +#define SQL_SG_DELETE_TABLE 0x00000020L +#define SQL_SG_INSERT_TABLE 0x00000040L +#define SQL_SG_INSERT_COLUMN 0x00000080L +#define SQL_SG_REFERENCES_TABLE 0x00000100L +#define SQL_SG_REFERENCES_COLUMN 0x00000200L +#define SQL_SG_SELECT_TABLE 0x00000400L +#define SQL_SG_UPDATE_TABLE 0x00000800L +#define SQL_SG_UPDATE_COLUMN 0x00001000L + +/* SQL_SQL92_PREDICATES bitmasks */ +#define SQL_SP_EXISTS 0x00000001L +#define SQL_SP_ISNOTNULL 0x00000002L +#define SQL_SP_ISNULL 0x00000004L +#define SQL_SP_MATCH_FULL 0x00000008L +#define SQL_SP_MATCH_PARTIAL 0x00000010L +#define SQL_SP_MATCH_UNIQUE_FULL 0x00000020L +#define SQL_SP_MATCH_UNIQUE_PARTIAL 0x00000040L +#define SQL_SP_OVERLAPS 0x00000080L +#define SQL_SP_UNIQUE 0x00000100L +#define SQL_SP_LIKE 0x00000200L +#define SQL_SP_IN 0x00000400L +#define SQL_SP_BETWEEN 0x00000800L +#define SQL_SP_COMPARISON 0x00001000L +#define SQL_SP_QUANTIFIED_COMPARISON 0x00002000L + +/* SQL_SQL92_RELATIONAL_JOIN_OPERATORS bitmasks */ +#define SQL_SRJO_CORRESPONDING_CLAUSE 0x00000001L +#define SQL_SRJO_CROSS_JOIN 0x00000002L +#define SQL_SRJO_EXCEPT_JOIN 0x00000004L +#define SQL_SRJO_FULL_OUTER_JOIN 0x00000008L +#define SQL_SRJO_INNER_JOIN 0x00000010L +#define SQL_SRJO_INTERSECT_JOIN 0x00000020L +#define SQL_SRJO_LEFT_OUTER_JOIN 0x00000040L +#define SQL_SRJO_NATURAL_JOIN 0x00000080L +#define SQL_SRJO_RIGHT_OUTER_JOIN 0x00000100L +#define SQL_SRJO_UNION_JOIN 0x00000200L + +/* SQL_SQL92_REVOKE bitmasks */ +#define SQL_SR_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SR_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SR_USAGE_ON_COLLATION 0x00000004L +#define SQL_SR_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SR_GRANT_OPTION_FOR 0x00000010L +#define SQL_SR_CASCADE 0x00000020L +#define SQL_SR_RESTRICT 0x00000040L +#define SQL_SR_DELETE_TABLE 0x00000080L +#define SQL_SR_INSERT_TABLE 0x00000100L +#define SQL_SR_INSERT_COLUMN 0x00000200L +#define SQL_SR_REFERENCES_TABLE 0x00000400L +#define SQL_SR_REFERENCES_COLUMN 0x00000800L +#define SQL_SR_SELECT_TABLE 0x00001000L +#define SQL_SR_UPDATE_TABLE 0x00002000L +#define SQL_SR_UPDATE_COLUMN 0x00004000L + +/* SQL_SQL92_ROW_VALUE_CONSTRUCTOR bitmasks */ +#define SQL_SRVC_VALUE_EXPRESSION 0x00000001L +#define SQL_SRVC_NULL 0x00000002L +#define SQL_SRVC_DEFAULT 0x00000004L +#define SQL_SRVC_ROW_SUBQUERY 0x00000008L + +/* SQL_SQL92_VALUE_EXPRESSIONS bitmasks */ +#define SQL_SVE_CASE 0x00000001L +#define SQL_SVE_CAST 0x00000002L +#define SQL_SVE_COALESCE 0x00000004L +#define SQL_SVE_NULLIF 0x00000008L + +/* SQL_STANDARD_CLI_CONFORMANCE bitmasks */ +#define SQL_SCC_XOPEN_CLI_VERSION1 0x00000001L +#define SQL_SCC_ISO92_CLI 0x00000002L + +/* SQL_UNION_STATEMENT bitmasks */ +#define SQL_US_UNION SQL_U_UNION +#define SQL_US_UNION_ALL SQL_U_UNION_ALL + +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_DTC_TRANSITION_COST bitmasks */ +#define SQL_DTC_ENLIST_EXPENSIVE 0x00000001L +#define SQL_DTC_UNENLIST_EXPENSIVE 0x00000002L + +/* additional SQLDataSources fetch directions */ +#if (ODBCVER >= 0x0300) +#define SQL_FETCH_FIRST_USER 31 +#define SQL_FETCH_FIRST_SYSTEM 32 +#endif /* ODBCVER >= 0x0300 */ + + +/* Defines for SQLSetPos */ +#define SQL_ENTIRE_ROWSET 0 + +/* Operations in SQLSetPos */ +#define SQL_POSITION 0 /* 1.0 FALSE */ +#define SQL_REFRESH 1 /* 1.0 TRUE */ +#define SQL_UPDATE 2 +#define SQL_DELETE 3 + +/* Operations in SQLBulkOperations */ +#define SQL_ADD 4 +#define SQL_SETPOS_MAX_OPTION_VALUE SQL_ADD +#if (ODBCVER >= 0x0300) +#define SQL_UPDATE_BY_BOOKMARK 5 +#define SQL_DELETE_BY_BOOKMARK 6 +#define SQL_FETCH_BY_BOOKMARK 7 + +#endif /* ODBCVER >= 0x0300 */ + +/* Lock options in SQLSetPos */ +#define SQL_LOCK_NO_CHANGE 0 /* 1.0 FALSE */ +#define SQL_LOCK_EXCLUSIVE 1 /* 1.0 TRUE */ +#define SQL_LOCK_UNLOCK 2 + +#define SQL_SETPOS_MAX_LOCK_VALUE SQL_LOCK_UNLOCK + +/* Macros for SQLSetPos */ +#define SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE) +#define SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock) +#define SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock) +#define SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE) +#define SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE) +#define SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE) + +/* Column types and scopes in SQLSpecialColumns. */ +#define SQL_BEST_ROWID 1 +#define SQL_ROWVER 2 + +/* Defines for SQLSpecialColumns (returned in the result set) + SQL_PC_UNKNOWN and SQL_PC_PSEUDO are defined in sql.h */ +#define SQL_PC_NOT_PSEUDO 1 + +/* Defines for SQLStatistics */ +#define SQL_QUICK 0 +#define SQL_ENSURE 1 + +/* Defines for SQLStatistics (returned in the result set) + SQL_INDEX_CLUSTERED, SQL_INDEX_HASHED, and SQL_INDEX_OTHER are + defined in sql.h */ +#define SQL_TABLE_STAT 0 + + +/* Defines for SQLTables */ +#if (ODBCVER >= 0x0300) +#define SQL_ALL_CATALOGS "%" +#define SQL_ALL_SCHEMAS "%" +#define SQL_ALL_TABLE_TYPES "%" +#endif /* ODBCVER >= 0x0300 */ + +/* Options for SQLDriverConnect */ +#define SQL_DRIVER_NOPROMPT 0 +#define SQL_DRIVER_COMPLETE 1 +#define SQL_DRIVER_PROMPT 2 +#define SQL_DRIVER_COMPLETE_REQUIRED 3 + +#ifndef RC_INVOKED + +SQLRETURN SQL_API SQLDriverConnect( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + +#endif /* RC_INVOKED */ + +/* Level 2 Functions */ + +/* SQLExtendedFetch "fFetchType" values */ +#define SQL_FETCH_BOOKMARK 8 + +/* SQLExtendedFetch "rgfRowStatus" element values */ +#define SQL_ROW_SUCCESS 0 +#define SQL_ROW_DELETED 1 +#define SQL_ROW_UPDATED 2 +#define SQL_ROW_NOROW 3 +#define SQL_ROW_ADDED 4 +#define SQL_ROW_ERROR 5 +#if (ODBCVER >= 0x0300) +#define SQL_ROW_SUCCESS_WITH_INFO 6 +#define SQL_ROW_PROCEED 0 +#define SQL_ROW_IGNORE 1 +#endif + +/* value for SQL_DESC_ARRAY_STATUS_PTR */ +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_SUCCESS 0 +#define SQL_PARAM_SUCCESS_WITH_INFO 6 +#define SQL_PARAM_ERROR 5 +#define SQL_PARAM_UNUSED 7 +#define SQL_PARAM_DIAG_UNAVAILABLE 1 + +#define SQL_PARAM_PROCEED 0 +#define SQL_PARAM_IGNORE 1 +#endif /* ODBCVER >= 0x0300 */ + +/* Defines for SQLForeignKeys (UPDATE_RULE and DELETE_RULE) */ +#define SQL_CASCADE 0 +#define SQL_RESTRICT 1 +#define SQL_SET_NULL 2 +#if (ODBCVER >= 0x0250) +#define SQL_NO_ACTION 3 +#define SQL_SET_DEFAULT 4 +#endif /* ODBCVER >= 0x0250 */ + +#if (ODBCVER >= 0x0300) +/* Note that the following are in a different column of SQLForeignKeys than */ +/* the previous #defines. These are for DEFERRABILITY. */ + +#define SQL_INITIALLY_DEFERRED 5 +#define SQL_INITIALLY_IMMEDIATE 6 +#define SQL_NOT_DEFERRABLE 7 + +#endif /* ODBCVER >= 0x0300 */ + +/* Defines for SQLBindParameter and + SQLProcedureColumns (returned in the result set) */ +#define SQL_PARAM_TYPE_UNKNOWN 0 +#define SQL_PARAM_INPUT 1 +#define SQL_PARAM_INPUT_OUTPUT 2 +#define SQL_RESULT_COL 3 +#define SQL_PARAM_OUTPUT 4 +#define SQL_RETURN_VALUE 5 + +/* Defines for SQLProcedures (returned in the result set) */ +#define SQL_PT_UNKNOWN 0 +#define SQL_PT_PROCEDURE 1 +#define SQL_PT_FUNCTION 2 + +#ifndef RC_INVOKED + +/* This define is too large for RC */ +#define SQL_ODBC_KEYWORDS \ +"ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\ +"ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\ +"BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\ +"CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\ +"COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\ +"CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\ +"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\ +"DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\ +"DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\ +"DISTINCT,DOMAIN,DOUBLE,DROP,"\ +"ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\ +"EXISTS,EXTERNAL,EXTRACT,"\ +"FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\ +"GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\ +"IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\ +"INPUT,INSENSITIVE,INSERT,INT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\ +"JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\ +"MATCH,MAX,MIN,MINUTE,MODULE,MONTH,"\ +"NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\ +"OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\ +"PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\ +"PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\ +"READ,REAL,REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS"\ +"SCHEMA,SCROLL,SECOND,SECTION,SELECT,SESSION,SESSION_USER,SET,SIZE,"\ +"SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\ +"SUBSTRING,SUM,SYSTEM_USER,"\ +"TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\ +"TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\ +"UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\ +"VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,"\ +"YEAR,ZONE" + +SQLRETURN SQL_API SQLBrowseConnect( + SQLHDBC hdbc, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLBulkOperations( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +#endif /* ODBCVER >= 0x0300 */ + +SQLRETURN SQL_API SQLColAttributes( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); + +SQLRETURN SQL_API SQLColumnPrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLDescribeParam( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + +SQLRETURN SQL_API SQLExtendedFetch( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLLEN irow, + SQLULEN *pcrow, + SQLUSMALLINT *rgfRowStatus); + +SQLRETURN SQL_API SQLForeignKeys( + SQLHSTMT hstmt, + SQLCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + +SQLRETURN SQL_API SQLMoreResults( + SQLHSTMT hstmt); + +SQLRETURN SQL_API SQLNativeSql( + SQLHDBC hdbc, + SQLCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + +SQLRETURN SQL_API SQLNumParams( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); + +SQLRETURN SQL_API SQLParamOptions( + SQLHSTMT hstmt, + SQLULEN crow, + SQLULEN *pirow); + +SQLRETURN SQL_API SQLPrimaryKeys( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLProcedureColumns( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLProcedures( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName); + +SQLRETURN SQL_API SQLSetPos( + SQLHSTMT hstmt, + SQLSETPOSIROW irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); + +SQLRETURN SQL_API SQLTablePrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLDrivers( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); + +SQLRETURN SQL_API SQLBindParameter( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN *pcbValue); + + +#endif /* RC_INVOKED */ + +/*---------------------------------------------------------*/ +/* SQLAllocHandleStd is implemented to make SQLAllocHandle */ +/* compatible with X/Open standard. an application should */ +/* not call SQLAllocHandleStd directly */ +/*---------------------------------------------------------*/ +#ifdef ODBC_STD +#define SQLAllocHandle SQLAllocHandleStd +#define SQLAllocEnv(phenv) SQLAllocHandleStd(SQL_HANDLE_ENV, SQL_NULL_HANDLE, phenv) + +/* Internal type subcodes */ +#define SQL_YEAR SQL_CODE_YEAR +#define SQL_MONTH SQL_CODE_MONTH +#define SQL_DAY SQL_CODE_DAY +#define SQL_HOUR SQL_CODE_HOUR +#define SQL_MINUTE SQL_CODE_MINUTE +#define SQL_SECOND SQL_CODE_SECOND +#define SQL_YEAR_TO_MONTH SQL_CODE_YEAR_TO_MONTH +#define SQL_DAY_TO_HOUR SQL_CODE_DAY_TO_HOUR +#define SQL_DAY_TO_MINUTE SQL_CODE_DAY_TO_MINUTE +#define SQL_DAY_TO_SECOND SQL_CODE_DAY_TO_SECOND +#define SQL_HOUR_TO_MINUTE SQL_CODE_HOUR_TO_MINUTE +#define SQL_HOUR_TO_SECOND SQL_CODE_HOUR_TO_SECOND +#define SQL_MINUTE_TO_SECOND SQL_CODE_MINUTE_TO_SECOND +#endif /* ODBC_STD */ + +#if (ODBCVER >= 0x0300) +#ifndef RC_INVOKED +SQLRETURN SQL_API SQLAllocHandleStd( + SQLSMALLINT fHandleType, + SQLHANDLE hInput, + SQLHANDLE *phOutput); +#endif /* RC_INVOKED */ +#endif + +/* Deprecated defines from prior versions of ODBC */ +#define SQL_DATABASE_NAME 16 /* Use SQLGetConnectOption/SQL_CURRENT_QUALIFIER */ +#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR +#define SQL_FETCH_PREV SQL_FETCH_PRIOR +#define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER +#define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER +#define SQL_CC_DELETE SQL_CB_DELETE +#define SQL_CR_DELETE SQL_CB_DELETE +#define SQL_CC_CLOSE SQL_CB_CLOSE +#define SQL_CR_CLOSE SQL_CB_CLOSE +#define SQL_CC_PRESERVE SQL_CB_PRESERVE +#define SQL_CR_PRESERVE SQL_CB_PRESERVE +/* SQL_FETCH_RESUME is not supported by 2.0+ drivers +#define SQL_FETCH_RESUME 7 +*/ +#define SQL_SCROLL_FORWARD_ONLY 0L /*-SQL_CURSOR_FORWARD_ONLY */ +#define SQL_SCROLL_KEYSET_DRIVEN (-1L) /*-SQL_CURSOR_KEYSET_DRIVEN */ +#define SQL_SCROLL_DYNAMIC (-2L) /*-SQL_CURSOR_DYNAMIC */ +#define SQL_SCROLL_STATIC (-3L) /*-SQL_CURSOR_STATIC */ + +/* Deprecated functions from prior versions of ODBC */ +#ifndef RC_INVOKED + +SQLRETURN SQL_API SQLSetScrollOptions( /* Use SQLSetStmtOptions */ + SQLHSTMT hstmt, + SQLUSMALLINT fConcurrency, + SQLLEN crowKeyset, + SQLUSMALLINT crowRowset); +#if 0 +/* Tracing section */ + +#define TRACE_VERSION 1000 /* Version of trace API */ + +RETCODE SQL_API TraceOpenLogFile(LPWSTR,LPWSTR,DWORD);// open a trace log file +RETCODE SQL_API TraceCloseLogFile(); // Request to close a trace log +VOID SQL_API TraceReturn(RETCODE,RETCODE); // Processes trace after FN is called +DWORD SQL_API TraceVersion(); // Returns trace API version + +/* Functions for Visual Studio Analyzer*/ +/* to turn on/off tracing or VS events, call TraceVSControl by setting or clearing the following bits */ +#define TRACE_ON 0x00000001L +#define TRACE_VS_EVENT_ON 0x00000002L + +RETCODE SQL_API TraceVSControl(DWORD); + +/* the flags in ODBC_VS_ARGS */ +#define ODBC_VS_FLAG_UNICODE_ARG 0x00000001L /* the argument is unicode */ +#define ODBC_VS_FLAG_UNICODE_COR 0x00000002L /* the correlation is unicode */ +#define ODBC_VS_FLAG_RETCODE 0x00000004L /* RetCode field is set */ +#define ODBC_VS_FLAG_STOP 0x00000008L /* Stop firing visual studio analyzer events */ + +typedef struct tagODBC_VS_ARGS { + const GUID *pguidEvent; /* the GUID for event */ + DWORD dwFlags; /* flags for the call */ + union { + WCHAR *wszArg; + CHAR *szArg; + }; + union { + WCHAR *wszCorrelation; + CHAR *szCorrelation; + }; + RETCODE RetCode; +} ODBC_VS_ARGS, *PODBC_VS_ARGS; +VOID SQL_API FireVSDebugEvent(PODBC_VS_ARGS); +#endif +#endif /* RC_INVOKED */ + + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ + +#if defined(WIN32) || defined(ODBC64) +#if 0 +#include "sqlucode.h" +#endif +#endif + +#endif /* __SQLEXT */ diff --git a/libraries/SQLAPI/include/db2_win/sqlsystm.h b/libraries/SQLAPI/include/db2_win/sqlsystm.h new file mode 100644 index 000000000..e2ded131d --- /dev/null +++ b/libraries/SQLAPI/include/db2_win/sqlsystm.h @@ -0,0 +1,115 @@ +/****************************************************************************** + * + * Source File Name = SQLSYSTM.H + * + * + * (C) COPYRIGHT International Business Machines Corp. 1993 + * All Rights Reserved + * Licensed Materials - Property of IBM + * + * US Government Users Restricted Rights - Use, duplication or + * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. + * + * Function = Include File defining: + * Operating System Specific Information + * + * Operating System = NT 3.5 + * + *****************************************************************************/ + +#ifndef SQL_H_SQLSYSTM + #define SQL_H_SQLSYSTM /* Permit duplicate Includes */ + + +#if !defined DB2NT + #define DB2NT 1 +#endif + + +#if !defined SQL_API_RC + #define SQL_API_RC int + #define SQL_STRUCTURE struct + #define SQL_POINTER + #define SQL_API_FN __stdcall + #define SQL_API_INTR __stdcall + #define PSQL_API_FN __stdcall * +#endif + +/****************************************************************************** +** +** The SQLOLDCHAR macro may be used to maintain compatibility between +** version 1 applications and version 2 header files. In version 1, many +** strings were declared as 'unsigned char'. In keeping with the spirit +** of ANSI C, all character data, structure members and function +** parameters with string semantics have been changed to 'char' in version 2. +** This change may produce type conflicts with some compilers. Adding +** -DSQLOLDCHAR to the compile command will cause the changed items to +** revert to their version 1 types. Note that this should be used for +** compatibility purposes only. New code should be written using plain +** 'char' where indicated in the documentation. +******************************************************************************/ + +#undef _SQLOLDCHAR +#if defined SQLOLDCHAR + #define _SQLOLDCHAR unsigned char +#else + #define _SQLOLDCHAR char +#endif + +/****************************************************************************** +** +** Define fixed size integer types. +** +******************************************************************************/ + +typedef char sqlint8; +typedef unsigned char sqluint8; + +typedef short sqlint16; +typedef unsigned short sqluint16; + +#if defined DB2_FORCE_INT32_TYPES_TO_INT + typedef int sqlint32; + typedef unsigned int sqluint32; +#else + typedef long sqlint32; + typedef unsigned long sqluint32; +#endif + +#if !defined SQL_BIGINT_TYPE + #if defined _MSC_VER || defined __BORLANDC__ + #define SQL_BIGINT_TYPE __int64 + #define DB2_CONSTRUCT_BIGINT_CONSTANT(db2BigIntConstantValue) db2BigIntConstantValue##i64 + #else + #define DB2_CONSTRUCT_BIGINT_CONSTANT(db2BigIntConstantValue) db2BigIntConstantValue##LL + #define SQL_BIGINT_TYPE long long + #endif +#endif +#if !defined SQL_BIGUINT_TYPE + #if defined _MSC_VER || defined __BORLANDC__ + #define SQL_BIGUINT_TYPE unsigned __int64 + #else + #define SQL_BIGUINT_TYPE unsigned long long + #endif +#endif +typedef SQL_BIGINT_TYPE sqlint64; +typedef SQL_BIGUINT_TYPE sqluint64; + +/****************************************************************************** +** +** The sqlintptr and sqluintptr are defined as integer types large enough +** to contain pointer values on this platform. +** +******************************************************************************/ + +#if defined _WIN64 + #define db2Is64bit + + typedef sqlint64 sqlintptr; + typedef sqluint64 sqluintptr; +#else + typedef sqlint32 sqlintptr; + typedef sqluint32 sqluintptr; +#endif + +#endif /* SQL_H_SQLSYSTM */ diff --git a/libraries/SQLAPI/include/ibAPI.h b/libraries/SQLAPI/include/ibAPI.h new file mode 100644 index 000000000..d2ac44ffc --- /dev/null +++ b/libraries/SQLAPI/include/ibAPI.h @@ -0,0 +1,991 @@ +/*! + * interface for the IibClient class. + * + * Copyright (c) 2005 by + */ + +#if !defined(__IBAPI_H__) +#define __IBAPI_H__ + +#include "SQLAPI.h" + +#ifdef __SUNPRO_CC +#include +#define _INTPTR_T_DEFINED +#endif + +#include + +#ifdef SA_64BIT +#define ISC_NULL_HANDLE 0 +#else +#define ISC_NULL_HANDLE NULL +#endif + +extern long g_nIB_DLLVersionLoaded; + +extern void AddIBSupport(const SAConnection *pCon); +extern void ReleaseIBSupport(); + +typedef ISC_STATUS (ISC_EXPORT *isc_attach_database_t) (ISC_STATUS ISC_FAR *, + short, + char ISC_FAR *, + isc_db_handle ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_array_gen_sdl_t) (ISC_STATUS ISC_FAR *, + ISC_ARRAY_DESC ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *, + short ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_array_get_slice_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + ISC_QUAD ISC_FAR *, + ISC_ARRAY_DESC ISC_FAR *, + void ISC_FAR *, + ISC_LONG ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_array_lookup_bounds_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + char ISC_FAR *, + char ISC_FAR *, + ISC_ARRAY_DESC ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_array_lookup_desc_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + char ISC_FAR *, + char ISC_FAR *, + ISC_ARRAY_DESC ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_array_set_desc_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *, + char ISC_FAR *, + short ISC_FAR *, + short ISC_FAR *, + short ISC_FAR *, + ISC_ARRAY_DESC ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_array_put_slice_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + ISC_QUAD ISC_FAR *, + ISC_ARRAY_DESC ISC_FAR *, + void ISC_FAR *, + ISC_LONG ISC_FAR *); + +typedef void (ISC_EXPORT *isc_blob_default_desc_t) (ISC_BLOB_DESC ISC_FAR *, + unsigned char ISC_FAR *, + unsigned char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_blob_gen_bpb_t) (ISC_STATUS ISC_FAR *, + ISC_BLOB_DESC ISC_FAR *, + ISC_BLOB_DESC ISC_FAR *, + unsigned short, + unsigned char ISC_FAR *, + unsigned short ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_blob_info_t) (ISC_STATUS ISC_FAR *, + isc_blob_handle ISC_FAR *, + short, + char ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_blob_lookup_desc_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + unsigned char ISC_FAR *, + unsigned char ISC_FAR *, + ISC_BLOB_DESC ISC_FAR *, + unsigned char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_blob_set_desc_t) (ISC_STATUS ISC_FAR *, + unsigned char ISC_FAR *, + unsigned char ISC_FAR *, + short, + short, + short, + ISC_BLOB_DESC ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_cancel_blob_t) (ISC_STATUS ISC_FAR *, + isc_blob_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_cancel_events_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + ISC_LONG ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_close_blob_t) (ISC_STATUS ISC_FAR *, + isc_blob_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_commit_retaining_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_commit_transaction_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_create_blob_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_blob_handle ISC_FAR *, + ISC_QUAD ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_create_blob2_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_blob_handle ISC_FAR *, + ISC_QUAD ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_create_database_t) (ISC_STATUS ISC_FAR *, + short, + char ISC_FAR *, + isc_db_handle ISC_FAR *, + short, + char ISC_FAR *, + short); + +typedef ISC_STATUS (ISC_EXPORT *isc_database_info_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + short, + char ISC_FAR *, + short, + char ISC_FAR *); + +typedef void (ISC_EXPORT *isc_decode_date_t) (ISC_QUAD ISC_FAR *, + void ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_detach_database_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_drop_database_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_allocate_statement_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_alloc_statement2_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_describe_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_describe_bind_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_exec_immed2_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_execute_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_execute2_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_execute_immediate_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_fetch_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_finish_t) (isc_db_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_free_statement_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_insert_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_prepare_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_set_cursor_name_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + char ISC_FAR *, + unsigned short); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_sql_info_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + short, + char ISC_FAR *, + short, + char ISC_FAR *); + +typedef void (ISC_EXPORT *isc_encode_date_t) (void ISC_FAR *, + ISC_QUAD ISC_FAR *); + +typedef ISC_LONG (ISC_EXPORT_VARARG *isc_event_block_t) (char ISC_FAR * ISC_FAR *, + char ISC_FAR * ISC_FAR *, + unsigned short, ...); + +typedef void (ISC_EXPORT *isc_event_counts_t) (ISC_ULONG ISC_FAR *, + short, + char ISC_FAR *, + char ISC_FAR *); + +typedef void (ISC_EXPORT_VARARG *isc_expand_dpb_t) (char ISC_FAR * ISC_FAR *, + short ISC_FAR *, ...); + +typedef int (ISC_EXPORT *isc_modify_dpb_t) (char ISC_FAR * ISC_FAR *, + short ISC_FAR *, unsigned short, + char ISC_FAR *, short ); + +typedef ISC_LONG (ISC_EXPORT *isc_free_t) (char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_get_segment_t) (ISC_STATUS ISC_FAR *, + isc_blob_handle ISC_FAR *, + unsigned short ISC_FAR *, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_get_slice_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + ISC_QUAD ISC_FAR *, + short, + char ISC_FAR *, + short, + ISC_LONG ISC_FAR *, + ISC_LONG, + void ISC_FAR *, + ISC_LONG ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_interprete_t) (char ISC_FAR *, + ISC_STATUS ISC_FAR * ISC_FAR *); + +/* Firebird safe string verison of isc_interprete */ +typedef ISC_STATUS (ISC_EXPORT *fb_interpret_t)(char ISC_FAR *, + unsigned int, + ISC_STATUS ISC_FAR * ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_open_blob_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_blob_handle ISC_FAR *, + ISC_QUAD ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_open_blob2_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_blob_handle ISC_FAR *, + ISC_QUAD ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_prepare_transaction2_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + short, + char ISC_FAR *); + +typedef void (ISC_EXPORT *isc_print_sqlerror_t) (short, + ISC_STATUS ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_print_status_t) (ISC_STATUS ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_put_segment_t) (ISC_STATUS ISC_FAR *, + isc_blob_handle ISC_FAR *, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_put_slice_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + ISC_QUAD ISC_FAR *, + short, + char ISC_FAR *, + short, + ISC_LONG ISC_FAR *, + ISC_LONG, + void ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_que_events_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + ISC_LONG ISC_FAR *, + short, + char ISC_FAR *, + isc_callback, + void ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_rollback_transaction_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_start_multiple_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + short, + void ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT_VARARG *isc_start_transaction_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + short, ...); + +typedef ISC_LONG (ISC_EXPORT *isc_sqlcode_t) (ISC_STATUS ISC_FAR *); + +typedef void (ISC_EXPORT *isc_sql_interprete_t) (short, + char ISC_FAR *, + short); + +typedef ISC_STATUS (ISC_EXPORT *isc_transaction_info_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + short, + char ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_transact_request_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + char ISC_FAR *); + +typedef ISC_LONG (ISC_EXPORT *isc_vax_integer_t) (char ISC_FAR *, + short); + + +typedef int (ISC_EXPORT *isc_add_user_t) (ISC_STATUS ISC_FAR *, USER_SEC_DATA *); + +typedef int (ISC_EXPORT *isc_delete_user_t) (ISC_STATUS ISC_FAR *, USER_SEC_DATA *); + +typedef int (ISC_EXPORT *isc_modify_user_t) (ISC_STATUS ISC_FAR *, USER_SEC_DATA *); + + +typedef ISC_STATUS (ISC_EXPORT *isc_compile_request_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_compile_request2_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_ddl_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_prepare_transaction_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *); + + +typedef ISC_STATUS (ISC_EXPORT *isc_receive_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *, + short, + short, + void ISC_FAR *, + short); + +typedef ISC_STATUS (ISC_EXPORT *isc_reconnect_transaction_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_release_request_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_request_info_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *, + short, + short, + char ISC_FAR *, + short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_seek_blob_t) (ISC_STATUS ISC_FAR *, + isc_blob_handle ISC_FAR *, + short, + ISC_LONG, + ISC_LONG ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_send_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *, + short, + short, + void ISC_FAR *, + short); + +typedef ISC_STATUS (ISC_EXPORT *isc_start_and_send_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + short, + short, + void ISC_FAR *, + short); + +typedef ISC_STATUS (ISC_EXPORT *isc_start_request_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + short); + +typedef ISC_STATUS (ISC_EXPORT *isc_unwind_request_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + short); + +typedef ISC_STATUS (ISC_EXPORT *isc_wait_for_event_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + short, + char ISC_FAR *, + char ISC_FAR *); + + +typedef ISC_STATUS (ISC_EXPORT *isc_close_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_declare_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_execute_immediate_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_execute_m_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_execute2_m_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_execute_immediate_m_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_exec_immed3_m_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_fetch_m_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_insert_m_t) (ISC_STATUS ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_prepare_m_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_stmt_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + unsigned short, + char ISC_FAR *, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_dsql_release_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_close_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_declare_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_describe_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_describe_bind_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_execute_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_execute2_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_execute_immed_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_fetch_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_open_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_open2_t) (ISC_STATUS ISC_FAR *, + isc_tr_handle ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_insert_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_prepare_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + char ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + XSQLDA ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_embed_dsql_release_t) (ISC_STATUS ISC_FAR *, + char ISC_FAR *); + +typedef BSTREAM ISC_FAR * (ISC_EXPORT *BLOB_open_t) (isc_blob_handle, + char ISC_FAR *, + int); + +typedef int (ISC_EXPORT *BLOB_put_t) (char, + BSTREAM ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_close_t) (BSTREAM ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_get_t) (BSTREAM ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_display_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_dump_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_edit_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_load_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_text_dump_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *); + +typedef int (ISC_EXPORT *BLOB_text_load_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *); + +typedef BSTREAM ISC_FAR * (ISC_EXPORT *Bopen_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *); + +typedef BSTREAM ISC_FAR * (ISC_EXPORT *Bopen2_t) (ISC_QUAD ISC_FAR *, + isc_db_handle, + isc_tr_handle, + char ISC_FAR *, + unsigned short); + + +typedef ISC_LONG (ISC_EXPORT *isc_ftof_t) (char ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short); + +typedef ISC_STATUS (ISC_EXPORT *isc_print_blr_t) (char ISC_FAR *, + isc_callback, + void ISC_FAR *, + short); + +typedef void (ISC_EXPORT *isc_set_debug_t) (int); + +typedef void (ISC_EXPORT *isc_qtoq_t) (ISC_QUAD ISC_FAR *, + ISC_QUAD ISC_FAR *); + +typedef void (ISC_EXPORT *isc_vtof_t) (char ISC_FAR *, + char ISC_FAR *, + unsigned short); + +typedef void (ISC_EXPORT *isc_vtov_t) (char ISC_FAR *, + char ISC_FAR *, + short); + +typedef int (ISC_EXPORT *isc_version_t) (isc_db_handle ISC_FAR *, + isc_callback, + void ISC_FAR *); + +typedef ISC_LONG (ISC_EXPORT *isc_reset_fpe_t) (unsigned short); + + +typedef ISC_STATUS (ISC_EXPORT *isc_attach_service_t) (ISC_STATUS ISC_FAR *, + unsigned short, + char ISC_FAR *, + isc_svc_handle ISC_FAR *, + unsigned short, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_detach_service_t) (ISC_STATUS ISC_FAR *, + isc_svc_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_query_service_t) (ISC_STATUS ISC_FAR *, + isc_svc_handle ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + char ISC_FAR *, + unsigned short, + char ISC_FAR *); + +/* InterBase API +typedef ISC_STATUS (ISC_EXPORT *isc_compile_map_t) (ISC_STATUS ISC_FAR *, + isc_form_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_compile_menu_t) (ISC_STATUS ISC_FAR *, + isc_form_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_compile_sub_map_t) (ISC_STATUS ISC_FAR *, + isc_win_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_create_window_t) (ISC_STATUS ISC_FAR *, + isc_win_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *, + short ISC_FAR *, + short ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_delete_window_t) (ISC_STATUS ISC_FAR *, + isc_win_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_drive_form_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_win_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + unsigned char ISC_FAR *, + unsigned char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_drive_menu_t) (ISC_STATUS ISC_FAR *, + isc_win_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *, + short ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *, + ISC_LONG ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_form_delete_t) (ISC_STATUS ISC_FAR *, + isc_form_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_form_fetch_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + unsigned char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_form_insert_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + unsigned char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_get_entree_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *, + ISC_LONG ISC_FAR *, + short ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_initialize_menu_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_menu_t) (ISC_STATUS ISC_FAR *, + isc_win_handle ISC_FAR *, + isc_req_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_load_form_t) (ISC_STATUS ISC_FAR *, + isc_db_handle ISC_FAR *, + isc_tr_handle ISC_FAR *, + isc_form_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_pop_window_t) (ISC_STATUS ISC_FAR *, + isc_win_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_put_entree_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *, + short ISC_FAR *, + char ISC_FAR *, + ISC_LONG ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_reset_form_t) (ISC_STATUS ISC_FAR *, + isc_req_handle ISC_FAR *); + +typedef ISC_STATUS (ISC_EXPORT *isc_suspend_window_t) (ISC_STATUS ISC_FAR *, + isc_win_handle ISC_FAR *); +*/ + +// API declarations +class SQLAPI_API ibAPI : public saAPI +{ +public: + ibAPI(); + + isc_add_user_t isc_add_user; + isc_array_gen_sdl_t isc_array_gen_sdl; + isc_array_get_slice_t isc_array_get_slice; + isc_array_lookup_bounds_t isc_array_lookup_bounds; + isc_array_lookup_desc_t isc_array_lookup_desc; + isc_array_put_slice_t isc_array_put_slice; + isc_array_set_desc_t isc_array_set_desc; + isc_attach_database_t isc_attach_database; + isc_blob_default_desc_t isc_blob_default_desc; + isc_blob_gen_bpb_t isc_blob_gen_bpb; + isc_blob_info_t isc_blob_info; + isc_blob_lookup_desc_t isc_blob_lookup_desc; + isc_blob_set_desc_t isc_blob_set_desc; + isc_cancel_blob_t isc_cancel_blob; + isc_cancel_events_t isc_cancel_events; + isc_close_blob_t isc_close_blob; + isc_commit_retaining_t isc_commit_retaining; + isc_commit_transaction_t isc_commit_transaction; + isc_create_blob_t isc_create_blob; + isc_create_blob2_t isc_create_blob2; + isc_create_database_t isc_create_database; + isc_database_info_t isc_database_info; + isc_decode_date_t isc_decode_date; + isc_detach_database_t isc_detach_database; + isc_drop_database_t isc_drop_database; + isc_dsql_allocate_statement_t isc_dsql_allocate_statement; + isc_dsql_alloc_statement2_t isc_dsql_alloc_statement2; + isc_dsql_describe_t isc_dsql_describe; + isc_dsql_describe_bind_t isc_dsql_describe_bind; + isc_dsql_exec_immed2_t isc_dsql_exec_immed2; + isc_dsql_execute_t isc_dsql_execute; + isc_dsql_execute2_t isc_dsql_execute2; + isc_dsql_execute_immediate_t isc_dsql_execute_immediate; + isc_dsql_fetch_t isc_dsql_fetch; + isc_dsql_finish_t isc_dsql_finish; + isc_dsql_free_statement_t isc_dsql_free_statement; + isc_dsql_insert_t isc_dsql_insert; + isc_dsql_prepare_t isc_dsql_prepare; + isc_dsql_set_cursor_name_t isc_dsql_set_cursor_name; + isc_dsql_sql_info_t isc_dsql_sql_info; + isc_encode_date_t isc_encode_date; + isc_event_block_t isc_event_block; + isc_event_counts_t isc_event_counts; + isc_expand_dpb_t isc_expand_dpb; + isc_modify_dpb_t isc_modify_dpb; + isc_free_t isc_free; + isc_get_segment_t isc_get_segment; + isc_get_slice_t isc_get_slice; + isc_interprete_t isc_interprete; + isc_open_blob_t isc_open_blob; + isc_open_blob2_t isc_open_blob2; + isc_prepare_transaction2_t isc_prepare_transaction2; + isc_print_sqlerror_t isc_print_sqlerror; + isc_print_status_t isc_print_status; + isc_put_segment_t isc_put_segment; + isc_put_slice_t isc_put_slice; + isc_que_events_t isc_que_events; + isc_rollback_transaction_t isc_rollback_transaction; + isc_start_multiple_t isc_start_multiple; + isc_start_transaction_t isc_start_transaction; + isc_sqlcode_t isc_sqlcode; + isc_sql_interprete_t isc_sql_interprete; + isc_transaction_info_t isc_transaction_info; + isc_transact_request_t isc_transact_request; + isc_vax_integer_t isc_vax_integer; + isc_delete_user_t isc_delete_user; + isc_modify_user_t isc_modify_user; + isc_compile_request_t isc_compile_request; + isc_compile_request2_t isc_compile_request2; + isc_ddl_t isc_ddl; + isc_prepare_transaction_t isc_prepare_transaction; + isc_receive_t isc_receive; + isc_reconnect_transaction_t isc_reconnect_transaction; + isc_release_request_t isc_release_request; + isc_request_info_t isc_request_info; + isc_seek_blob_t isc_seek_blob; + isc_send_t isc_send; + isc_start_and_send_t isc_start_and_send; + isc_start_request_t isc_start_request; + isc_unwind_request_t isc_unwind_request; + isc_wait_for_event_t isc_wait_for_event; + isc_close_t isc_close; + isc_declare_t isc_declare; + isc_execute_immediate_t isc_execute_immediate; + isc_dsql_execute_m_t isc_dsql_execute_m; + isc_dsql_execute2_m_t isc_dsql_execute2_m; + isc_dsql_execute_immediate_m_t isc_dsql_execute_immediate_m; + isc_dsql_exec_immed3_m_t isc_dsql_exec_immed3_m; + isc_dsql_fetch_m_t isc_dsql_fetch_m; + isc_dsql_insert_m_t isc_dsql_insert_m; + isc_dsql_prepare_m_t isc_dsql_prepare_m; + isc_dsql_release_t isc_dsql_release; + isc_embed_dsql_close_t isc_embed_dsql_close; + isc_embed_dsql_declare_t isc_embed_dsql_declare; + isc_embed_dsql_describe_t isc_embed_dsql_describe; + isc_embed_dsql_describe_bind_t isc_embed_dsql_describe_bind; + isc_embed_dsql_execute_t isc_embed_dsql_execute; + isc_embed_dsql_execute2_t isc_embed_dsql_execute2; + isc_embed_dsql_execute_immed_t isc_embed_dsql_execute_immed; + isc_embed_dsql_fetch_t isc_embed_dsql_fetch; + isc_embed_dsql_open_t isc_embed_dsql_open; + isc_embed_dsql_open2_t isc_embed_dsql_open2; + isc_embed_dsql_insert_t isc_embed_dsql_insert; + isc_embed_dsql_prepare_t isc_embed_dsql_prepare; + isc_embed_dsql_release_t isc_embed_dsql_release; + isc_ftof_t isc_ftof; + isc_print_blr_t isc_print_blr; + isc_set_debug_t isc_set_debug; + isc_qtoq_t isc_qtoq; + isc_vtof_t isc_vtof; + isc_vtov_t isc_vtov; + isc_version_t isc_version; + fb_interpret_t fb_interpret; + +}; + +class SQLAPI_API ibConnectionHandles : public saConnectionHandles +{ +public: + ibConnectionHandles(); + + isc_db_handle m_db_handle; // Database handle + isc_tr_handle m_tr_handle; // Transaction handle +}; + +class SQLAPI_API ibCommandHandles : public saCommandHandles +{ +public: + ibCommandHandles(); + + isc_stmt_handle m_stmt_handle; +}; + +extern ibAPI g_ibAPI; + +#endif // !defined(__IBAPI_H__) diff --git a/libraries/SQLAPI/include/ibase/ib_util.h b/libraries/SQLAPI/include/ibase/ib_util.h new file mode 100644 index 000000000..d0bc1828e --- /dev/null +++ b/libraries/SQLAPI/include/ibase/ib_util.h @@ -0,0 +1,37 @@ +/* + * PROGRAM: UDF and Blob filter Utilities library + * MODULE: ib_util.h + * DESCRIPTION: Prototype header file for ib_util.c + * + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.html + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#ifndef _IB_UTIL_H +#define _IB_UTIL_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern void *ib_util_malloc(long); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* _IB_UTIL_H */ diff --git a/libraries/SQLAPI/include/ibase/ibase.h b/libraries/SQLAPI/include/ibase/ibase.h new file mode 100644 index 000000000..115dd5a33 --- /dev/null +++ b/libraries/SQLAPI/include/ibase/ibase.h @@ -0,0 +1,2549 @@ +/* + * MODULE: ibase.h + * DESCRIPTION: OSRI entrypoints and defines + * + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.html + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * + * 2001.07.28: John Bellardo: Added blr_skip + * 2001.09.18: Ann Harrison: New info codes + * 17-Oct-2001 Mike Nordell: CPU affinity + * 2001-04-16 Paul Beach: ISC_TIME_SECONDS_PRECISION_SCALE modified for HP10 + * Compiler Compatibility + * 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports: + * - EPSON, XENIX, MAC (MAC_AUX), Cray and OS/2 + * 2002.10.29 Nickolay Samofatov: Added support for savepoints + * + * 2002.10.29 Sean Leyne - Removed support for obsolete IPX/SPX Protocol + * + * 2006.09.06 Steve Boyd - Added various prototypes required by Cobol ESQL + * isc_embed_dsql_length + * isc_event_block_a + * isc_sqlcode_s + * isc_embed_dsql_fetch_a + * isc_event_block_s + * isc_baddress + * isc_baddress_s + * + */ + +#ifndef JRD_IBASE_H +#define JRD_IBASE_H + +#define FB_API_VER 20 +#define isc_version4 + +#define ISC_TRUE 1 +#define ISC_FALSE 0 +#if !(defined __cplusplus) +#define ISC__TRUE ISC_TRUE +#define ISC__FALSE ISC_FALSE +#endif + +#define ISC_FAR + +#if defined _MSC_VER && _MSC_VER >= 1300 +#define FB_API_DEPRECATED __declspec(deprecated) +#elif defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) +#define FB_API_DEPRECATED __attribute__((__deprecated__)) +#else +#define FB_API_DEPRECATED +#endif + + +#ifndef INCLUDE_TYPES_PUB_H +#define INCLUDE_TYPES_PUB_H + +#include + +#if defined(__GNUC__) +#include +#else + +#if !defined(_INTPTR_T_DEFINED) +#if defined(_WIN64) +typedef __int64 intptr_t; +typedef unsigned __int64 uintptr_t; +#else +typedef long intptr_t; +typedef unsigned long uintptr_t; +#endif +#endif + +#endif + +#if defined(_LP64) || defined(__LP64__) || defined(__arch64__) || defined(_WIN64) +typedef unsigned int FB_API_HANDLE; +#else +typedef void* FB_API_HANDLE; +#endif + +typedef intptr_t ISC_STATUS; + +#define ISC_STATUS_LENGTH 20 +typedef ISC_STATUS ISC_STATUS_ARRAY[ISC_STATUS_LENGTH]; + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) + #define ISC_EXPORT __stdcall + #define ISC_EXPORT_VARARG __cdecl +#else + #define ISC_EXPORT + #define ISC_EXPORT_VARARG +#endif + +#if defined(_LP64) || defined(__LP64__) || defined(__arch64__) +typedef int ISC_LONG; +typedef unsigned int ISC_ULONG; +#else +typedef signed long ISC_LONG; +typedef unsigned long ISC_ULONG; +#endif + +typedef signed short ISC_SHORT; +typedef unsigned short ISC_USHORT; + +typedef unsigned char ISC_UCHAR; +typedef char ISC_SCHAR; + +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(__GNUC__) +typedef __int64 ISC_INT64; +typedef unsigned __int64 ISC_UINT64; +#else +typedef long long int ISC_INT64; +typedef unsigned long long int ISC_UINT64; +#endif + +#ifndef ISC_TIMESTAMP_DEFINED +typedef int ISC_DATE; +typedef unsigned int ISC_TIME; +typedef struct +{ + ISC_DATE timestamp_date; + ISC_TIME timestamp_time; +} ISC_TIMESTAMP; +#define ISC_TIMESTAMP_DEFINED +#endif + +struct GDS_QUAD_t { + ISC_LONG gds_quad_high; + ISC_ULONG gds_quad_low; +}; + +typedef struct GDS_QUAD_t GDS_QUAD; +typedef struct GDS_QUAD_t ISC_QUAD; + +#define isc_quad_high gds_quad_high +#define isc_quad_low gds_quad_low + +#endif + +/********************************/ +/* Firebird Handle Definitions */ +/********************************/ + +typedef FB_API_HANDLE isc_att_handle; +typedef FB_API_HANDLE isc_blob_handle; +typedef FB_API_HANDLE isc_db_handle; +typedef FB_API_HANDLE isc_req_handle; +typedef FB_API_HANDLE isc_stmt_handle; +typedef FB_API_HANDLE isc_svc_handle; +typedef FB_API_HANDLE isc_tr_handle; +typedef void (* isc_callback) (); +typedef ISC_LONG isc_resv_handle; + +typedef void (*ISC_PRINT_CALLBACK) (void*, ISC_SHORT, const char*); +typedef void (*ISC_VERSION_CALLBACK)(void*, const char*); +typedef void (*ISC_EVENT_CALLBACK)(void*, ISC_USHORT, const ISC_UCHAR*); + +/*******************************************************************/ +/* Blob id structure */ +/*******************************************************************/ + +#if !(defined __cplusplus) +typedef GDS_QUAD GDS__QUAD; +#endif /* !(defined __cplusplus) */ + +typedef struct +{ + short array_bound_lower; + short array_bound_upper; +} ISC_ARRAY_BOUND; + +typedef struct +{ + ISC_UCHAR array_desc_dtype; + ISC_SCHAR array_desc_scale; + unsigned short array_desc_length; + ISC_SCHAR array_desc_field_name[32]; + ISC_SCHAR array_desc_relation_name[32]; + short array_desc_dimensions; + short array_desc_flags; + ISC_ARRAY_BOUND array_desc_bounds[16]; +} ISC_ARRAY_DESC; + +typedef struct +{ + short blob_desc_subtype; + short blob_desc_charset; + short blob_desc_segment_size; + ISC_UCHAR blob_desc_field_name[32]; + ISC_UCHAR blob_desc_relation_name[32]; +} ISC_BLOB_DESC; + +/***************************/ +/* Blob control structure */ +/***************************/ + +typedef struct isc_blob_ctl +{ + ISC_STATUS (* ctl_source)(); /* Source filter */ + struct isc_blob_ctl* ctl_source_handle; /* Argument to pass to source filter */ + short ctl_to_sub_type; /* Target type */ + short ctl_from_sub_type; /* Source type */ + unsigned short ctl_buffer_length; /* Length of buffer */ + unsigned short ctl_segment_length; /* Length of current segment */ + unsigned short ctl_bpb_length; /* Length of blob parameter block */ + /* Internally, this is const UCHAR*, but this public struct probably can't change. */ + ISC_SCHAR* ctl_bpb; /* Address of blob parameter block */ + ISC_UCHAR* ctl_buffer; /* Address of segment buffer */ + ISC_LONG ctl_max_segment; /* Length of longest segment */ + ISC_LONG ctl_number_segments; /* Total number of segments */ + ISC_LONG ctl_total_length; /* Total length of blob */ + ISC_STATUS* ctl_status; /* Address of status vector */ + long ctl_data[8]; /* Application specific data */ +} * ISC_BLOB_CTL; + +/***************************/ +/* Blob stream definitions */ +/***************************/ + +typedef struct bstream +{ + isc_blob_handle bstr_blob; /* Blob handle */ + ISC_SCHAR * bstr_buffer; /* Address of buffer */ + ISC_SCHAR * bstr_ptr; /* Next character */ + short bstr_length; /* Length of buffer */ + short bstr_cnt; /* Characters in buffer */ + char bstr_mode; /* (mode) ? OUTPUT : INPUT */ +} BSTREAM; + +/* Three ugly macros, one even using octal radix... sigh... */ +#define getb(p) (--(p)->bstr_cnt >= 0 ? *(p)->bstr_ptr++ & 0377: BLOB_get (p)) +#define putb(x,p) (((x) == '\n' || (!(--(p)->bstr_cnt))) ? BLOB_put ((x),p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x)))) +#define putbx(x,p) ((!(--(p)->bstr_cnt)) ? BLOB_put ((x),p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x)))) + +/********************************************************************/ +/* CVC: Public blob interface definition held in val.h. */ +/* For some unknown reason, it was only documented in langRef */ +/* and being the structure passed by the engine to UDFs it never */ +/* made its way into this public definitions file. */ +/* Being its original name "blob", I renamed it blobcallback here. */ +/* I did the full definition with the proper parameters instead of */ +/* the weak C declaration with any number and type of parameters. */ +/* Since the first parameter -BLB- is unknown outside the engine, */ +/* it's more accurate to use void* than int* as the blob pointer */ +/********************************************************************/ + +#if !defined(JRD_VAL_H) && !defined(REQUESTER) +/* Blob passing structure */ + +/* This enum applies to parameter "mode" in blob_lseek */ +enum blob_lseek_mode {blb_seek_relative = 1, blb_seek_from_tail = 2}; +/* This enum applies to the value returned by blob_get_segment */ +enum blob_get_result {blb_got_fragment = -1, blb_got_eof = 0, blb_got_full_segment = 1}; + +typedef struct blobcallback { + short (*blob_get_segment) + (void* hnd, ISC_UCHAR* buffer, ISC_USHORT buf_size, ISC_USHORT* result_len); + void* blob_handle; + ISC_LONG blob_number_segments; + ISC_LONG blob_max_segment; + ISC_LONG blob_total_length; + void (*blob_put_segment) + (void* hnd, const ISC_UCHAR* buffer, ISC_USHORT buf_size); + ISC_LONG (*blob_lseek) + (void* hnd, ISC_USHORT mode, ISC_LONG offset); +} *BLOBCALLBACK; +#endif /* !defined(JRD_VAL_H) && !defined(REQUESTER) */ + + +/********************************************************************/ +/* CVC: Public descriptor interface held in dsc2.h. */ +/* We need it documented to be able to recognize NULL in UDFs. */ +/* Being its original name "dsc", I renamed it paramdsc here. */ +/* Notice that I adjust to the original definition: contrary to */ +/* other cases, the typedef is the same struct not the pointer. */ +/* I included the enumeration of dsc_dtype possible values. */ +/* Ultimately, dsc2.h should be part of the public interface. */ +/********************************************************************/ + +#if !defined(JRD_DSC_H) +/* This is the famous internal descriptor that UDFs can use, too. */ +typedef struct paramdsc { + ISC_UCHAR dsc_dtype; + signed char dsc_scale; + ISC_USHORT dsc_length; + short dsc_sub_type; + ISC_USHORT dsc_flags; + ISC_UCHAR *dsc_address; +} PARAMDSC; + +#if !defined(JRD_VAL_H) +/* This is a helper struct to work with varchars. */ +typedef struct paramvary { + ISC_USHORT vary_length; + ISC_UCHAR vary_string[1]; +} PARAMVARY; +#endif /* !defined(JRD_VAL_H) */ + + +#ifndef JRD_DSC_PUB_H +#define JRD_DSC_PUB_H + +#define DSC_null 1 +#define DSC_no_subtype 2 +#define DSC_nullable 4 + +#define dtype_unknown 0 +#define dtype_text 1 +#define dtype_cstring 2 +#define dtype_varying 3 + +#define dtype_packed 6 +#define dtype_byte 7 +#define dtype_short 8 +#define dtype_long 9 +#define dtype_quad 10 +#define dtype_real 11 +#define dtype_double 12 +#define dtype_d_float 13 +#define dtype_sql_date 14 +#define dtype_sql_time 15 +#define dtype_timestamp 16 +#define dtype_blob 17 +#define dtype_array 18 +#define dtype_int64 19 +#define DTYPE_TYPE_MAX 20 + +#define ISC_TIME_SECONDS_PRECISION 10000 +#define ISC_TIME_SECONDS_PRECISION_SCALE (-4) + +#endif + + +#endif /* !defined(JRD_DSC_H) */ + +/***************************/ +/* Dynamic SQL definitions */ +/***************************/ + + +#ifndef DSQL_SQLDA_PUB_H +#define DSQL_SQLDA_PUB_H + +#define DSQL_close 1 +#define DSQL_drop 2 + +typedef struct +{ + ISC_SHORT sqltype; + ISC_SHORT sqlscale; + ISC_SHORT sqlsubtype; + ISC_SHORT sqllen; + ISC_SCHAR* sqldata; + ISC_SHORT* sqlind; + ISC_SHORT sqlname_length; + ISC_SCHAR sqlname[32]; + ISC_SHORT relname_length; + ISC_SCHAR relname[32]; + ISC_SHORT ownname_length; + ISC_SCHAR ownname[32]; + ISC_SHORT aliasname_length; + ISC_SCHAR aliasname[32]; +} XSQLVAR; + +#define SQLDA_VERSION1 1 + +typedef struct +{ + ISC_SHORT version; + ISC_SCHAR sqldaid[8]; + ISC_LONG sqldabc; + ISC_SHORT sqln; + ISC_SHORT sqld; + XSQLVAR sqlvar[1]; +} XSQLDA; + +#define XSQLDA_LENGTH(n) (sizeof (XSQLDA) + (n - 1) * sizeof (XSQLVAR)) + +#define SQL_TEXT 452 +#define SQL_VARYING 448 +#define SQL_SHORT 500 +#define SQL_LONG 496 +#define SQL_FLOAT 482 +#define SQL_DOUBLE 480 +#define SQL_D_FLOAT 530 +#define SQL_TIMESTAMP 510 +#define SQL_BLOB 520 +#define SQL_ARRAY 540 +#define SQL_QUAD 550 +#define SQL_TYPE_TIME 560 +#define SQL_TYPE_DATE 570 +#define SQL_INT64 580 + +#define SQL_DATE SQL_TIMESTAMP + +#define SQL_DIALECT_V5 1 +#define SQL_DIALECT_V6_TRANSITION 2 +#define SQL_DIALECT_V6 3 +#define SQL_DIALECT_CURRENT SQL_DIALECT_V6 + +#endif + + +/***************************/ +/* OSRI database functions */ +/***************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +ISC_STATUS ISC_EXPORT isc_attach_database(ISC_STATUS*, + short, + const ISC_SCHAR*, + isc_db_handle*, + short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_array_gen_sdl(ISC_STATUS*, + const ISC_ARRAY_DESC*, + ISC_SHORT*, + ISC_UCHAR*, + ISC_SHORT*); + +ISC_STATUS ISC_EXPORT isc_array_get_slice(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, + const ISC_ARRAY_DESC*, + void*, + ISC_LONG*); + +ISC_STATUS ISC_EXPORT isc_array_lookup_bounds(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + const ISC_SCHAR*, + const ISC_SCHAR*, + ISC_ARRAY_DESC*); + +ISC_STATUS ISC_EXPORT isc_array_lookup_desc(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + const ISC_SCHAR*, + const ISC_SCHAR*, + ISC_ARRAY_DESC*); + +ISC_STATUS ISC_EXPORT isc_array_set_desc(ISC_STATUS*, + const ISC_SCHAR*, + const ISC_SCHAR*, + const short*, + const short*, + const short*, + ISC_ARRAY_DESC*); + +ISC_STATUS ISC_EXPORT isc_array_put_slice(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, + const ISC_ARRAY_DESC*, + void*, + ISC_LONG *); + +void ISC_EXPORT isc_blob_default_desc(ISC_BLOB_DESC*, + const ISC_UCHAR*, + const ISC_UCHAR*); + +ISC_STATUS ISC_EXPORT isc_blob_gen_bpb(ISC_STATUS*, + const ISC_BLOB_DESC*, + const ISC_BLOB_DESC*, + unsigned short, + ISC_UCHAR*, + unsigned short*); + +ISC_STATUS ISC_EXPORT isc_blob_info(ISC_STATUS*, + isc_blob_handle*, + short, + const ISC_SCHAR*, + short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_blob_lookup_desc(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + const ISC_UCHAR*, + const ISC_UCHAR*, + ISC_BLOB_DESC*, + ISC_UCHAR*); + +ISC_STATUS ISC_EXPORT isc_blob_set_desc(ISC_STATUS*, + const ISC_UCHAR*, + const ISC_UCHAR*, + short, + short, + short, + ISC_BLOB_DESC*); + +ISC_STATUS ISC_EXPORT isc_cancel_blob(ISC_STATUS *, + isc_blob_handle *); + +ISC_STATUS ISC_EXPORT isc_cancel_events(ISC_STATUS *, + isc_db_handle *, + ISC_LONG *); + +ISC_STATUS ISC_EXPORT isc_close_blob(ISC_STATUS *, + isc_blob_handle *); + +ISC_STATUS ISC_EXPORT isc_commit_retaining(ISC_STATUS *, + isc_tr_handle *); + +ISC_STATUS ISC_EXPORT isc_commit_transaction(ISC_STATUS *, + isc_tr_handle *); + +ISC_STATUS ISC_EXPORT isc_create_blob(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*); + +ISC_STATUS ISC_EXPORT isc_create_blob2(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*, + short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_create_database(ISC_STATUS*, + short, + const ISC_SCHAR*, + isc_db_handle*, + short, + const ISC_SCHAR*, + short); + +ISC_STATUS ISC_EXPORT isc_database_info(ISC_STATUS*, + isc_db_handle*, + short, + const ISC_SCHAR*, + short, + ISC_SCHAR*); + +void ISC_EXPORT isc_decode_date(const ISC_QUAD*, + void*); + +void ISC_EXPORT isc_decode_sql_date(const ISC_DATE*, + void*); + +void ISC_EXPORT isc_decode_sql_time(const ISC_TIME*, + void*); + +void ISC_EXPORT isc_decode_timestamp(const ISC_TIMESTAMP*, + void*); + +ISC_STATUS ISC_EXPORT isc_detach_database(ISC_STATUS *, + isc_db_handle *); + +ISC_STATUS ISC_EXPORT isc_drop_database(ISC_STATUS *, + isc_db_handle *); + +ISC_STATUS ISC_EXPORT isc_dsql_allocate_statement(ISC_STATUS *, + isc_db_handle *, + isc_stmt_handle *); + +ISC_STATUS ISC_EXPORT isc_dsql_alloc_statement2(ISC_STATUS *, + isc_db_handle *, + isc_stmt_handle *); + +ISC_STATUS ISC_EXPORT isc_dsql_describe(ISC_STATUS *, + isc_stmt_handle *, + unsigned short, + XSQLDA *); + +ISC_STATUS ISC_EXPORT isc_dsql_describe_bind(ISC_STATUS *, + isc_stmt_handle *, + unsigned short, + XSQLDA *); + +ISC_STATUS ISC_EXPORT isc_dsql_exec_immed2(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + XSQLDA*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_dsql_execute(ISC_STATUS*, + isc_tr_handle*, + isc_stmt_handle*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_dsql_execute2(ISC_STATUS*, + isc_tr_handle*, + isc_stmt_handle*, + unsigned short, + XSQLDA*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_dsql_fetch(ISC_STATUS *, + isc_stmt_handle *, + unsigned short, + XSQLDA *); + +ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle *); + +ISC_STATUS ISC_EXPORT isc_dsql_free_statement(ISC_STATUS *, + isc_stmt_handle *, + unsigned short); + +ISC_STATUS ISC_EXPORT isc_dsql_insert(ISC_STATUS*, + isc_stmt_handle*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_dsql_prepare(ISC_STATUS*, + isc_tr_handle*, + isc_stmt_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_dsql_set_cursor_name(ISC_STATUS*, + isc_stmt_handle*, + const ISC_SCHAR*, + unsigned short); + +ISC_STATUS ISC_EXPORT isc_dsql_sql_info(ISC_STATUS*, + isc_stmt_handle*, + short, + const ISC_SCHAR*, + short, + ISC_SCHAR*); + +void ISC_EXPORT isc_encode_date(const void*, + ISC_QUAD*); + +void ISC_EXPORT isc_encode_sql_date(const void*, + ISC_DATE*); + +void ISC_EXPORT isc_encode_sql_time(const void*, + ISC_TIME*); + +void ISC_EXPORT isc_encode_timestamp(const void*, + ISC_TIMESTAMP*); + +ISC_LONG ISC_EXPORT_VARARG isc_event_block(ISC_UCHAR**, + ISC_UCHAR**, + ISC_USHORT, ...); + +ISC_USHORT ISC_EXPORT isc_event_block_a(ISC_SCHAR**, + ISC_SCHAR**, + ISC_USHORT, + ISC_SCHAR**); + +void ISC_EXPORT isc_event_block_s(ISC_SCHAR**, + ISC_SCHAR**, + ISC_USHORT, + ISC_SCHAR**, + ISC_USHORT*); + +void ISC_EXPORT isc_event_counts(ISC_ULONG*, + short, + ISC_UCHAR*, + const ISC_UCHAR *); + +/* 17 May 2001 - isc_expand_dpb is DEPRECATED */ +void FB_API_DEPRECATED ISC_EXPORT_VARARG isc_expand_dpb(ISC_SCHAR**, + short*, ...); + +int ISC_EXPORT isc_modify_dpb(ISC_SCHAR**, + short*, + unsigned short, + const ISC_SCHAR*, + short); + +ISC_LONG ISC_EXPORT isc_free(ISC_SCHAR *); + +ISC_STATUS ISC_EXPORT isc_get_segment(ISC_STATUS *, + isc_blob_handle *, + unsigned short *, + unsigned short, + ISC_SCHAR *); + +ISC_STATUS ISC_EXPORT isc_get_slice(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, + short, + const ISC_SCHAR*, + short, + const ISC_LONG*, + ISC_LONG, + void*, + ISC_LONG*); + +/* CVC: This non-const signature is needed for compatibility, see gds.cpp. */ +ISC_LONG FB_API_DEPRECATED ISC_EXPORT isc_interprete(ISC_SCHAR*, + ISC_STATUS**); + +/* This const params version used in the engine and other places. */ +ISC_LONG ISC_EXPORT fb_interpret(ISC_SCHAR*, + unsigned int, + const ISC_STATUS**); + +ISC_STATUS ISC_EXPORT isc_open_blob(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*); + +ISC_STATUS ISC_EXPORT isc_open_blob2(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*, + ISC_USHORT, + const ISC_UCHAR*); + +ISC_STATUS ISC_EXPORT isc_prepare_transaction2(ISC_STATUS*, + isc_tr_handle*, + ISC_USHORT, + const ISC_UCHAR*); + +void ISC_EXPORT isc_print_sqlerror(ISC_SHORT, + const ISC_STATUS*); + +ISC_STATUS ISC_EXPORT isc_print_status(const ISC_STATUS*); + +ISC_STATUS ISC_EXPORT isc_put_segment(ISC_STATUS*, + isc_blob_handle*, + unsigned short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_put_slice(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, + short, + const ISC_SCHAR*, + short, + const ISC_LONG*, + ISC_LONG, + void*); + +ISC_STATUS ISC_EXPORT isc_que_events(ISC_STATUS*, + isc_db_handle*, + ISC_LONG*, + short, + const ISC_UCHAR*, + ISC_EVENT_CALLBACK, + void*); + +ISC_STATUS ISC_EXPORT isc_rollback_retaining(ISC_STATUS *, + isc_tr_handle *); + +ISC_STATUS ISC_EXPORT isc_rollback_transaction(ISC_STATUS *, + isc_tr_handle *); + +ISC_STATUS ISC_EXPORT isc_start_multiple(ISC_STATUS *, + isc_tr_handle *, + short, + void *); + +ISC_STATUS ISC_EXPORT_VARARG isc_start_transaction(ISC_STATUS *, + isc_tr_handle *, + short, ...); + +ISC_LONG ISC_EXPORT isc_sqlcode(const ISC_STATUS*); + +void ISC_EXPORT isc_sqlcode_s(const ISC_STATUS*, + ISC_ULONG*); + +void ISC_EXPORT isc_sql_interprete(short, + ISC_SCHAR*, + short); + +ISC_STATUS ISC_EXPORT isc_transaction_info(ISC_STATUS*, + isc_tr_handle*, + short, + const ISC_SCHAR*, + short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_transact_request(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + ISC_SCHAR*, + unsigned short, + ISC_SCHAR*); + +ISC_LONG ISC_EXPORT isc_vax_integer(const ISC_SCHAR*, + short); + +ISC_INT64 ISC_EXPORT isc_portable_integer(const ISC_UCHAR*, + short); + +/*************************************/ +/* Security Functions and structures */ +/*************************************/ + +#define sec_uid_spec 0x01 +#define sec_gid_spec 0x02 +#define sec_server_spec 0x04 +#define sec_password_spec 0x08 +#define sec_group_name_spec 0x10 +#define sec_first_name_spec 0x20 +#define sec_middle_name_spec 0x40 +#define sec_last_name_spec 0x80 +#define sec_dba_user_name_spec 0x100 +#define sec_dba_password_spec 0x200 + +#define sec_protocol_tcpip 1 +#define sec_protocol_netbeui 2 +#define sec_protocol_spx 3 /* -- Deprecated Protocol. Declaration retained for compatibility */ +#define sec_protocol_local 4 + +typedef struct { + short sec_flags; /* which fields are specified */ + int uid; /* the user's id */ + int gid; /* the user's group id */ + int protocol; /* protocol to use for connection */ + ISC_SCHAR *server; /* server to administer */ + ISC_SCHAR *user_name; /* the user's name */ + ISC_SCHAR *password; /* the user's password */ + ISC_SCHAR *group_name; /* the group name */ + ISC_SCHAR *first_name; /* the user's first name */ + ISC_SCHAR *middle_name; /* the user's middle name */ + ISC_SCHAR *last_name; /* the user's last name */ + ISC_SCHAR *dba_user_name; /* the dba user name */ + ISC_SCHAR *dba_password; /* the dba password */ +} USER_SEC_DATA; + +ISC_STATUS ISC_EXPORT isc_add_user(ISC_STATUS*, const USER_SEC_DATA*); + +ISC_STATUS ISC_EXPORT isc_delete_user(ISC_STATUS*, const USER_SEC_DATA*); + +ISC_STATUS ISC_EXPORT isc_modify_user(ISC_STATUS*, const USER_SEC_DATA*); + +/**********************************/ +/* Other OSRI functions */ +/**********************************/ + +ISC_STATUS ISC_EXPORT isc_compile_request(ISC_STATUS*, + isc_db_handle*, + isc_req_handle*, + short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_compile_request2(ISC_STATUS*, + isc_db_handle*, + isc_req_handle*, + short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_ddl(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_prepare_transaction(ISC_STATUS*, + isc_tr_handle*); + + +ISC_STATUS ISC_EXPORT isc_receive(ISC_STATUS*, + isc_req_handle*, + short, + short, + void*, + short); + +ISC_STATUS ISC_EXPORT isc_reconnect_transaction(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_release_request(ISC_STATUS*, + isc_req_handle*); + +ISC_STATUS ISC_EXPORT isc_request_info(ISC_STATUS*, + isc_req_handle*, + short, + short, + const ISC_SCHAR*, + short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_seek_blob(ISC_STATUS*, + isc_blob_handle*, + short, + ISC_LONG, + ISC_LONG*); + +ISC_STATUS ISC_EXPORT isc_send(ISC_STATUS*, + isc_req_handle*, + short, + short, + const void*, + short); + +ISC_STATUS ISC_EXPORT isc_start_and_send(ISC_STATUS*, + isc_req_handle*, + isc_tr_handle*, + short, + short, + const void*, + short); + +ISC_STATUS ISC_EXPORT isc_start_request(ISC_STATUS *, + isc_req_handle *, + isc_tr_handle *, + short); + +ISC_STATUS ISC_EXPORT isc_unwind_request(ISC_STATUS *, + isc_tr_handle *, + short); + +ISC_STATUS ISC_EXPORT isc_wait_for_event(ISC_STATUS*, + isc_db_handle*, + short, + const ISC_UCHAR*, + ISC_UCHAR*); + + +/*****************************/ +/* Other Sql functions */ +/*****************************/ + +ISC_STATUS ISC_EXPORT isc_close(ISC_STATUS*, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_declare(ISC_STATUS*, + const ISC_SCHAR*, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_describe(ISC_STATUS*, + const ISC_SCHAR*, + XSQLDA *); + +ISC_STATUS ISC_EXPORT isc_describe_bind(ISC_STATUS*, + const ISC_SCHAR*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_execute(ISC_STATUS*, + isc_tr_handle*, + const ISC_SCHAR*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_execute_immediate(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + short*, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_fetch(ISC_STATUS*, + const ISC_SCHAR*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_open(ISC_STATUS*, + isc_tr_handle*, + const ISC_SCHAR*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_prepare(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + const ISC_SCHAR*, + short*, + const ISC_SCHAR*, + XSQLDA*); + + +/*************************************/ +/* Other Dynamic sql functions */ +/*************************************/ + +ISC_STATUS ISC_EXPORT isc_dsql_execute_m(ISC_STATUS*, + isc_tr_handle*, + isc_stmt_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_dsql_execute2_m(ISC_STATUS*, + isc_tr_handle*, + isc_stmt_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + const ISC_SCHAR*, + unsigned short, + ISC_SCHAR*, + unsigned short, + unsigned short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate_m(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_dsql_exec_immed3_m(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + ISC_SCHAR*, + unsigned short, + ISC_SCHAR*, + unsigned short, + unsigned short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_dsql_fetch_m(ISC_STATUS*, + isc_stmt_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_dsql_insert_m(ISC_STATUS*, + isc_stmt_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_dsql_prepare_m(ISC_STATUS*, + isc_tr_handle*, + isc_stmt_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + unsigned short, + const ISC_SCHAR*, + unsigned short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_dsql_release(ISC_STATUS*, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_close(ISC_STATUS*, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_declare(ISC_STATUS*, + const ISC_SCHAR*, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_describe(ISC_STATUS*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_describe_bind(ISC_STATUS*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_execute(ISC_STATUS*, + isc_tr_handle*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_execute2(ISC_STATUS*, + isc_tr_handle*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_execute_immed(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_fetch(ISC_STATUS*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_fetch_a(ISC_STATUS*, + int*, + const ISC_SCHAR*, + ISC_USHORT, + XSQLDA*); + +void ISC_EXPORT isc_embed_dsql_length(const ISC_UCHAR*, + ISC_USHORT*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_open(ISC_STATUS*, + isc_tr_handle*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_open2(ISC_STATUS*, + isc_tr_handle*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_insert(ISC_STATUS*, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_prepare(ISC_STATUS*, + isc_db_handle*, + isc_tr_handle*, + const ISC_SCHAR*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + XSQLDA*); + +ISC_STATUS ISC_EXPORT isc_embed_dsql_release(ISC_STATUS*, + const ISC_SCHAR*); + + +/******************************/ +/* Other Blob functions */ +/******************************/ + +BSTREAM* ISC_EXPORT BLOB_open(isc_blob_handle, + ISC_SCHAR*, + int); + +int ISC_EXPORT BLOB_put(ISC_SCHAR, + BSTREAM*); + +int ISC_EXPORT BLOB_close(BSTREAM*); + +int ISC_EXPORT BLOB_get(BSTREAM*); + +int ISC_EXPORT BLOB_display(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); + +int ISC_EXPORT BLOB_dump(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); + +int ISC_EXPORT BLOB_edit(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); + +int ISC_EXPORT BLOB_load(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); + +int ISC_EXPORT BLOB_text_dump(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); + +int ISC_EXPORT BLOB_text_load(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); + +BSTREAM* ISC_EXPORT Bopen(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); + +/* Disabled, not found anywhere. +BSTREAM* ISC_EXPORT Bopen2(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*, + unsigned short); +*/ + + +/******************************/ +/* Other Misc functions */ +/******************************/ + +ISC_LONG ISC_EXPORT isc_ftof(const ISC_SCHAR*, + const unsigned short, + ISC_SCHAR*, + const unsigned short); + +ISC_STATUS ISC_EXPORT isc_print_blr(const ISC_SCHAR*, + ISC_PRINT_CALLBACK, + void*, + short); + +void ISC_EXPORT isc_set_debug(int); + +void ISC_EXPORT isc_qtoq(const ISC_QUAD*, + ISC_QUAD*); + +void ISC_EXPORT isc_vtof(const ISC_SCHAR*, + ISC_SCHAR*, + unsigned short); + +void ISC_EXPORT isc_vtov(const ISC_SCHAR*, + ISC_SCHAR*, + short); + +int ISC_EXPORT isc_version(isc_db_handle*, + ISC_VERSION_CALLBACK, + void*); + +ISC_LONG ISC_EXPORT isc_reset_fpe(ISC_USHORT); + +uintptr_t ISC_EXPORT isc_baddress(ISC_SCHAR*); +void ISC_EXPORT isc_baddress_s(const ISC_SCHAR*, + uintptr_t*); + +/*****************************************/ +/* Service manager functions */ +/*****************************************/ + +#define ADD_SPB_LENGTH(p, length) {*(p)++ = (length); \ + *(p)++ = (length) >> 8;} + +#define ADD_SPB_NUMERIC(p, data) {*(p)++ = (ISC_SCHAR) (data); \ + *(p)++ = (ISC_SCHAR) ((data) >> 8); \ + *(p)++ = (ISC_SCHAR) ((data) >> 16); \ + *(p)++ = (ISC_SCHAR) ((data) >> 24);} + +ISC_STATUS ISC_EXPORT isc_service_attach(ISC_STATUS*, + unsigned short, + const ISC_SCHAR*, + isc_svc_handle*, + unsigned short, + const ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_service_detach(ISC_STATUS *, + isc_svc_handle *); + +ISC_STATUS ISC_EXPORT isc_service_query(ISC_STATUS*, + isc_svc_handle*, + isc_resv_handle*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + const ISC_SCHAR*, + unsigned short, + ISC_SCHAR*); + +ISC_STATUS ISC_EXPORT isc_service_start(ISC_STATUS*, + isc_svc_handle*, + isc_resv_handle*, + unsigned short, + const ISC_SCHAR*); + + +/********************************/ +/* Client information functions */ +/********************************/ + +void ISC_EXPORT isc_get_client_version ( ISC_SCHAR *); +int ISC_EXPORT isc_get_client_major_version (); +int ISC_EXPORT isc_get_client_minor_version (); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/***************************************************/ +/* Actions to pass to the blob filter (ctl_source) */ +/***************************************************/ + +#define isc_blob_filter_open 0 +#define isc_blob_filter_get_segment 1 +#define isc_blob_filter_close 2 +#define isc_blob_filter_create 3 +#define isc_blob_filter_put_segment 4 +#define isc_blob_filter_alloc 5 +#define isc_blob_filter_free 6 +#define isc_blob_filter_seek 7 + +/*******************/ +/* Blr definitions */ +/*******************/ + + +#ifndef JRD_BLR_H +#define JRD_BLR_H + +#define blr_text (unsigned char)14 +#define blr_text2 (unsigned char)15 +#define blr_short (unsigned char)7 +#define blr_long (unsigned char)8 +#define blr_quad (unsigned char)9 +#define blr_float (unsigned char)10 +#define blr_double (unsigned char)27 +#define blr_d_float (unsigned char)11 +#define blr_timestamp (unsigned char)35 +#define blr_varying (unsigned char)37 +#define blr_varying2 (unsigned char)38 +#define blr_blob (unsigned short)261 +#define blr_cstring (unsigned char)40 +#define blr_cstring2 (unsigned char)41 +#define blr_blob_id (unsigned char)45 +#define blr_sql_date (unsigned char)12 +#define blr_sql_time (unsigned char)13 +#define blr_int64 (unsigned char)16 +#define blr_blob2 (unsigned char)17 +#define blr_domain_name (unsigned char)18 +#define blr_domain_name2 (unsigned char)19 +#define blr_not_nullable (unsigned char)20 + +#define blr_domain_type_of (unsigned char)0 +#define blr_domain_full (unsigned char)1 + +#define blr_date blr_timestamp + +#define blr_inner (unsigned char)0 +#define blr_left (unsigned char)1 +#define blr_right (unsigned char)2 +#define blr_full (unsigned char)3 + +#define blr_gds_code (unsigned char)0 +#define blr_sql_code (unsigned char)1 +#define blr_exception (unsigned char)2 +#define blr_trigger_code (unsigned char)3 +#define blr_default_code (unsigned char)4 +#define blr_raise (unsigned char)5 +#define blr_exception_msg (unsigned char)6 + +#define blr_version4 (unsigned char)4 +#define blr_version5 (unsigned char)5 +#define blr_eoc (unsigned char)76 +#define blr_end (unsigned char)255 + +#define blr_assignment (unsigned char)1 +#define blr_begin (unsigned char)2 +#define blr_dcl_variable (unsigned char)3 +#define blr_message (unsigned char)4 +#define blr_erase (unsigned char)5 +#define blr_fetch (unsigned char)6 +#define blr_for (unsigned char)7 +#define blr_if (unsigned char)8 +#define blr_loop (unsigned char)9 +#define blr_modify (unsigned char)10 +#define blr_handler (unsigned char)11 +#define blr_receive (unsigned char)12 +#define blr_select (unsigned char)13 +#define blr_send (unsigned char)14 +#define blr_store (unsigned char)15 +#define blr_label (unsigned char)17 +#define blr_leave (unsigned char)18 +#define blr_store2 (unsigned char)19 +#define blr_post (unsigned char)20 +#define blr_literal (unsigned char)21 +#define blr_dbkey (unsigned char)22 +#define blr_field (unsigned char)23 +#define blr_fid (unsigned char)24 +#define blr_parameter (unsigned char)25 +#define blr_variable (unsigned char)26 +#define blr_average (unsigned char)27 +#define blr_count (unsigned char)28 +#define blr_maximum (unsigned char)29 +#define blr_minimum (unsigned char)30 +#define blr_total (unsigned char)31 + +#define blr_add (unsigned char)34 +#define blr_subtract (unsigned char)35 +#define blr_multiply (unsigned char)36 +#define blr_divide (unsigned char)37 +#define blr_negate (unsigned char)38 +#define blr_concatenate (unsigned char)39 +#define blr_substring (unsigned char)40 +#define blr_parameter2 (unsigned char)41 +#define blr_from (unsigned char)42 +#define blr_via (unsigned char)43 +#define blr_parameter2_old (unsigned char)44 +#define blr_user_name (unsigned char)44 +#define blr_null (unsigned char)45 + +#define blr_equiv (unsigned char)46 +#define blr_eql (unsigned char)47 +#define blr_neq (unsigned char)48 +#define blr_gtr (unsigned char)49 +#define blr_geq (unsigned char)50 +#define blr_lss (unsigned char)51 +#define blr_leq (unsigned char)52 +#define blr_containing (unsigned char)53 +#define blr_matching (unsigned char)54 +#define blr_starting (unsigned char)55 +#define blr_between (unsigned char)56 +#define blr_or (unsigned char)57 +#define blr_and (unsigned char)58 +#define blr_not (unsigned char)59 +#define blr_any (unsigned char)60 +#define blr_missing (unsigned char)61 +#define blr_unique (unsigned char)62 +#define blr_like (unsigned char)63 + +#define blr_rse (unsigned char)67 +#define blr_first (unsigned char)68 +#define blr_project (unsigned char)69 +#define blr_sort (unsigned char)70 +#define blr_boolean (unsigned char)71 +#define blr_ascending (unsigned char)72 +#define blr_descending (unsigned char)73 +#define blr_relation (unsigned char)74 +#define blr_rid (unsigned char)75 +#define blr_union (unsigned char)76 +#define blr_map (unsigned char)77 +#define blr_group_by (unsigned char)78 +#define blr_aggregate (unsigned char)79 +#define blr_join_type (unsigned char)80 + +#define blr_agg_count (unsigned char)83 +#define blr_agg_max (unsigned char)84 +#define blr_agg_min (unsigned char)85 +#define blr_agg_total (unsigned char)86 +#define blr_agg_average (unsigned char)87 +#define blr_parameter3 (unsigned char)88 +#define blr_run_max (unsigned char)89 +#define blr_run_min (unsigned char)90 +#define blr_run_total (unsigned char)91 +#define blr_run_average (unsigned char)92 +#define blr_agg_count2 (unsigned char)93 +#define blr_agg_count_distinct (unsigned char)94 +#define blr_agg_total_distinct (unsigned char)95 +#define blr_agg_average_distinct (unsigned char)96 + +#define blr_function (unsigned char)100 +#define blr_gen_id (unsigned char)101 +#define blr_prot_mask (unsigned char)102 +#define blr_upcase (unsigned char)103 +#define blr_lock_state (unsigned char)104 +#define blr_value_if (unsigned char)105 +#define blr_matching2 (unsigned char)106 +#define blr_index (unsigned char)107 +#define blr_ansi_like (unsigned char)108 + +#define blr_seek (unsigned char)112 + +#define blr_continue (unsigned char)0 +#define blr_forward (unsigned char)1 +#define blr_backward (unsigned char)2 +#define blr_bof_forward (unsigned char)3 +#define blr_eof_backward (unsigned char)4 + +#define blr_run_count (unsigned char)118 +#define blr_rs_stream (unsigned char)119 +#define blr_exec_proc (unsigned char)120 + +#define blr_procedure (unsigned char)124 +#define blr_pid (unsigned char)125 +#define blr_exec_pid (unsigned char)126 +#define blr_singular (unsigned char)127 +#define blr_abort (unsigned char)128 +#define blr_block (unsigned char)129 +#define blr_error_handler (unsigned char)130 + +#define blr_cast (unsigned char)131 + +#define blr_start_savepoint (unsigned char)134 +#define blr_end_savepoint (unsigned char)135 + +#define blr_plan (unsigned char)139 +#define blr_merge (unsigned char)140 +#define blr_join (unsigned char)141 +#define blr_sequential (unsigned char)142 +#define blr_navigational (unsigned char)143 +#define blr_indices (unsigned char)144 +#define blr_retrieve (unsigned char)145 + +#define blr_relation2 (unsigned char)146 +#define blr_rid2 (unsigned char)147 + +#define blr_set_generator (unsigned char)150 + +#define blr_ansi_any (unsigned char)151 +#define blr_exists (unsigned char)152 + +#define blr_record_version (unsigned char)154 +#define blr_stall (unsigned char)155 + +#define blr_ansi_all (unsigned char)158 + +#define blr_extract (unsigned char)159 + +#define blr_extract_year (unsigned char)0 +#define blr_extract_month (unsigned char)1 +#define blr_extract_day (unsigned char)2 +#define blr_extract_hour (unsigned char)3 +#define blr_extract_minute (unsigned char)4 +#define blr_extract_second (unsigned char)5 +#define blr_extract_weekday (unsigned char)6 +#define blr_extract_yearday (unsigned char)7 +#define blr_extract_millisecond (unsigned char)8 +#define blr_extract_week (unsigned char)9 + +#define blr_current_date (unsigned char)160 +#define blr_current_timestamp (unsigned char)161 +#define blr_current_time (unsigned char)162 + +#define blr_post_arg (unsigned char)163 +#define blr_exec_into (unsigned char)164 +#define blr_user_savepoint (unsigned char)165 +#define blr_dcl_cursor (unsigned char)166 +#define blr_cursor_stmt (unsigned char)167 +#define blr_current_timestamp2 (unsigned char)168 +#define blr_current_time2 (unsigned char)169 +#define blr_agg_list (unsigned char)170 +#define blr_agg_list_distinct (unsigned char)171 +#define blr_modify2 (unsigned char)172 + +#define blr_current_role (unsigned char)174 +#define blr_skip (unsigned char)175 + +#define blr_exec_sql (unsigned char)176 +#define blr_internal_info (unsigned char)177 +#define blr_nullsfirst (unsigned char)178 +#define blr_writelock (unsigned char)179 +#define blr_nullslast (unsigned char)180 + +#define blr_lowcase (unsigned char)181 +#define blr_strlen (unsigned char)182 + +#define blr_strlen_bit (unsigned char)0 +#define blr_strlen_char (unsigned char)1 +#define blr_strlen_octet (unsigned char)2 + +#define blr_trim (unsigned char)183 + +#define blr_trim_both (unsigned char)0 +#define blr_trim_leading (unsigned char)1 +#define blr_trim_trailing (unsigned char)2 + +#define blr_trim_spaces (unsigned char)0 +#define blr_trim_characters (unsigned char)1 + +#define blr_savepoint_set (unsigned char)0 +#define blr_savepoint_release (unsigned char)1 +#define blr_savepoint_undo (unsigned char)2 +#define blr_savepoint_release_single (unsigned char)3 + +#define blr_cursor_open (unsigned char)0 +#define blr_cursor_close (unsigned char)1 +#define blr_cursor_fetch (unsigned char)2 + +#define blr_init_variable (unsigned char)184 +#define blr_recurse (unsigned char)185 +#define blr_sys_function (unsigned char)186 + +#endif + + +#ifndef INCLUDE_CONSTS_PUB_H +#define INCLUDE_CONSTS_PUB_H + +#define isc_dpb_version1 1 +#define isc_dpb_cdd_pathname 1 +#define isc_dpb_allocation 2 +#define isc_dpb_journal 3 +#define isc_dpb_page_size 4 +#define isc_dpb_num_buffers 5 +#define isc_dpb_buffer_length 6 +#define isc_dpb_debug 7 +#define isc_dpb_garbage_collect 8 +#define isc_dpb_verify 9 +#define isc_dpb_sweep 10 +#define isc_dpb_enable_journal 11 +#define isc_dpb_disable_journal 12 +#define isc_dpb_dbkey_scope 13 +#define isc_dpb_number_of_users 14 +#define isc_dpb_trace 15 +#define isc_dpb_no_garbage_collect 16 +#define isc_dpb_damaged 17 +#define isc_dpb_license 18 +#define isc_dpb_sys_user_name 19 +#define isc_dpb_encrypt_key 20 +#define isc_dpb_activate_shadow 21 +#define isc_dpb_sweep_interval 22 +#define isc_dpb_delete_shadow 23 +#define isc_dpb_force_write 24 +#define isc_dpb_begin_log 25 +#define isc_dpb_quit_log 26 +#define isc_dpb_no_reserve 27 +#define isc_dpb_user_name 28 +#define isc_dpb_password 29 +#define isc_dpb_password_enc 30 +#define isc_dpb_sys_user_name_enc 31 +#define isc_dpb_interp 32 +#define isc_dpb_online_dump 33 +#define isc_dpb_old_file_size 34 +#define isc_dpb_old_num_files 35 +#define isc_dpb_old_file 36 +#define isc_dpb_old_start_page 37 +#define isc_dpb_old_start_seqno 38 +#define isc_dpb_old_start_file 39 +#define isc_dpb_drop_walfile 40 +#define isc_dpb_old_dump_id 41 +#define isc_dpb_wal_backup_dir 42 +#define isc_dpb_wal_chkptlen 43 +#define isc_dpb_wal_numbufs 44 +#define isc_dpb_wal_bufsize 45 +#define isc_dpb_wal_grp_cmt_wait 46 +#define isc_dpb_lc_messages 47 +#define isc_dpb_lc_ctype 48 +#define isc_dpb_cache_manager 49 +#define isc_dpb_shutdown 50 +#define isc_dpb_online 51 +#define isc_dpb_shutdown_delay 52 +#define isc_dpb_reserved 53 +#define isc_dpb_overwrite 54 +#define isc_dpb_sec_attach 55 +#define isc_dpb_disable_wal 56 +#define isc_dpb_connect_timeout 57 +#define isc_dpb_dummy_packet_interval 58 +#define isc_dpb_gbak_attach 59 +#define isc_dpb_sql_role_name 60 +#define isc_dpb_set_page_buffers 61 +#define isc_dpb_working_directory 62 +#define isc_dpb_sql_dialect 63 +#define isc_dpb_set_db_readonly 64 +#define isc_dpb_set_db_sql_dialect 65 +#define isc_dpb_gfix_attach 66 +#define isc_dpb_gstat_attach 67 +#define isc_dpb_set_db_charset 68 +#define isc_dpb_gsec_attach 69 +#define isc_dpb_address_path 70 +#define isc_dpb_process_id 71 +#define isc_dpb_no_db_triggers 72 +#define isc_dpb_trusted_auth 73 +#define isc_dpb_process_name 74 + +#define isc_dpb_address 1 + +#define isc_dpb_addr_protocol 1 +#define isc_dpb_addr_endpoint 2 + +#define isc_dpb_pages 1 +#define isc_dpb_records 2 +#define isc_dpb_indices 4 +#define isc_dpb_transactions 8 +#define isc_dpb_no_update 16 +#define isc_dpb_repair 32 +#define isc_dpb_ignore 64 + +#define isc_dpb_shut_cache 0x1 +#define isc_dpb_shut_attachment 0x2 +#define isc_dpb_shut_transaction 0x4 +#define isc_dpb_shut_force 0x8 +#define isc_dpb_shut_mode_mask 0x70 + +#define isc_dpb_shut_default 0x0 +#define isc_dpb_shut_normal 0x10 +#define isc_dpb_shut_multi 0x20 +#define isc_dpb_shut_single 0x30 +#define isc_dpb_shut_full 0x40 + +#define RDB_system 1 +#define RDB_id_assigned 2 + +#define isc_tpb_version1 1 +#define isc_tpb_version3 3 +#define isc_tpb_consistency 1 +#define isc_tpb_concurrency 2 +#define isc_tpb_shared 3 +#define isc_tpb_protected 4 +#define isc_tpb_exclusive 5 +#define isc_tpb_wait 6 +#define isc_tpb_nowait 7 +#define isc_tpb_read 8 +#define isc_tpb_write 9 +#define isc_tpb_lock_read 10 +#define isc_tpb_lock_write 11 +#define isc_tpb_verb_time 12 +#define isc_tpb_commit_time 13 +#define isc_tpb_ignore_limbo 14 +#define isc_tpb_read_committed 15 +#define isc_tpb_autocommit 16 +#define isc_tpb_rec_version 17 +#define isc_tpb_no_rec_version 18 +#define isc_tpb_restart_requests 19 +#define isc_tpb_no_auto_undo 20 +#define isc_tpb_lock_timeout 21 + +#define isc_bpb_version1 1 +#define isc_bpb_source_type 1 +#define isc_bpb_target_type 2 +#define isc_bpb_type 3 +#define isc_bpb_source_interp 4 +#define isc_bpb_target_interp 5 +#define isc_bpb_filter_parameter 6 +#define isc_bpb_storage 7 + +#define isc_bpb_type_segmented 0x0 +#define isc_bpb_type_stream 0x1 +#define isc_bpb_storage_main 0x0 +#define isc_bpb_storage_temp 0x2 + +#define isc_spb_version1 1 +#define isc_spb_current_version 2 +#define isc_spb_version isc_spb_current_version +#define isc_spb_user_name isc_dpb_user_name +#define isc_spb_sys_user_name isc_dpb_sys_user_name +#define isc_spb_sys_user_name_enc isc_dpb_sys_user_name_enc +#define isc_spb_password isc_dpb_password +#define isc_spb_password_enc isc_dpb_password_enc +#define isc_spb_command_line 105 +#define isc_spb_dbname 106 +#define isc_spb_verbose 107 +#define isc_spb_options 108 +#define isc_spb_address_path 109 +#define isc_spb_process_id 110 +#define isc_spb_trusted_auth 111 +#define isc_spb_process_name 112 + +#define isc_spb_connect_timeout isc_dpb_connect_timeout +#define isc_spb_dummy_packet_interval isc_dpb_dummy_packet_interval +#define isc_spb_sql_role_name isc_dpb_sql_role_name + +#define isc_action_svc_backup 1 +#define isc_action_svc_restore 2 +#define isc_action_svc_repair 3 +#define isc_action_svc_add_user 4 +#define isc_action_svc_delete_user 5 +#define isc_action_svc_modify_user 6 +#define isc_action_svc_display_user 7 +#define isc_action_svc_properties 8 +#define isc_action_svc_add_license 9 +#define isc_action_svc_remove_license 10 +#define isc_action_svc_db_stats 11 +#define isc_action_svc_get_ib_log 12 +#define isc_action_svc_get_fb_log 12 + +#define isc_info_svc_svr_db_info 50 +#define isc_info_svc_get_license 51 +#define isc_info_svc_get_license_mask 52 +#define isc_info_svc_get_config 53 +#define isc_info_svc_version 54 +#define isc_info_svc_server_version 55 +#define isc_info_svc_implementation 56 +#define isc_info_svc_capabilities 57 +#define isc_info_svc_user_dbpath 58 +#define isc_info_svc_get_env 59 +#define isc_info_svc_get_env_lock 60 +#define isc_info_svc_get_env_msg 61 +#define isc_info_svc_line 62 +#define isc_info_svc_to_eof 63 +#define isc_info_svc_timeout 64 +#define isc_info_svc_get_licensed_users 65 +#define isc_info_svc_limbo_trans 66 +#define isc_info_svc_running 67 +#define isc_info_svc_get_users 68 + +#define isc_spb_sec_userid 5 +#define isc_spb_sec_groupid 6 +#define isc_spb_sec_username 7 +#define isc_spb_sec_password 8 +#define isc_spb_sec_groupname 9 +#define isc_spb_sec_firstname 10 +#define isc_spb_sec_middlename 11 +#define isc_spb_sec_lastname 12 + +#define isc_spb_lic_key 5 +#define isc_spb_lic_id 6 +#define isc_spb_lic_desc 7 + +#define isc_spb_bkp_file 5 +#define isc_spb_bkp_factor 6 +#define isc_spb_bkp_length 7 +#define isc_spb_bkp_ignore_checksums 0x01 +#define isc_spb_bkp_ignore_limbo 0x02 +#define isc_spb_bkp_metadata_only 0x04 +#define isc_spb_bkp_no_garbage_collect 0x08 +#define isc_spb_bkp_old_descriptions 0x10 +#define isc_spb_bkp_non_transportable 0x20 +#define isc_spb_bkp_convert 0x40 +#define isc_spb_bkp_expand 0x80 + +#define isc_spb_prp_page_buffers 5 +#define isc_spb_prp_sweep_interval 6 +#define isc_spb_prp_shutdown_db 7 +#define isc_spb_prp_deny_new_attachments 9 +#define isc_spb_prp_deny_new_transactions 10 +#define isc_spb_prp_reserve_space 11 +#define isc_spb_prp_write_mode 12 +#define isc_spb_prp_access_mode 13 +#define isc_spb_prp_set_sql_dialect 14 +#define isc_spb_prp_activate 0x0100 +#define isc_spb_prp_db_online 0x0200 + +#define isc_spb_prp_res_use_full 35 +#define isc_spb_prp_res 36 + +#define isc_spb_prp_wm_async 37 +#define isc_spb_prp_wm_sync 38 + +#define isc_spb_prp_am_readonly 39 +#define isc_spb_prp_am_readwrite 40 + +#define isc_spb_rpr_commit_trans 15 +#define isc_spb_rpr_rollback_trans 34 +#define isc_spb_rpr_recover_two_phase 17 +#define isc_spb_tra_id 18 +#define isc_spb_single_tra_id 19 +#define isc_spb_multi_tra_id 20 +#define isc_spb_tra_state 21 +#define isc_spb_tra_state_limbo 22 +#define isc_spb_tra_state_commit 23 +#define isc_spb_tra_state_rollback 24 +#define isc_spb_tra_state_unknown 25 +#define isc_spb_tra_host_site 26 +#define isc_spb_tra_remote_site 27 +#define isc_spb_tra_db_path 28 +#define isc_spb_tra_advise 29 +#define isc_spb_tra_advise_commit 30 +#define isc_spb_tra_advise_rollback 31 +#define isc_spb_tra_advise_unknown 33 + +#define isc_spb_rpr_validate_db 0x01 +#define isc_spb_rpr_sweep_db 0x02 +#define isc_spb_rpr_mend_db 0x04 +#define isc_spb_rpr_list_limbo_trans 0x08 +#define isc_spb_rpr_check_db 0x10 +#define isc_spb_rpr_ignore_checksum 0x20 +#define isc_spb_rpr_kill_shadows 0x40 +#define isc_spb_rpr_full 0x80 + +#define isc_spb_res_buffers 9 +#define isc_spb_res_page_size 10 +#define isc_spb_res_length 11 +#define isc_spb_res_access_mode 12 +#define isc_spb_res_deactivate_idx 0x0100 +#define isc_spb_res_no_shadow 0x0200 +#define isc_spb_res_no_validity 0x0400 +#define isc_spb_res_one_at_a_time 0x0800 +#define isc_spb_res_replace 0x1000 +#define isc_spb_res_create 0x2000 +#define isc_spb_res_use_all_space 0x4000 + +#define isc_spb_res_am_readonly isc_spb_prp_am_readonly +#define isc_spb_res_am_readwrite isc_spb_prp_am_readwrite + +#define isc_spb_num_att 5 +#define isc_spb_num_db 6 + +#define isc_spb_sts_data_pages 0x01 +#define isc_spb_sts_db_log 0x02 +#define isc_spb_sts_hdr_pages 0x04 +#define isc_spb_sts_idx_pages 0x08 +#define isc_spb_sts_sys_relations 0x10 +#define isc_spb_sts_record_versions 0x20 +#define isc_spb_sts_table 0x40 +#define isc_spb_sts_nocreation 0x80 + +#define isc_dyn_version_1 1 +#define isc_dyn_eoc 255 + +#define isc_dyn_begin 2 +#define isc_dyn_end 3 +#define isc_dyn_if 4 +#define isc_dyn_def_database 5 +#define isc_dyn_def_global_fld 6 +#define isc_dyn_def_local_fld 7 +#define isc_dyn_def_idx 8 +#define isc_dyn_def_rel 9 +#define isc_dyn_def_sql_fld 10 +#define isc_dyn_def_view 12 +#define isc_dyn_def_trigger 15 +#define isc_dyn_def_security_class 120 +#define isc_dyn_def_dimension 140 +#define isc_dyn_def_generator 24 +#define isc_dyn_def_function 25 +#define isc_dyn_def_filter 26 +#define isc_dyn_def_function_arg 27 +#define isc_dyn_def_shadow 34 +#define isc_dyn_def_trigger_msg 17 +#define isc_dyn_def_file 36 +#define isc_dyn_mod_database 39 +#define isc_dyn_mod_rel 11 +#define isc_dyn_mod_global_fld 13 +#define isc_dyn_mod_idx 102 +#define isc_dyn_mod_local_fld 14 +#define isc_dyn_mod_sql_fld 216 +#define isc_dyn_mod_view 16 +#define isc_dyn_mod_security_class 122 +#define isc_dyn_mod_trigger 113 +#define isc_dyn_mod_trigger_msg 28 +#define isc_dyn_delete_database 18 +#define isc_dyn_delete_rel 19 +#define isc_dyn_delete_global_fld 20 +#define isc_dyn_delete_local_fld 21 +#define isc_dyn_delete_idx 22 +#define isc_dyn_delete_security_class 123 +#define isc_dyn_delete_dimensions 143 +#define isc_dyn_delete_trigger 23 +#define isc_dyn_delete_trigger_msg 29 +#define isc_dyn_delete_filter 32 +#define isc_dyn_delete_function 33 +#define isc_dyn_delete_shadow 35 +#define isc_dyn_grant 30 +#define isc_dyn_revoke 31 +#define isc_dyn_def_primary_key 37 +#define isc_dyn_def_foreign_key 38 +#define isc_dyn_def_unique 40 +#define isc_dyn_def_procedure 164 +#define isc_dyn_delete_procedure 165 +#define isc_dyn_def_parameter 135 +#define isc_dyn_delete_parameter 136 +#define isc_dyn_mod_procedure 175 + +#define isc_dyn_def_exception 181 +#define isc_dyn_mod_exception 182 +#define isc_dyn_del_exception 183 + +#define isc_dyn_def_difference 220 +#define isc_dyn_drop_difference 221 +#define isc_dyn_begin_backup 222 +#define isc_dyn_end_backup 223 +#define isc_dyn_debug_info 240 + +#define isc_dyn_view_blr 43 +#define isc_dyn_view_source 44 +#define isc_dyn_view_relation 45 +#define isc_dyn_view_context 46 +#define isc_dyn_view_context_name 47 + +#define isc_dyn_rel_name 50 +#define isc_dyn_fld_name 51 +#define isc_dyn_new_fld_name 215 +#define isc_dyn_idx_name 52 +#define isc_dyn_description 53 +#define isc_dyn_security_class 54 +#define isc_dyn_system_flag 55 +#define isc_dyn_update_flag 56 +#define isc_dyn_prc_name 166 +#define isc_dyn_prm_name 137 +#define isc_dyn_sql_object 196 +#define isc_dyn_fld_character_set_name 174 + +#define isc_dyn_rel_dbkey_length 61 +#define isc_dyn_rel_store_trig 62 +#define isc_dyn_rel_modify_trig 63 +#define isc_dyn_rel_erase_trig 64 +#define isc_dyn_rel_store_trig_source 65 +#define isc_dyn_rel_modify_trig_source 66 +#define isc_dyn_rel_erase_trig_source 67 +#define isc_dyn_rel_ext_file 68 +#define isc_dyn_rel_sql_protection 69 +#define isc_dyn_rel_constraint 162 +#define isc_dyn_delete_rel_constraint 163 + +#define isc_dyn_rel_temporary 238 +#define isc_dyn_rel_temp_global_preserve 1 +#define isc_dyn_rel_temp_global_delete 2 + +#define isc_dyn_fld_type 70 +#define isc_dyn_fld_length 71 +#define isc_dyn_fld_scale 72 +#define isc_dyn_fld_sub_type 73 +#define isc_dyn_fld_segment_length 74 +#define isc_dyn_fld_query_header 75 +#define isc_dyn_fld_edit_string 76 +#define isc_dyn_fld_validation_blr 77 +#define isc_dyn_fld_validation_source 78 +#define isc_dyn_fld_computed_blr 79 +#define isc_dyn_fld_computed_source 80 +#define isc_dyn_fld_missing_value 81 +#define isc_dyn_fld_default_value 82 +#define isc_dyn_fld_query_name 83 +#define isc_dyn_fld_dimensions 84 +#define isc_dyn_fld_not_null 85 +#define isc_dyn_fld_precision 86 +#define isc_dyn_fld_char_length 172 +#define isc_dyn_fld_collation 173 +#define isc_dyn_fld_default_source 193 +#define isc_dyn_del_default 197 +#define isc_dyn_del_validation 198 +#define isc_dyn_single_validation 199 +#define isc_dyn_fld_character_set 203 + +#define isc_dyn_fld_source 90 +#define isc_dyn_fld_base_fld 91 +#define isc_dyn_fld_position 92 +#define isc_dyn_fld_update_flag 93 + +#define isc_dyn_idx_unique 100 +#define isc_dyn_idx_inactive 101 +#define isc_dyn_idx_type 103 +#define isc_dyn_idx_foreign_key 104 +#define isc_dyn_idx_ref_column 105 +#define isc_dyn_idx_statistic 204 + +#define isc_dyn_trg_type 110 +#define isc_dyn_trg_blr 111 +#define isc_dyn_trg_source 112 +#define isc_dyn_trg_name 114 +#define isc_dyn_trg_sequence 115 +#define isc_dyn_trg_inactive 116 +#define isc_dyn_trg_msg_number 117 +#define isc_dyn_trg_msg 118 + +#define isc_dyn_scl_acl 121 +#define isc_dyn_grant_user 130 +#define isc_dyn_grant_user_explicit 219 +#define isc_dyn_grant_proc 186 +#define isc_dyn_grant_trig 187 +#define isc_dyn_grant_view 188 +#define isc_dyn_grant_options 132 +#define isc_dyn_grant_user_group 205 +#define isc_dyn_grant_role 218 + +#define isc_dyn_dim_lower 141 +#define isc_dyn_dim_upper 142 + +#define isc_dyn_file_name 125 +#define isc_dyn_file_start 126 +#define isc_dyn_file_length 127 +#define isc_dyn_shadow_number 128 +#define isc_dyn_shadow_man_auto 129 +#define isc_dyn_shadow_conditional 130 + +#define isc_dyn_function_name 145 +#define isc_dyn_function_type 146 +#define isc_dyn_func_module_name 147 +#define isc_dyn_func_entry_point 148 +#define isc_dyn_func_return_argument 149 +#define isc_dyn_func_arg_position 150 +#define isc_dyn_func_mechanism 151 +#define isc_dyn_filter_in_subtype 152 +#define isc_dyn_filter_out_subtype 153 + +#define isc_dyn_description2 154 +#define isc_dyn_fld_computed_source2 155 +#define isc_dyn_fld_edit_string2 156 +#define isc_dyn_fld_query_header2 157 +#define isc_dyn_fld_validation_source2 158 +#define isc_dyn_trg_msg2 159 +#define isc_dyn_trg_source2 160 +#define isc_dyn_view_source2 161 +#define isc_dyn_xcp_msg2 184 + +#define isc_dyn_generator_name 95 +#define isc_dyn_generator_id 96 + +#define isc_dyn_prc_inputs 167 +#define isc_dyn_prc_outputs 168 +#define isc_dyn_prc_source 169 +#define isc_dyn_prc_blr 170 +#define isc_dyn_prc_source2 171 +#define isc_dyn_prc_type 239 + +#define isc_dyn_prc_t_selectable 1 +#define isc_dyn_prc_t_executable 2 + +#define isc_dyn_prm_number 138 +#define isc_dyn_prm_type 139 +#define isc_dyn_prm_mechanism 241 + +#define isc_dyn_xcp_msg 185 + +#define isc_dyn_foreign_key_update 205 +#define isc_dyn_foreign_key_delete 206 +#define isc_dyn_foreign_key_cascade 207 +#define isc_dyn_foreign_key_default 208 +#define isc_dyn_foreign_key_null 209 +#define isc_dyn_foreign_key_none 210 + +#define isc_dyn_def_sql_role 211 +#define isc_dyn_sql_role_name 212 +#define isc_dyn_grant_admin_options 213 +#define isc_dyn_del_sql_role 214 + +#define isc_dyn_delete_generator 217 + +#define isc_dyn_mod_function 224 +#define isc_dyn_mod_filter 225 +#define isc_dyn_mod_generator 226 +#define isc_dyn_mod_sql_role 227 +#define isc_dyn_mod_charset 228 +#define isc_dyn_mod_collation 229 +#define isc_dyn_mod_prc_parameter 230 + +#define isc_dyn_def_collation 231 +#define isc_dyn_coll_for_charset 232 +#define isc_dyn_coll_from 233 +#define isc_dyn_coll_from_external 239 +#define isc_dyn_coll_attribute 234 +#define isc_dyn_coll_specific_attributes_charset 235 +#define isc_dyn_coll_specific_attributes 236 +#define isc_dyn_del_collation 237 + +#define isc_dyn_last_dyn_value 242 + +#define isc_sdl_version1 1 +#define isc_sdl_eoc 255 +#define isc_sdl_relation 2 +#define isc_sdl_rid 3 +#define isc_sdl_field 4 +#define isc_sdl_fid 5 +#define isc_sdl_struct 6 +#define isc_sdl_variable 7 +#define isc_sdl_scalar 8 +#define isc_sdl_tiny_integer 9 +#define isc_sdl_short_integer 10 +#define isc_sdl_long_integer 11 +#define isc_sdl_literal 12 +#define isc_sdl_add 13 +#define isc_sdl_subtract 14 +#define isc_sdl_multiply 15 +#define isc_sdl_divide 16 +#define isc_sdl_negate 17 +#define isc_sdl_eql 18 +#define isc_sdl_neq 19 +#define isc_sdl_gtr 20 +#define isc_sdl_geq 21 +#define isc_sdl_lss 22 +#define isc_sdl_leq 23 +#define isc_sdl_and 24 +#define isc_sdl_or 25 +#define isc_sdl_not 26 +#define isc_sdl_while 27 +#define isc_sdl_assignment 28 +#define isc_sdl_label 29 +#define isc_sdl_leave 30 +#define isc_sdl_begin 31 +#define isc_sdl_end 32 +#define isc_sdl_do3 33 +#define isc_sdl_do2 34 +#define isc_sdl_do1 35 +#define isc_sdl_element 36 + +#define isc_interp_eng_ascii 0 +#define isc_interp_jpn_sjis 5 +#define isc_interp_jpn_euc 6 + +#define isc_blob_untyped 0 + +#define isc_blob_text 1 +#define isc_blob_blr 2 +#define isc_blob_acl 3 +#define isc_blob_ranges 4 +#define isc_blob_summary 5 +#define isc_blob_format 6 +#define isc_blob_tra 7 +#define isc_blob_extfile 8 +#define isc_blob_debug_info 9 +#define isc_blob_max_predefined_subtype 10 + +#define isc_blob_formatted_memo 20 +#define isc_blob_paradox_ole 21 +#define isc_blob_graphic 22 +#define isc_blob_dbase_ole 23 +#define isc_blob_typed_binary 24 + +#define isc_info_db_SQL_dialect 62 +#define isc_dpb_SQL_dialect 63 +#define isc_dpb_set_db_SQL_dialect 65 + +#define fb_dbg_version 1 +#define fb_dbg_end 255 +#define fb_dbg_map_src2blr 2 +#define fb_dbg_map_varname 3 +#define fb_dbg_map_argument 4 + +#define fb_dbg_arg_input 0 +#define fb_dbg_arg_output 1 + +#endif + +/*********************************/ +/* Information call declarations */ +/*********************************/ + + +#ifndef JRD_INF_PUB_H +#define JRD_INF_PUB_H + +#define isc_info_end 1 +#define isc_info_truncated 2 +#define isc_info_error 3 +#define isc_info_data_not_ready 4 +#define isc_info_length 126 +#define isc_info_flag_end 127 + +enum db_info_types +{ + isc_info_db_id = 4, + isc_info_reads = 5, + isc_info_writes = 6, + isc_info_fetches = 7, + isc_info_marks = 8, + + isc_info_implementation = 11, + isc_info_isc_version = 12, + isc_info_base_level = 13, + isc_info_page_size = 14, + isc_info_num_buffers = 15, + isc_info_limbo = 16, + isc_info_current_memory = 17, + isc_info_max_memory = 18, + isc_info_window_turns = 19, + isc_info_license = 20, + + isc_info_allocation = 21, + isc_info_attachment_id = 22, + isc_info_read_seq_count = 23, + isc_info_read_idx_count = 24, + isc_info_insert_count = 25, + isc_info_update_count = 26, + isc_info_delete_count = 27, + isc_info_backout_count = 28, + isc_info_purge_count = 29, + isc_info_expunge_count = 30, + + isc_info_sweep_interval = 31, + isc_info_ods_version = 32, + isc_info_ods_minor_version = 33, + isc_info_no_reserve = 34, + + isc_info_logfile = 35, + isc_info_cur_logfile_name = 36, + isc_info_cur_log_part_offset = 37, + isc_info_num_wal_buffers = 38, + isc_info_wal_buffer_size = 39, + isc_info_wal_ckpt_length = 40, + + isc_info_wal_cur_ckpt_interval = 41, + isc_info_wal_prv_ckpt_fname = 42, + isc_info_wal_prv_ckpt_poffset = 43, + isc_info_wal_recv_ckpt_fname = 44, + isc_info_wal_recv_ckpt_poffset = 45, + isc_info_wal_grpc_wait_usecs = 47, + isc_info_wal_num_io = 48, + isc_info_wal_avg_io_size = 49, + isc_info_wal_num_commits = 50, + isc_info_wal_avg_grpc_size = 51, + + isc_info_forced_writes = 52, + isc_info_user_names = 53, + isc_info_page_errors = 54, + isc_info_record_errors = 55, + isc_info_bpage_errors = 56, + isc_info_dpage_errors = 57, + isc_info_ipage_errors = 58, + isc_info_ppage_errors = 59, + isc_info_tpage_errors = 60, + + isc_info_set_page_buffers = 61, + isc_info_db_sql_dialect = 62, + isc_info_db_read_only = 63, + isc_info_db_size_in_pages = 64, + + frb_info_att_charset = 101, + isc_info_db_class = 102, + isc_info_firebird_version = 103, + isc_info_oldest_transaction = 104, + isc_info_oldest_active = 105, + isc_info_oldest_snapshot = 106, + isc_info_next_transaction = 107, + isc_info_db_provider = 108, + isc_info_active_transactions = 109, + isc_info_active_tran_count = 110, + isc_info_creation_date = 111, + isc_info_db_file_size = 112, + + isc_info_db_last_value +}; + +#define isc_info_version isc_info_isc_version + +enum info_db_implementations +{ + isc_info_db_impl_rdb_vms = 1, + isc_info_db_impl_rdb_eln = 2, + isc_info_db_impl_rdb_eln_dev = 3, + isc_info_db_impl_rdb_vms_y = 4, + isc_info_db_impl_rdb_eln_y = 5, + isc_info_db_impl_jri = 6, + isc_info_db_impl_jsv = 7, + + isc_info_db_impl_isc_apl_68K = 25, + isc_info_db_impl_isc_vax_ultr = 26, + isc_info_db_impl_isc_vms = 27, + isc_info_db_impl_isc_sun_68k = 28, + isc_info_db_impl_isc_os2 = 29, + isc_info_db_impl_isc_sun4 = 30, + + isc_info_db_impl_isc_hp_ux = 31, + isc_info_db_impl_isc_sun_386i = 32, + isc_info_db_impl_isc_vms_orcl = 33, + isc_info_db_impl_isc_mac_aux = 34, + isc_info_db_impl_isc_rt_aix = 35, + isc_info_db_impl_isc_mips_ult = 36, + isc_info_db_impl_isc_xenix = 37, + isc_info_db_impl_isc_dg = 38, + isc_info_db_impl_isc_hp_mpexl = 39, + isc_info_db_impl_isc_hp_ux68K = 40, + + isc_info_db_impl_isc_sgi = 41, + isc_info_db_impl_isc_sco_unix = 42, + isc_info_db_impl_isc_cray = 43, + isc_info_db_impl_isc_imp = 44, + isc_info_db_impl_isc_delta = 45, + isc_info_db_impl_isc_next = 46, + isc_info_db_impl_isc_dos = 47, + isc_info_db_impl_m88K = 48, + isc_info_db_impl_unixware = 49, + isc_info_db_impl_isc_winnt_x86 = 50, + + isc_info_db_impl_isc_epson = 51, + isc_info_db_impl_alpha_osf = 52, + isc_info_db_impl_alpha_vms = 53, + isc_info_db_impl_netware_386 = 54, + isc_info_db_impl_win_only = 55, + isc_info_db_impl_ncr_3000 = 56, + isc_info_db_impl_winnt_ppc = 57, + isc_info_db_impl_dg_x86 = 58, + isc_info_db_impl_sco_ev = 59, + isc_info_db_impl_i386 = 60, + + isc_info_db_impl_freebsd = 61, + isc_info_db_impl_netbsd = 62, + isc_info_db_impl_darwin_ppc = 63, + isc_info_db_impl_sinixz = 64, + + isc_info_db_impl_linux_sparc = 65, + isc_info_db_impl_linux_amd64 = 66, + + isc_info_db_impl_freebsd_amd64 = 67, + + isc_info_db_impl_winnt_amd64 = 68, + + isc_info_db_impl_linux_ppc = 69, + isc_info_db_impl_darwin_x86 = 70, + isc_info_db_impl_linux_mipsel = 71, + isc_info_db_impl_linux_mips = 72, + isc_info_db_impl_darwin_x64 = 73, + + isc_info_db_impl_last_value +}; + +#define isc_info_db_impl_isc_a isc_info_db_impl_isc_apl_68K +#define isc_info_db_impl_isc_u isc_info_db_impl_isc_vax_ultr +#define isc_info_db_impl_isc_v isc_info_db_impl_isc_vms +#define isc_info_db_impl_isc_s isc_info_db_impl_isc_sun_68k + +enum info_db_class +{ + isc_info_db_class_access = 1, + isc_info_db_class_y_valve = 2, + isc_info_db_class_rem_int = 3, + isc_info_db_class_rem_srvr = 4, + isc_info_db_class_pipe_int = 7, + isc_info_db_class_pipe_srvr = 8, + isc_info_db_class_sam_int = 9, + isc_info_db_class_sam_srvr = 10, + isc_info_db_class_gateway = 11, + isc_info_db_class_cache = 12, + isc_info_db_class_classic_access = 13, + isc_info_db_class_server_access = 14, + + isc_info_db_class_last_value +}; + +enum info_db_provider +{ + isc_info_db_code_rdb_eln = 1, + isc_info_db_code_rdb_vms = 2, + isc_info_db_code_interbase = 3, + isc_info_db_code_firebird = 4, + + isc_info_db_code_last_value +}; + +#define isc_info_number_messages 4 +#define isc_info_max_message 5 +#define isc_info_max_send 6 +#define isc_info_max_receive 7 +#define isc_info_state 8 +#define isc_info_message_number 9 +#define isc_info_message_size 10 +#define isc_info_request_cost 11 +#define isc_info_access_path 12 +#define isc_info_req_select_count 13 +#define isc_info_req_insert_count 14 +#define isc_info_req_update_count 15 +#define isc_info_req_delete_count 16 + +#define isc_info_rsb_end 0 +#define isc_info_rsb_begin 1 +#define isc_info_rsb_type 2 +#define isc_info_rsb_relation 3 +#define isc_info_rsb_plan 4 + +#define isc_info_rsb_unknown 1 +#define isc_info_rsb_indexed 2 +#define isc_info_rsb_navigate 3 +#define isc_info_rsb_sequential 4 +#define isc_info_rsb_cross 5 +#define isc_info_rsb_sort 6 +#define isc_info_rsb_first 7 +#define isc_info_rsb_boolean 8 +#define isc_info_rsb_union 9 +#define isc_info_rsb_aggregate 10 +#define isc_info_rsb_merge 11 +#define isc_info_rsb_ext_sequential 12 +#define isc_info_rsb_ext_indexed 13 +#define isc_info_rsb_ext_dbkey 14 +#define isc_info_rsb_left_cross 15 +#define isc_info_rsb_select 16 +#define isc_info_rsb_sql_join 17 +#define isc_info_rsb_simulate 18 +#define isc_info_rsb_sim_cross 19 +#define isc_info_rsb_once 20 +#define isc_info_rsb_procedure 21 +#define isc_info_rsb_skip 22 +#define isc_info_rsb_virt_sequential 23 +#define isc_info_rsb_recursive 24 + +#define isc_info_rsb_and 1 +#define isc_info_rsb_or 2 +#define isc_info_rsb_dbkey 3 +#define isc_info_rsb_index 4 + +#define isc_info_req_active 2 +#define isc_info_req_inactive 3 +#define isc_info_req_send 4 +#define isc_info_req_receive 5 +#define isc_info_req_select 6 +#define isc_info_req_sql_stall 7 + +#define isc_info_blob_num_segments 4 +#define isc_info_blob_max_segment 5 +#define isc_info_blob_total_length 6 +#define isc_info_blob_type 7 + +#define isc_info_tra_id 4 +#define isc_info_tra_oldest_interesting 5 +#define isc_info_tra_oldest_snapshot 6 +#define isc_info_tra_oldest_active 7 +#define isc_info_tra_isolation 8 +#define isc_info_tra_access 9 +#define isc_info_tra_lock_timeout 10 + +#define isc_info_tra_consistency 1 +#define isc_info_tra_concurrency 2 +#define isc_info_tra_read_committed 3 + +#define isc_info_tra_no_rec_version 0 +#define isc_info_tra_rec_version 1 + +#define isc_info_tra_readonly 0 +#define isc_info_tra_readwrite 1 + +#define isc_info_sql_select 4 +#define isc_info_sql_bind 5 +#define isc_info_sql_num_variables 6 +#define isc_info_sql_describe_vars 7 +#define isc_info_sql_describe_end 8 +#define isc_info_sql_sqlda_seq 9 +#define isc_info_sql_message_seq 10 +#define isc_info_sql_type 11 +#define isc_info_sql_sub_type 12 +#define isc_info_sql_scale 13 +#define isc_info_sql_length 14 +#define isc_info_sql_null_ind 15 +#define isc_info_sql_field 16 +#define isc_info_sql_relation 17 +#define isc_info_sql_owner 18 +#define isc_info_sql_alias 19 +#define isc_info_sql_sqlda_start 20 +#define isc_info_sql_stmt_type 21 +#define isc_info_sql_get_plan 22 +#define isc_info_sql_records 23 +#define isc_info_sql_batch_fetch 24 +#define isc_info_sql_relation_alias 25 + +#define isc_info_sql_stmt_select 1 +#define isc_info_sql_stmt_insert 2 +#define isc_info_sql_stmt_update 3 +#define isc_info_sql_stmt_delete 4 +#define isc_info_sql_stmt_ddl 5 +#define isc_info_sql_stmt_get_segment 6 +#define isc_info_sql_stmt_put_segment 7 +#define isc_info_sql_stmt_exec_procedure 8 +#define isc_info_sql_stmt_start_trans 9 +#define isc_info_sql_stmt_commit 10 +#define isc_info_sql_stmt_rollback 11 +#define isc_info_sql_stmt_select_for_upd 12 +#define isc_info_sql_stmt_set_generator 13 +#define isc_info_sql_stmt_savepoint 14 + +#endif + + +#include "iberror.h" + +#endif /* JRD_IBASE_H */ + diff --git a/libraries/SQLAPI/include/ibase/iberror.h b/libraries/SQLAPI/include/ibase/iberror.h new file mode 100644 index 000000000..80770ffc5 --- /dev/null +++ b/libraries/SQLAPI/include/ibase/iberror.h @@ -0,0 +1,1739 @@ + +#ifndef JRD_GEN_IBERROR_H +#define JRD_GEN_IBERROR_H +/* + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.html + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The content of this file was generated by the Firebird project + * using the program jrd/codes.epp + */ +/* + * + * *** WARNING *** - This file is automatically generated by codes.epp - do not edit! + * + */ +/* + * MODULE: iberror.h + * DESCRIPTION: ISC error codes + * + */ + + + +/***********************/ +/* ISC Error Codes */ +/***********************/ + + +#ifdef __cplusplus /* c++ definitions */ + +const ISC_LONG isc_facility = 20; +const ISC_LONG isc_base = 335544320L; +const ISC_LONG isc_factor = 1; +const ISC_LONG isc_arg_end = 0; // end of argument list +const ISC_LONG isc_arg_gds = 1; // generic DSRI status value +const ISC_LONG isc_arg_string = 2; // string argument +const ISC_LONG isc_arg_cstring = 3; // count & string argument +const ISC_LONG isc_arg_number = 4; // numeric argument (long) +const ISC_LONG isc_arg_interpreted = 5; // interpreted status code (string) +const ISC_LONG isc_arg_vms = 6; // VAX/VMS status code (long) +const ISC_LONG isc_arg_unix = 7; // UNIX error code +const ISC_LONG isc_arg_domain = 8; // Apollo/Domain error code +const ISC_LONG isc_arg_dos = 9; // MSDOS/OS2 error code +const ISC_LONG isc_arg_mpexl = 10; // HP MPE/XL error code +const ISC_LONG isc_arg_mpexl_ipc = 11; // HP MPE/XL IPC error code +const ISC_LONG isc_arg_next_mach = 15; // NeXT/Mach error code +const ISC_LONG isc_arg_netware = 16; // NetWare error code +const ISC_LONG isc_arg_win32 = 17; // Win32 error code +const ISC_LONG isc_arg_warning = 18; // warning argument + +const ISC_LONG isc_arith_except = 335544321L; +const ISC_LONG isc_bad_dbkey = 335544322L; +const ISC_LONG isc_bad_db_format = 335544323L; +const ISC_LONG isc_bad_db_handle = 335544324L; +const ISC_LONG isc_bad_dpb_content = 335544325L; +const ISC_LONG isc_bad_dpb_form = 335544326L; +const ISC_LONG isc_bad_req_handle = 335544327L; +const ISC_LONG isc_bad_segstr_handle = 335544328L; +const ISC_LONG isc_bad_segstr_id = 335544329L; +const ISC_LONG isc_bad_tpb_content = 335544330L; +const ISC_LONG isc_bad_tpb_form = 335544331L; +const ISC_LONG isc_bad_trans_handle = 335544332L; +const ISC_LONG isc_bug_check = 335544333L; +const ISC_LONG isc_convert_error = 335544334L; +const ISC_LONG isc_db_corrupt = 335544335L; +const ISC_LONG isc_deadlock = 335544336L; +const ISC_LONG isc_excess_trans = 335544337L; +const ISC_LONG isc_from_no_match = 335544338L; +const ISC_LONG isc_infinap = 335544339L; +const ISC_LONG isc_infona = 335544340L; +const ISC_LONG isc_infunk = 335544341L; +const ISC_LONG isc_integ_fail = 335544342L; +const ISC_LONG isc_invalid_blr = 335544343L; +const ISC_LONG isc_io_error = 335544344L; +const ISC_LONG isc_lock_conflict = 335544345L; +const ISC_LONG isc_metadata_corrupt = 335544346L; +const ISC_LONG isc_not_valid = 335544347L; +const ISC_LONG isc_no_cur_rec = 335544348L; +const ISC_LONG isc_no_dup = 335544349L; +const ISC_LONG isc_no_finish = 335544350L; +const ISC_LONG isc_no_meta_update = 335544351L; +const ISC_LONG isc_no_priv = 335544352L; +const ISC_LONG isc_no_recon = 335544353L; +const ISC_LONG isc_no_record = 335544354L; +const ISC_LONG isc_no_segstr_close = 335544355L; +const ISC_LONG isc_obsolete_metadata = 335544356L; +const ISC_LONG isc_open_trans = 335544357L; +const ISC_LONG isc_port_len = 335544358L; +const ISC_LONG isc_read_only_field = 335544359L; +const ISC_LONG isc_read_only_rel = 335544360L; +const ISC_LONG isc_read_only_trans = 335544361L; +const ISC_LONG isc_read_only_view = 335544362L; +const ISC_LONG isc_req_no_trans = 335544363L; +const ISC_LONG isc_req_sync = 335544364L; +const ISC_LONG isc_req_wrong_db = 335544365L; +const ISC_LONG isc_segment = 335544366L; +const ISC_LONG isc_segstr_eof = 335544367L; +const ISC_LONG isc_segstr_no_op = 335544368L; +const ISC_LONG isc_segstr_no_read = 335544369L; +const ISC_LONG isc_segstr_no_trans = 335544370L; +const ISC_LONG isc_segstr_no_write = 335544371L; +const ISC_LONG isc_segstr_wrong_db = 335544372L; +const ISC_LONG isc_sys_request = 335544373L; +const ISC_LONG isc_stream_eof = 335544374L; +const ISC_LONG isc_unavailable = 335544375L; +const ISC_LONG isc_unres_rel = 335544376L; +const ISC_LONG isc_uns_ext = 335544377L; +const ISC_LONG isc_wish_list = 335544378L; +const ISC_LONG isc_wrong_ods = 335544379L; +const ISC_LONG isc_wronumarg = 335544380L; +const ISC_LONG isc_imp_exc = 335544381L; +const ISC_LONG isc_random = 335544382L; +const ISC_LONG isc_fatal_conflict = 335544383L; +const ISC_LONG isc_badblk = 335544384L; +const ISC_LONG isc_invpoolcl = 335544385L; +const ISC_LONG isc_nopoolids = 335544386L; +const ISC_LONG isc_relbadblk = 335544387L; +const ISC_LONG isc_blktoobig = 335544388L; +const ISC_LONG isc_bufexh = 335544389L; +const ISC_LONG isc_syntaxerr = 335544390L; +const ISC_LONG isc_bufinuse = 335544391L; +const ISC_LONG isc_bdbincon = 335544392L; +const ISC_LONG isc_reqinuse = 335544393L; +const ISC_LONG isc_badodsver = 335544394L; +const ISC_LONG isc_relnotdef = 335544395L; +const ISC_LONG isc_fldnotdef = 335544396L; +const ISC_LONG isc_dirtypage = 335544397L; +const ISC_LONG isc_waifortra = 335544398L; +const ISC_LONG isc_doubleloc = 335544399L; +const ISC_LONG isc_nodnotfnd = 335544400L; +const ISC_LONG isc_dupnodfnd = 335544401L; +const ISC_LONG isc_locnotmar = 335544402L; +const ISC_LONG isc_badpagtyp = 335544403L; +const ISC_LONG isc_corrupt = 335544404L; +const ISC_LONG isc_badpage = 335544405L; +const ISC_LONG isc_badindex = 335544406L; +const ISC_LONG isc_dbbnotzer = 335544407L; +const ISC_LONG isc_tranotzer = 335544408L; +const ISC_LONG isc_trareqmis = 335544409L; +const ISC_LONG isc_badhndcnt = 335544410L; +const ISC_LONG isc_wrotpbver = 335544411L; +const ISC_LONG isc_wroblrver = 335544412L; +const ISC_LONG isc_wrodpbver = 335544413L; +const ISC_LONG isc_blobnotsup = 335544414L; +const ISC_LONG isc_badrelation = 335544415L; +const ISC_LONG isc_nodetach = 335544416L; +const ISC_LONG isc_notremote = 335544417L; +const ISC_LONG isc_trainlim = 335544418L; +const ISC_LONG isc_notinlim = 335544419L; +const ISC_LONG isc_traoutsta = 335544420L; +const ISC_LONG isc_connect_reject = 335544421L; +const ISC_LONG isc_dbfile = 335544422L; +const ISC_LONG isc_orphan = 335544423L; +const ISC_LONG isc_no_lock_mgr = 335544424L; +const ISC_LONG isc_ctxinuse = 335544425L; +const ISC_LONG isc_ctxnotdef = 335544426L; +const ISC_LONG isc_datnotsup = 335544427L; +const ISC_LONG isc_badmsgnum = 335544428L; +const ISC_LONG isc_badparnum = 335544429L; +const ISC_LONG isc_virmemexh = 335544430L; +const ISC_LONG isc_blocking_signal = 335544431L; +const ISC_LONG isc_lockmanerr = 335544432L; +const ISC_LONG isc_journerr = 335544433L; +const ISC_LONG isc_keytoobig = 335544434L; +const ISC_LONG isc_nullsegkey = 335544435L; +const ISC_LONG isc_sqlerr = 335544436L; +const ISC_LONG isc_wrodynver = 335544437L; +const ISC_LONG isc_funnotdef = 335544438L; +const ISC_LONG isc_funmismat = 335544439L; +const ISC_LONG isc_bad_msg_vec = 335544440L; +const ISC_LONG isc_bad_detach = 335544441L; +const ISC_LONG isc_noargacc_read = 335544442L; +const ISC_LONG isc_noargacc_write = 335544443L; +const ISC_LONG isc_read_only = 335544444L; +const ISC_LONG isc_ext_err = 335544445L; +const ISC_LONG isc_non_updatable = 335544446L; +const ISC_LONG isc_no_rollback = 335544447L; +const ISC_LONG isc_bad_sec_info = 335544448L; +const ISC_LONG isc_invalid_sec_info = 335544449L; +const ISC_LONG isc_misc_interpreted = 335544450L; +const ISC_LONG isc_update_conflict = 335544451L; +const ISC_LONG isc_unlicensed = 335544452L; +const ISC_LONG isc_obj_in_use = 335544453L; +const ISC_LONG isc_nofilter = 335544454L; +const ISC_LONG isc_shadow_accessed = 335544455L; +const ISC_LONG isc_invalid_sdl = 335544456L; +const ISC_LONG isc_out_of_bounds = 335544457L; +const ISC_LONG isc_invalid_dimension = 335544458L; +const ISC_LONG isc_rec_in_limbo = 335544459L; +const ISC_LONG isc_shadow_missing = 335544460L; +const ISC_LONG isc_cant_validate = 335544461L; +const ISC_LONG isc_cant_start_journal = 335544462L; +const ISC_LONG isc_gennotdef = 335544463L; +const ISC_LONG isc_cant_start_logging = 335544464L; +const ISC_LONG isc_bad_segstr_type = 335544465L; +const ISC_LONG isc_foreign_key = 335544466L; +const ISC_LONG isc_high_minor = 335544467L; +const ISC_LONG isc_tra_state = 335544468L; +const ISC_LONG isc_trans_invalid = 335544469L; +const ISC_LONG isc_buf_invalid = 335544470L; +const ISC_LONG isc_indexnotdefined = 335544471L; +const ISC_LONG isc_login = 335544472L; +const ISC_LONG isc_invalid_bookmark = 335544473L; +const ISC_LONG isc_bad_lock_level = 335544474L; +const ISC_LONG isc_relation_lock = 335544475L; +const ISC_LONG isc_record_lock = 335544476L; +const ISC_LONG isc_max_idx = 335544477L; +const ISC_LONG isc_jrn_enable = 335544478L; +const ISC_LONG isc_old_failure = 335544479L; +const ISC_LONG isc_old_in_progress = 335544480L; +const ISC_LONG isc_old_no_space = 335544481L; +const ISC_LONG isc_no_wal_no_jrn = 335544482L; +const ISC_LONG isc_num_old_files = 335544483L; +const ISC_LONG isc_wal_file_open = 335544484L; +const ISC_LONG isc_bad_stmt_handle = 335544485L; +const ISC_LONG isc_wal_failure = 335544486L; +const ISC_LONG isc_walw_err = 335544487L; +const ISC_LONG isc_logh_small = 335544488L; +const ISC_LONG isc_logh_inv_version = 335544489L; +const ISC_LONG isc_logh_open_flag = 335544490L; +const ISC_LONG isc_logh_open_flag2 = 335544491L; +const ISC_LONG isc_logh_diff_dbname = 335544492L; +const ISC_LONG isc_logf_unexpected_eof = 335544493L; +const ISC_LONG isc_logr_incomplete = 335544494L; +const ISC_LONG isc_logr_header_small = 335544495L; +const ISC_LONG isc_logb_small = 335544496L; +const ISC_LONG isc_wal_illegal_attach = 335544497L; +const ISC_LONG isc_wal_invalid_wpb = 335544498L; +const ISC_LONG isc_wal_err_rollover = 335544499L; +const ISC_LONG isc_no_wal = 335544500L; +const ISC_LONG isc_drop_wal = 335544501L; +const ISC_LONG isc_stream_not_defined = 335544502L; +const ISC_LONG isc_wal_subsys_error = 335544503L; +const ISC_LONG isc_wal_subsys_corrupt = 335544504L; +const ISC_LONG isc_no_archive = 335544505L; +const ISC_LONG isc_shutinprog = 335544506L; +const ISC_LONG isc_range_in_use = 335544507L; +const ISC_LONG isc_range_not_found = 335544508L; +const ISC_LONG isc_charset_not_found = 335544509L; +const ISC_LONG isc_lock_timeout = 335544510L; +const ISC_LONG isc_prcnotdef = 335544511L; +const ISC_LONG isc_prcmismat = 335544512L; +const ISC_LONG isc_wal_bugcheck = 335544513L; +const ISC_LONG isc_wal_cant_expand = 335544514L; +const ISC_LONG isc_codnotdef = 335544515L; +const ISC_LONG isc_xcpnotdef = 335544516L; +const ISC_LONG isc_except = 335544517L; +const ISC_LONG isc_cache_restart = 335544518L; +const ISC_LONG isc_bad_lock_handle = 335544519L; +const ISC_LONG isc_jrn_present = 335544520L; +const ISC_LONG isc_wal_err_rollover2 = 335544521L; +const ISC_LONG isc_wal_err_logwrite = 335544522L; +const ISC_LONG isc_wal_err_jrn_comm = 335544523L; +const ISC_LONG isc_wal_err_expansion = 335544524L; +const ISC_LONG isc_wal_err_setup = 335544525L; +const ISC_LONG isc_wal_err_ww_sync = 335544526L; +const ISC_LONG isc_wal_err_ww_start = 335544527L; +const ISC_LONG isc_shutdown = 335544528L; +const ISC_LONG isc_existing_priv_mod = 335544529L; +const ISC_LONG isc_primary_key_ref = 335544530L; +const ISC_LONG isc_primary_key_notnull = 335544531L; +const ISC_LONG isc_ref_cnstrnt_notfound = 335544532L; +const ISC_LONG isc_foreign_key_notfound = 335544533L; +const ISC_LONG isc_ref_cnstrnt_update = 335544534L; +const ISC_LONG isc_check_cnstrnt_update = 335544535L; +const ISC_LONG isc_check_cnstrnt_del = 335544536L; +const ISC_LONG isc_integ_index_seg_del = 335544537L; +const ISC_LONG isc_integ_index_seg_mod = 335544538L; +const ISC_LONG isc_integ_index_del = 335544539L; +const ISC_LONG isc_integ_index_mod = 335544540L; +const ISC_LONG isc_check_trig_del = 335544541L; +const ISC_LONG isc_check_trig_update = 335544542L; +const ISC_LONG isc_cnstrnt_fld_del = 335544543L; +const ISC_LONG isc_cnstrnt_fld_rename = 335544544L; +const ISC_LONG isc_rel_cnstrnt_update = 335544545L; +const ISC_LONG isc_constaint_on_view = 335544546L; +const ISC_LONG isc_invld_cnstrnt_type = 335544547L; +const ISC_LONG isc_primary_key_exists = 335544548L; +const ISC_LONG isc_systrig_update = 335544549L; +const ISC_LONG isc_not_rel_owner = 335544550L; +const ISC_LONG isc_grant_obj_notfound = 335544551L; +const ISC_LONG isc_grant_fld_notfound = 335544552L; +const ISC_LONG isc_grant_nopriv = 335544553L; +const ISC_LONG isc_nonsql_security_rel = 335544554L; +const ISC_LONG isc_nonsql_security_fld = 335544555L; +const ISC_LONG isc_wal_cache_err = 335544556L; +const ISC_LONG isc_shutfail = 335544557L; +const ISC_LONG isc_check_constraint = 335544558L; +const ISC_LONG isc_bad_svc_handle = 335544559L; +const ISC_LONG isc_shutwarn = 335544560L; +const ISC_LONG isc_wrospbver = 335544561L; +const ISC_LONG isc_bad_spb_form = 335544562L; +const ISC_LONG isc_svcnotdef = 335544563L; +const ISC_LONG isc_no_jrn = 335544564L; +const ISC_LONG isc_transliteration_failed = 335544565L; +const ISC_LONG isc_start_cm_for_wal = 335544566L; +const ISC_LONG isc_wal_ovflow_log_required = 335544567L; +const ISC_LONG isc_text_subtype = 335544568L; +const ISC_LONG isc_dsql_error = 335544569L; +const ISC_LONG isc_dsql_command_err = 335544570L; +const ISC_LONG isc_dsql_constant_err = 335544571L; +const ISC_LONG isc_dsql_cursor_err = 335544572L; +const ISC_LONG isc_dsql_datatype_err = 335544573L; +const ISC_LONG isc_dsql_decl_err = 335544574L; +const ISC_LONG isc_dsql_cursor_update_err = 335544575L; +const ISC_LONG isc_dsql_cursor_open_err = 335544576L; +const ISC_LONG isc_dsql_cursor_close_err = 335544577L; +const ISC_LONG isc_dsql_field_err = 335544578L; +const ISC_LONG isc_dsql_internal_err = 335544579L; +const ISC_LONG isc_dsql_relation_err = 335544580L; +const ISC_LONG isc_dsql_procedure_err = 335544581L; +const ISC_LONG isc_dsql_request_err = 335544582L; +const ISC_LONG isc_dsql_sqlda_err = 335544583L; +const ISC_LONG isc_dsql_var_count_err = 335544584L; +const ISC_LONG isc_dsql_stmt_handle = 335544585L; +const ISC_LONG isc_dsql_function_err = 335544586L; +const ISC_LONG isc_dsql_blob_err = 335544587L; +const ISC_LONG isc_collation_not_found = 335544588L; +const ISC_LONG isc_collation_not_for_charset = 335544589L; +const ISC_LONG isc_dsql_dup_option = 335544590L; +const ISC_LONG isc_dsql_tran_err = 335544591L; +const ISC_LONG isc_dsql_invalid_array = 335544592L; +const ISC_LONG isc_dsql_max_arr_dim_exceeded = 335544593L; +const ISC_LONG isc_dsql_arr_range_error = 335544594L; +const ISC_LONG isc_dsql_trigger_err = 335544595L; +const ISC_LONG isc_dsql_subselect_err = 335544596L; +const ISC_LONG isc_dsql_crdb_prepare_err = 335544597L; +const ISC_LONG isc_specify_field_err = 335544598L; +const ISC_LONG isc_num_field_err = 335544599L; +const ISC_LONG isc_col_name_err = 335544600L; +const ISC_LONG isc_where_err = 335544601L; +const ISC_LONG isc_table_view_err = 335544602L; +const ISC_LONG isc_distinct_err = 335544603L; +const ISC_LONG isc_key_field_count_err = 335544604L; +const ISC_LONG isc_subquery_err = 335544605L; +const ISC_LONG isc_expression_eval_err = 335544606L; +const ISC_LONG isc_node_err = 335544607L; +const ISC_LONG isc_command_end_err = 335544608L; +const ISC_LONG isc_index_name = 335544609L; +const ISC_LONG isc_exception_name = 335544610L; +const ISC_LONG isc_field_name = 335544611L; +const ISC_LONG isc_token_err = 335544612L; +const ISC_LONG isc_union_err = 335544613L; +const ISC_LONG isc_dsql_construct_err = 335544614L; +const ISC_LONG isc_field_aggregate_err = 335544615L; +const ISC_LONG isc_field_ref_err = 335544616L; +const ISC_LONG isc_order_by_err = 335544617L; +const ISC_LONG isc_return_mode_err = 335544618L; +const ISC_LONG isc_extern_func_err = 335544619L; +const ISC_LONG isc_alias_conflict_err = 335544620L; +const ISC_LONG isc_procedure_conflict_error = 335544621L; +const ISC_LONG isc_relation_conflict_err = 335544622L; +const ISC_LONG isc_dsql_domain_err = 335544623L; +const ISC_LONG isc_idx_seg_err = 335544624L; +const ISC_LONG isc_node_name_err = 335544625L; +const ISC_LONG isc_table_name = 335544626L; +const ISC_LONG isc_proc_name = 335544627L; +const ISC_LONG isc_idx_create_err = 335544628L; +const ISC_LONG isc_wal_shadow_err = 335544629L; +const ISC_LONG isc_dependency = 335544630L; +const ISC_LONG isc_idx_key_err = 335544631L; +const ISC_LONG isc_dsql_file_length_err = 335544632L; +const ISC_LONG isc_dsql_shadow_number_err = 335544633L; +const ISC_LONG isc_dsql_token_unk_err = 335544634L; +const ISC_LONG isc_dsql_no_relation_alias = 335544635L; +const ISC_LONG isc_indexname = 335544636L; +const ISC_LONG isc_no_stream_plan = 335544637L; +const ISC_LONG isc_stream_twice = 335544638L; +const ISC_LONG isc_stream_not_found = 335544639L; +const ISC_LONG isc_collation_requires_text = 335544640L; +const ISC_LONG isc_dsql_domain_not_found = 335544641L; +const ISC_LONG isc_index_unused = 335544642L; +const ISC_LONG isc_dsql_self_join = 335544643L; +const ISC_LONG isc_stream_bof = 335544644L; +const ISC_LONG isc_stream_crack = 335544645L; +const ISC_LONG isc_db_or_file_exists = 335544646L; +const ISC_LONG isc_invalid_operator = 335544647L; +const ISC_LONG isc_conn_lost = 335544648L; +const ISC_LONG isc_bad_checksum = 335544649L; +const ISC_LONG isc_page_type_err = 335544650L; +const ISC_LONG isc_ext_readonly_err = 335544651L; +const ISC_LONG isc_sing_select_err = 335544652L; +const ISC_LONG isc_psw_attach = 335544653L; +const ISC_LONG isc_psw_start_trans = 335544654L; +const ISC_LONG isc_invalid_direction = 335544655L; +const ISC_LONG isc_dsql_var_conflict = 335544656L; +const ISC_LONG isc_dsql_no_blob_array = 335544657L; +const ISC_LONG isc_dsql_base_table = 335544658L; +const ISC_LONG isc_duplicate_base_table = 335544659L; +const ISC_LONG isc_view_alias = 335544660L; +const ISC_LONG isc_index_root_page_full = 335544661L; +const ISC_LONG isc_dsql_blob_type_unknown = 335544662L; +const ISC_LONG isc_req_max_clones_exceeded = 335544663L; +const ISC_LONG isc_dsql_duplicate_spec = 335544664L; +const ISC_LONG isc_unique_key_violation = 335544665L; +const ISC_LONG isc_srvr_version_too_old = 335544666L; +const ISC_LONG isc_drdb_completed_with_errs = 335544667L; +const ISC_LONG isc_dsql_procedure_use_err = 335544668L; +const ISC_LONG isc_dsql_count_mismatch = 335544669L; +const ISC_LONG isc_blob_idx_err = 335544670L; +const ISC_LONG isc_array_idx_err = 335544671L; +const ISC_LONG isc_key_field_err = 335544672L; +const ISC_LONG isc_no_delete = 335544673L; +const ISC_LONG isc_del_last_field = 335544674L; +const ISC_LONG isc_sort_err = 335544675L; +const ISC_LONG isc_sort_mem_err = 335544676L; +const ISC_LONG isc_version_err = 335544677L; +const ISC_LONG isc_inval_key_posn = 335544678L; +const ISC_LONG isc_no_segments_err = 335544679L; +const ISC_LONG isc_crrp_data_err = 335544680L; +const ISC_LONG isc_rec_size_err = 335544681L; +const ISC_LONG isc_dsql_field_ref = 335544682L; +const ISC_LONG isc_req_depth_exceeded = 335544683L; +const ISC_LONG isc_no_field_access = 335544684L; +const ISC_LONG isc_no_dbkey = 335544685L; +const ISC_LONG isc_jrn_format_err = 335544686L; +const ISC_LONG isc_jrn_file_full = 335544687L; +const ISC_LONG isc_dsql_open_cursor_request = 335544688L; +const ISC_LONG isc_ib_error = 335544689L; +const ISC_LONG isc_cache_redef = 335544690L; +const ISC_LONG isc_cache_too_small = 335544691L; +const ISC_LONG isc_log_redef = 335544692L; +const ISC_LONG isc_log_too_small = 335544693L; +const ISC_LONG isc_partition_too_small = 335544694L; +const ISC_LONG isc_partition_not_supp = 335544695L; +const ISC_LONG isc_log_length_spec = 335544696L; +const ISC_LONG isc_precision_err = 335544697L; +const ISC_LONG isc_scale_nogt = 335544698L; +const ISC_LONG isc_expec_short = 335544699L; +const ISC_LONG isc_expec_long = 335544700L; +const ISC_LONG isc_expec_ushort = 335544701L; +const ISC_LONG isc_like_escape_invalid = 335544702L; +const ISC_LONG isc_svcnoexe = 335544703L; +const ISC_LONG isc_net_lookup_err = 335544704L; +const ISC_LONG isc_service_unknown = 335544705L; +const ISC_LONG isc_host_unknown = 335544706L; +const ISC_LONG isc_grant_nopriv_on_base = 335544707L; +const ISC_LONG isc_dyn_fld_ambiguous = 335544708L; +const ISC_LONG isc_dsql_agg_ref_err = 335544709L; +const ISC_LONG isc_complex_view = 335544710L; +const ISC_LONG isc_unprepared_stmt = 335544711L; +const ISC_LONG isc_expec_positive = 335544712L; +const ISC_LONG isc_dsql_sqlda_value_err = 335544713L; +const ISC_LONG isc_invalid_array_id = 335544714L; +const ISC_LONG isc_extfile_uns_op = 335544715L; +const ISC_LONG isc_svc_in_use = 335544716L; +const ISC_LONG isc_err_stack_limit = 335544717L; +const ISC_LONG isc_invalid_key = 335544718L; +const ISC_LONG isc_net_init_error = 335544719L; +const ISC_LONG isc_loadlib_failure = 335544720L; +const ISC_LONG isc_network_error = 335544721L; +const ISC_LONG isc_net_connect_err = 335544722L; +const ISC_LONG isc_net_connect_listen_err = 335544723L; +const ISC_LONG isc_net_event_connect_err = 335544724L; +const ISC_LONG isc_net_event_listen_err = 335544725L; +const ISC_LONG isc_net_read_err = 335544726L; +const ISC_LONG isc_net_write_err = 335544727L; +const ISC_LONG isc_integ_index_deactivate = 335544728L; +const ISC_LONG isc_integ_deactivate_primary = 335544729L; +const ISC_LONG isc_cse_not_supported = 335544730L; +const ISC_LONG isc_tra_must_sweep = 335544731L; +const ISC_LONG isc_unsupported_network_drive = 335544732L; +const ISC_LONG isc_io_create_err = 335544733L; +const ISC_LONG isc_io_open_err = 335544734L; +const ISC_LONG isc_io_close_err = 335544735L; +const ISC_LONG isc_io_read_err = 335544736L; +const ISC_LONG isc_io_write_err = 335544737L; +const ISC_LONG isc_io_delete_err = 335544738L; +const ISC_LONG isc_io_access_err = 335544739L; +const ISC_LONG isc_udf_exception = 335544740L; +const ISC_LONG isc_lost_db_connection = 335544741L; +const ISC_LONG isc_no_write_user_priv = 335544742L; +const ISC_LONG isc_token_too_long = 335544743L; +const ISC_LONG isc_max_att_exceeded = 335544744L; +const ISC_LONG isc_login_same_as_role_name = 335544745L; +const ISC_LONG isc_reftable_requires_pk = 335544746L; +const ISC_LONG isc_usrname_too_long = 335544747L; +const ISC_LONG isc_password_too_long = 335544748L; +const ISC_LONG isc_usrname_required = 335544749L; +const ISC_LONG isc_password_required = 335544750L; +const ISC_LONG isc_bad_protocol = 335544751L; +const ISC_LONG isc_dup_usrname_found = 335544752L; +const ISC_LONG isc_usrname_not_found = 335544753L; +const ISC_LONG isc_error_adding_sec_record = 335544754L; +const ISC_LONG isc_error_modifying_sec_record = 335544755L; +const ISC_LONG isc_error_deleting_sec_record = 335544756L; +const ISC_LONG isc_error_updating_sec_db = 335544757L; +const ISC_LONG isc_sort_rec_size_err = 335544758L; +const ISC_LONG isc_bad_default_value = 335544759L; +const ISC_LONG isc_invalid_clause = 335544760L; +const ISC_LONG isc_too_many_handles = 335544761L; +const ISC_LONG isc_optimizer_blk_exc = 335544762L; +const ISC_LONG isc_invalid_string_constant = 335544763L; +const ISC_LONG isc_transitional_date = 335544764L; +const ISC_LONG isc_read_only_database = 335544765L; +const ISC_LONG isc_must_be_dialect_2_and_up = 335544766L; +const ISC_LONG isc_blob_filter_exception = 335544767L; +const ISC_LONG isc_exception_access_violation = 335544768L; +const ISC_LONG isc_exception_datatype_missalignment = 335544769L; +const ISC_LONG isc_exception_array_bounds_exceeded = 335544770L; +const ISC_LONG isc_exception_float_denormal_operand = 335544771L; +const ISC_LONG isc_exception_float_divide_by_zero = 335544772L; +const ISC_LONG isc_exception_float_inexact_result = 335544773L; +const ISC_LONG isc_exception_float_invalid_operand = 335544774L; +const ISC_LONG isc_exception_float_overflow = 335544775L; +const ISC_LONG isc_exception_float_stack_check = 335544776L; +const ISC_LONG isc_exception_float_underflow = 335544777L; +const ISC_LONG isc_exception_integer_divide_by_zero = 335544778L; +const ISC_LONG isc_exception_integer_overflow = 335544779L; +const ISC_LONG isc_exception_unknown = 335544780L; +const ISC_LONG isc_exception_stack_overflow = 335544781L; +const ISC_LONG isc_exception_sigsegv = 335544782L; +const ISC_LONG isc_exception_sigill = 335544783L; +const ISC_LONG isc_exception_sigbus = 335544784L; +const ISC_LONG isc_exception_sigfpe = 335544785L; +const ISC_LONG isc_ext_file_delete = 335544786L; +const ISC_LONG isc_ext_file_modify = 335544787L; +const ISC_LONG isc_adm_task_denied = 335544788L; +const ISC_LONG isc_extract_input_mismatch = 335544789L; +const ISC_LONG isc_insufficient_svc_privileges = 335544790L; +const ISC_LONG isc_file_in_use = 335544791L; +const ISC_LONG isc_service_att_err = 335544792L; +const ISC_LONG isc_ddl_not_allowed_by_db_sql_dial = 335544793L; +const ISC_LONG isc_cancelled = 335544794L; +const ISC_LONG isc_unexp_spb_form = 335544795L; +const ISC_LONG isc_sql_dialect_datatype_unsupport = 335544796L; +const ISC_LONG isc_svcnouser = 335544797L; +const ISC_LONG isc_depend_on_uncommitted_rel = 335544798L; +const ISC_LONG isc_svc_name_missing = 335544799L; +const ISC_LONG isc_too_many_contexts = 335544800L; +const ISC_LONG isc_datype_notsup = 335544801L; +const ISC_LONG isc_dialect_reset_warning = 335544802L; +const ISC_LONG isc_dialect_not_changed = 335544803L; +const ISC_LONG isc_database_create_failed = 335544804L; +const ISC_LONG isc_inv_dialect_specified = 335544805L; +const ISC_LONG isc_valid_db_dialects = 335544806L; +const ISC_LONG isc_sqlwarn = 335544807L; +const ISC_LONG isc_dtype_renamed = 335544808L; +const ISC_LONG isc_extern_func_dir_error = 335544809L; +const ISC_LONG isc_date_range_exceeded = 335544810L; +const ISC_LONG isc_inv_client_dialect_specified = 335544811L; +const ISC_LONG isc_valid_client_dialects = 335544812L; +const ISC_LONG isc_optimizer_between_err = 335544813L; +const ISC_LONG isc_service_not_supported = 335544814L; +const ISC_LONG isc_generator_name = 335544815L; +const ISC_LONG isc_udf_name = 335544816L; +const ISC_LONG isc_bad_limit_param = 335544817L; +const ISC_LONG isc_bad_skip_param = 335544818L; +const ISC_LONG isc_io_32bit_exceeded_err = 335544819L; +const ISC_LONG isc_invalid_savepoint = 335544820L; +const ISC_LONG isc_dsql_column_pos_err = 335544821L; +const ISC_LONG isc_dsql_agg_where_err = 335544822L; +const ISC_LONG isc_dsql_agg_group_err = 335544823L; +const ISC_LONG isc_dsql_agg_column_err = 335544824L; +const ISC_LONG isc_dsql_agg_having_err = 335544825L; +const ISC_LONG isc_dsql_agg_nested_err = 335544826L; +const ISC_LONG isc_exec_sql_invalid_arg = 335544827L; +const ISC_LONG isc_exec_sql_invalid_req = 335544828L; +const ISC_LONG isc_exec_sql_invalid_var = 335544829L; +const ISC_LONG isc_exec_sql_max_call_exceeded = 335544830L; +const ISC_LONG isc_conf_access_denied = 335544831L; +const ISC_LONG isc_wrong_backup_state = 335544832L; +const ISC_LONG isc_wal_backup_err = 335544833L; +const ISC_LONG isc_cursor_not_open = 335544834L; +const ISC_LONG isc_bad_shutdown_mode = 335544835L; +const ISC_LONG isc_concat_overflow = 335544836L; +const ISC_LONG isc_bad_substring_offset = 335544837L; +const ISC_LONG isc_foreign_key_target_doesnt_exist = 335544838L; +const ISC_LONG isc_foreign_key_references_present = 335544839L; +const ISC_LONG isc_no_update = 335544840L; +const ISC_LONG isc_cursor_already_open = 335544841L; +const ISC_LONG isc_stack_trace = 335544842L; +const ISC_LONG isc_ctx_var_not_found = 335544843L; +const ISC_LONG isc_ctx_namespace_invalid = 335544844L; +const ISC_LONG isc_ctx_too_big = 335544845L; +const ISC_LONG isc_ctx_bad_argument = 335544846L; +const ISC_LONG isc_identifier_too_long = 335544847L; +const ISC_LONG isc_except2 = 335544848L; +const ISC_LONG isc_malformed_string = 335544849L; +const ISC_LONG isc_prc_out_param_mismatch = 335544850L; +const ISC_LONG isc_command_end_err2 = 335544851L; +const ISC_LONG isc_partner_idx_incompat_type = 335544852L; +const ISC_LONG isc_bad_substring_length = 335544853L; +const ISC_LONG isc_charset_not_installed = 335544854L; +const ISC_LONG isc_collation_not_installed = 335544855L; +const ISC_LONG isc_att_shutdown = 335544856L; +const ISC_LONG isc_blobtoobig = 335544857L; +const ISC_LONG isc_must_have_phys_field = 335544858L; +const ISC_LONG isc_invalid_time_precision = 335544859L; +const ISC_LONG isc_blob_convert_error = 335544860L; +const ISC_LONG isc_array_convert_error = 335544861L; +const ISC_LONG isc_record_lock_not_supp = 335544862L; +const ISC_LONG isc_partner_idx_not_found = 335544863L; +const ISC_LONG isc_tra_num_exc = 335544864L; +const ISC_LONG isc_field_disappeared = 335544865L; +const ISC_LONG isc_met_wrong_gtt_scope = 335544866L; +const ISC_LONG isc_subtype_for_internal_use = 335544867L; +const ISC_LONG isc_illegal_prc_type = 335544868L; +const ISC_LONG isc_invalid_sort_datatype = 335544869L; +const ISC_LONG isc_collation_name = 335544870L; +const ISC_LONG isc_domain_name = 335544871L; +const ISC_LONG isc_domnotdef = 335544872L; +const ISC_LONG isc_array_max_dimensions = 335544873L; +const ISC_LONG isc_max_db_per_trans_allowed = 335544874L; +const ISC_LONG isc_bad_debug_format = 335544875L; +const ISC_LONG isc_bad_proc_BLR = 335544876L; +const ISC_LONG isc_key_too_big = 335544877L; +const ISC_LONG isc_concurrent_transaction = 335544878L; +const ISC_LONG isc_not_valid_for_var = 335544879L; +const ISC_LONG isc_not_valid_for = 335544880L; +const ISC_LONG isc_need_difference = 335544881L; +const ISC_LONG isc_long_login = 335544882L; +const ISC_LONG isc_fldnotdef2 = 335544883L; +const ISC_LONG isc_gfix_db_name = 335740929L; +const ISC_LONG isc_gfix_invalid_sw = 335740930L; +const ISC_LONG isc_gfix_incmp_sw = 335740932L; +const ISC_LONG isc_gfix_replay_req = 335740933L; +const ISC_LONG isc_gfix_pgbuf_req = 335740934L; +const ISC_LONG isc_gfix_val_req = 335740935L; +const ISC_LONG isc_gfix_pval_req = 335740936L; +const ISC_LONG isc_gfix_trn_req = 335740937L; +const ISC_LONG isc_gfix_full_req = 335740940L; +const ISC_LONG isc_gfix_usrname_req = 335740941L; +const ISC_LONG isc_gfix_pass_req = 335740942L; +const ISC_LONG isc_gfix_subs_name = 335740943L; +const ISC_LONG isc_gfix_wal_req = 335740944L; +const ISC_LONG isc_gfix_sec_req = 335740945L; +const ISC_LONG isc_gfix_nval_req = 335740946L; +const ISC_LONG isc_gfix_type_shut = 335740947L; +const ISC_LONG isc_gfix_retry = 335740948L; +const ISC_LONG isc_gfix_retry_db = 335740951L; +const ISC_LONG isc_gfix_exceed_max = 335740991L; +const ISC_LONG isc_gfix_corrupt_pool = 335740992L; +const ISC_LONG isc_gfix_mem_exhausted = 335740993L; +const ISC_LONG isc_gfix_bad_pool = 335740994L; +const ISC_LONG isc_gfix_trn_not_valid = 335740995L; +const ISC_LONG isc_gfix_unexp_eoi = 335741012L; +const ISC_LONG isc_gfix_recon_fail = 335741018L; +const ISC_LONG isc_gfix_trn_unknown = 335741036L; +const ISC_LONG isc_gfix_mode_req = 335741038L; +const ISC_LONG isc_gfix_opt_SQL_dialect = 335741039L; +const ISC_LONG isc_gfix_pzval_req = 335741042L; +const ISC_LONG isc_dsql_dbkey_from_non_table = 336003074L; +const ISC_LONG isc_dsql_transitional_numeric = 336003075L; +const ISC_LONG isc_dsql_dialect_warning_expr = 336003076L; +const ISC_LONG isc_sql_db_dialect_dtype_unsupport = 336003077L; +const ISC_LONG isc_isc_sql_dialect_conflict_num = 336003079L; +const ISC_LONG isc_dsql_warning_number_ambiguous = 336003080L; +const ISC_LONG isc_dsql_warning_number_ambiguous1 = 336003081L; +const ISC_LONG isc_dsql_warn_precision_ambiguous = 336003082L; +const ISC_LONG isc_dsql_warn_precision_ambiguous1 = 336003083L; +const ISC_LONG isc_dsql_warn_precision_ambiguous2 = 336003084L; +const ISC_LONG isc_dsql_ambiguous_field_name = 336003085L; +const ISC_LONG isc_dsql_udf_return_pos_err = 336003086L; +const ISC_LONG isc_dsql_invalid_label = 336003087L; +const ISC_LONG isc_dsql_datatypes_not_comparable = 336003088L; +const ISC_LONG isc_dsql_cursor_invalid = 336003089L; +const ISC_LONG isc_dsql_cursor_redefined = 336003090L; +const ISC_LONG isc_dsql_cursor_not_found = 336003091L; +const ISC_LONG isc_dsql_cursor_exists = 336003092L; +const ISC_LONG isc_dsql_cursor_rel_ambiguous = 336003093L; +const ISC_LONG isc_dsql_cursor_rel_not_found = 336003094L; +const ISC_LONG isc_dsql_cursor_not_open = 336003095L; +const ISC_LONG isc_dsql_type_not_supp_ext_tab = 336003096L; +const ISC_LONG isc_dsql_feature_not_supported_ods = 336003097L; +const ISC_LONG isc_primary_key_required = 336003098L; +const ISC_LONG isc_upd_ins_doesnt_match_pk = 336003099L; +const ISC_LONG isc_upd_ins_doesnt_match_matching = 336003100L; +const ISC_LONG isc_upd_ins_with_complex_view = 336003101L; +const ISC_LONG isc_dsql_incompatible_trigger_type = 336003102L; +const ISC_LONG isc_dsql_db_trigger_type_cant_change = 336003103L; +const ISC_LONG isc_dyn_role_does_not_exist = 336068796L; +const ISC_LONG isc_dyn_no_grant_admin_opt = 336068797L; +const ISC_LONG isc_dyn_user_not_role_member = 336068798L; +const ISC_LONG isc_dyn_delete_role_failed = 336068799L; +const ISC_LONG isc_dyn_grant_role_to_user = 336068800L; +const ISC_LONG isc_dyn_inv_sql_role_name = 336068801L; +const ISC_LONG isc_dyn_dup_sql_role = 336068802L; +const ISC_LONG isc_dyn_kywd_spec_for_role = 336068803L; +const ISC_LONG isc_dyn_roles_not_supported = 336068804L; +const ISC_LONG isc_dyn_domain_name_exists = 336068812L; +const ISC_LONG isc_dyn_field_name_exists = 336068813L; +const ISC_LONG isc_dyn_dependency_exists = 336068814L; +const ISC_LONG isc_dyn_dtype_invalid = 336068815L; +const ISC_LONG isc_dyn_char_fld_too_small = 336068816L; +const ISC_LONG isc_dyn_invalid_dtype_conversion = 336068817L; +const ISC_LONG isc_dyn_dtype_conv_invalid = 336068818L; +const ISC_LONG isc_dyn_zero_len_id = 336068820L; +const ISC_LONG isc_max_coll_per_charset = 336068829L; +const ISC_LONG isc_invalid_coll_attr = 336068830L; +const ISC_LONG isc_dyn_wrong_gtt_scope = 336068840L; +const ISC_LONG isc_dyn_scale_too_big = 336068852L; +const ISC_LONG isc_dyn_precision_too_small = 336068853L; +const ISC_LONG isc_dyn_miss_priv_warning = 336068855L; +const ISC_LONG isc_dyn_ods_not_supp_feature = 336068856L; +const ISC_LONG isc_gbak_unknown_switch = 336330753L; +const ISC_LONG isc_gbak_page_size_missing = 336330754L; +const ISC_LONG isc_gbak_page_size_toobig = 336330755L; +const ISC_LONG isc_gbak_redir_ouput_missing = 336330756L; +const ISC_LONG isc_gbak_switches_conflict = 336330757L; +const ISC_LONG isc_gbak_unknown_device = 336330758L; +const ISC_LONG isc_gbak_no_protection = 336330759L; +const ISC_LONG isc_gbak_page_size_not_allowed = 336330760L; +const ISC_LONG isc_gbak_multi_source_dest = 336330761L; +const ISC_LONG isc_gbak_filename_missing = 336330762L; +const ISC_LONG isc_gbak_dup_inout_names = 336330763L; +const ISC_LONG isc_gbak_inv_page_size = 336330764L; +const ISC_LONG isc_gbak_db_specified = 336330765L; +const ISC_LONG isc_gbak_db_exists = 336330766L; +const ISC_LONG isc_gbak_unk_device = 336330767L; +const ISC_LONG isc_gbak_blob_info_failed = 336330772L; +const ISC_LONG isc_gbak_unk_blob_item = 336330773L; +const ISC_LONG isc_gbak_get_seg_failed = 336330774L; +const ISC_LONG isc_gbak_close_blob_failed = 336330775L; +const ISC_LONG isc_gbak_open_blob_failed = 336330776L; +const ISC_LONG isc_gbak_put_blr_gen_id_failed = 336330777L; +const ISC_LONG isc_gbak_unk_type = 336330778L; +const ISC_LONG isc_gbak_comp_req_failed = 336330779L; +const ISC_LONG isc_gbak_start_req_failed = 336330780L; +const ISC_LONG isc_gbak_rec_failed = 336330781L; +const ISC_LONG isc_gbak_rel_req_failed = 336330782L; +const ISC_LONG isc_gbak_db_info_failed = 336330783L; +const ISC_LONG isc_gbak_no_db_desc = 336330784L; +const ISC_LONG isc_gbak_db_create_failed = 336330785L; +const ISC_LONG isc_gbak_decomp_len_error = 336330786L; +const ISC_LONG isc_gbak_tbl_missing = 336330787L; +const ISC_LONG isc_gbak_blob_col_missing = 336330788L; +const ISC_LONG isc_gbak_create_blob_failed = 336330789L; +const ISC_LONG isc_gbak_put_seg_failed = 336330790L; +const ISC_LONG isc_gbak_rec_len_exp = 336330791L; +const ISC_LONG isc_gbak_inv_rec_len = 336330792L; +const ISC_LONG isc_gbak_exp_data_type = 336330793L; +const ISC_LONG isc_gbak_gen_id_failed = 336330794L; +const ISC_LONG isc_gbak_unk_rec_type = 336330795L; +const ISC_LONG isc_gbak_inv_bkup_ver = 336330796L; +const ISC_LONG isc_gbak_missing_bkup_desc = 336330797L; +const ISC_LONG isc_gbak_string_trunc = 336330798L; +const ISC_LONG isc_gbak_cant_rest_record = 336330799L; +const ISC_LONG isc_gbak_send_failed = 336330800L; +const ISC_LONG isc_gbak_no_tbl_name = 336330801L; +const ISC_LONG isc_gbak_unexp_eof = 336330802L; +const ISC_LONG isc_gbak_db_format_too_old = 336330803L; +const ISC_LONG isc_gbak_inv_array_dim = 336330804L; +const ISC_LONG isc_gbak_xdr_len_expected = 336330807L; +const ISC_LONG isc_gbak_open_bkup_error = 336330817L; +const ISC_LONG isc_gbak_open_error = 336330818L; +const ISC_LONG isc_gbak_missing_block_fac = 336330934L; +const ISC_LONG isc_gbak_inv_block_fac = 336330935L; +const ISC_LONG isc_gbak_block_fac_specified = 336330936L; +const ISC_LONG isc_gbak_missing_username = 336330940L; +const ISC_LONG isc_gbak_missing_password = 336330941L; +const ISC_LONG isc_gbak_missing_skipped_bytes = 336330952L; +const ISC_LONG isc_gbak_inv_skipped_bytes = 336330953L; +const ISC_LONG isc_gbak_err_restore_charset = 336330965L; +const ISC_LONG isc_gbak_err_restore_collation = 336330967L; +const ISC_LONG isc_gbak_read_error = 336330972L; +const ISC_LONG isc_gbak_write_error = 336330973L; +const ISC_LONG isc_gbak_db_in_use = 336330985L; +const ISC_LONG isc_gbak_sysmemex = 336330990L; +const ISC_LONG isc_gbak_restore_role_failed = 336331002L; +const ISC_LONG isc_gbak_role_op_missing = 336331005L; +const ISC_LONG isc_gbak_page_buffers_missing = 336331010L; +const ISC_LONG isc_gbak_page_buffers_wrong_param = 336331011L; +const ISC_LONG isc_gbak_page_buffers_restore = 336331012L; +const ISC_LONG isc_gbak_inv_size = 336331014L; +const ISC_LONG isc_gbak_file_outof_sequence = 336331015L; +const ISC_LONG isc_gbak_join_file_missing = 336331016L; +const ISC_LONG isc_gbak_stdin_not_supptd = 336331017L; +const ISC_LONG isc_gbak_stdout_not_supptd = 336331018L; +const ISC_LONG isc_gbak_bkup_corrupt = 336331019L; +const ISC_LONG isc_gbak_unk_db_file_spec = 336331020L; +const ISC_LONG isc_gbak_hdr_write_failed = 336331021L; +const ISC_LONG isc_gbak_disk_space_ex = 336331022L; +const ISC_LONG isc_gbak_size_lt_min = 336331023L; +const ISC_LONG isc_gbak_svc_name_missing = 336331025L; +const ISC_LONG isc_gbak_not_ownr = 336331026L; +const ISC_LONG isc_gbak_mode_req = 336331031L; +const ISC_LONG isc_gbak_just_data = 336331033L; +const ISC_LONG isc_gbak_data_only = 336331034L; +const ISC_LONG isc_dsql_too_old_ods = 336397205L; +const ISC_LONG isc_dsql_table_not_found = 336397206L; +const ISC_LONG isc_dsql_view_not_found = 336397207L; +const ISC_LONG isc_dsql_line_col_error = 336397208L; +const ISC_LONG isc_dsql_unknown_pos = 336397209L; +const ISC_LONG isc_dsql_no_dup_name = 336397210L; +const ISC_LONG isc_dsql_too_many_values = 336397211L; +const ISC_LONG isc_dsql_no_array_computed = 336397212L; +const ISC_LONG isc_dsql_implicit_domain_name = 336397213L; +const ISC_LONG isc_dsql_only_can_subscript_array = 336397214L; +const ISC_LONG isc_dsql_max_sort_items = 336397215L; +const ISC_LONG isc_dsql_max_group_items = 336397216L; +const ISC_LONG isc_dsql_conflicting_sort_field = 336397217L; +const ISC_LONG isc_dsql_derived_table_more_columns = 336397218L; +const ISC_LONG isc_dsql_derived_table_less_columns = 336397219L; +const ISC_LONG isc_dsql_derived_field_unnamed = 336397220L; +const ISC_LONG isc_dsql_derived_field_dup_name = 336397221L; +const ISC_LONG isc_dsql_derived_alias_select = 336397222L; +const ISC_LONG isc_dsql_derived_alias_field = 336397223L; +const ISC_LONG isc_dsql_auto_field_bad_pos = 336397224L; +const ISC_LONG isc_dsql_cte_wrong_reference = 336397225L; +const ISC_LONG isc_dsql_cte_cycle = 336397226L; +const ISC_LONG isc_dsql_cte_outer_join = 336397227L; +const ISC_LONG isc_dsql_cte_mult_references = 336397228L; +const ISC_LONG isc_dsql_cte_not_a_union = 336397229L; +const ISC_LONG isc_dsql_cte_nonrecurs_after_recurs = 336397230L; +const ISC_LONG isc_dsql_cte_wrong_clause = 336397231L; +const ISC_LONG isc_dsql_cte_union_all = 336397232L; +const ISC_LONG isc_dsql_cte_miss_nonrecursive = 336397233L; +const ISC_LONG isc_dsql_cte_nested_with = 336397234L; +const ISC_LONG isc_dsql_col_more_than_once_using = 336397235L; +const ISC_LONG isc_dsql_unsupp_feature_dialect = 336397236L; +const ISC_LONG isc_gsec_cant_open_db = 336723983L; +const ISC_LONG isc_gsec_switches_error = 336723984L; +const ISC_LONG isc_gsec_no_op_spec = 336723985L; +const ISC_LONG isc_gsec_no_usr_name = 336723986L; +const ISC_LONG isc_gsec_err_add = 336723987L; +const ISC_LONG isc_gsec_err_modify = 336723988L; +const ISC_LONG isc_gsec_err_find_mod = 336723989L; +const ISC_LONG isc_gsec_err_rec_not_found = 336723990L; +const ISC_LONG isc_gsec_err_delete = 336723991L; +const ISC_LONG isc_gsec_err_find_del = 336723992L; +const ISC_LONG isc_gsec_err_find_disp = 336723996L; +const ISC_LONG isc_gsec_inv_param = 336723997L; +const ISC_LONG isc_gsec_op_specified = 336723998L; +const ISC_LONG isc_gsec_pw_specified = 336723999L; +const ISC_LONG isc_gsec_uid_specified = 336724000L; +const ISC_LONG isc_gsec_gid_specified = 336724001L; +const ISC_LONG isc_gsec_proj_specified = 336724002L; +const ISC_LONG isc_gsec_org_specified = 336724003L; +const ISC_LONG isc_gsec_fname_specified = 336724004L; +const ISC_LONG isc_gsec_mname_specified = 336724005L; +const ISC_LONG isc_gsec_lname_specified = 336724006L; +const ISC_LONG isc_gsec_inv_switch = 336724008L; +const ISC_LONG isc_gsec_amb_switch = 336724009L; +const ISC_LONG isc_gsec_no_op_specified = 336724010L; +const ISC_LONG isc_gsec_params_not_allowed = 336724011L; +const ISC_LONG isc_gsec_incompat_switch = 336724012L; +const ISC_LONG isc_gsec_inv_username = 336724044L; +const ISC_LONG isc_gsec_inv_pw_length = 336724045L; +const ISC_LONG isc_gsec_db_specified = 336724046L; +const ISC_LONG isc_gsec_db_admin_specified = 336724047L; +const ISC_LONG isc_gsec_db_admin_pw_specified = 336724048L; +const ISC_LONG isc_gsec_sql_role_specified = 336724049L; +const ISC_LONG isc_license_no_file = 336789504L; +const ISC_LONG isc_license_op_specified = 336789523L; +const ISC_LONG isc_license_op_missing = 336789524L; +const ISC_LONG isc_license_inv_switch = 336789525L; +const ISC_LONG isc_license_inv_switch_combo = 336789526L; +const ISC_LONG isc_license_inv_op_combo = 336789527L; +const ISC_LONG isc_license_amb_switch = 336789528L; +const ISC_LONG isc_license_inv_parameter = 336789529L; +const ISC_LONG isc_license_param_specified = 336789530L; +const ISC_LONG isc_license_param_req = 336789531L; +const ISC_LONG isc_license_syntx_error = 336789532L; +const ISC_LONG isc_license_dup_id = 336789534L; +const ISC_LONG isc_license_inv_id_key = 336789535L; +const ISC_LONG isc_license_err_remove = 336789536L; +const ISC_LONG isc_license_err_update = 336789537L; +const ISC_LONG isc_license_err_convert = 336789538L; +const ISC_LONG isc_license_err_unk = 336789539L; +const ISC_LONG isc_license_svc_err_add = 336789540L; +const ISC_LONG isc_license_svc_err_remove = 336789541L; +const ISC_LONG isc_license_eval_exists = 336789563L; +const ISC_LONG isc_gstat_unknown_switch = 336920577L; +const ISC_LONG isc_gstat_retry = 336920578L; +const ISC_LONG isc_gstat_wrong_ods = 336920579L; +const ISC_LONG isc_gstat_unexpected_eof = 336920580L; +const ISC_LONG isc_gstat_open_err = 336920605L; +const ISC_LONG isc_gstat_read_err = 336920606L; +const ISC_LONG isc_gstat_sysmemex = 336920607L; +const ISC_LONG isc_fbsvcmgr_bad_am = 336986113L; +const ISC_LONG isc_fbsvcmgr_bad_wm = 336986114L; +const ISC_LONG isc_fbsvcmgr_bad_rs = 336986115L; +const ISC_LONG isc_fbsvcmgr_info_err = 336986116L; +const ISC_LONG isc_fbsvcmgr_query_err = 336986117L; +const ISC_LONG isc_fbsvcmgr_switch_unknown = 336986118L; +const ISC_LONG isc_err_max = 826; + +#else /* c definitions */ + +#define isc_facility 20 +#define isc_base 335544320L +#define isc_factor 1 + +#define isc_arg_end 0 /* end of argument list */ +#define isc_arg_gds 1 /* generic DSRI status value */ +#define isc_arg_string 2 /* string argument */ +#define isc_arg_cstring 3 /* count & string argument */ +#define isc_arg_number 4 /* numeric argument (long) */ +#define isc_arg_interpreted 5 /* interpreted status code (string) */ +#define isc_arg_vms 6 /* VAX/VMS status code (long) */ +#define isc_arg_unix 7 /* UNIX error code */ +#define isc_arg_domain 8 /* Apollo/Domain error code */ +#define isc_arg_dos 9 /* MSDOS/OS2 error code */ +#define isc_arg_mpexl 10 /* HP MPE/XL error code */ +#define isc_arg_mpexl_ipc 11 /* HP MPE/XL IPC error code */ +#define isc_arg_next_mach 15 /* NeXT/Mach error code */ +#define isc_arg_netware 16 /* NetWare error code */ +#define isc_arg_win32 17 /* Win32 error code */ +#define isc_arg_warning 18 /* warning argument */ + +#define isc_arith_except 335544321L +#define isc_bad_dbkey 335544322L +#define isc_bad_db_format 335544323L +#define isc_bad_db_handle 335544324L +#define isc_bad_dpb_content 335544325L +#define isc_bad_dpb_form 335544326L +#define isc_bad_req_handle 335544327L +#define isc_bad_segstr_handle 335544328L +#define isc_bad_segstr_id 335544329L +#define isc_bad_tpb_content 335544330L +#define isc_bad_tpb_form 335544331L +#define isc_bad_trans_handle 335544332L +#define isc_bug_check 335544333L +#define isc_convert_error 335544334L +#define isc_db_corrupt 335544335L +#define isc_deadlock 335544336L +#define isc_excess_trans 335544337L +#define isc_from_no_match 335544338L +#define isc_infinap 335544339L +#define isc_infona 335544340L +#define isc_infunk 335544341L +#define isc_integ_fail 335544342L +#define isc_invalid_blr 335544343L +#define isc_io_error 335544344L +#define isc_lock_conflict 335544345L +#define isc_metadata_corrupt 335544346L +#define isc_not_valid 335544347L +#define isc_no_cur_rec 335544348L +#define isc_no_dup 335544349L +#define isc_no_finish 335544350L +#define isc_no_meta_update 335544351L +#define isc_no_priv 335544352L +#define isc_no_recon 335544353L +#define isc_no_record 335544354L +#define isc_no_segstr_close 335544355L +#define isc_obsolete_metadata 335544356L +#define isc_open_trans 335544357L +#define isc_port_len 335544358L +#define isc_read_only_field 335544359L +#define isc_read_only_rel 335544360L +#define isc_read_only_trans 335544361L +#define isc_read_only_view 335544362L +#define isc_req_no_trans 335544363L +#define isc_req_sync 335544364L +#define isc_req_wrong_db 335544365L +#define isc_segment 335544366L +#define isc_segstr_eof 335544367L +#define isc_segstr_no_op 335544368L +#define isc_segstr_no_read 335544369L +#define isc_segstr_no_trans 335544370L +#define isc_segstr_no_write 335544371L +#define isc_segstr_wrong_db 335544372L +#define isc_sys_request 335544373L +#define isc_stream_eof 335544374L +#define isc_unavailable 335544375L +#define isc_unres_rel 335544376L +#define isc_uns_ext 335544377L +#define isc_wish_list 335544378L +#define isc_wrong_ods 335544379L +#define isc_wronumarg 335544380L +#define isc_imp_exc 335544381L +#define isc_random 335544382L +#define isc_fatal_conflict 335544383L +#define isc_badblk 335544384L +#define isc_invpoolcl 335544385L +#define isc_nopoolids 335544386L +#define isc_relbadblk 335544387L +#define isc_blktoobig 335544388L +#define isc_bufexh 335544389L +#define isc_syntaxerr 335544390L +#define isc_bufinuse 335544391L +#define isc_bdbincon 335544392L +#define isc_reqinuse 335544393L +#define isc_badodsver 335544394L +#define isc_relnotdef 335544395L +#define isc_fldnotdef 335544396L +#define isc_dirtypage 335544397L +#define isc_waifortra 335544398L +#define isc_doubleloc 335544399L +#define isc_nodnotfnd 335544400L +#define isc_dupnodfnd 335544401L +#define isc_locnotmar 335544402L +#define isc_badpagtyp 335544403L +#define isc_corrupt 335544404L +#define isc_badpage 335544405L +#define isc_badindex 335544406L +#define isc_dbbnotzer 335544407L +#define isc_tranotzer 335544408L +#define isc_trareqmis 335544409L +#define isc_badhndcnt 335544410L +#define isc_wrotpbver 335544411L +#define isc_wroblrver 335544412L +#define isc_wrodpbver 335544413L +#define isc_blobnotsup 335544414L +#define isc_badrelation 335544415L +#define isc_nodetach 335544416L +#define isc_notremote 335544417L +#define isc_trainlim 335544418L +#define isc_notinlim 335544419L +#define isc_traoutsta 335544420L +#define isc_connect_reject 335544421L +#define isc_dbfile 335544422L +#define isc_orphan 335544423L +#define isc_no_lock_mgr 335544424L +#define isc_ctxinuse 335544425L +#define isc_ctxnotdef 335544426L +#define isc_datnotsup 335544427L +#define isc_badmsgnum 335544428L +#define isc_badparnum 335544429L +#define isc_virmemexh 335544430L +#define isc_blocking_signal 335544431L +#define isc_lockmanerr 335544432L +#define isc_journerr 335544433L +#define isc_keytoobig 335544434L +#define isc_nullsegkey 335544435L +#define isc_sqlerr 335544436L +#define isc_wrodynver 335544437L +#define isc_funnotdef 335544438L +#define isc_funmismat 335544439L +#define isc_bad_msg_vec 335544440L +#define isc_bad_detach 335544441L +#define isc_noargacc_read 335544442L +#define isc_noargacc_write 335544443L +#define isc_read_only 335544444L +#define isc_ext_err 335544445L +#define isc_non_updatable 335544446L +#define isc_no_rollback 335544447L +#define isc_bad_sec_info 335544448L +#define isc_invalid_sec_info 335544449L +#define isc_misc_interpreted 335544450L +#define isc_update_conflict 335544451L +#define isc_unlicensed 335544452L +#define isc_obj_in_use 335544453L +#define isc_nofilter 335544454L +#define isc_shadow_accessed 335544455L +#define isc_invalid_sdl 335544456L +#define isc_out_of_bounds 335544457L +#define isc_invalid_dimension 335544458L +#define isc_rec_in_limbo 335544459L +#define isc_shadow_missing 335544460L +#define isc_cant_validate 335544461L +#define isc_cant_start_journal 335544462L +#define isc_gennotdef 335544463L +#define isc_cant_start_logging 335544464L +#define isc_bad_segstr_type 335544465L +#define isc_foreign_key 335544466L +#define isc_high_minor 335544467L +#define isc_tra_state 335544468L +#define isc_trans_invalid 335544469L +#define isc_buf_invalid 335544470L +#define isc_indexnotdefined 335544471L +#define isc_login 335544472L +#define isc_invalid_bookmark 335544473L +#define isc_bad_lock_level 335544474L +#define isc_relation_lock 335544475L +#define isc_record_lock 335544476L +#define isc_max_idx 335544477L +#define isc_jrn_enable 335544478L +#define isc_old_failure 335544479L +#define isc_old_in_progress 335544480L +#define isc_old_no_space 335544481L +#define isc_no_wal_no_jrn 335544482L +#define isc_num_old_files 335544483L +#define isc_wal_file_open 335544484L +#define isc_bad_stmt_handle 335544485L +#define isc_wal_failure 335544486L +#define isc_walw_err 335544487L +#define isc_logh_small 335544488L +#define isc_logh_inv_version 335544489L +#define isc_logh_open_flag 335544490L +#define isc_logh_open_flag2 335544491L +#define isc_logh_diff_dbname 335544492L +#define isc_logf_unexpected_eof 335544493L +#define isc_logr_incomplete 335544494L +#define isc_logr_header_small 335544495L +#define isc_logb_small 335544496L +#define isc_wal_illegal_attach 335544497L +#define isc_wal_invalid_wpb 335544498L +#define isc_wal_err_rollover 335544499L +#define isc_no_wal 335544500L +#define isc_drop_wal 335544501L +#define isc_stream_not_defined 335544502L +#define isc_wal_subsys_error 335544503L +#define isc_wal_subsys_corrupt 335544504L +#define isc_no_archive 335544505L +#define isc_shutinprog 335544506L +#define isc_range_in_use 335544507L +#define isc_range_not_found 335544508L +#define isc_charset_not_found 335544509L +#define isc_lock_timeout 335544510L +#define isc_prcnotdef 335544511L +#define isc_prcmismat 335544512L +#define isc_wal_bugcheck 335544513L +#define isc_wal_cant_expand 335544514L +#define isc_codnotdef 335544515L +#define isc_xcpnotdef 335544516L +#define isc_except 335544517L +#define isc_cache_restart 335544518L +#define isc_bad_lock_handle 335544519L +#define isc_jrn_present 335544520L +#define isc_wal_err_rollover2 335544521L +#define isc_wal_err_logwrite 335544522L +#define isc_wal_err_jrn_comm 335544523L +#define isc_wal_err_expansion 335544524L +#define isc_wal_err_setup 335544525L +#define isc_wal_err_ww_sync 335544526L +#define isc_wal_err_ww_start 335544527L +#define isc_shutdown 335544528L +#define isc_existing_priv_mod 335544529L +#define isc_primary_key_ref 335544530L +#define isc_primary_key_notnull 335544531L +#define isc_ref_cnstrnt_notfound 335544532L +#define isc_foreign_key_notfound 335544533L +#define isc_ref_cnstrnt_update 335544534L +#define isc_check_cnstrnt_update 335544535L +#define isc_check_cnstrnt_del 335544536L +#define isc_integ_index_seg_del 335544537L +#define isc_integ_index_seg_mod 335544538L +#define isc_integ_index_del 335544539L +#define isc_integ_index_mod 335544540L +#define isc_check_trig_del 335544541L +#define isc_check_trig_update 335544542L +#define isc_cnstrnt_fld_del 335544543L +#define isc_cnstrnt_fld_rename 335544544L +#define isc_rel_cnstrnt_update 335544545L +#define isc_constaint_on_view 335544546L +#define isc_invld_cnstrnt_type 335544547L +#define isc_primary_key_exists 335544548L +#define isc_systrig_update 335544549L +#define isc_not_rel_owner 335544550L +#define isc_grant_obj_notfound 335544551L +#define isc_grant_fld_notfound 335544552L +#define isc_grant_nopriv 335544553L +#define isc_nonsql_security_rel 335544554L +#define isc_nonsql_security_fld 335544555L +#define isc_wal_cache_err 335544556L +#define isc_shutfail 335544557L +#define isc_check_constraint 335544558L +#define isc_bad_svc_handle 335544559L +#define isc_shutwarn 335544560L +#define isc_wrospbver 335544561L +#define isc_bad_spb_form 335544562L +#define isc_svcnotdef 335544563L +#define isc_no_jrn 335544564L +#define isc_transliteration_failed 335544565L +#define isc_start_cm_for_wal 335544566L +#define isc_wal_ovflow_log_required 335544567L +#define isc_text_subtype 335544568L +#define isc_dsql_error 335544569L +#define isc_dsql_command_err 335544570L +#define isc_dsql_constant_err 335544571L +#define isc_dsql_cursor_err 335544572L +#define isc_dsql_datatype_err 335544573L +#define isc_dsql_decl_err 335544574L +#define isc_dsql_cursor_update_err 335544575L +#define isc_dsql_cursor_open_err 335544576L +#define isc_dsql_cursor_close_err 335544577L +#define isc_dsql_field_err 335544578L +#define isc_dsql_internal_err 335544579L +#define isc_dsql_relation_err 335544580L +#define isc_dsql_procedure_err 335544581L +#define isc_dsql_request_err 335544582L +#define isc_dsql_sqlda_err 335544583L +#define isc_dsql_var_count_err 335544584L +#define isc_dsql_stmt_handle 335544585L +#define isc_dsql_function_err 335544586L +#define isc_dsql_blob_err 335544587L +#define isc_collation_not_found 335544588L +#define isc_collation_not_for_charset 335544589L +#define isc_dsql_dup_option 335544590L +#define isc_dsql_tran_err 335544591L +#define isc_dsql_invalid_array 335544592L +#define isc_dsql_max_arr_dim_exceeded 335544593L +#define isc_dsql_arr_range_error 335544594L +#define isc_dsql_trigger_err 335544595L +#define isc_dsql_subselect_err 335544596L +#define isc_dsql_crdb_prepare_err 335544597L +#define isc_specify_field_err 335544598L +#define isc_num_field_err 335544599L +#define isc_col_name_err 335544600L +#define isc_where_err 335544601L +#define isc_table_view_err 335544602L +#define isc_distinct_err 335544603L +#define isc_key_field_count_err 335544604L +#define isc_subquery_err 335544605L +#define isc_expression_eval_err 335544606L +#define isc_node_err 335544607L +#define isc_command_end_err 335544608L +#define isc_index_name 335544609L +#define isc_exception_name 335544610L +#define isc_field_name 335544611L +#define isc_token_err 335544612L +#define isc_union_err 335544613L +#define isc_dsql_construct_err 335544614L +#define isc_field_aggregate_err 335544615L +#define isc_field_ref_err 335544616L +#define isc_order_by_err 335544617L +#define isc_return_mode_err 335544618L +#define isc_extern_func_err 335544619L +#define isc_alias_conflict_err 335544620L +#define isc_procedure_conflict_error 335544621L +#define isc_relation_conflict_err 335544622L +#define isc_dsql_domain_err 335544623L +#define isc_idx_seg_err 335544624L +#define isc_node_name_err 335544625L +#define isc_table_name 335544626L +#define isc_proc_name 335544627L +#define isc_idx_create_err 335544628L +#define isc_wal_shadow_err 335544629L +#define isc_dependency 335544630L +#define isc_idx_key_err 335544631L +#define isc_dsql_file_length_err 335544632L +#define isc_dsql_shadow_number_err 335544633L +#define isc_dsql_token_unk_err 335544634L +#define isc_dsql_no_relation_alias 335544635L +#define isc_indexname 335544636L +#define isc_no_stream_plan 335544637L +#define isc_stream_twice 335544638L +#define isc_stream_not_found 335544639L +#define isc_collation_requires_text 335544640L +#define isc_dsql_domain_not_found 335544641L +#define isc_index_unused 335544642L +#define isc_dsql_self_join 335544643L +#define isc_stream_bof 335544644L +#define isc_stream_crack 335544645L +#define isc_db_or_file_exists 335544646L +#define isc_invalid_operator 335544647L +#define isc_conn_lost 335544648L +#define isc_bad_checksum 335544649L +#define isc_page_type_err 335544650L +#define isc_ext_readonly_err 335544651L +#define isc_sing_select_err 335544652L +#define isc_psw_attach 335544653L +#define isc_psw_start_trans 335544654L +#define isc_invalid_direction 335544655L +#define isc_dsql_var_conflict 335544656L +#define isc_dsql_no_blob_array 335544657L +#define isc_dsql_base_table 335544658L +#define isc_duplicate_base_table 335544659L +#define isc_view_alias 335544660L +#define isc_index_root_page_full 335544661L +#define isc_dsql_blob_type_unknown 335544662L +#define isc_req_max_clones_exceeded 335544663L +#define isc_dsql_duplicate_spec 335544664L +#define isc_unique_key_violation 335544665L +#define isc_srvr_version_too_old 335544666L +#define isc_drdb_completed_with_errs 335544667L +#define isc_dsql_procedure_use_err 335544668L +#define isc_dsql_count_mismatch 335544669L +#define isc_blob_idx_err 335544670L +#define isc_array_idx_err 335544671L +#define isc_key_field_err 335544672L +#define isc_no_delete 335544673L +#define isc_del_last_field 335544674L +#define isc_sort_err 335544675L +#define isc_sort_mem_err 335544676L +#define isc_version_err 335544677L +#define isc_inval_key_posn 335544678L +#define isc_no_segments_err 335544679L +#define isc_crrp_data_err 335544680L +#define isc_rec_size_err 335544681L +#define isc_dsql_field_ref 335544682L +#define isc_req_depth_exceeded 335544683L +#define isc_no_field_access 335544684L +#define isc_no_dbkey 335544685L +#define isc_jrn_format_err 335544686L +#define isc_jrn_file_full 335544687L +#define isc_dsql_open_cursor_request 335544688L +#define isc_ib_error 335544689L +#define isc_cache_redef 335544690L +#define isc_cache_too_small 335544691L +#define isc_log_redef 335544692L +#define isc_log_too_small 335544693L +#define isc_partition_too_small 335544694L +#define isc_partition_not_supp 335544695L +#define isc_log_length_spec 335544696L +#define isc_precision_err 335544697L +#define isc_scale_nogt 335544698L +#define isc_expec_short 335544699L +#define isc_expec_long 335544700L +#define isc_expec_ushort 335544701L +#define isc_like_escape_invalid 335544702L +#define isc_svcnoexe 335544703L +#define isc_net_lookup_err 335544704L +#define isc_service_unknown 335544705L +#define isc_host_unknown 335544706L +#define isc_grant_nopriv_on_base 335544707L +#define isc_dyn_fld_ambiguous 335544708L +#define isc_dsql_agg_ref_err 335544709L +#define isc_complex_view 335544710L +#define isc_unprepared_stmt 335544711L +#define isc_expec_positive 335544712L +#define isc_dsql_sqlda_value_err 335544713L +#define isc_invalid_array_id 335544714L +#define isc_extfile_uns_op 335544715L +#define isc_svc_in_use 335544716L +#define isc_err_stack_limit 335544717L +#define isc_invalid_key 335544718L +#define isc_net_init_error 335544719L +#define isc_loadlib_failure 335544720L +#define isc_network_error 335544721L +#define isc_net_connect_err 335544722L +#define isc_net_connect_listen_err 335544723L +#define isc_net_event_connect_err 335544724L +#define isc_net_event_listen_err 335544725L +#define isc_net_read_err 335544726L +#define isc_net_write_err 335544727L +#define isc_integ_index_deactivate 335544728L +#define isc_integ_deactivate_primary 335544729L +#define isc_cse_not_supported 335544730L +#define isc_tra_must_sweep 335544731L +#define isc_unsupported_network_drive 335544732L +#define isc_io_create_err 335544733L +#define isc_io_open_err 335544734L +#define isc_io_close_err 335544735L +#define isc_io_read_err 335544736L +#define isc_io_write_err 335544737L +#define isc_io_delete_err 335544738L +#define isc_io_access_err 335544739L +#define isc_udf_exception 335544740L +#define isc_lost_db_connection 335544741L +#define isc_no_write_user_priv 335544742L +#define isc_token_too_long 335544743L +#define isc_max_att_exceeded 335544744L +#define isc_login_same_as_role_name 335544745L +#define isc_reftable_requires_pk 335544746L +#define isc_usrname_too_long 335544747L +#define isc_password_too_long 335544748L +#define isc_usrname_required 335544749L +#define isc_password_required 335544750L +#define isc_bad_protocol 335544751L +#define isc_dup_usrname_found 335544752L +#define isc_usrname_not_found 335544753L +#define isc_error_adding_sec_record 335544754L +#define isc_error_modifying_sec_record 335544755L +#define isc_error_deleting_sec_record 335544756L +#define isc_error_updating_sec_db 335544757L +#define isc_sort_rec_size_err 335544758L +#define isc_bad_default_value 335544759L +#define isc_invalid_clause 335544760L +#define isc_too_many_handles 335544761L +#define isc_optimizer_blk_exc 335544762L +#define isc_invalid_string_constant 335544763L +#define isc_transitional_date 335544764L +#define isc_read_only_database 335544765L +#define isc_must_be_dialect_2_and_up 335544766L +#define isc_blob_filter_exception 335544767L +#define isc_exception_access_violation 335544768L +#define isc_exception_datatype_missalignment 335544769L +#define isc_exception_array_bounds_exceeded 335544770L +#define isc_exception_float_denormal_operand 335544771L +#define isc_exception_float_divide_by_zero 335544772L +#define isc_exception_float_inexact_result 335544773L +#define isc_exception_float_invalid_operand 335544774L +#define isc_exception_float_overflow 335544775L +#define isc_exception_float_stack_check 335544776L +#define isc_exception_float_underflow 335544777L +#define isc_exception_integer_divide_by_zero 335544778L +#define isc_exception_integer_overflow 335544779L +#define isc_exception_unknown 335544780L +#define isc_exception_stack_overflow 335544781L +#define isc_exception_sigsegv 335544782L +#define isc_exception_sigill 335544783L +#define isc_exception_sigbus 335544784L +#define isc_exception_sigfpe 335544785L +#define isc_ext_file_delete 335544786L +#define isc_ext_file_modify 335544787L +#define isc_adm_task_denied 335544788L +#define isc_extract_input_mismatch 335544789L +#define isc_insufficient_svc_privileges 335544790L +#define isc_file_in_use 335544791L +#define isc_service_att_err 335544792L +#define isc_ddl_not_allowed_by_db_sql_dial 335544793L +#define isc_cancelled 335544794L +#define isc_unexp_spb_form 335544795L +#define isc_sql_dialect_datatype_unsupport 335544796L +#define isc_svcnouser 335544797L +#define isc_depend_on_uncommitted_rel 335544798L +#define isc_svc_name_missing 335544799L +#define isc_too_many_contexts 335544800L +#define isc_datype_notsup 335544801L +#define isc_dialect_reset_warning 335544802L +#define isc_dialect_not_changed 335544803L +#define isc_database_create_failed 335544804L +#define isc_inv_dialect_specified 335544805L +#define isc_valid_db_dialects 335544806L +#define isc_sqlwarn 335544807L +#define isc_dtype_renamed 335544808L +#define isc_extern_func_dir_error 335544809L +#define isc_date_range_exceeded 335544810L +#define isc_inv_client_dialect_specified 335544811L +#define isc_valid_client_dialects 335544812L +#define isc_optimizer_between_err 335544813L +#define isc_service_not_supported 335544814L +#define isc_generator_name 335544815L +#define isc_udf_name 335544816L +#define isc_bad_limit_param 335544817L +#define isc_bad_skip_param 335544818L +#define isc_io_32bit_exceeded_err 335544819L +#define isc_invalid_savepoint 335544820L +#define isc_dsql_column_pos_err 335544821L +#define isc_dsql_agg_where_err 335544822L +#define isc_dsql_agg_group_err 335544823L +#define isc_dsql_agg_column_err 335544824L +#define isc_dsql_agg_having_err 335544825L +#define isc_dsql_agg_nested_err 335544826L +#define isc_exec_sql_invalid_arg 335544827L +#define isc_exec_sql_invalid_req 335544828L +#define isc_exec_sql_invalid_var 335544829L +#define isc_exec_sql_max_call_exceeded 335544830L +#define isc_conf_access_denied 335544831L +#define isc_wrong_backup_state 335544832L +#define isc_wal_backup_err 335544833L +#define isc_cursor_not_open 335544834L +#define isc_bad_shutdown_mode 335544835L +#define isc_concat_overflow 335544836L +#define isc_bad_substring_offset 335544837L +#define isc_foreign_key_target_doesnt_exist 335544838L +#define isc_foreign_key_references_present 335544839L +#define isc_no_update 335544840L +#define isc_cursor_already_open 335544841L +#define isc_stack_trace 335544842L +#define isc_ctx_var_not_found 335544843L +#define isc_ctx_namespace_invalid 335544844L +#define isc_ctx_too_big 335544845L +#define isc_ctx_bad_argument 335544846L +#define isc_identifier_too_long 335544847L +#define isc_except2 335544848L +#define isc_malformed_string 335544849L +#define isc_prc_out_param_mismatch 335544850L +#define isc_command_end_err2 335544851L +#define isc_partner_idx_incompat_type 335544852L +#define isc_bad_substring_length 335544853L +#define isc_charset_not_installed 335544854L +#define isc_collation_not_installed 335544855L +#define isc_att_shutdown 335544856L +#define isc_blobtoobig 335544857L +#define isc_must_have_phys_field 335544858L +#define isc_invalid_time_precision 335544859L +#define isc_blob_convert_error 335544860L +#define isc_array_convert_error 335544861L +#define isc_record_lock_not_supp 335544862L +#define isc_partner_idx_not_found 335544863L +#define isc_tra_num_exc 335544864L +#define isc_field_disappeared 335544865L +#define isc_met_wrong_gtt_scope 335544866L +#define isc_subtype_for_internal_use 335544867L +#define isc_illegal_prc_type 335544868L +#define isc_invalid_sort_datatype 335544869L +#define isc_collation_name 335544870L +#define isc_domain_name 335544871L +#define isc_domnotdef 335544872L +#define isc_array_max_dimensions 335544873L +#define isc_max_db_per_trans_allowed 335544874L +#define isc_bad_debug_format 335544875L +#define isc_bad_proc_BLR 335544876L +#define isc_key_too_big 335544877L +#define isc_concurrent_transaction 335544878L +#define isc_not_valid_for_var 335544879L +#define isc_not_valid_for 335544880L +#define isc_need_difference 335544881L +#define isc_long_login 335544882L +#define isc_fldnotdef2 335544883L +#define isc_gfix_db_name 335740929L +#define isc_gfix_invalid_sw 335740930L +#define isc_gfix_incmp_sw 335740932L +#define isc_gfix_replay_req 335740933L +#define isc_gfix_pgbuf_req 335740934L +#define isc_gfix_val_req 335740935L +#define isc_gfix_pval_req 335740936L +#define isc_gfix_trn_req 335740937L +#define isc_gfix_full_req 335740940L +#define isc_gfix_usrname_req 335740941L +#define isc_gfix_pass_req 335740942L +#define isc_gfix_subs_name 335740943L +#define isc_gfix_wal_req 335740944L +#define isc_gfix_sec_req 335740945L +#define isc_gfix_nval_req 335740946L +#define isc_gfix_type_shut 335740947L +#define isc_gfix_retry 335740948L +#define isc_gfix_retry_db 335740951L +#define isc_gfix_exceed_max 335740991L +#define isc_gfix_corrupt_pool 335740992L +#define isc_gfix_mem_exhausted 335740993L +#define isc_gfix_bad_pool 335740994L +#define isc_gfix_trn_not_valid 335740995L +#define isc_gfix_unexp_eoi 335741012L +#define isc_gfix_recon_fail 335741018L +#define isc_gfix_trn_unknown 335741036L +#define isc_gfix_mode_req 335741038L +#define isc_gfix_opt_SQL_dialect 335741039L +#define isc_gfix_pzval_req 335741042L +#define isc_dsql_dbkey_from_non_table 336003074L +#define isc_dsql_transitional_numeric 336003075L +#define isc_dsql_dialect_warning_expr 336003076L +#define isc_sql_db_dialect_dtype_unsupport 336003077L +#define isc_isc_sql_dialect_conflict_num 336003079L +#define isc_dsql_warning_number_ambiguous 336003080L +#define isc_dsql_warning_number_ambiguous1 336003081L +#define isc_dsql_warn_precision_ambiguous 336003082L +#define isc_dsql_warn_precision_ambiguous1 336003083L +#define isc_dsql_warn_precision_ambiguous2 336003084L +#define isc_dsql_ambiguous_field_name 336003085L +#define isc_dsql_udf_return_pos_err 336003086L +#define isc_dsql_invalid_label 336003087L +#define isc_dsql_datatypes_not_comparable 336003088L +#define isc_dsql_cursor_invalid 336003089L +#define isc_dsql_cursor_redefined 336003090L +#define isc_dsql_cursor_not_found 336003091L +#define isc_dsql_cursor_exists 336003092L +#define isc_dsql_cursor_rel_ambiguous 336003093L +#define isc_dsql_cursor_rel_not_found 336003094L +#define isc_dsql_cursor_not_open 336003095L +#define isc_dsql_type_not_supp_ext_tab 336003096L +#define isc_dsql_feature_not_supported_ods 336003097L +#define isc_primary_key_required 336003098L +#define isc_upd_ins_doesnt_match_pk 336003099L +#define isc_upd_ins_doesnt_match_matching 336003100L +#define isc_upd_ins_with_complex_view 336003101L +#define isc_dsql_incompatible_trigger_type 336003102L +#define isc_dsql_db_trigger_type_cant_change 336003103L +#define isc_dyn_role_does_not_exist 336068796L +#define isc_dyn_no_grant_admin_opt 336068797L +#define isc_dyn_user_not_role_member 336068798L +#define isc_dyn_delete_role_failed 336068799L +#define isc_dyn_grant_role_to_user 336068800L +#define isc_dyn_inv_sql_role_name 336068801L +#define isc_dyn_dup_sql_role 336068802L +#define isc_dyn_kywd_spec_for_role 336068803L +#define isc_dyn_roles_not_supported 336068804L +#define isc_dyn_domain_name_exists 336068812L +#define isc_dyn_field_name_exists 336068813L +#define isc_dyn_dependency_exists 336068814L +#define isc_dyn_dtype_invalid 336068815L +#define isc_dyn_char_fld_too_small 336068816L +#define isc_dyn_invalid_dtype_conversion 336068817L +#define isc_dyn_dtype_conv_invalid 336068818L +#define isc_dyn_zero_len_id 336068820L +#define isc_max_coll_per_charset 336068829L +#define isc_invalid_coll_attr 336068830L +#define isc_dyn_wrong_gtt_scope 336068840L +#define isc_dyn_scale_too_big 336068852L +#define isc_dyn_precision_too_small 336068853L +#define isc_dyn_miss_priv_warning 336068855L +#define isc_dyn_ods_not_supp_feature 336068856L +#define isc_gbak_unknown_switch 336330753L +#define isc_gbak_page_size_missing 336330754L +#define isc_gbak_page_size_toobig 336330755L +#define isc_gbak_redir_ouput_missing 336330756L +#define isc_gbak_switches_conflict 336330757L +#define isc_gbak_unknown_device 336330758L +#define isc_gbak_no_protection 336330759L +#define isc_gbak_page_size_not_allowed 336330760L +#define isc_gbak_multi_source_dest 336330761L +#define isc_gbak_filename_missing 336330762L +#define isc_gbak_dup_inout_names 336330763L +#define isc_gbak_inv_page_size 336330764L +#define isc_gbak_db_specified 336330765L +#define isc_gbak_db_exists 336330766L +#define isc_gbak_unk_device 336330767L +#define isc_gbak_blob_info_failed 336330772L +#define isc_gbak_unk_blob_item 336330773L +#define isc_gbak_get_seg_failed 336330774L +#define isc_gbak_close_blob_failed 336330775L +#define isc_gbak_open_blob_failed 336330776L +#define isc_gbak_put_blr_gen_id_failed 336330777L +#define isc_gbak_unk_type 336330778L +#define isc_gbak_comp_req_failed 336330779L +#define isc_gbak_start_req_failed 336330780L +#define isc_gbak_rec_failed 336330781L +#define isc_gbak_rel_req_failed 336330782L +#define isc_gbak_db_info_failed 336330783L +#define isc_gbak_no_db_desc 336330784L +#define isc_gbak_db_create_failed 336330785L +#define isc_gbak_decomp_len_error 336330786L +#define isc_gbak_tbl_missing 336330787L +#define isc_gbak_blob_col_missing 336330788L +#define isc_gbak_create_blob_failed 336330789L +#define isc_gbak_put_seg_failed 336330790L +#define isc_gbak_rec_len_exp 336330791L +#define isc_gbak_inv_rec_len 336330792L +#define isc_gbak_exp_data_type 336330793L +#define isc_gbak_gen_id_failed 336330794L +#define isc_gbak_unk_rec_type 336330795L +#define isc_gbak_inv_bkup_ver 336330796L +#define isc_gbak_missing_bkup_desc 336330797L +#define isc_gbak_string_trunc 336330798L +#define isc_gbak_cant_rest_record 336330799L +#define isc_gbak_send_failed 336330800L +#define isc_gbak_no_tbl_name 336330801L +#define isc_gbak_unexp_eof 336330802L +#define isc_gbak_db_format_too_old 336330803L +#define isc_gbak_inv_array_dim 336330804L +#define isc_gbak_xdr_len_expected 336330807L +#define isc_gbak_open_bkup_error 336330817L +#define isc_gbak_open_error 336330818L +#define isc_gbak_missing_block_fac 336330934L +#define isc_gbak_inv_block_fac 336330935L +#define isc_gbak_block_fac_specified 336330936L +#define isc_gbak_missing_username 336330940L +#define isc_gbak_missing_password 336330941L +#define isc_gbak_missing_skipped_bytes 336330952L +#define isc_gbak_inv_skipped_bytes 336330953L +#define isc_gbak_err_restore_charset 336330965L +#define isc_gbak_err_restore_collation 336330967L +#define isc_gbak_read_error 336330972L +#define isc_gbak_write_error 336330973L +#define isc_gbak_db_in_use 336330985L +#define isc_gbak_sysmemex 336330990L +#define isc_gbak_restore_role_failed 336331002L +#define isc_gbak_role_op_missing 336331005L +#define isc_gbak_page_buffers_missing 336331010L +#define isc_gbak_page_buffers_wrong_param 336331011L +#define isc_gbak_page_buffers_restore 336331012L +#define isc_gbak_inv_size 336331014L +#define isc_gbak_file_outof_sequence 336331015L +#define isc_gbak_join_file_missing 336331016L +#define isc_gbak_stdin_not_supptd 336331017L +#define isc_gbak_stdout_not_supptd 336331018L +#define isc_gbak_bkup_corrupt 336331019L +#define isc_gbak_unk_db_file_spec 336331020L +#define isc_gbak_hdr_write_failed 336331021L +#define isc_gbak_disk_space_ex 336331022L +#define isc_gbak_size_lt_min 336331023L +#define isc_gbak_svc_name_missing 336331025L +#define isc_gbak_not_ownr 336331026L +#define isc_gbak_mode_req 336331031L +#define isc_gbak_just_data 336331033L +#define isc_gbak_data_only 336331034L +#define isc_dsql_too_old_ods 336397205L +#define isc_dsql_table_not_found 336397206L +#define isc_dsql_view_not_found 336397207L +#define isc_dsql_line_col_error 336397208L +#define isc_dsql_unknown_pos 336397209L +#define isc_dsql_no_dup_name 336397210L +#define isc_dsql_too_many_values 336397211L +#define isc_dsql_no_array_computed 336397212L +#define isc_dsql_implicit_domain_name 336397213L +#define isc_dsql_only_can_subscript_array 336397214L +#define isc_dsql_max_sort_items 336397215L +#define isc_dsql_max_group_items 336397216L +#define isc_dsql_conflicting_sort_field 336397217L +#define isc_dsql_derived_table_more_columns 336397218L +#define isc_dsql_derived_table_less_columns 336397219L +#define isc_dsql_derived_field_unnamed 336397220L +#define isc_dsql_derived_field_dup_name 336397221L +#define isc_dsql_derived_alias_select 336397222L +#define isc_dsql_derived_alias_field 336397223L +#define isc_dsql_auto_field_bad_pos 336397224L +#define isc_dsql_cte_wrong_reference 336397225L +#define isc_dsql_cte_cycle 336397226L +#define isc_dsql_cte_outer_join 336397227L +#define isc_dsql_cte_mult_references 336397228L +#define isc_dsql_cte_not_a_union 336397229L +#define isc_dsql_cte_nonrecurs_after_recurs 336397230L +#define isc_dsql_cte_wrong_clause 336397231L +#define isc_dsql_cte_union_all 336397232L +#define isc_dsql_cte_miss_nonrecursive 336397233L +#define isc_dsql_cte_nested_with 336397234L +#define isc_dsql_col_more_than_once_using 336397235L +#define isc_dsql_unsupp_feature_dialect 336397236L +#define isc_gsec_cant_open_db 336723983L +#define isc_gsec_switches_error 336723984L +#define isc_gsec_no_op_spec 336723985L +#define isc_gsec_no_usr_name 336723986L +#define isc_gsec_err_add 336723987L +#define isc_gsec_err_modify 336723988L +#define isc_gsec_err_find_mod 336723989L +#define isc_gsec_err_rec_not_found 336723990L +#define isc_gsec_err_delete 336723991L +#define isc_gsec_err_find_del 336723992L +#define isc_gsec_err_find_disp 336723996L +#define isc_gsec_inv_param 336723997L +#define isc_gsec_op_specified 336723998L +#define isc_gsec_pw_specified 336723999L +#define isc_gsec_uid_specified 336724000L +#define isc_gsec_gid_specified 336724001L +#define isc_gsec_proj_specified 336724002L +#define isc_gsec_org_specified 336724003L +#define isc_gsec_fname_specified 336724004L +#define isc_gsec_mname_specified 336724005L +#define isc_gsec_lname_specified 336724006L +#define isc_gsec_inv_switch 336724008L +#define isc_gsec_amb_switch 336724009L +#define isc_gsec_no_op_specified 336724010L +#define isc_gsec_params_not_allowed 336724011L +#define isc_gsec_incompat_switch 336724012L +#define isc_gsec_inv_username 336724044L +#define isc_gsec_inv_pw_length 336724045L +#define isc_gsec_db_specified 336724046L +#define isc_gsec_db_admin_specified 336724047L +#define isc_gsec_db_admin_pw_specified 336724048L +#define isc_gsec_sql_role_specified 336724049L +#define isc_license_no_file 336789504L +#define isc_license_op_specified 336789523L +#define isc_license_op_missing 336789524L +#define isc_license_inv_switch 336789525L +#define isc_license_inv_switch_combo 336789526L +#define isc_license_inv_op_combo 336789527L +#define isc_license_amb_switch 336789528L +#define isc_license_inv_parameter 336789529L +#define isc_license_param_specified 336789530L +#define isc_license_param_req 336789531L +#define isc_license_syntx_error 336789532L +#define isc_license_dup_id 336789534L +#define isc_license_inv_id_key 336789535L +#define isc_license_err_remove 336789536L +#define isc_license_err_update 336789537L +#define isc_license_err_convert 336789538L +#define isc_license_err_unk 336789539L +#define isc_license_svc_err_add 336789540L +#define isc_license_svc_err_remove 336789541L +#define isc_license_eval_exists 336789563L +#define isc_gstat_unknown_switch 336920577L +#define isc_gstat_retry 336920578L +#define isc_gstat_wrong_ods 336920579L +#define isc_gstat_unexpected_eof 336920580L +#define isc_gstat_open_err 336920605L +#define isc_gstat_read_err 336920606L +#define isc_gstat_sysmemex 336920607L +#define isc_fbsvcmgr_bad_am 336986113L +#define isc_fbsvcmgr_bad_wm 336986114L +#define isc_fbsvcmgr_bad_rs 336986115L +#define isc_fbsvcmgr_info_err 336986116L +#define isc_fbsvcmgr_query_err 336986117L +#define isc_fbsvcmgr_switch_unknown 336986118L +#define isc_err_max 826 + +#endif + +#endif /* JRD_GEN_IBERROR_H */ diff --git a/libraries/SQLAPI/include/infAPI.h b/libraries/SQLAPI/include/infAPI.h new file mode 100644 index 000000000..c288b1e68 --- /dev/null +++ b/libraries/SQLAPI/include/infAPI.h @@ -0,0 +1,432 @@ +// infAPI.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__INFAPI_H__) +#define __INFAPI_H__ + +#include "SQLAPI.h" + +// API header(s) +#include + +extern long g_nInfDLLVersionLoaded; + +extern void AddInfSupport(const SAConnection * pCon); +extern void ReleaseInfSupport(); + +typedef SQLRETURN (SQL_API *SQLAllocConnect_t)(SQLHENV EnvironmentHandle, + SQLHDBC *ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLAllocEnv_t)(SQLHENV *EnvironmentHandle); +typedef SQLRETURN (SQL_API *SQLAllocHandle_t)(SQLSMALLINT HandleType, + SQLHANDLE InputHandle, SQLHANDLE *OutputHandle); +typedef SQLRETURN (SQL_API *SQLAllocStmt_t)(SQLHDBC ConnectionHandle, + SQLHSTMT *StatementHandle); +typedef SQLRETURN (SQL_API *SQLBindCol_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLBindParameter_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN *pcbValue); +typedef SQLRETURN (SQL_API *SQLBrowseConnect_t)( + SQLHDBC hdbc, + SQLTCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLTCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); +typedef SQLRETURN (SQL_API *SQLBulkOperations_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +typedef SQLRETURN (SQL_API *SQLCancel_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLCloseCursor_t)(SQLHSTMT StatementHandle); +#if defined(SA_UNICODE) && (defined(SA_64BIT) || defined(WIN64) || defined(ODBC64)) +typedef SQLRETURN (SQL_API *SQLColAttribute_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLLEN* NumericAttribute); +#else +typedef SQLRETURN (SQL_API *SQLColAttribute_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute); +#endif +typedef SQLRETURN (SQL_API *SQLColAttributes_t)( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); +typedef SQLRETURN (SQL_API *SQLColumnPrivileges_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLTCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLColumns_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLTCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLTCHAR *TableName, SQLSMALLINT NameLength3, + SQLTCHAR *ColumnName, SQLSMALLINT NameLength4); +typedef SQLRETURN (SQL_API *SQLConnect_t)(SQLHDBC ConnectionHandle, + SQLTCHAR *ServerName, SQLSMALLINT NameLength1, + SQLTCHAR *UserName, SQLSMALLINT NameLength2, + SQLTCHAR *Authentication, SQLSMALLINT NameLength3); +typedef SQLRETURN (SQL_API *SQLCopyDesc_t)(SQLHDESC SourceDescHandle, + SQLHDESC TargetDescHandle); +typedef SQLRETURN (SQL_API *SQLDataSources_t)(SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, SQLTCHAR *ServerName, + SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, + SQLTCHAR *Description, SQLSMALLINT BufferLength2, + SQLSMALLINT *NameLength2); +typedef SQLRETURN (SQL_API *SQLDescribeCol_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLTCHAR *ColumnName, + SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, + SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable); +typedef SQLRETURN (SQL_API *SQLDescribeParam_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); +typedef SQLRETURN (SQL_API *SQLDisconnect_t)(SQLHDBC ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLDriverConnect_t)( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLTCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLTCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); +typedef SQLRETURN (SQL_API *SQLDrivers_t)( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLTCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLTCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); +typedef SQLRETURN (SQL_API *SQLEndTran_t)(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT CompletionType); +typedef SQLRETURN (SQL_API *SQLError_t)(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, + SQLTCHAR *Sqlstate, SQLINTEGER *NativeError, + SQLTCHAR *MessageText, SQLSMALLINT BufferLength, + SQLSMALLINT *TextLength); +typedef SQLRETURN (SQL_API *SQLExecDirect_t)(SQLHSTMT StatementHandle, + SQLTCHAR *StatementText, SQLINTEGER TextLength); +typedef SQLRETURN (SQL_API *SQLExecute_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLExtendedFetch_t)( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLINTEGER irow, + SQLUINTEGER *pcrow, + SQLUSMALLINT *rgfRowStatus); +typedef SQLRETURN (SQL_API *SQLFetch_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLFetchScroll_t)(SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, SQLLEN FetchOffset); +typedef SQLRETURN (SQL_API *SQLForeignKeys_t)( + SQLHSTMT hstmt, + SQLTCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLTCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLTCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLTCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLTCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLTCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); +typedef SQLRETURN (SQL_API *SQLFreeConnect_t)(SQLHDBC ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLFreeEnv_t)(SQLHENV EnvironmentHandle); +typedef SQLRETURN (SQL_API *SQLFreeHandle_t)(SQLSMALLINT HandleType, SQLHANDLE Handle); +typedef SQLRETURN (SQL_API *SQLFreeStmt_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT Option); +typedef SQLRETURN (SQL_API *SQLGetConnectAttr_t)(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetConnectOption_t)(SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, SQLPOINTER Value); +typedef SQLRETURN (SQL_API *SQLGetCursorName_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CursorName, SQLSMALLINT BufferLength, + SQLSMALLINT *NameLength); +typedef SQLRETURN (SQL_API *SQLGetData_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLGetDescField_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength, + SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetDescRec_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLTCHAR *Name, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, + SQLSMALLINT *Type, SQLSMALLINT *SubType, + SQLLEN *Length, SQLSMALLINT *Precision, + SQLSMALLINT *Scale, SQLSMALLINT *Nullable); +typedef SQLRETURN (SQL_API *SQLGetDiagRec_t)(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLTCHAR *Sqlstate, + SQLINTEGER *NativeError, SQLTCHAR *MessageText, + SQLSMALLINT BufferLength, SQLSMALLINT *TextLength); +typedef SQLRETURN (SQL_API *SQLGetDiagField_t)(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength); +typedef SQLRETURN (SQL_API *SQLGetEnvAttr_t)(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetFunctions_t)(SQLHDBC ConnectionHandle, + SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported); +typedef SQLRETURN (SQL_API *SQLGetInfo_t)(SQLHDBC ConnectionHandle, + SQLUSMALLINT InfoType, SQLPOINTER InfoValue, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength); +typedef SQLRETURN (SQL_API *SQLGetStmtAttr_t)(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetStmtOption_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT Option, SQLPOINTER Value); +typedef SQLRETURN (SQL_API *SQLGetTypeInfo_t)(SQLHSTMT StatementHandle, + SQLSMALLINT DataType); +typedef SQLRETURN (SQL_API *SQLMoreResults_t)( + SQLHSTMT hstmt); +typedef SQLRETURN (SQL_API *SQLNativeSql_t)( + SQLHDBC hdbc, + SQLTCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLTCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); +typedef SQLRETURN (SQL_API *SQLNumParams_t)( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); +typedef SQLRETURN (SQL_API *SQLNumResultCols_t)(SQLHSTMT StatementHandle, + SQLSMALLINT *ColumnCount); +typedef SQLRETURN (SQL_API *SQLParamData_t)(SQLHSTMT StatementHandle, + SQLPOINTER *Value); +typedef SQLRETURN (SQL_API *SQLParamOptions_t)( + SQLHSTMT hstmt, + SQLULEN crow, + SQLULEN *pirow); +typedef SQLRETURN (SQL_API *SQLPrepare_t)(SQLHSTMT StatementHandle, + SQLTCHAR *StatementText, SQLINTEGER TextLength); +typedef SQLRETURN (SQL_API *SQLPrimaryKeys_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API *SQLProcedureColumns_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLTCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLProcedures_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szProcName, + SQLSMALLINT cbProcName); +typedef SQLRETURN (SQL_API *SQLPutData_t)(SQLHSTMT StatementHandle, + SQLPOINTER Data, SQLLEN StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLRowCount_t)(SQLHSTMT StatementHandle, + SQLLEN *RowCount); +typedef SQLRETURN (SQL_API *SQLSetConnectAttr_t)(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API *SQLSetConnectOption_t)(SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, SQLULEN Value); +typedef SQLRETURN (SQL_API *SQLSetCursorName_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CursorName, SQLSMALLINT NameLength); +typedef SQLRETURN (SQL_API *SQLSetDescField_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength); +typedef SQLRETURN (SQL_API *SQLSetDescRec_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT Type, + SQLSMALLINT SubType, SQLLEN Length, + SQLSMALLINT Precision, SQLSMALLINT Scale, + SQLPOINTER Data, SQLLEN *StringLength, + SQLLEN *Indicator); +typedef SQLRETURN (SQL_API *SQLSetEnvAttr_t)(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API *SQLSetParam_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLSetPos_t)( + SQLHSTMT hstmt, + SQLSETPOSIROW irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); +typedef SQLRETURN (SQL_API *SQLSetScrollOptions_t)( /* Use SQLSetStmtOptions */ + SQLHSTMT hstmt, + SQLUSMALLINT fConcurrency, + SQLINTEGER crowKeyset, + SQLUSMALLINT crowRowset); +typedef SQLRETURN (SQL_API *SQLSetStmtAttr_t)(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API *SQLSetStmtOption_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT Option, SQLULEN Value); +typedef SQLRETURN (SQL_API *SQLSpecialColumns_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT IdentifierType, SQLTCHAR *CatalogName, + SQLSMALLINT NameLength1, SQLTCHAR *SchemaName, + SQLSMALLINT NameLength2, SQLTCHAR *TableName, + SQLSMALLINT NameLength3, SQLUSMALLINT Scope, + SQLUSMALLINT Nullable); +typedef SQLRETURN (SQL_API *SQLStatistics_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLTCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLTCHAR *TableName, SQLSMALLINT NameLength3, + SQLUSMALLINT Unique, SQLUSMALLINT Reserved); +typedef SQLRETURN (SQL_API *SQLTablePrivileges_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API *SQLTables_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLTCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLTCHAR *TableName, SQLSMALLINT NameLength3, + SQLTCHAR *TableType, SQLSMALLINT NameLength4); +typedef SQLRETURN (SQL_API *SQLTransact_t)(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType); + + +class SQLAPI_API infAPI : public saAPI +{ +public: + infAPI(); + + SQLAllocConnect_t SQLAllocConnect; // 1.0 + SQLAllocEnv_t SQLAllocEnv; // 1.0 + SQLAllocHandle_t SQLAllocHandle; // 3.0 + SQLAllocStmt_t SQLAllocStmt; // 1.0 + SQLBindCol_t SQLBindCol; // 1.0 + SQLBindParameter_t SQLBindParameter; // 2.0 + SQLBrowseConnect_t SQLBrowseConnect; // 1.0 + SQLBulkOperations_t SQLBulkOperations; // 3.0 + SQLCancel_t SQLCancel; // 1.0 + SQLCloseCursor_t SQLCloseCursor; // 3.0 + SQLColAttribute_t SQLColAttribute; // 3.0 + SQLColAttributes_t SQLColAttributes; // 1.0 + SQLColumnPrivileges_t SQLColumnPrivileges;// 1.0 + SQLColumns_t SQLColumns; // 1.0 + SQLConnect_t SQLConnect; // 1.0 + SQLCopyDesc_t SQLCopyDesc; // 3.0 + SQLDataSources_t SQLDataSources; // 1.0 + SQLDescribeCol_t SQLDescribeCol; // 1.0 + SQLDescribeParam_t SQLDescribeParam; // 1.0 + SQLDisconnect_t SQLDisconnect; // 1.0 + SQLDriverConnect_t SQLDriverConnect; // 1.0 + SQLDrivers_t SQLDrivers; // 2.0 + SQLEndTran_t SQLEndTran; // 3.0 + SQLError_t SQLError; // 1.0 + SQLExecDirect_t SQLExecDirect; // 1.0 + SQLExecute_t SQLExecute; // 1.0 + SQLExtendedFetch_t SQLExtendedFetch; // 1.0 + SQLFetch_t SQLFetch; // 1.0 + SQLFetchScroll_t SQLFetchScroll; // 1.0 + SQLForeignKeys_t SQLForeignKeys; // 1.0 + SQLFreeConnect_t SQLFreeConnect; // 1.0 + SQLFreeEnv_t SQLFreeEnv; // 1.0 + SQLFreeHandle_t SQLFreeHandle; // 3.0 + SQLFreeStmt_t SQLFreeStmt; // 1.0 + SQLGetConnectAttr_t SQLGetConnectAttr; // 3.0 + SQLGetConnectOption_t SQLGetConnectOption;// 1.0 + SQLGetCursorName_t SQLGetCursorName; // 1.0 + SQLGetData_t SQLGetData; // 1.0 + SQLGetDescField_t SQLGetDescField; // 3.0 + SQLGetDescRec_t SQLGetDescRec; // 3.0 + SQLGetDiagField_t SQLGetDiagField; // 3.0 + SQLGetDiagRec_t SQLGetDiagRec; // 3.0 + SQLGetEnvAttr_t SQLGetEnvAttr; // 3.0 + SQLGetFunctions_t SQLGetFunctions; // 1.0 + SQLGetInfo_t SQLGetInfo; // 1.0 + SQLGetStmtAttr_t SQLGetStmtAttr; // 3.0 + SQLGetStmtOption_t SQLGetStmtOption; // 1.0 + SQLGetTypeInfo_t SQLGetTypeInfo; // 1.0 + SQLMoreResults_t SQLMoreResults; // 1.0 + SQLNativeSql_t SQLNativeSql; // 1.0 + SQLNumParams_t SQLNumParams; // 1.0 + SQLNumResultCols_t SQLNumResultCols; // 1.0 + SQLParamData_t SQLParamData; // 1.0 + SQLParamOptions_t SQLParamOptions; // 1.0 + SQLPrepare_t SQLPrepare; // 1.0 + SQLPrimaryKeys_t SQLPrimaryKeys; // 1.0 + SQLProcedureColumns_t SQLProcedureColumns;// 1.0 + SQLProcedures_t SQLProcedures; // 1.0 + SQLPutData_t SQLPutData; // 1.0 + SQLRowCount_t SQLRowCount; // 1.0 + SQLSetConnectAttr_t SQLSetConnectAttr; // 3.0 + SQLSetConnectOption_t SQLSetConnectOption;// 1.0 + SQLSetCursorName_t SQLSetCursorName; // 1.0 + SQLSetDescField_t SQLSetDescField; // 3.0 + SQLSetDescRec_t SQLSetDescRec; // 3.0 + SQLSetEnvAttr_t SQLSetEnvAttr; // 3.0 + SQLSetParam_t SQLSetParam; // 1.0 + SQLSetPos_t SQLSetPos; // 1.0 + SQLSetScrollOptions_t SQLSetScrollOptions;// 1.0 + SQLSetStmtAttr_t SQLSetStmtAttr; // 3.0 + SQLSetStmtOption_t SQLSetStmtOption; // 1.0 + SQLSpecialColumns_t SQLSpecialColumns; // 1.0 + SQLStatistics_t SQLStatistics; // 1.0 + SQLTablePrivileges_t SQLTablePrivileges; // 1.0 + SQLTables_t SQLTables; // 1.0 + SQLTransact_t SQLTransact; // 1.0 +}; + +class SQLAPI_API infConnectionHandles : public saConnectionHandles +{ +public: + infConnectionHandles(); + + SQLHENV m_hevn; + SQLHDBC m_hdbc; +}; + +class SQLAPI_API infCommandHandles : public saCommandHandles +{ +public: + infCommandHandles(); + + SQLHSTMT m_hstmt; +}; + +extern infAPI g_infAPI; + +#endif // !defined(__INFAPI_H__) diff --git a/libraries/SQLAPI/include/informix/infxcli.h b/libraries/SQLAPI/include/informix/infxcli.h new file mode 100644 index 000000000..97beff413 --- /dev/null +++ b/libraries/SQLAPI/include/informix/infxcli.h @@ -0,0 +1,310 @@ +/**************************************************************************** + * + * IBM CORP. + * + * PROPRIETARY DATA + * + * Licensed Material - Property Of IBM + * + * "Restricted Materials of IBM" + * + * IBM Informix Client SDK + * + * (c) Copyright IBM Corporation 1997, 2011. All rights reserved. + * +** INFXCLI.H - This is the the main include for IBM Informix-CLI +** applications. +** +** Preconditions: +** for Windows environment: +** #include "windows.h" +** +*********************************************************************/ + +#ifndef __INFXCLI_H +#define __INFXCLI_H + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +/* +** include sql.h and sqlext.h +*/ +#ifdef _WINDOWS_ +#include "sql.h" +#include "sqlext.h" +#else +#include +#include "infxsql.h" +#endif /*_WINDOWS_*/ + +#define SQL_TXN_LAST_COMMITTED 0x00000010L +#define SQL_TRANSACTION_LAST_COMMITTED SQL_TXN_LAST_COMMITTED + +/* For extended errors */ + +#define SQL_DIAG_ISAM_ERROR 13 +#define SQL_DIAG_XA_ERROR 14 + +/* START -- Q+E Software's SQLSetStmtOption extensions (1040 to 1139) */ +/* defines here for backwards compatibility */ + +#define SQL_STMTOPT_START 1040 + +/* Get the rowid for the last row inserted */ +#define SQL_GET_ROWID (SQL_STMTOPT_START+8) + +/* Get the value for the serial column in the last row inserted */ +#define SQL_GET_SERIAL_VALUE (SQL_STMTOPT_START+9) + +/* END -- Q+E Software's SQLSetStmtOption extensions (1040 to 1139) */ + +/* +** Informix extensions +*/ + +/* Informix Column Attributes Flags Definitions */ +#define FDNULLABLE 0x0001 /* null allowed in field */ +#define FDDISTINCT 0x0002 /* distinct of all */ +#define FDDISTLVARCHAR 0x0004 /* distinct of SQLLVARCHAR */ +#define FDDISTBOOLEAN 0x0008 /* distinct of SQLBOOL */ +#define FDDISTSIMP 0x0010 /* distinct of simple type */ +#define FDCSTTYPE 0x0020 /* constructor type */ +#define FDNAMED 0x0040 /* named row type */ + +#define ISNULLABLE( flags ) ( flags & FDNULLABLE ? 1 : 0) +#define ISDISTINCT( flags ) ( flags & FDDISTINCT ? 1 : 0) + +/* Informix Type Estensions */ +#define SQL_INFX_UDT_FIXED -100 +#define SQL_INFX_UDT_VARYING -101 +#define SQL_INFX_UDT_BLOB -102 +#define SQL_INFX_UDT_CLOB -103 +#define SQL_INFX_UDT_LVARCHAR -104 +#define SQL_INFX_RC_ROW -105 +#define SQL_INFX_RC_COLLECTION -106 +#define SQL_INFX_RC_LIST -107 +#define SQL_INFX_RC_SET -108 +#define SQL_INFX_RC_MULTISET -109 +#define SQL_INFX_UNSUPPORTED -110 +#define SQL_INFX_C_SMARTLOB_LOCATOR -111 +#define SQL_INFX_QUALIFIER -112 +#define SQL_INFX_DECIMAL -113 +#define SQL_INFX_BIGINT -114 + +typedef void * HINFX_RC; /* row & collection handle */ + +/* Informix Connect Attributes Extensions */ +#define SQL_OPT_LONGID 2251 +#define SQL_INFX_ATTR_LONGID SQL_OPT_LONGID +#define SQL_INFX_ATTR_LEAVE_TRAILING_SPACES 2252 +#define SQL_INFX_ATTR_DEFAULT_UDT_FETCH_TYPE 2253 +#define SQL_INFX_ATTR_ENABLE_SCROLL_CURSORS 2254 +#define SQL_ENABLE_INSERT_CURSOR 2255 +#define SQL_INFX_ATTR_ENABLE_INSERT_CURSORS SQL_ENABLE_INSERT_CURSOR +#define SQL_INFX_ATTR_OPTIMIZE_AUTOCOMMIT 2256 +#define SQL_INFX_ATTR_ODBC_TYPES_ONLY 2257 +#define SQL_INFX_ATTR_FETCH_BUFFER_SIZE 2258 +#define SQL_INFX_ATTR_OPTOFC 2259 +#define SQL_INFX_ATTR_OPTMSG 2260 +#define SQL_INFX_ATTR_REPORT_KEYSET_CURSORS 2261 +#define SQL_INFX_ATTR_LO_AUTOMATIC 2262 +#define SQL_INFX_ATTR_AUTO_FREE 2263 +#define SQL_INFX_ATTR_DEFERRED_PREPARE 2265 + +#define SQL_INFX_ATTR_PAM_FUNCTION 2266 /* void pamCallback + (int msgStyle, + void *responseBuf, + int responseBufLen, + int *responseLenPtr, + void *challengeBuf, + int challengeBufLen, + int *challengeLenPtr) */ +#define SQL_INFX_ATTR_PAM_RESPONSE_BUF 2267 /* SQLPOINTER */ +#define SQL_INFX_ATTR_PAM_RESPONSE_BUF_LEN 2268 /* SQLINTEGER */ +#define SQL_INFX_ATTR_PAM_RESPONSE_LEN_PTR 2269 /* SQLPOINTER */ +#define SQL_INFX_ATTR_PAM_CHALLENGE_BUF 2270 /* SQLPOINTER */ +#define SQL_INFX_ATTR_PAM_CHALLENGE_BUF_LEN 2271 /* SQLINTEGER */ +#define SQL_INFX_ATTR_PAM_CHALLENGE_LEN_PTR 2272 /* SQLINTEGER * - number of bytes in challenge */ +#define SQL_INFX_ATTR_DELIMIDENT 2273 /* As of now this attribute is only being used + in .NET Provider since it is sitting on top + of ODBC.*/ +#define SQL_INFX_ATTR_DBLOCALE 2275 +#define SQL_INFX_ATTR_LOCALIZE_DECIMALS 2276 +#define SQL_INFX_ATTR_DEFAULT_DECIMAL 2277 +#define SQL_INFX_ATTR_SKIP_PARSING 2278 +#define SQL_INFX_ATTR_CALL_FROM_DOTNET 2279 +#define SQL_INFX_ATTR_LENGTHINCHARFORDIAGRECW 2280 +#define SQL_INFX_ATTR_SENDTIMEOUT 2281 +#define SQL_INFX_ATTR_RECVTIMEOUT 2282 +#define SQL_INFX_ATTR_IDSISAMERRMSG 2283 + +/*Attributes same as cli*/ +#define SQL_ATTR_USE_TRUSTED_CONTEXT 2561 + +/* Informix Descriptor Extensions */ +#define SQL_INFX_ATTR_FLAGS 1900 /* UDWORD */ +#define SQL_INFX_ATTR_EXTENDED_TYPE_CODE 1901 /* UDWORD */ +#define SQL_INFX_ATTR_EXTENDED_TYPE_NAME 1902 /* UCHAR ptr */ +#define SQL_INFX_ATTR_EXTENDED_TYPE_OWNER 1903 /* UCHAR ptr */ +#define SQL_INFX_ATTR_EXTENDED_TYPE_ALIGNMENT 1904 /* UDWORD */ +#define SQL_INFX_ATTR_SOURCE_TYPE_CODE 1905 /* UDWORD */ + +/* Informix Statement Attributes Extensions */ +#define SQL_VMB_CHAR_LEN 2325 +#define SQL_INFX_ATTR_VMB_CHAR_LEN SQL_VMB_CHAR_LEN +#define SQL_INFX_ATTR_MAX_FET_ARR_SIZE 2326 + +/* Informix fOption, SQL_VMB_CHAR_LEN vParam */ +#define SQL_VMB_CHAR_EXACT 0 +#define SQL_VMB_CHAR_ESTIMATE 1 + +/* Informix row/collection traversal constants */ +#define SQL_INFX_RC_NEXT 1 +#define SQL_INFX_RC_PRIOR 2 +#define SQL_INFX_RC_FIRST 3 +#define SQL_INFX_RC_LAST 4 +#define SQL_INFX_RC_ABSOLUTE 5 +#define SQL_INFX_RC_RELATIVE 6 +#define SQL_INFX_RC_CURRENT 7 + +/******************************************************************************* + * Large Object (LO) related structures + * + * LO_SPEC: Large object spec structure + * It is used for creating smartblobs. The user may examin and/or set certain + * fields of LO_SPEC by using ifx_lo_spec[set|get]_* accessor functions. + * + * LO_PTR: Large object pointer structure + * Identifies the LO and provides ancillary, security-related information. + * + * LO_STAT: Large object stat structure + * It is used in querying attribtes of smartblobs. The user may examin fields + * herein by using ifx_lo_stat[set|get]_* accessor functions. + * + * These structures are opaque to the user. Accessor functions are provided + * for these structures. + ******************************************************************************/ + +/* Informix GetInfo Extensions to obtain length of LO related structures */ +#define SQL_INFX_LO_SPEC_LENGTH 2250 /* UWORD */ +#define SQL_INFX_LO_PTR_LENGTH 2251 /* UWORD */ +#define SQL_INFX_LO_STAT_LENGTH 2252 /* UWORD */ + +/****************************************************************************** + * LO Open flags: (see documentation for further explanation) + * + * LO_APPEND - Positions the seek position to end-of-file + 1. By itself, + * it is equivalent to write only mode followed by a seek to the + * end of large object. Read opeartions will fail. + * You can OR the LO_APPEND flag with another access mode. + * LO_WRONLY - Only write operations are valid on the data. + * LO_RDONLY - Only read operations are valid on the data. + * LO_RDWR - Both read and write operations are valid on the data. + * + * LO_RANDOM - If set overrides optimizer decision. Indicates that I/O is + * random and that the system should not read-ahead. + * LO_SEQUENTIAL - If set overrides optimizer decision. Indicates that + * reads are sequential in either forward or reverse direction. + * + * LO_FORWARD - Only used for sequential access. Indicates that the sequential + * access will be in a forward direction, i.e. from low offset + * to higher offset. + * LO_REVERSE - Only used for sequential access. Indicates that the sequential + * access will be in a reverse direction. + * + * LO_BUFFER - If set overrides optimizer decision. I/O goes through the + * buffer pool. + * LO_NOBUFFER - If set then I/O does not use the buffer pool. + ******************************************************************************/ + +#define LO_APPEND 0x1 +#define LO_WRONLY 0x2 +#define LO_RDONLY 0x4 /* default */ +#define LO_RDWR 0x8 + +#define LO_RANDOM 0x20 /* default is determined by optimizer */ +#define LO_SEQUENTIAL 0x40 /* default is determined by optimizer */ + +#define LO_FORWARD 0x80 /* default */ +#define LO_REVERSE 0x100 + +#define LO_BUFFER 0x200 /* default is determined by optimizer */ +#define LO_NOBUFFER 0x400 /* default is determined by optimizer */ + +#define LO_DIRTY_READ 0x10 +#define LO_NODIRTY_READ 0x800 + +#define LO_LOCKALL 0x1000 /* default */ +#define LO_LOCKRANGE 0x2000 + +/******************************************************************************* + * LO create-time flags: + * + * Bitmask - Set/Get via ifx_lo_specset_flags() on LO_SPEC. + ******************************************************************************/ + +#define LO_ATTR_LOG 0x0001 +#define LO_ATTR_NOLOG 0x0002 +#define LO_ATTR_DELAY_LOG 0x0004 +#define LO_ATTR_KEEP_LASTACCESS_TIME 0x0008 +#define LO_ATTR_NOKEEP_LASTACCESS_TIME 0x0010 +#define LO_ATTR_HIGH_INTEG 0x0020 +#define LO_ATTR_MODERATE_INTEG 0x0040 + +/******************************************************************************* + * Symbolic constants for the "lseek" routine + ******************************************************************************/ + +#define LO_SEEK_SET 0 /* Set curr. pos. to "offset" */ +#define LO_SEEK_CUR 1 /* Set curr. pos. to current + "offset" */ +#define LO_SEEK_END 2 /* Set curr. pos. to EOF + "offset" */ + +/******************************************************************************* + * Symbolic constants for lo_lock and lo_unlock routines. +******************************************************************************/ + +#define LO_SHARED_MODE 1 +#define LO_EXCLUSIVE_MODE 2 + +/******************************************************************************* + * Intersolv specific infoTypes for SQLGetInfo + ******************************************************************************/ + +#define SQL_RESERVED_WORDS 1011 +#define SQL_PSEUDO_COLUMNS 1012 +#define SQL_FROM_RESERVED_WORDS 1013 +#define SQL_WHERE_CLAUSE_TERMINATORS 1014 +#define SQL_COLUMN_FIRST_CHARS 1015 +#define SQL_COLUMN_MIDDLE_CHARS 1016 +#define SQL_TABLE_FIRST_CHARS 1018 +#define SQL_TABLE_MIDDLE_CHARS 1019 +#define SQL_FAST_SPECIAL_COLUMNS 1021 +#define SQL_ACCESS_CONFLICTS 1022 +#define SQL_LOCKING_SYNTAX 1023 +#define SQL_LOCKING_DURATION 1024 +#define SQL_RECORD_OPERATIONS 1025 +#define SQL_QUALIFIER_SYNTAX 1026 + + +/* Function for acquiring the xa_switch structure defined by Informix RM */ + +struct xa_switch_t * _fninfx_xa_switch( void ); + + +/* Function for obtaining the Environment handle associated with an XA +Connection */ + +RETCODE IFMX_SQLGetXaHenv(int, HENV *); + + +/*Function for obtaining the Database handle associated with an XA Connection */ + +RETCODE IFMX_SQLGetXaHdbc(int, HDBC *); + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ + +#endif /* __INFXCLI_H */ diff --git a/libraries/SQLAPI/include/informix/infxsql.h b/libraries/SQLAPI/include/informix/infxsql.h new file mode 100644 index 000000000..c9ac6a7fe --- /dev/null +++ b/libraries/SQLAPI/include/informix/infxsql.h @@ -0,0 +1,1505 @@ +/**************************************************************************** + * + * IBM CORP. + * + * PROPRIETARY DATA + * + * Licensed Material - Property Of IBM + * + * "Restricted Materials of IBM" + * + * IBM Informix Client SDK + * + * Copyright IBM Corporation 2012 + * +** INFXSQL.H - This is the the include file for IBM Informix-CLI +** applications with sqlcli.h, sqlcli1.h and SQLEXT.H +** +*********************************************************************/ + +#ifndef __INFXSQL +#define __INFXSQL + + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +#ifndef ODBCVER +#define ODBCVER 0x0300 +#endif + +#define FAR + +/* environment specific definitions */ +#ifndef EXPORT +#define EXPORT +#endif + +#if !defined SQL_API_RC + #define SQL_API_RC int + #define SQL_STRUCTURE struct + #define PSQL_API_FN * +#if defined(WIN32) || defined(WIN64) + #define SQL_API_FN __stdcall +#else + #define SQL_API_FN +#endif /* WIN32 || WIN64 */ + #define SQL_POINTER + #define SQL_API_INTR +#endif /* !SQL_API_RC */ + +#define SQL_API SQL_API_FN + +#ifndef RC_INVOKED + +/* + * The following are provided to enhance portability and compatibility + * with ODBC taken from sqlcli.h, sqlcli1.h and sqlsystm.h + */ +typedef char sqlint8; +typedef unsigned char sqluint8; +typedef short sqlint16; +typedef unsigned short sqluint16; +typedef int sqlint32; +typedef unsigned int sqluint32; + +typedef signed char SCHAR; +typedef unsigned char UCHAR; +typedef short int SWORD; +typedef unsigned short USHORT; +typedef signed short SSHORT; +typedef unsigned short int UWORD; + +typedef sqlint32 SDWORD; +typedef unsigned long ULONG; +typedef sqluint32 UDWORD; +typedef signed long SLONG; + +typedef double LDOUBLE; +typedef double SDOUBLE; +typedef float SFLOAT; +typedef unsigned char SQLDATE; +typedef unsigned char SQLTIME; +typedef unsigned char SQLTIMESTAMP; +typedef unsigned char SQLDECIMAL; +typedef unsigned char SQLNUMERIC; + +typedef UCHAR SQLCHAR; +typedef UCHAR SQLVARCHAR; +typedef SCHAR SQLSCHAR; +typedef SDWORD SQLINTEGER; +typedef UDWORD SQLUINTEGER; +typedef SWORD SQLSMALLINT; +typedef SDOUBLE SQLDOUBLE; +typedef SDOUBLE SQLFLOAT; +typedef SFLOAT SQLREAL; + +typedef void FAR * PTR; +typedef PTR SQLPOINTER; +typedef UWORD SQLUSMALLINT; + +typedef void FAR * HENV; +typedef void FAR * HDBC; +typedef void FAR * HSTMT; + +typedef signed short RETCODE; + +/* 64-bit Length Defines */ +#define SQLLEN SQLINTEGER +#define SQLULEN SQLUINTEGER +#define SQLSETPOSIROW SQLUSMALLINT + +/* Windows/NT specific DataTypes and defines */ +#if !defined(WIN32) && !defined(WIN64) + +#define CALLBACK +#define PASCAL +#define _cdecl +#define TRUE 1 +#define FALSE 0 +#define VOID void +#ifndef BOOL +#define BOOL int +#endif + +typedef int HWND; +typedef unsigned int UINT; +typedef VOID *HANDLE; +typedef char *LPSTR; +typedef const char *LPCSTR; +typedef char *LPWSTR; +typedef char WCHAR; +typedef SQLUINTEGER DWORD; +typedef unsigned short WORD; +typedef unsigned char BYTE; +typedef BYTE *LPBYTE; +typedef SQLINTEGER LONG; +typedef VOID *LPVOID; +typedef VOID *PVOID; +typedef VOID *HMODULE; +typedef int GLOBALHANDLE; +typedef int (*FARPROC)(void); +typedef VOID *HINSTANCE; +typedef unsigned int WPARAM; +typedef SQLUINTEGER LPARAM; +typedef VOID *HKEY; +typedef VOID *PHKEY; +typedef char CHAR; +typedef BOOL *LPBOOL; +typedef DWORD *LPDWORD; +typedef const char *LPCWSTR; +typedef char TCHAR; +typedef char VCHAR; +typedef TCHAR *LPTSTR; +typedef const TCHAR *LPCTSTR; + +#endif /*!WIN32 */ + + +typedef SQLSMALLINT SQLRETURN; + +typedef void * SQLHANDLE; +typedef SQLHANDLE SQLHENV; +typedef SQLHANDLE SQLHDBC; +typedef SQLHANDLE SQLHSTMT; +typedef SQLHANDLE SQLHDESC; +typedef SQLPOINTER SQLHWND; + + + +typedef struct DATE_STRUCT + { + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; + } DATE_STRUCT; + +typedef DATE_STRUCT SQL_DATE_STRUCT; + +typedef struct TIME_STRUCT + { + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + } TIME_STRUCT; + +typedef TIME_STRUCT SQL_TIME_STRUCT; + +typedef struct TIMESTAMP_STRUCT + { + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + SQLUINTEGER fraction; /* fraction of a second */ + } TIMESTAMP_STRUCT; + + +typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT; + +typedef enum +{ + SQL_IS_YEAR = 1, + SQL_IS_MONTH = 2, + SQL_IS_DAY = 3, + SQL_IS_HOUR = 4, + SQL_IS_MINUTE = 5, + SQL_IS_SECOND = 6, + SQL_IS_YEAR_TO_MONTH = 7, + SQL_IS_DAY_TO_HOUR = 8, + SQL_IS_DAY_TO_MINUTE = 9, + SQL_IS_DAY_TO_SECOND = 10, + SQL_IS_HOUR_TO_MINUTE = 11, + SQL_IS_HOUR_TO_SECOND = 12, + SQL_IS_MINUTE_TO_SECOND = 13 +} SQLINTERVAL; + +typedef struct tagSQL_YEAR_MONTH +{ + SQLUINTEGER year; + SQLUINTEGER month; +} SQL_YEAR_MONTH_STRUCT; + +typedef struct tagSQL_DAY_SECOND +{ + SQLUINTEGER day; + SQLUINTEGER hour; + SQLUINTEGER minute; + SQLUINTEGER second; + SQLUINTEGER fraction; +} SQL_DAY_SECOND_STRUCT; + +typedef struct tagSQL_INTERVAL_STRUCT +{ + SQLINTERVAL interval_type; + SQLSMALLINT interval_sign; + union { + SQL_YEAR_MONTH_STRUCT year_month; + SQL_DAY_SECOND_STRUCT day_second; + } intval; + +} SQL_INTERVAL_STRUCT; + +/* Maximum precision (in base 10) of an SQL_C_NUMERIC value */ +#define SQL_MAX_C_NUMERIC_PRECISION 38 + +/* internal representation of numeric data type */ +#define SQL_MAX_NUMERIC_LEN 16 +typedef struct tagSQL_NUMERIC_STRUCT +{ + SQLCHAR precision; + SQLSCHAR scale; + SQLCHAR sign; /* 1 if positive, 0 if negative */ + SQLCHAR val[SQL_MAX_NUMERIC_LEN]; +} SQL_NUMERIC_STRUCT; + +#define SQL_BIGINT_TYPE long long +#define SQL_BIGUINT_TYPE unsigned long long +typedef SQL_BIGINT_TYPE SQLBIGINT; +typedef SQL_BIGUINT_TYPE SQLUBIGINT; + +typedef SQLUINTEGER BOOKMARK; + + +#ifdef UCS2 +typedef unsigned short SQLWCHAR; +#else +#ifdef UTF8 +typedef char SQLWCHAR; +#else +typedef wchar_t SQLWCHAR; +#endif /* !UTF-8 and !UCS-2 */ +#endif /* UCS-2 */ + +#define SQL_C_WCHAR SQL_WCHAR +#ifdef UNICODE +#define SQL_C_TCHAR SQL_C_WCHAR +typedef SQLWCHAR SQLTCHAR; +#else +#define SQL_C_TCHAR SQL_C_CHAR +typedef SQLCHAR SQLTCHAR; +#endif + +/* Special length values */ +#define SQL_NULL_DATA -1 +#define SQL_DATA_AT_EXEC -2 +#define SQL_NTS -3 /* NTS = Null Terminated String */ +#define SQL_NTSL -3L /* NTS = Null Terminated String */ + +/* RETCODE values */ +#define SQL_SUCCESS 0 +#define SQL_SUCCESS_WITH_INFO 1 +#define SQL_NEED_DATA 99 +#define SQL_NO_DATA 100 +#define SQL_STILL_EXECUTING 2 +#define SQL_ERROR -1 +#define SQL_INVALID_HANDLE -2 + +/* test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO */ +#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) + +/* Special length values */ +#define SQL_NULL_DATA -1 +#define SQL_DATA_AT_EXEC -2 +#define SQL_NTS -3 /* NTS = Null Terminated String */ +#define SQL_NTSL -3L /* NTS = Null Terminated String */ + +/* generally useful constants */ +#define SQL_MAX_MESSAGE_LENGTH 512 /* message buffer size */ +#define SQL_MAX_ID_LENGTH 128 /* maximum identifier name size, + e.g. cursor names */ + +/* date/time length constants */ +#define SQL_DATE_LEN 10 +#define SQL_TIME_LEN 8 /* add P+1 if precision is nonzero */ +#define SQL_TIMESTAMP_LEN 19 /* add P+1 if precision is nonzero */ + +/* handle type identifiers */ +#define SQL_HANDLE_ENV 1 +#define SQL_HANDLE_DBC 2 +#define SQL_HANDLE_STMT 3 +#define SQL_HANDLE_DESC 4 + +/* + * Environment attributes; note SQL_CONNECTTYPE, SQL_SYNC_POINT are also + * environment attributes that are settable at the connection level + */ + +#define SQL_ATTR_OUTPUT_NTS 10001 + +/* Options for SQLGetStmtOption/SQLSetStmtOption */ + +#define SQL_ATTR_AUTO_IPD 10001 +#define SQL_ATTR_APP_ROW_DESC 10010 +#define SQL_ATTR_APP_PARAM_DESC 10011 +#define SQL_ATTR_IMP_ROW_DESC 10012 +#define SQL_ATTR_IMP_PARAM_DESC 10013 +#define SQL_ATTR_METADATA_ID 10014 +#define SQL_ATTR_CURSOR_SCROLLABLE (-1) +#define SQL_ATTR_CURSOR_SENSITIVITY (-2) + +/* SQL_ATTR_CURSOR_SCROLLABLE values */ +#define SQL_NONSCROLLABLE 0 +#define SQL_SCROLLABLE 1 + +/* SQL_ATTR_CURSOR_SCROLLABLE values */ +#define SQL_NONSCROLLABLE 0 +#define SQL_SCROLLABLE 1 + +/* identifiers of fields in the SQL descriptor */ +#define SQL_DESC_COUNT 1001 +#define SQL_DESC_TYPE 1002 +#define SQL_DESC_LENGTH 1003 +#define SQL_DESC_OCTET_LENGTH_PTR 1004 +#define SQL_DESC_PRECISION 1005 +#define SQL_DESC_SCALE 1006 +#define SQL_DESC_DATETIME_INTERVAL_CODE 1007 +#define SQL_DESC_NULLABLE 1008 +#define SQL_DESC_INDICATOR_PTR 1009 +#define SQL_DESC_DATA_PTR 1010 +#define SQL_DESC_NAME 1011 +#define SQL_DESC_UNNAMED 1012 +#define SQL_DESC_OCTET_LENGTH 1013 +#define SQL_DESC_ALLOC_TYPE 1099 +#define SQL_DESC_USER_DEFINED_TYPE_CODE 1098 +#define SQL_DESC_CARDINALITY 1040 +#define SQL_DESC_CARDINALITY_PTR 1043 + +/* identifiers of fields in the diagnostics area */ +#define SQL_DIAG_RETURNCODE 1 +#define SQL_DIAG_NUMBER 2 +#define SQL_DIAG_ROW_COUNT 3 +#define SQL_DIAG_SQLSTATE 4 +#define SQL_DIAG_NATIVE 5 +#define SQL_DIAG_MESSAGE_TEXT 6 +#define SQL_DIAG_DYNAMIC_FUNCTION 7 +#define SQL_DIAG_CLASS_ORIGIN 8 +#define SQL_DIAG_SUBCLASS_ORIGIN 9 +#define SQL_DIAG_CONNECTION_NAME 10 +#define SQL_DIAG_SERVER_NAME 11 +#define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12 + +/* dynamic function codes */ +#define SQL_DIAG_ALTER_TABLE 4 +#define SQL_DIAG_CALL 7 +#define SQL_DIAG_CREATE_INDEX (-1) +#define SQL_DIAG_CREATE_TABLE 77 +#define SQL_DIAG_CREATE_VIEW 84 +#define SQL_DIAG_DELETE_WHERE 19 +#define SQL_DIAG_DROP_INDEX (-2) +#define SQL_DIAG_DROP_TABLE 32 +#define SQL_DIAG_DROP_VIEW 36 +#define SQL_DIAG_DYNAMIC_DELETE_CURSOR 38 +#define SQL_DIAG_DYNAMIC_UPDATE_CURSOR 81 +#define SQL_DIAG_GRANT 48 +#define SQL_DIAG_INSERT 50 +#define SQL_DIAG_MERGE 128 +#define SQL_DIAG_REVOKE 59 +#define SQL_DIAG_SELECT_CURSOR 85 +#define SQL_DIAG_UNKNOWN_STATEMENT 0 +#define SQL_DIAG_UPDATE_WHERE 82 + +/* Standard SQL data types */ +#define SQL_UNKNOWN_TYPE 0 +#define SQL_CHAR 1 +#define SQL_NUMERIC 2 +#define SQL_DECIMAL 3 +#define SQL_INTEGER 4 +#define SQL_SMALLINT 5 +#define SQL_FLOAT 6 +#define SQL_REAL 7 +#define SQL_DOUBLE 8 +#define SQL_DATETIME 9 +#define SQL_VARCHAR 12 +#define SQL_WCHAR (-8) +#define SQL_WVARCHAR (-9) +#define SQL_WLONGVARCHAR (-10) +#define SQL_DECFLOAT (-360) +/* One-parameter shortcuts for date/time data types */ +#define SQL_TYPE_DATE 91 +#define SQL_TYPE_TIME 92 +#define SQL_TYPE_TIMESTAMP 93 + +/* Statement attribute values for cursor sensitivity */ +#define SQL_UNSPECIFIED 0 +#define SQL_INSENSITIVE 1 +#define SQL_SENSITIVE 2 + +/* SQLGetTypeInfo define */ +#define SQL_ALL_TYPES 0 + +/* Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */ +#define SQL_DEFAULT 99 + +/* SQLGetData() code indicating that the application row descriptor + * specifies the data type + */ +#define SQL_ARD_TYPE (-99) + +/* SQL date/time type subcodes */ +#define SQL_CODE_DATE 1 +#define SQL_CODE_TIME 2 +#define SQL_CODE_TIMESTAMP 3 + +/* CLI attribute/option values */ +#define SQL_FALSE 0 +#define SQL_TRUE 1 + +/* + * NULL status defines; these are used in SQLColAttributes, SQLDescribeCol, + * to describe the nullability of a column in a table. + */ + +#define SQL_NO_NULLS 0 +#define SQL_NULLABLE 1 +#define SQL_NULLABLE_UNKNOWN 2 + +/* + * SQLColAttribute defines for SQL_COLUMN_SEARCHABLE condition. + */ +#define SQL_PRED_NONE 0 +#define SQL_PRED_CHAR 1 +#define SQL_PRED_BASIC 2 + + +/* values of UNNAMED field in descriptor used in SQLColAttribute */ +#define SQL_NAMED 0 +#define SQL_UNNAMED 1 + +/* values of ALLOC_TYPE field in descriptor */ +#define SQL_DESC_ALLOC_AUTO 1 +#define SQL_DESC_ALLOC_USER 2 + +/* SQLFreeStmt option values */ +#define SQL_CLOSE 0 +#define SQL_DROP 1 +#define SQL_UNBIND 2 +#define SQL_RESET_PARAMS 3 + +/* SQLDataSources "fDirection" values, also used on SQLExtendedFetch() */ +/* See sqlext.h for additional SQLExtendedFetch fetch direction defines */ +#define SQL_FETCH_NEXT 1 +#define SQL_FETCH_FIRST 2 + +/* OTHER CODES USED FOR FETCHORIENTATION IN SQLFETCHSCROLL() */ +#define SQL_FETCH_LAST 3 +#define SQL_FETCH_PRIOR 4 +#define SQL_FETCH_ABSOLUTE 5 +#define SQL_FETCH_RELATIVE 6 + +/* SQLTransact option values */ +#define SQL_COMMIT 0 +#define SQL_ROLLBACK 1 + +/* NULL handle defines */ +#define SQL_NULL_HENV 0L +#define SQL_NULL_HDBC 0L +#define SQL_NULL_HSTMT 0L +#define SQL_NULL_HDESC 0L +#define SQL_NULL_HANDLE 0L + +/* Column types and scopes in SQLSpecialColumns */ + +#define SQL_SCOPE_CURROW 0 +#define SQL_SCOPE_TRANSACTION 1 +#define SQL_SCOPE_SESSION 2 + +/* Defines for SQLStatistics */ +#define SQL_INDEX_UNIQUE 0 +#define SQL_INDEX_ALL 1 + +/* Defines for SQLStatistics (returned in the result set) */ +#define SQL_INDEX_CLUSTERED 1 +#define SQL_INDEX_HASHED 2 +#define SQL_INDEX_OTHER 3 + +/* Defines for SQLSpecialColumns (returned in the result set) */ +#define SQL_PC_UNKNOWN 0 +#define SQL_PC_NON_PSEUDO 1 +#define SQL_PC_PSEUDO 2 + +/* Reserved value for the IdentifierType argument of SQLSpecialColumns() */ +#define SQL_ROW_IDENTIFIER 1 + +/* SQLGetFunction defines - supported functions */ +#define SQL_API_SQLALLOCCONNECT 1 +#define SQL_API_SQLALLOCENV 2 +#define SQL_API_SQLALLOCSTMT 3 +#define SQL_API_SQLBINDCOL 4 +#define SQL_API_SQLBINDPARAM 1002 +#define SQL_API_SQLCANCEL 5 +#define SQL_API_SQLCONNECT 7 +#define SQL_API_SQLCOPYDESC 1004 +#define SQL_API_SQLDESCRIBECOL 8 +#define SQL_API_SQLDISCONNECT 9 +#define SQL_API_SQLERROR 10 +#define SQL_API_SQLEXECDIRECT 11 +#define SQL_API_SQLEXECUTE 12 +#define SQL_API_SQLFETCH 13 +#define SQL_API_SQLFREECONNECT 14 +#define SQL_API_SQLFREEENV 15 +#define SQL_API_SQLFREESTMT 16 +#define SQL_API_SQLGETCURSORNAME 17 +#define SQL_API_SQLNUMRESULTCOLS 18 +#define SQL_API_SQLPREPARE 19 +#define SQL_API_SQLROWCOUNT 20 +#define SQL_API_SQLSETCURSORNAME 21 +#define SQL_API_SQLSETDESCFIELD 1017 +#define SQL_API_SQLSETDESCREC 1018 +#define SQL_API_SQLSETENVATTR 1019 +#define SQL_API_SQLSETPARAM 22 +#define SQL_API_SQLTRANSACT 23 + +#define SQL_API_SQLCOLUMNS 40 +#define SQL_API_SQLGETCONNECTOPTION 42 +#define SQL_API_SQLGETDATA 43 +#define SQL_API_SQLGETDATAINTERNAL 174 +#define SQL_API_SQLGETDESCFIELD 1008 +#define SQL_API_SQLGETDESCREC 1009 +#define SQL_API_SQLGETDIAGFIELD 1010 +#define SQL_API_SQLGETDIAGREC 1011 +#define SQL_API_SQLGETENVATTR 1012 +#define SQL_API_SQLGETFUNCTIONS 44 +#define SQL_API_SQLGETINFO 45 +#define SQL_API_SQLGETSTMTOPTION 46 +#define SQL_API_SQLGETTYPEINFO 47 +#define SQL_API_SQLPARAMDATA 48 +#define SQL_API_SQLPUTDATA 49 +#define SQL_API_SQLSETCONNECTOPTION 50 +#define SQL_API_SQLSETSTMTOPTION 51 +#define SQL_API_SQLSPECIALCOLUMNS 52 +#define SQL_API_SQLSTATISTICS 53 +#define SQL_API_SQLTABLES 54 +#define SQL_API_SQLDATASOURCES 57 +#define SQL_API_SQLSETCONNECTATTR 1016 +#define SQL_API_SQLSETSTMTATTR 1020 + +#define SQL_API_SQLBINDFILETOCOL 1250 +#define SQL_API_SQLBINDFILETOPARAM 1251 +#define SQL_API_SQLSETCOLATTRIBUTES 1252 +#define SQL_API_SQLGETSQLCA 1253 +#define SQL_API_SQLSETCONNECTION 1254 +#define SQL_API_SQLGETDATALINKATTR 1255 +#define SQL_API_SQLBUILDDATALINK 1256 +#define SQL_API_SQLNEXTRESULT 1257 +#define SQL_API_SQLEXTENDEDPREPARE 1296 +#define SQL_API_SQLEXTENDEDBIND 1297 +#define SQL_API_SQLEXTENDEDDESCRIBE 1298 + +#define SQL_API_SQLFETCHSCROLL 1021 +#define SQL_API_SQLGETLENGTH 1022 +#define SQL_API_SQLGETPOSITION 1023 +#define SQL_API_SQLGETSUBSTRING 1024 + + +#define SQL_API_SQLALLOCHANDLE 1001 +#define SQL_API_SQLFREEHANDLE 1006 +#define SQL_API_SQLCLOSECURSOR 1003 +#define SQL_API_SQLENDTRAN 1005 +#define SQL_API_SQLCOLATTRIBUTE 6 +#define SQL_API_SQLGETSTMTATTR 1014 +#define SQL_API_SQLGETCONNECTATTR 1007 + +/* Information requested by SQLGetInfo() */ +#define SQL_MAX_DRIVER_CONNECTIONS 0 +#define SQL_MAXIMUM_DRIVER_CONNECTIONS SQL_MAX_DRIVER_CONNECTIONS +#define SQL_MAX_CONCURRENT_ACTIVITIES 1 +#define SQL_MAXIMUM_CONCURRENT_ACTIVITIES SQL_MAX_CONCURRENT_ACTIVITIES +#define SQL_ATTR_ANSI_APP 115 + +/* SQLGetInfo defines - Info Type */ +#define SQL_DATA_SOURCE_NAME 2 +#define SQL_FETCH_DIRECTION 8 +#define SQL_SERVER_NAME 13 +#define SQL_SEARCH_PATTERN_ESCAPE 14 +#define SQL_DBMS_NAME 17 +#define SQL_DBMS_VER 18 +#define SQL_ACCESSIBLE_TABLES 19 +#define SQL_ACCESSIBLE_PROCEDURES 20 +#define SQL_CURSOR_COMMIT_BEHAVIOR 23 +#define SQL_DATA_SOURCE_READ_ONLY 25 +#define SQL_DEFAULT_TXN_ISOLATION 26 +#define SQL_IDENTIFIER_CASE 28 +#define SQL_IDENTIFIER_QUOTE_CHAR 29 +#define SQL_MAX_COLUMN_NAME_LEN 30 +#define SQL_MAXIMUM_COLUMN_NAME_LENGTH SQL_MAX_COLUMN_NAME_LEN +#define SQL_MAX_CURSOR_NAME_LEN 31 +#define SQL_MAXIMUM_CURSOR_NAME_LENGTH SQL_MAX_CURSOR_NAME_LEN +#define SQL_MAX_TABLE_NAME_LEN 35 +#define SQL_SCROLL_CONCURRENCY 43 +#define SQL_TXN_CAPABLE 46 +#define SQL_TRANSACTION_CAPABLE SQL_TXN_CAPABLE +#define SQL_USER_NAME 47 +#define SQL_TXN_ISOLATION_OPTION 72 +#define SQL_TRANSACTION_ISOLATION_OPTION SQL_TXN_ISOLATION_OPTION +#define SQL_GETDATA_EXTENSIONS 81 +#define SQL_NULL_COLLATION 85 +#define SQL_ALTER_TABLE 86 +#define SQL_ORDER_BY_COLUMNS_IN_SELECT 90 +#define SQL_SPECIAL_CHARACTERS 94 +#define SQL_MAX_COLUMNS_IN_GROUP_BY 97 +#define SQL_MAXIMUM_COLUMNS_IN_GROUP_BY SQL_MAX_COLUMNS_IN_GROUP_BY +#define SQL_MAX_COLUMNS_IN_INDEX 98 +#define SQL_MAXIMUM_COLUMNS_IN_INDEX SQL_MAX_COLUMNS_IN_INDEX +#define SQL_MAX_COLUMNS_IN_ORDER_BY 99 +#define SQL_MAXIMUM_COLUMNS_IN_ORDER_BY SQL_MAX_COLUMNS_IN_ORDER_BY +#define SQL_MAX_COLUMNS_IN_SELECT 100 +#define SQL_MAXIMUM_COLUMNS_IN_SELECT SQL_MAX_COLUMNS_IN_SELECT +#define SQL_MAX_COLUMNS_IN_TABLE 101 +#define SQL_MAX_INDEX_SIZE 102 +#define SQL_MAXIMUM_INDEX_SIZE SQL_MAX_INDEX_SIZE +#define SQL_MAX_ROW_SIZE 104 +#define SQL_MAXIMUM_ROW_SIZE SQL_MAX_ROW_SIZE +#define SQL_MAX_STATEMENT_LEN 105 +#define SQL_MAXIMUM_STATEMENT_LENGTH SQL_MAX_STATEMENT_LEN +#define SQL_MAX_TABLES_IN_SELECT 106 +#define SQL_MAXIMUM_TABLES_IN_SELECT SQL_MAX_TABLES_IN_SELECT +#define SQL_MAX_USER_NAME_LEN 107 +#define SQL_MAXIMUM_USER_NAME_LENGTH SQL_MAX_USER_NAME_LEN +#define SQL_MAX_SCHEMA_NAME_LEN SQL_MAX_OWNER_NAME_LEN +#define SQL_MAXIMUM_SCHEMA_NAME_LENGTH SQL_MAX_SCHEMA_NAME_LEN +#define SQL_MAX_CATALOG_NAME_LEN SQL_MAX_QUALIFIER_NAME_LEN +#define SQL_MAXIMUM_CATALOG_NAME_LENGTH SQL_MAX_CATALOG_NAME_LEN +#define SQL_OJ_CAPABILITIES 115 +#define SQL_OUTER_JOIN_CAPABILITIES SQL_OJ_CAPABILITIES +#define SQL_XOPEN_CLI_YEAR 10000 +#define SQL_CURSOR_SENSITIVITY 10001 +#define SQL_DESCRIBE_PARAMETER 10002 +#define SQL_CATALOG_NAME 10003 +#define SQL_COLLATION_SEQ 10004 +#define SQL_MAX_IDENTIFIER_LEN 10005 +#define SQL_MAXIMUM_IDENTIFIER_LENGTH SQL_MAX_IDENTIFIER_LEN +#define SQL_INTEGRITY 73 +#define SQL_DATABASE_CODEPAGE 2519 +#define SQL_APPLICATION_CODEPAGE 2520 +#define SQL_CONNECT_CODEPAGE 2521 +#define SQL_ATTR_DB2_APPLICATION_ID 2532 +#define SQL_ATTR_DB2_APPLICATION_HANDLE 2533 +#define SQL_ATTR_HANDLE_XA_ASSOCIATED 2535 +#define SQL_DB2_DRIVER_VER 2550 +#define SQL_ATTR_XML_DECLARATION 2552 +#define SQL_ATTR_CURRENT_IMPLICIT_XMLPARSE_OPTION 2553 +#define SQL_ATTR_XQUERY_STATEMENT 2557 +#define SQL_DB2_DRIVER_TYPE 2567 +#define SQL_INPUT_CHAR_CONVFACTOR 2581 +#define SQL_OUTPUT_CHAR_CONVFACTOR 2582 +#define SQL_ATTR_REPLACE_QUOTED_LITERALS 2586 +#define SQL_ATTR_REPORT_TIMESTAMP_TRUNC_AS_WARN 2587 + + +#define SQL_INFO_LAST 114 +#define SQL_INFO_DRIVER_START 1000 + +/* SQL_ALTER_TABLE bitmasks */ +#define SQL_AT_ADD_COLUMN 0x00000001L +#define SQL_AT_DROP_COLUMN 0x00000002L +#define SQL_AT_ADD_CONSTRAINT 0x00000008L + +/* Bitmasks for SQL_ASYNC_MODE */ + +#define SQL_AM_NONE 0 +#define SQL_AM_CONNECTION 1 +#define SQL_AM_STATEMENT 2 + +/* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */ + +#define SQL_CB_DELETE 0x0000 +#define SQL_CB_CLOSE 0x0001 +#define SQL_CB_PRESERVE 0x0002 + +/* SQL_FETCH_DIRECTION masks */ + +#define SQL_FD_FETCH_NEXT 0x00000001L +#define SQL_FD_FETCH_FIRST 0x00000002L +#define SQL_FD_FETCH_LAST 0x00000004L +#define SQL_FD_FETCH_PRIOR 0x00000008L +#define SQL_FD_FETCH_ABSOLUTE 0x00000010L +#define SQL_FD_FETCH_RELATIVE 0x00000020L +#define SQL_FD_FETCH_RESUME 0x00000040L + +/* SQL_GETDATA_EXTENSIONS values */ + +#define SQL_GD_ANY_COLUMN 0x00000001L +#define SQL_GD_ANY_ORDER 0x00000002L + +/* SQL_IDENTIFIER_CASE values */ + +#define SQL_IC_UPPER 0x0001 +#define SQL_IC_LOWER 0x0002 +#define SQL_IC_SENSITIVE 0x0003 +#define SQL_IC_MIXED 0x0004 + +/* SQL_OJ_CAPABILITIES values */ + +#define SQL_OJ_LEFT 0x00000001L +#define SQL_OJ_RIGHT 0x00000002L +#define SQL_OJ_FULL 0x00000004L +#define SQL_OJ_NESTED 0x00000008L +#define SQL_OJ_NOT_ORDERED 0x00000010L +#define SQL_OJ_INNER 0x00000020L +#define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L + +/* SQL_TXN_CAPABLE values */ + +#define SQL_TC_NONE 0x0000 +#define SQL_TC_DML 0x0001 +#define SQL_TC_ALL 0x0002 +#define SQL_TC_DDL_COMMIT 0x0003 +#define SQL_TC_DDL_IGNORE 0x0004 + +/* SQL_SCROLL_CONCURRENCY masks */ + +#define SQL_SCCO_READ_ONLY 0x00000001L +#define SQL_SCCO_LOCK 0x00000002L +#define SQL_SCCO_OPT_ROWVER 0x00000004L +#define SQL_SCCO_OPT_VALUES 0x00000008L + +/* SQL_TXN_ISOLATION_OPTION masks */ +#define SQL_TXN_READ_UNCOMMITTED 0x00000001L +#define SQL_TRANSACTION_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED +#define SQL_TXN_READ_COMMITTED 0x00000002L +#define SQL_TRANSACTION_READ_COMMITTED SQL_TXN_READ_COMMITTED +#define SQL_TXN_REPEATABLE_READ 0x00000004L +#define SQL_TRANSACTION_REPEATABLE_READ SQL_TXN_REPEATABLE_READ +#define SQL_TXN_SERIALIZABLE 0x00000008L +#define SQL_TRANSACTION_SERIALIZABLE SQL_TXN_SERIALIZABLE +#define SQL_TXN_NOCOMMIT 0x00000020L +#define SQL_TRANSACTION_NOCOMMIT SQL_TXN_NOCOMMIT +#define SQL_TXN_IDS_CURSOR_STABILITY 0x00000040L +#define SQL_TRANSACTION_IDS_CURSOR_STABILITY SQL_TXN_IDS_CURSOR_STABILITY +#define SQL_TXN_IDS_LAST_COMMITTED 0x00000080L +#define SQL_TRANSACTION_IDS_LAST_COMMITTED SQL_TXN_IDS_LAST_COMMITTED + +#define SQL_TXN_LAST_COMMITTED 0x00000010L +#define SQL_TRANSACTION_LAST_COMMITTED SQL_TXN_LAST_COMMITTED + +/* SQL_NULL_COLLATION values */ +#define SQL_NC_HIGH 0 +#define SQL_NC_LOW 1 + +/* API Prototypes */ + +SQLRETURN SQL_API_FN SQLAllocConnect (SQLHENV henv, + SQLHDBC FAR *phdbc); + + +SQLRETURN SQL_API_FN SQLAllocEnv (SQLHENV FAR *phenv); + +SQLRETURN SQL_API_FN SQLAllocStmt (SQLHDBC hdbc, + SQLHSTMT FAR *phstmt); + +SQLRETURN SQL_API_FN SQLAllocHandle (SQLSMALLINT fHandleType, + SQLHANDLE hInput, + SQLHANDLE * phOutput); + +SQLRETURN SQL_API_FN SQLBindCol (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLSMALLINT fCType, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN FAR *pcbValue); + +SQLRETURN SQL_API_FN SQLCancel (SQLHSTMT hstmt); + +SQLRETURN SQL_API_FN SQLBindParam (SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, + SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, + SQLPOINTER ParameterValue, + SQLLEN *StrLen_or_Ind); + +SQLRETURN SQL_API_FN SQLCloseCursor (SQLHSTMT hStmt); + +SQLRETURN SQL_API_FN SQLColAttribute (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT FAR *pcbDesc, + SQLPOINTER pfDesc); + + +SQLRETURN SQL_API_FN SQLColumns (SQLHSTMT hstmt, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR FAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API_FN SQLConnect (SQLHDBC hdbc, + SQLCHAR FAR *szDSN, + SQLSMALLINT cbDSN, + SQLCHAR FAR *szUID, + SQLSMALLINT cbUID, + SQLCHAR FAR *szAuthStr, + SQLSMALLINT cbAuthStr); + +SQLRETURN SQL_API_FN SQLCopyDesc (SQLHDESC hDescSource, + SQLHDESC hDescTarget); + +SQLRETURN SQL_API_FN SQLDataSources (SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR FAR *szDSN, + SQLSMALLINT cbDSNMax, + SQLSMALLINT FAR *pcbDSN, + SQLCHAR FAR *szDescription, + SQLSMALLINT cbDescriptionMax, + SQLSMALLINT FAR *pcbDescription); + +SQLRETURN SQL_API_FN SQLDescribeCol (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLCHAR FAR *szColName, + SQLSMALLINT cbColNameMax, + SQLSMALLINT FAR *pcbColName, + SQLSMALLINT FAR *pfSqlType, + SQLULEN FAR *pcbColDef, + SQLSMALLINT FAR *pibScale, + SQLSMALLINT FAR *pfNullable); + +SQLRETURN SQL_API_FN SQLDisconnect (SQLHDBC hdbc); + +SQLRETURN SQL_API_FN SQLEndTran (SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT fType); + +SQLRETURN SQL_API_FN SQLError (SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + SQLCHAR FAR *szSqlState, + SQLINTEGER FAR *pfNativeError, + SQLCHAR FAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT FAR *pcbErrorMsg); + +SQLRETURN SQL_API_FN SQLExecDirect (SQLHSTMT hstmt, + SQLCHAR FAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API_FN SQLExecute (SQLHSTMT hstmt); + +SQLRETURN SQL_API_FN SQLFetch (SQLHSTMT hstmt); + + +SQLRETURN SQL_API SQLFetchScroll (SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, + SQLLEN FetchOffset); + +SQLRETURN SQL_API_FN SQLFreeConnect (SQLHDBC hdbc); + +SQLRETURN SQL_API_FN SQLFreeEnv (SQLHENV henv); + +SQLRETURN SQL_API_FN SQLFreeStmt (SQLHSTMT hstmt, + SQLUSMALLINT fOption); + +SQLRETURN SQL_API_FN SQLFreeHandle (SQLSMALLINT fHandleType, + SQLHANDLE hHandle); + +SQLRETURN SQL_API SQLGetConnectAttr (SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN SQL_API_FN SQLGetConnectOption ( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); + +SQLRETURN SQL_API_FN SQLGetCursorName (SQLHSTMT hstmt, + SQLCHAR FAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT FAR *pcbCursor); + +SQLRETURN SQL_API_FN SQLGetData (SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLSMALLINT fCType, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN FAR *pcbValue); + + +SQLRETURN SQL_API_FN SQLGetDescField( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN SQL_API_FN SQLGetDescRec( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLCHAR *Name, + SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, + SQLSMALLINT *Type, + SQLSMALLINT *SubType, + SQLLEN *Length, + SQLSMALLINT *Precision, + SQLSMALLINT *Scale, + SQLSMALLINT *Nullable); + +SQLRETURN SQL_API_FN SQLGetDiagField( SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT iRecNumber, + SQLSMALLINT fDiagIdentifier, + SQLPOINTER pDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT * pcbDiagInfo ); + + +SQLRETURN SQL_API_FN SQLGetDiagRec( SQLSMALLINT fHandleType, + SQLHANDLE hHandle, + SQLSMALLINT iRecNumber, + SQLCHAR * pszSqlState, + SQLINTEGER * pfNativeError, + SQLCHAR * pszErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT * pcbErrorMsg ); + +SQLRETURN SQL_API_FN SQLGetEnvAttr (SQLHENV henv, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER FAR *StringLength); + +SQLRETURN SQL_API_FN SQLGetFunctions (SQLHDBC hdbc, + SQLUSMALLINT fFunction, + SQLUSMALLINT FAR *pfExists); + + +SQLRETURN SQL_API_FN SQLGetInfo (SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT FAR *pcbInfoValue); + +SQLRETURN SQL_API SQLGetStmtAttr (SQLHSTMT StatementHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN SQL_API_FN SQLGetStmtOption (SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); + +SQLRETURN SQL_API_FN SQLGetTypeInfo (SQLHSTMT hstmt, + SQLSMALLINT fSqlType); + + +SQLRETURN SQL_API_FN SQLNumResultCols (SQLHSTMT hstmt, + SQLSMALLINT FAR *pccol); + + +SQLRETURN SQL_API_FN SQLParamData (SQLHSTMT hstmt, + SQLPOINTER FAR *prgbValue); + + +SQLRETURN SQL_API_FN SQLPrepare (SQLHSTMT hstmt, + SQLCHAR FAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API_FN SQLPutData (SQLHSTMT hstmt, + SQLPOINTER rgbValue, + SQLLEN cbValue); + +SQLRETURN SQL_API_FN SQLRowCount (SQLHSTMT hstmt, + SQLLEN FAR *pcrow); + + +SQLRETURN SQL_API_FN SQLSetConnectAttr( + SQLHDBC hdbc, + SQLINTEGER fOption, + SQLPOINTER pvParam, + SQLINTEGER fStrLen); + +SQLRETURN SQL_API_FN SQLSetConnectOption( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + ULONG vParam); + +SQLRETURN SQL_API_FN SQLSetCursorName (SQLHSTMT hstmt, + SQLCHAR FAR *szCursor, + SQLSMALLINT cbCursor); + + +SQLRETURN SQL_API_FN SQLSetDescField (SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength); + +SQLRETURN SQL_API_FN SQLSetDescRec (SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT Type, + SQLSMALLINT SubType, + SQLLEN Length, + SQLSMALLINT Precision, + SQLSMALLINT Scale, + SQLPOINTER Data, + SQLLEN *StringLength, + SQLLEN *Indicator); + +SQLRETURN SQL_API_FN SQLSetEnvAttr (SQLHENV henv, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER StringLength); + + +SQLRETURN SQL_API_FN SQLSetParam (SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbParamDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN FAR *pcbValue); + +SQLRETURN SQL_API_FN SQLSetStmtAttr (SQLHSTMT hstmt, + SQLINTEGER fOption, + SQLPOINTER pvParam, + SQLINTEGER fStrLen); + + +SQLRETURN SQL_API_FN SQLSetStmtOption (SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLULEN vParam); + +SQLRETURN SQL_API_FN SQLSpecialColumns(SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); + +SQLRETURN SQL_API_FN SQLStatistics (SQLHSTMT hstmt, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + + SQLUSMALLINT fAccuracy); + +SQLRETURN SQL_API_FN SQLTables (SQLHSTMT hstmt, + SQLCHAR FAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR FAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR FAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR FAR *szTableType, + SQLSMALLINT cbTableType); + +SQLRETURN SQL_API_FN SQLTransact (SQLHENV henv, + SQLHDBC hdbc, + SQLUSMALLINT fType); +#endif + + + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ + +#define GUID TAGGUID +typedef struct _TAGGUID { + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[ 8 ]; +} TAGGUID; + +#define __SQL +#include + +#undef GUID + +/* UNICODE versions */ + +#if defined(_WIN64) || defined(ODBC64) +SQLRETURN SQL_API SQLColAttributeW( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLLEN *pNumAttr); +#else + SQLRETURN SQL_API SQLColAttributeW( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLPOINTER pNumAttr); +#endif + +SQLRETURN SQL_API SQLColAttributesW( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); + +SQLRETURN SQL_API SQLConnectW( + SQLHDBC hdbc, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSN, + SQLWCHAR *szUID, + SQLSMALLINT cbUID, + SQLWCHAR *szAuthStr, + SQLSMALLINT cbAuthStr); + +SQLRETURN SQL_API SQLConnectWInt( + SQLHDBC hdbc, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSN, + SQLWCHAR *szUID, + SQLSMALLINT cbUID, + SQLWCHAR *szAuthStr, + SQLSMALLINT cbAuthStr); + + +SQLRETURN SQL_API SQLDescribeColW( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLWCHAR *szColName, + SQLSMALLINT cbColNameMax, + SQLSMALLINT *pcbColName, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbColDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + + +SQLRETURN SQL_API SQLErrorW( + SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + SQLWCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLWCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + +SQLRETURN SQL_API SQLExecDirectW( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API SQLGetConnectAttrW( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetCursorNameW( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT *pcbCursor); + +SQLRETURN SQL_API SQLSetDescFieldW(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength); + + + +SQLRETURN SQL_API SQLGetDescFieldW( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLSMALLINT iField, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetDescRecW( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLWCHAR *szName, + SQLSMALLINT cbNameMax, + SQLSMALLINT *pcbName, + SQLSMALLINT *pfType, + SQLSMALLINT *pfSubType, + SQLLEN *pLength, + SQLSMALLINT *pPrecision, + SQLSMALLINT *pScale, + SQLSMALLINT *pNullable); + +SQLRETURN SQL_API SQLGetDiagFieldW( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLSMALLINT fDiagField, + SQLPOINTER rgbDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT *pcbDiagInfo); + +SQLRETURN SQL_API SQLGetDiagRecW( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLWCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLWCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + +SQLRETURN SQL_API_FN SQLGetEnvAttrW( + SQLHENV hEnv, + SQLINTEGER fAttribute, + SQLPOINTER pParam, + SQLINTEGER cbParamMax, + SQLINTEGER * pcbParam ); + +SQLRETURN SQL_API SQLPrepareW( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API_FN SQLExtendedPrepareW( SQLHSTMT hStmt, + SQLWCHAR * pszSqlStrIn, + SQLINTEGER cbSqlStr, + SQLINTEGER cPars, + SQLSMALLINT sStmtType, + SQLINTEGER cStmtAttrs, + SQLINTEGER * piStmtAttr, + SQLINTEGER * pvParams ); + +SQLRETURN SQL_API SQLSetConnectAttrW( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValue); + +SQLRETURN SQL_API SQLSetCursorNameW( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursor); + +SQLRETURN SQL_API_FN SQLSetEnvAttrW( + SQLHENV hEnv, + SQLINTEGER fAttribute, + SQLPOINTER pParam, + SQLINTEGER cbParam ); + +SQLRETURN SQL_API SQLColumnsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLGetInfoW( + SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT *pcbInfoValue); + +SQLRETURN SQL_API_FN SQLGetConnectOptionW( + SQLHDBC hDbc, + SQLUSMALLINT fOptionIn, + SQLPOINTER pvParam ); + +SQLRETURN SQL_API_FN SQLSetConnectOptionW( + SQLHDBC hDbc, + SQLUSMALLINT fOptionIn, + SQLULEN vParam ); + +SQLRETURN SQL_API_FN SQLGetTypeInfoW( + SQLHSTMT hstmt, + SQLSMALLINT fSqlType); + +SQLRETURN SQL_API SQLSpecialColumnsW( + SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); + +SQLRETURN SQL_API SQLStatisticsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + SQLUSMALLINT fAccuracy); + +SQLRETURN SQL_API SQLTablesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szTableType, + SQLSMALLINT cbTableType); + + + +SQLRETURN SQL_API SQLDataSourcesW( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSNMax, + SQLSMALLINT *pcbDSN, + SQLWCHAR *szDescription, + SQLSMALLINT cbDescriptionMax, + SQLSMALLINT *pcbDescription); + + + + +SQLRETURN SQL_API SQLDriverConnectW( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + + +SQLRETURN SQL_API SQLBrowseConnectW( + SQLHDBC hdbc, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +SQLRETURN SQL_API SQLColumnPrivilegesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLGetStmtAttrW( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLSetStmtAttrW( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax); + +SQLRETURN SQL_API SQLForeignKeysW( + SQLHSTMT hstmt, + SQLWCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLWCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLWCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLWCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLWCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLWCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + + +SQLRETURN SQL_API SQLNativeSqlW( + SQLHDBC hdbc, + SQLWCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + + +SQLRETURN SQL_API SQLPrimaryKeysW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLProcedureColumnsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLProceduresW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName); + + +SQLRETURN SQL_API SQLTablePrivilegesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLDriversW( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLWCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLWCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); + +#endif /* __INFXSQL */ diff --git a/libraries/SQLAPI/include/informix/sqlext.h b/libraries/SQLAPI/include/informix/sqlext.h new file mode 100644 index 000000000..034e179e3 --- /dev/null +++ b/libraries/SQLAPI/include/informix/sqlext.h @@ -0,0 +1,2069 @@ +//----------------------------------------------------------------------------- +// File: sqlext.h +// +// Copyright: Copyright (c) Microsoft Corporation +// +// Contents: This is the include for applications using the Microsoft SQL Extensions +// +// Comments: +// +//----------------------------------------------------------------------------- + +#ifndef __SQLEXT +#define __SQLEXT + +#ifndef __SQL +#include "sql.h" +#endif + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +/* generally useful constants */ +#define SQL_SPEC_MAJOR 3 /* Major version of specification */ +#define SQL_SPEC_MINOR 52 /* Minor version of specification */ +#define SQL_SPEC_STRING "03.52" /* String constant for version */ + +#define SQL_SQLSTATE_SIZE 5 /* size of SQLSTATE */ +#define SQL_MAX_DSN_LENGTH 32 /* maximum data source name size */ + +#define SQL_MAX_OPTION_STRING_LENGTH 256 + +/* return code SQL_NO_DATA_FOUND is the same as SQL_NO_DATA */ +#if (ODBCVER < 0x0300) +#define SQL_NO_DATA_FOUND 100 +#else +#define SQL_NO_DATA_FOUND SQL_NO_DATA +#endif + +/* an end handle type */ +#if (ODBCVER >= 0x0300) +#define SQL_HANDLE_SENV 5 +#endif /* ODBCVER >= 0x0300 */ + +/* env attribute */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ODBC_VERSION 200 +#define SQL_ATTR_CONNECTION_POOLING 201 +#define SQL_ATTR_CP_MATCH 202 +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER >= 0x0300) +/* values for SQL_ATTR_CONNECTION_POOLING */ +#define SQL_CP_OFF 0UL +#define SQL_CP_ONE_PER_DRIVER 1UL +#define SQL_CP_ONE_PER_HENV 2UL +#define SQL_CP_DEFAULT SQL_CP_OFF + +/* values for SQL_ATTR_CP_MATCH */ +#define SQL_CP_STRICT_MATCH 0UL +#define SQL_CP_RELAXED_MATCH 1UL +#define SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH + +/* values for SQL_ATTR_ODBC_VERSION */ +#define SQL_OV_ODBC2 2UL +#define SQL_OV_ODBC3 3UL +#endif /* ODBCVER >= 0x0300 */ + +/* connection attributes */ +#define SQL_ACCESS_MODE 101 +#define SQL_AUTOCOMMIT 102 +#define SQL_LOGIN_TIMEOUT 103 +#define SQL_OPT_TRACE 104 +#define SQL_OPT_TRACEFILE 105 +#define SQL_TRANSLATE_DLL 106 +#define SQL_TRANSLATE_OPTION 107 +#define SQL_TXN_ISOLATION 108 +#define SQL_CURRENT_QUALIFIER 109 +#define SQL_ODBC_CURSORS 110 +#define SQL_QUIET_MODE 111 +#define SQL_PACKET_SIZE 112 + +/* connection attributes with new names */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE +#define SQL_ATTR_AUTOCOMMIT SQL_AUTOCOMMIT +#define SQL_ATTR_CONNECTION_TIMEOUT 113 +#define SQL_ATTR_CURRENT_CATALOG SQL_CURRENT_QUALIFIER +#define SQL_ATTR_DISCONNECT_BEHAVIOR 114 +#define SQL_ATTR_ENLIST_IN_DTC 1207 +#define SQL_ATTR_ENLIST_IN_XA 1208 +#define SQL_ATTR_LOGIN_TIMEOUT SQL_LOGIN_TIMEOUT +#define SQL_ATTR_ODBC_CURSORS SQL_ODBC_CURSORS +#define SQL_ATTR_PACKET_SIZE SQL_PACKET_SIZE +#define SQL_ATTR_QUIET_MODE SQL_QUIET_MODE +#define SQL_ATTR_TRACE SQL_OPT_TRACE +#define SQL_ATTR_TRACEFILE SQL_OPT_TRACEFILE +#define SQL_ATTR_TRANSLATE_LIB SQL_TRANSLATE_DLL +#define SQL_ATTR_TRANSLATE_OPTION SQL_TRANSLATE_OPTION +#define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION +#endif /* ODBCVER >= 0x0300 */ + +#define SQL_ATTR_CONNECTION_DEAD 1209 /* GetConnectAttr only */ + +#if (ODBCVER >= 0x0351) +/* ODBC Driver Manager sets this connection attribute to a unicode driver + (which supports SQLConnectW) when the application is an ANSI application + (which calls SQLConnect, SQLDriverConnect, or SQLBrowseConnect). + This is SetConnectAttr only and application does not set this attribute + This attribute was introduced because some unicode driver's some APIs may + need to behave differently on ANSI or Unicode applications. A unicode + driver, which has same behavior for both ANSI or Unicode applications, + should return SQL_ERROR when the driver manager sets this connection + attribute. When a unicode driver returns SQL_SUCCESS on this attribute, + the driver manager treates ANSI and Unicode connections differently in + connection pooling. +*/ +#define SQL_ATTR_ANSI_APP 115 +#endif + +/* SQL_CONNECT_OPT_DRVR_START is not meaningful for 3.0 driver */ +#if (ODBCVER < 0x0300) +#define SQL_CONNECT_OPT_DRVR_START 1000 +#endif /* ODBCVER < 0x0300 */ + +#if (ODBCVER < 0x0300) +#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE +#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE +#endif /* ODBCVER < 0x0300 */ + +/* SQL_ACCESS_MODE options */ +#define SQL_MODE_READ_WRITE 0UL +#define SQL_MODE_READ_ONLY 1UL +#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE + +/* SQL_AUTOCOMMIT options */ +#define SQL_AUTOCOMMIT_OFF 0UL +#define SQL_AUTOCOMMIT_ON 1UL +#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON + +/* SQL_LOGIN_TIMEOUT options */ +#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL + +/* SQL_OPT_TRACE options */ +#define SQL_OPT_TRACE_OFF 0UL +#define SQL_OPT_TRACE_ON 1UL +#define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF +#define SQL_OPT_TRACE_FILE_DEFAULT "\\SQL.LOG" + +/* SQL_ODBC_CURSORS options */ +#define SQL_CUR_USE_IF_NEEDED 0UL +#define SQL_CUR_USE_ODBC 1UL +#define SQL_CUR_USE_DRIVER 2UL +#define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER + +#if (ODBCVER >= 0x0300) +/* values for SQL_ATTR_DISCONNECT_BEHAVIOR */ +#define SQL_DB_RETURN_TO_POOL 0UL +#define SQL_DB_DISCONNECT 1UL +#define SQL_DB_DEFAULT SQL_DB_RETURN_TO_POOL + +/* values for SQL_ATTR_ENLIST_IN_DTC */ +#define SQL_DTC_DONE 0L +#endif /* ODBCVER >= 0x0300 */ + +/* values for SQL_ATTR_CONNECTION_DEAD */ +#define SQL_CD_TRUE 1L /* Connection is closed/dead */ +#define SQL_CD_FALSE 0L /* Connection is open/available */ + +/* values for SQL_ATTR_ANSI_APP */ +#if (ODBCVER >= 0x0351) +#define SQL_AA_TRUE 1L /* the application is an ANSI app */ +#define SQL_AA_FALSE 0L /* the application is a Unicode app */ +#endif + +/* statement attributes */ +#define SQL_QUERY_TIMEOUT 0 +#define SQL_MAX_ROWS 1 +#define SQL_NOSCAN 2 +#define SQL_MAX_LENGTH 3 +#define SQL_ASYNC_ENABLE 4 /* same as SQL_ATTR_ASYNC_ENABLE */ +#define SQL_BIND_TYPE 5 +#define SQL_CURSOR_TYPE 6 +#define SQL_CONCURRENCY 7 +#define SQL_KEYSET_SIZE 8 +#define SQL_ROWSET_SIZE 9 +#define SQL_SIMULATE_CURSOR 10 +#define SQL_RETRIEVE_DATA 11 +#define SQL_USE_BOOKMARKS 12 +#define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */ +#define SQL_ROW_NUMBER 14 /* GetStmtOption Only */ + +/* statement attributes for ODBC 3.0 */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ASYNC_ENABLE 4 +#define SQL_ATTR_CONCURRENCY SQL_CONCURRENCY +#define SQL_ATTR_CURSOR_TYPE SQL_CURSOR_TYPE +#define SQL_ATTR_ENABLE_AUTO_IPD 15 +#define SQL_ATTR_FETCH_BOOKMARK_PTR 16 +#define SQL_ATTR_KEYSET_SIZE SQL_KEYSET_SIZE +#define SQL_ATTR_MAX_LENGTH SQL_MAX_LENGTH +#define SQL_ATTR_MAX_ROWS SQL_MAX_ROWS +#define SQL_ATTR_NOSCAN SQL_NOSCAN +#define SQL_ATTR_PARAM_BIND_OFFSET_PTR 17 +#define SQL_ATTR_PARAM_BIND_TYPE 18 +#define SQL_ATTR_PARAM_OPERATION_PTR 19 +#define SQL_ATTR_PARAM_STATUS_PTR 20 +#define SQL_ATTR_PARAMS_PROCESSED_PTR 21 +#define SQL_ATTR_PARAMSET_SIZE 22 +#define SQL_ATTR_QUERY_TIMEOUT SQL_QUERY_TIMEOUT +#define SQL_ATTR_RETRIEVE_DATA SQL_RETRIEVE_DATA +#define SQL_ATTR_ROW_BIND_OFFSET_PTR 23 +#define SQL_ATTR_ROW_BIND_TYPE SQL_BIND_TYPE +#define SQL_ATTR_ROW_NUMBER SQL_ROW_NUMBER /*GetStmtAttr*/ +#define SQL_ATTR_ROW_OPERATION_PTR 24 +#define SQL_ATTR_ROW_STATUS_PTR 25 +#define SQL_ATTR_ROWS_FETCHED_PTR 26 +#define SQL_ATTR_ROW_ARRAY_SIZE 27 +#define SQL_ATTR_SIMULATE_CURSOR SQL_SIMULATE_CURSOR +#define SQL_ATTR_USE_BOOKMARKS SQL_USE_BOOKMARKS + +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER < 0x0300) +#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER +#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT +#endif /* ODBCVER < 0x0300 */ + +/* New defines for SEARCHABLE column in SQLGetTypeInfo */ + +#if (ODBCVER >= 0x0300) +#define SQL_COL_PRED_CHAR SQL_LIKE_ONLY +#define SQL_COL_PRED_BASIC SQL_ALL_EXCEPT_LIKE +#endif /* ODBCVER >= 0x0300 */ + + + +/* whether an attribute is a pointer or not */ +#if (ODBCVER >= 0x0300) +#define SQL_IS_POINTER (-4) +#define SQL_IS_UINTEGER (-5) +#define SQL_IS_INTEGER (-6) +#define SQL_IS_USMALLINT (-7) +#define SQL_IS_SMALLINT (-8) +#endif /* ODBCVER >= 0x0300 */ + +/* the value of SQL_ATTR_PARAM_BIND_TYPE */ +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_BIND_BY_COLUMN 0UL +#define SQL_PARAM_BIND_TYPE_DEFAULT SQL_PARAM_BIND_BY_COLUMN +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_QUERY_TIMEOUT options */ +#define SQL_QUERY_TIMEOUT_DEFAULT 0UL + +/* SQL_MAX_ROWS options */ +#define SQL_MAX_ROWS_DEFAULT 0UL + +/* SQL_NOSCAN options */ +#define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */ +#define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */ +#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF + +/* SQL_MAX_LENGTH options */ +#define SQL_MAX_LENGTH_DEFAULT 0UL + +/* values for SQL_ATTR_ASYNC_ENABLE */ +#define SQL_ASYNC_ENABLE_OFF 0UL +#define SQL_ASYNC_ENABLE_ON 1UL +#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF + +/* SQL_BIND_TYPE options */ +#define SQL_BIND_BY_COLUMN 0UL +#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN /* Default value */ + +/* SQL_CONCURRENCY options */ +#define SQL_CONCUR_READ_ONLY 1 +#define SQL_CONCUR_LOCK 2 +#define SQL_CONCUR_ROWVER 3 +#define SQL_CONCUR_VALUES 4 +#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY /* Default value */ + +/* SQL_CURSOR_TYPE options */ +#define SQL_CURSOR_FORWARD_ONLY 0UL +#define SQL_CURSOR_KEYSET_DRIVEN 1UL +#define SQL_CURSOR_DYNAMIC 2UL +#define SQL_CURSOR_STATIC 3UL +#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY /* Default value */ + +/* SQL_ROWSET_SIZE options */ +#define SQL_ROWSET_SIZE_DEFAULT 1UL + +/* SQL_KEYSET_SIZE options */ +#define SQL_KEYSET_SIZE_DEFAULT 0UL + +/* SQL_SIMULATE_CURSOR options */ +#define SQL_SC_NON_UNIQUE 0UL +#define SQL_SC_TRY_UNIQUE 1UL +#define SQL_SC_UNIQUE 2UL + +/* SQL_RETRIEVE_DATA options */ +#define SQL_RD_OFF 0UL +#define SQL_RD_ON 1UL +#define SQL_RD_DEFAULT SQL_RD_ON + +/* SQL_USE_BOOKMARKS options */ +#define SQL_UB_OFF 0UL +#define SQL_UB_ON 01UL +#define SQL_UB_DEFAULT SQL_UB_OFF + +/* New values for SQL_USE_BOOKMARKS attribute */ +#if (ODBCVER >= 0x0300) +#define SQL_UB_FIXED SQL_UB_ON +#define SQL_UB_VARIABLE 2UL +#endif /* ODBCVER >= 0x0300 */ + +/* extended descriptor field */ +#if (ODBCVER >= 0x0300) +#define SQL_DESC_ARRAY_SIZE 20 +#define SQL_DESC_ARRAY_STATUS_PTR 21 +#define SQL_DESC_AUTO_UNIQUE_VALUE SQL_COLUMN_AUTO_INCREMENT +#define SQL_DESC_BASE_COLUMN_NAME 22 +#define SQL_DESC_BASE_TABLE_NAME 23 +#define SQL_DESC_BIND_OFFSET_PTR 24 +#define SQL_DESC_BIND_TYPE 25 +#define SQL_DESC_CASE_SENSITIVE SQL_COLUMN_CASE_SENSITIVE +#define SQL_DESC_CATALOG_NAME SQL_COLUMN_QUALIFIER_NAME +#define SQL_DESC_CONCISE_TYPE SQL_COLUMN_TYPE +#define SQL_DESC_DATETIME_INTERVAL_PRECISION 26 +#define SQL_DESC_DISPLAY_SIZE SQL_COLUMN_DISPLAY_SIZE +#define SQL_DESC_FIXED_PREC_SCALE SQL_COLUMN_MONEY +#define SQL_DESC_LABEL SQL_COLUMN_LABEL +#define SQL_DESC_LITERAL_PREFIX 27 +#define SQL_DESC_LITERAL_SUFFIX 28 +#define SQL_DESC_LOCAL_TYPE_NAME 29 +#define SQL_DESC_MAXIMUM_SCALE 30 +#define SQL_DESC_MINIMUM_SCALE 31 +#define SQL_DESC_NUM_PREC_RADIX 32 +#define SQL_DESC_PARAMETER_TYPE 33 +#define SQL_DESC_ROWS_PROCESSED_PTR 34 +#if (ODBCVER >= 0x0350) +#define SQL_DESC_ROWVER 35 +#endif /* ODBCVER >= 0x0350 */ +#define SQL_DESC_SCHEMA_NAME SQL_COLUMN_OWNER_NAME +#define SQL_DESC_SEARCHABLE SQL_COLUMN_SEARCHABLE +#define SQL_DESC_TYPE_NAME SQL_COLUMN_TYPE_NAME +#define SQL_DESC_TABLE_NAME SQL_COLUMN_TABLE_NAME +#define SQL_DESC_UNSIGNED SQL_COLUMN_UNSIGNED +#define SQL_DESC_UPDATABLE SQL_COLUMN_UPDATABLE +#endif /* ODBCVER >= 0x0300 */ + + +/* defines for diagnostics fields */ +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_CURSOR_ROW_COUNT (-1249) +#define SQL_DIAG_ROW_NUMBER (-1248) +#define SQL_DIAG_COLUMN_NUMBER (-1247) +#endif /* ODBCVER >= 0x0300 */ + +/* SQL extended datatypes */ +#define SQL_DATE 9 +#if (ODBCVER >= 0x0300) +#define SQL_INTERVAL 10 +#endif /* ODBCVER >= 0x0300 */ +#define SQL_TIME 10 +#define SQL_TIMESTAMP 11 +#define SQL_LONGVARCHAR (-1) +#define SQL_BINARY (-2) +#define SQL_VARBINARY (-3) +#define SQL_LONGVARBINARY (-4) +#define SQL_BIGINT (-5) +#define SQL_TINYINT (-6) +#define SQL_BIT (-7) +#if (ODBCVER >= 0x0350) +#define SQL_GUID (-11) +#endif /* ODBCVER >= 0x0350 */ + +#if (ODBCVER >= 0x0300) +/* interval code */ +#define SQL_CODE_YEAR 1 +#define SQL_CODE_MONTH 2 +#define SQL_CODE_DAY 3 +#define SQL_CODE_HOUR 4 +#define SQL_CODE_MINUTE 5 +#define SQL_CODE_SECOND 6 +#define SQL_CODE_YEAR_TO_MONTH 7 +#define SQL_CODE_DAY_TO_HOUR 8 +#define SQL_CODE_DAY_TO_MINUTE 9 +#define SQL_CODE_DAY_TO_SECOND 10 +#define SQL_CODE_HOUR_TO_MINUTE 11 +#define SQL_CODE_HOUR_TO_SECOND 12 +#define SQL_CODE_MINUTE_TO_SECOND 13 + +#define SQL_INTERVAL_YEAR (100 + SQL_CODE_YEAR) +#define SQL_INTERVAL_MONTH (100 + SQL_CODE_MONTH) +#define SQL_INTERVAL_DAY (100 + SQL_CODE_DAY) +#define SQL_INTERVAL_HOUR (100 + SQL_CODE_HOUR) +#define SQL_INTERVAL_MINUTE (100 + SQL_CODE_MINUTE) +#define SQL_INTERVAL_SECOND (100 + SQL_CODE_SECOND) +#define SQL_INTERVAL_YEAR_TO_MONTH (100 + SQL_CODE_YEAR_TO_MONTH) +#define SQL_INTERVAL_DAY_TO_HOUR (100 + SQL_CODE_DAY_TO_HOUR) +#define SQL_INTERVAL_DAY_TO_MINUTE (100 + SQL_CODE_DAY_TO_MINUTE) +#define SQL_INTERVAL_DAY_TO_SECOND (100 + SQL_CODE_DAY_TO_SECOND) +#define SQL_INTERVAL_HOUR_TO_MINUTE (100 + SQL_CODE_HOUR_TO_MINUTE) +#define SQL_INTERVAL_HOUR_TO_SECOND (100 + SQL_CODE_HOUR_TO_SECOND) +#define SQL_INTERVAL_MINUTE_TO_SECOND (100 + SQL_CODE_MINUTE_TO_SECOND) + +#else +#define SQL_INTERVAL_YEAR (-80) +#define SQL_INTERVAL_MONTH (-81) +#define SQL_INTERVAL_YEAR_TO_MONTH (-82) +#define SQL_INTERVAL_DAY (-83) +#define SQL_INTERVAL_HOUR (-84) +#define SQL_INTERVAL_MINUTE (-85) +#define SQL_INTERVAL_SECOND (-86) +#define SQL_INTERVAL_DAY_TO_HOUR (-87) +#define SQL_INTERVAL_DAY_TO_MINUTE (-88) +#define SQL_INTERVAL_DAY_TO_SECOND (-89) +#define SQL_INTERVAL_HOUR_TO_MINUTE (-90) +#define SQL_INTERVAL_HOUR_TO_SECOND (-91) +#define SQL_INTERVAL_MINUTE_TO_SECOND (-92) +#endif /* ODBCVER >= 0x0300 */ + + +#if (ODBCVER <= 0x0300) +#define SQL_UNICODE (-95) +#define SQL_UNICODE_VARCHAR (-96) +#define SQL_UNICODE_LONGVARCHAR (-97) +#define SQL_UNICODE_CHAR SQL_UNICODE +#else +/* The previous definitions for SQL_UNICODE_ are historical and obsolete */ + +#define SQL_UNICODE SQL_WCHAR + +#define SQL_UNICODE_VARCHAR SQL_WVARCHAR +#define SQL_UNICODE_LONGVARCHAR SQL_WLONGVARCHAR +#define SQL_UNICODE_CHAR SQL_WCHAR +#endif + +#if (ODBCVER < 0x0300) +#define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR +#define SQL_TYPE_DRIVER_END SQL_UNICODE_LONGVARCHAR +#endif /* ODBCVER < 0x0300 */ + +/* C datatype to SQL datatype mapping SQL types + ------------------- */ +#define SQL_C_CHAR SQL_CHAR /* CHAR, VARCHAR, DECIMAL, NUMERIC */ +#define SQL_C_LONG SQL_INTEGER /* INTEGER */ +#define SQL_C_SHORT SQL_SMALLINT /* SMALLINT */ +#define SQL_C_FLOAT SQL_REAL /* REAL */ +#define SQL_C_DOUBLE SQL_DOUBLE /* FLOAT, DOUBLE */ +#if (ODBCVER >= 0x0300) +#define SQL_C_NUMERIC SQL_NUMERIC +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_DEFAULT 99 + +#define SQL_SIGNED_OFFSET (-20) +#define SQL_UNSIGNED_OFFSET (-22) + +/* C datatype to SQL datatype mapping */ +#define SQL_C_DATE SQL_DATE +#define SQL_C_TIME SQL_TIME +#define SQL_C_TIMESTAMP SQL_TIMESTAMP +#if (ODBCVER >= 0x0300) +#define SQL_C_TYPE_DATE SQL_TYPE_DATE +#define SQL_C_TYPE_TIME SQL_TYPE_TIME +#define SQL_C_TYPE_TIMESTAMP SQL_TYPE_TIMESTAMP +#define SQL_C_INTERVAL_YEAR SQL_INTERVAL_YEAR +#define SQL_C_INTERVAL_MONTH SQL_INTERVAL_MONTH +#define SQL_C_INTERVAL_DAY SQL_INTERVAL_DAY +#define SQL_C_INTERVAL_HOUR SQL_INTERVAL_HOUR +#define SQL_C_INTERVAL_MINUTE SQL_INTERVAL_MINUTE +#define SQL_C_INTERVAL_SECOND SQL_INTERVAL_SECOND +#define SQL_C_INTERVAL_YEAR_TO_MONTH SQL_INTERVAL_YEAR_TO_MONTH +#define SQL_C_INTERVAL_DAY_TO_HOUR SQL_INTERVAL_DAY_TO_HOUR +#define SQL_C_INTERVAL_DAY_TO_MINUTE SQL_INTERVAL_DAY_TO_MINUTE +#define SQL_C_INTERVAL_DAY_TO_SECOND SQL_INTERVAL_DAY_TO_SECOND +#define SQL_C_INTERVAL_HOUR_TO_MINUTE SQL_INTERVAL_HOUR_TO_MINUTE +#define SQL_C_INTERVAL_HOUR_TO_SECOND SQL_INTERVAL_HOUR_TO_SECOND +#define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_BINARY SQL_BINARY +#define SQL_C_BIT SQL_BIT +#if (ODBCVER >= 0x0300) +#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) /* SIGNED BIGINT */ +#define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED BIGINT */ +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_TINYINT SQL_TINYINT +#define SQL_C_SLONG (SQL_C_LONG+SQL_SIGNED_OFFSET) /* SIGNED INTEGER */ +#define SQL_C_SSHORT (SQL_C_SHORT+SQL_SIGNED_OFFSET) /* SIGNED SMALLINT */ +#define SQL_C_STINYINT (SQL_TINYINT+SQL_SIGNED_OFFSET) /* SIGNED TINYINT */ +#define SQL_C_ULONG (SQL_C_LONG+SQL_UNSIGNED_OFFSET) /* UNSIGNED INTEGER*/ +#define SQL_C_USHORT (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED SMALLINT*/ +#define SQL_C_UTINYINT (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED TINYINT*/ + +#ifdef _WIN64 +#define SQL_C_BOOKMARK SQL_C_UBIGINT /* BOOKMARK */ +#else +#define SQL_C_BOOKMARK SQL_C_ULONG /* BOOKMARK */ +#endif + +#if (ODBCVER >= 0x0350) +#define SQL_C_GUID SQL_GUID +#endif /* ODBCVER >= 0x0350 */ + +#define SQL_TYPE_NULL 0 +#if (ODBCVER < 0x0300) +#define SQL_TYPE_MIN SQL_BIT +#define SQL_TYPE_MAX SQL_VARCHAR +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_C_VARBOOKMARK SQL_C_BINARY +#endif /* ODBCVER >= 0x0300 */ + +/* define for SQL_DIAG_ROW_NUMBER and SQL_DIAG_COLUMN_NUMBER */ +#if (ODBCVER >= 0x0300) +#define SQL_NO_ROW_NUMBER (-1) +#define SQL_NO_COLUMN_NUMBER (-1) +#define SQL_ROW_NUMBER_UNKNOWN (-2) +#define SQL_COLUMN_NUMBER_UNKNOWN (-2) +#endif + +/* SQLBindParameter extensions */ +#define SQL_DEFAULT_PARAM (-5) +#define SQL_IGNORE (-6) +#if (ODBCVER >= 0x0300) +#define SQL_COLUMN_IGNORE SQL_IGNORE +#endif /* ODBCVER >= 0x0300 */ +#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) +#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET) + +/* binary length for driver specific attributes */ +#define SQL_LEN_BINARY_ATTR_OFFSET (-100) +#define SQL_LEN_BINARY_ATTR(length) (-(length)+SQL_LEN_BINARY_ATTR_OFFSET) + +/* Defines used by Driver Manager when mapping SQLSetParam to SQLBindParameter +*/ +#define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT +#define SQL_SETPARAM_VALUE_MAX (-1L) + +/* SQLColAttributes defines */ +#define SQL_COLUMN_COUNT 0 +#define SQL_COLUMN_NAME 1 +#define SQL_COLUMN_TYPE 2 +#define SQL_COLUMN_LENGTH 3 +#define SQL_COLUMN_PRECISION 4 +#define SQL_COLUMN_SCALE 5 +#define SQL_COLUMN_DISPLAY_SIZE 6 +#define SQL_COLUMN_NULLABLE 7 +#define SQL_COLUMN_UNSIGNED 8 +#define SQL_COLUMN_MONEY 9 +#define SQL_COLUMN_UPDATABLE 10 +#define SQL_COLUMN_AUTO_INCREMENT 11 +#define SQL_COLUMN_CASE_SENSITIVE 12 +#define SQL_COLUMN_SEARCHABLE 13 +#define SQL_COLUMN_TYPE_NAME 14 +#define SQL_COLUMN_TABLE_NAME 15 +#define SQL_COLUMN_OWNER_NAME 16 +#define SQL_COLUMN_QUALIFIER_NAME 17 +#define SQL_COLUMN_LABEL 18 +#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL +#if (ODBCVER < 0x0300) +#define SQL_COLUMN_DRIVER_START 1000 +#endif /* ODBCVER < 0x0300 */ + +#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT + +/* SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE */ +#define SQL_ATTR_READONLY 0 +#define SQL_ATTR_WRITE 1 +#define SQL_ATTR_READWRITE_UNKNOWN 2 + +/* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */ +/* These are also used by SQLGetInfo */ +#define SQL_UNSEARCHABLE 0 +#define SQL_LIKE_ONLY 1 +#define SQL_ALL_EXCEPT_LIKE 2 +#define SQL_SEARCHABLE 3 +#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE + + +/* Special return values for SQLGetData */ +#define SQL_NO_TOTAL (-4) + +/********************************************/ +/* SQLGetFunctions: additional values for */ +/* fFunction to represent functions that */ +/* are not in the X/Open spec. */ +/********************************************/ + +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLALLOCHANDLESTD 73 +#define SQL_API_SQLBULKOPERATIONS 24 +#endif /* ODBCVER >= 0x0300 */ +#define SQL_API_SQLBINDPARAMETER 72 +#define SQL_API_SQLBROWSECONNECT 55 +#define SQL_API_SQLCOLATTRIBUTES 6 +#define SQL_API_SQLCOLUMNPRIVILEGES 56 +#define SQL_API_SQLDESCRIBEPARAM 58 +#define SQL_API_SQLDRIVERCONNECT 41 +#define SQL_API_SQLDRIVERS 71 +#define SQL_API_SQLEXTENDEDFETCH 59 +#define SQL_API_SQLFOREIGNKEYS 60 +#define SQL_API_SQLMORERESULTS 61 +#define SQL_API_SQLNATIVESQL 62 +#define SQL_API_SQLNUMPARAMS 63 +#define SQL_API_SQLPARAMOPTIONS 64 +#define SQL_API_SQLPRIMARYKEYS 65 +#define SQL_API_SQLPROCEDURECOLUMNS 66 +#define SQL_API_SQLPROCEDURES 67 +#define SQL_API_SQLSETPOS 68 +#define SQL_API_SQLSETSCROLLOPTIONS 69 +#define SQL_API_SQLTABLEPRIVILEGES 70 + +/*-------------------------------------------*/ +/* SQL_EXT_API_LAST is not useful with ODBC */ +/* version 3.0 because some of the values */ +/* from X/Open are in the 10000 range. */ +/*-------------------------------------------*/ + +#if (ODBCVER < 0x0300) +#define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER +#define SQL_NUM_FUNCTIONS 23 +#define SQL_EXT_API_START 40 +#define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1) +#endif + +/*--------------------------------------------*/ +/* SQL_API_ALL_FUNCTIONS returns an array */ +/* of 'booleans' representing whether a */ +/* function is implemented by the driver. */ +/* */ +/* CAUTION: Only functions defined in ODBC */ +/* version 2.0 and earlier are returned, the */ +/* new high-range function numbers defined by */ +/* X/Open break this scheme. See the new */ +/* method -- SQL_API_ODBC3_ALL_FUNCTIONS */ +/*--------------------------------------------*/ + +#define SQL_API_ALL_FUNCTIONS 0 /* See CAUTION above */ + +/*----------------------------------------------*/ +/* 2.X drivers export a dummy function with */ +/* ordinal number SQL_API_LOADBYORDINAL to speed*/ +/* loading under the windows operating system. */ +/* */ +/* CAUTION: Loading by ordinal is not supported */ +/* for 3.0 and above drivers. */ +/*----------------------------------------------*/ + +#define SQL_API_LOADBYORDINAL 199 /* See CAUTION above */ + +/*----------------------------------------------*/ +/* SQL_API_ODBC3_ALL_FUNCTIONS */ +/* This returns a bitmap, which allows us to */ +/* handle the higher-valued function numbers. */ +/* Use SQL_FUNC_EXISTS(bitmap,function_number) */ +/* to determine if the function exists. */ +/*----------------------------------------------*/ + + +#if (ODBCVER >= 0x0300) +#define SQL_API_ODBC3_ALL_FUNCTIONS 999 +#define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE 250 /* array of 250 words */ + +#define SQL_FUNC_EXISTS(pfExists, uwAPI) \ + ((*(((UWORD*) (pfExists)) + ((uwAPI) >> 4)) \ + & (1 << ((uwAPI) & 0x000F)) \ + ) ? SQL_TRUE : SQL_FALSE \ + ) +#endif /* ODBCVER >= 0x0300 */ + + +/************************************************/ +/* Extended definitions for SQLGetInfo */ +/************************************************/ + +/*---------------------------------*/ +/* Values in ODBC 2.0 that are not */ +/* in the X/Open spec */ +/*---------------------------------*/ + +#define SQL_INFO_FIRST 0 +#define SQL_ACTIVE_CONNECTIONS 0 /* MAX_DRIVER_CONNECTIONS */ +#define SQL_ACTIVE_STATEMENTS 1 /* MAX_CONCURRENT_ACTIVITIES */ +#define SQL_DRIVER_HDBC 3 +#define SQL_DRIVER_HENV 4 +#define SQL_DRIVER_HSTMT 5 +#define SQL_DRIVER_NAME 6 +#define SQL_DRIVER_VER 7 +#define SQL_ODBC_API_CONFORMANCE 9 +#define SQL_ODBC_VER 10 +#define SQL_ROW_UPDATES 11 +#define SQL_ODBC_SAG_CLI_CONFORMANCE 12 +#define SQL_ODBC_SQL_CONFORMANCE 15 +#define SQL_PROCEDURES 21 +#define SQL_CONCAT_NULL_BEHAVIOR 22 +#define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 +#define SQL_EXPRESSIONS_IN_ORDERBY 27 +#define SQL_MAX_OWNER_NAME_LEN 32 /* MAX_SCHEMA_NAME_LEN */ +#define SQL_MAX_PROCEDURE_NAME_LEN 33 +#define SQL_MAX_QUALIFIER_NAME_LEN 34 /* MAX_CATALOG_NAME_LEN */ +#define SQL_MULT_RESULT_SETS 36 +#define SQL_MULTIPLE_ACTIVE_TXN 37 +#define SQL_OUTER_JOINS 38 +#define SQL_OWNER_TERM 39 +#define SQL_PROCEDURE_TERM 40 +#define SQL_QUALIFIER_NAME_SEPARATOR 41 +#define SQL_QUALIFIER_TERM 42 +#define SQL_SCROLL_OPTIONS 44 +#define SQL_TABLE_TERM 45 +#define SQL_CONVERT_FUNCTIONS 48 +#define SQL_NUMERIC_FUNCTIONS 49 +#define SQL_STRING_FUNCTIONS 50 +#define SQL_SYSTEM_FUNCTIONS 51 +#define SQL_TIMEDATE_FUNCTIONS 52 +#define SQL_CONVERT_BIGINT 53 +#define SQL_CONVERT_BINARY 54 +#define SQL_CONVERT_BIT 55 +#define SQL_CONVERT_CHAR 56 +#define SQL_CONVERT_DATE 57 +#define SQL_CONVERT_DECIMAL 58 +#define SQL_CONVERT_DOUBLE 59 +#define SQL_CONVERT_FLOAT 60 +#define SQL_CONVERT_INTEGER 61 +#define SQL_CONVERT_LONGVARCHAR 62 +#define SQL_CONVERT_NUMERIC 63 +#define SQL_CONVERT_REAL 64 +#define SQL_CONVERT_SMALLINT 65 +#define SQL_CONVERT_TIME 66 +#define SQL_CONVERT_TIMESTAMP 67 +#define SQL_CONVERT_TINYINT 68 +#define SQL_CONVERT_VARBINARY 69 +#define SQL_CONVERT_VARCHAR 70 +#define SQL_CONVERT_LONGVARBINARY 71 +#define SQL_ODBC_SQL_OPT_IEF 73 /* SQL_INTEGRITY */ +#define SQL_CORRELATION_NAME 74 +#define SQL_NON_NULLABLE_COLUMNS 75 +#define SQL_DRIVER_HLIB 76 +#define SQL_DRIVER_ODBC_VER 77 +#define SQL_LOCK_TYPES 78 +#define SQL_POS_OPERATIONS 79 +#define SQL_POSITIONED_STATEMENTS 80 +#define SQL_BOOKMARK_PERSISTENCE 82 +#define SQL_STATIC_SENSITIVITY 83 +#define SQL_FILE_USAGE 84 +#define SQL_COLUMN_ALIAS 87 +#define SQL_GROUP_BY 88 +#define SQL_KEYWORDS 89 +#define SQL_OWNER_USAGE 91 +#define SQL_QUALIFIER_USAGE 92 +#define SQL_QUOTED_IDENTIFIER_CASE 93 +#define SQL_SUBQUERIES 95 +#define SQL_UNION 96 +#define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103 +#define SQL_MAX_CHAR_LITERAL_LEN 108 +#define SQL_TIMEDATE_ADD_INTERVALS 109 +#define SQL_TIMEDATE_DIFF_INTERVALS 110 +#define SQL_NEED_LONG_DATA_LEN 111 +#define SQL_MAX_BINARY_LITERAL_LEN 112 +#define SQL_LIKE_ESCAPE_CLAUSE 113 +#define SQL_QUALIFIER_LOCATION 114 + +#if (ODBCVER >= 0x0201 && ODBCVER < 0x0300) +#define SQL_OJ_CAPABILITIES 65003 /* Temp value until ODBC 3.0 */ +#endif /* ODBCVER >= 0x0201 && ODBCVER < 0x0300 */ + +/*----------------------------------------------*/ +/* SQL_INFO_LAST and SQL_INFO_DRIVER_START are */ +/* not useful anymore, because X/Open has */ +/* values in the 10000 range. You */ +/* must contact X/Open directly to get a range */ +/* of numbers for driver-specific values. */ +/*----------------------------------------------*/ + +#if (ODBCVER < 0x0300) +#define SQL_INFO_LAST SQL_QUALIFIER_LOCATION +#define SQL_INFO_DRIVER_START 1000 +#endif /* ODBCVER < 0x0300 */ + +/*-----------------------------------------------*/ +/* ODBC 3.0 SQLGetInfo values that are not part */ +/* of the X/Open standard at this time. X/Open */ +/* standard values are in sql.h. */ +/*-----------------------------------------------*/ + +#if (ODBCVER >= 0x0300) +#define SQL_ACTIVE_ENVIRONMENTS 116 +#define SQL_ALTER_DOMAIN 117 + +#define SQL_SQL_CONFORMANCE 118 +#define SQL_DATETIME_LITERALS 119 + +#define SQL_ASYNC_MODE 10021 /* new X/Open spec */ +#define SQL_BATCH_ROW_COUNT 120 +#define SQL_BATCH_SUPPORT 121 +#define SQL_CATALOG_LOCATION SQL_QUALIFIER_LOCATION +#define SQL_CATALOG_NAME_SEPARATOR SQL_QUALIFIER_NAME_SEPARATOR +#define SQL_CATALOG_TERM SQL_QUALIFIER_TERM +#define SQL_CATALOG_USAGE SQL_QUALIFIER_USAGE +#define SQL_CONVERT_WCHAR 122 +#define SQL_CONVERT_INTERVAL_DAY_TIME 123 +#define SQL_CONVERT_INTERVAL_YEAR_MONTH 124 +#define SQL_CONVERT_WLONGVARCHAR 125 +#define SQL_CONVERT_WVARCHAR 126 +#define SQL_CREATE_ASSERTION 127 +#define SQL_CREATE_CHARACTER_SET 128 +#define SQL_CREATE_COLLATION 129 +#define SQL_CREATE_DOMAIN 130 +#define SQL_CREATE_SCHEMA 131 +#define SQL_CREATE_TABLE 132 +#define SQL_CREATE_TRANSLATION 133 +#define SQL_CREATE_VIEW 134 +#define SQL_DRIVER_HDESC 135 +#define SQL_DROP_ASSERTION 136 +#define SQL_DROP_CHARACTER_SET 137 +#define SQL_DROP_COLLATION 138 +#define SQL_DROP_DOMAIN 139 +#define SQL_DROP_SCHEMA 140 +#define SQL_DROP_TABLE 141 +#define SQL_DROP_TRANSLATION 142 +#define SQL_DROP_VIEW 143 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES1 144 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES2 145 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 146 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 147 +#define SQL_INDEX_KEYWORDS 148 +#define SQL_INFO_SCHEMA_VIEWS 149 +#define SQL_KEYSET_CURSOR_ATTRIBUTES1 150 +#define SQL_KEYSET_CURSOR_ATTRIBUTES2 151 +#define SQL_MAX_ASYNC_CONCURRENT_STATEMENTS 10022 /* new X/Open spec */ +#define SQL_ODBC_INTERFACE_CONFORMANCE 152 +#define SQL_PARAM_ARRAY_ROW_COUNTS 153 +#define SQL_PARAM_ARRAY_SELECTS 154 +#define SQL_SCHEMA_TERM SQL_OWNER_TERM +#define SQL_SCHEMA_USAGE SQL_OWNER_USAGE +#define SQL_SQL92_DATETIME_FUNCTIONS 155 +#define SQL_SQL92_FOREIGN_KEY_DELETE_RULE 156 +#define SQL_SQL92_FOREIGN_KEY_UPDATE_RULE 157 +#define SQL_SQL92_GRANT 158 +#define SQL_SQL92_NUMERIC_VALUE_FUNCTIONS 159 +#define SQL_SQL92_PREDICATES 160 +#define SQL_SQL92_RELATIONAL_JOIN_OPERATORS 161 +#define SQL_SQL92_REVOKE 162 +#define SQL_SQL92_ROW_VALUE_CONSTRUCTOR 163 +#define SQL_SQL92_STRING_FUNCTIONS 164 +#define SQL_SQL92_VALUE_EXPRESSIONS 165 +#define SQL_STANDARD_CLI_CONFORMANCE 166 +#define SQL_STATIC_CURSOR_ATTRIBUTES1 167 +#define SQL_STATIC_CURSOR_ATTRIBUTES2 168 + +#define SQL_AGGREGATE_FUNCTIONS 169 +#define SQL_DDL_INDEX 170 +#define SQL_DM_VER 171 +#define SQL_INSERT_STATEMENT 172 +#define SQL_CONVERT_GUID 173 +#define SQL_UNION_STATEMENT SQL_UNION +#endif /* ODBCVER >= 0x0300 */ + +#define SQL_DTC_TRANSITION_COST 1750 + +/* SQL_ALTER_TABLE bitmasks */ +#if (ODBCVER >= 0x0300) +/* the following 5 bitmasks are defined in sql.h +*#define SQL_AT_ADD_COLUMN 0x00000001L +*#define SQL_AT_DROP_COLUMN 0x00000002L +*#define SQL_AT_ADD_CONSTRAINT 0x00000008L +*/ +#define SQL_AT_ADD_COLUMN_SINGLE 0x00000020L +#define SQL_AT_ADD_COLUMN_DEFAULT 0x00000040L +#define SQL_AT_ADD_COLUMN_COLLATION 0x00000080L +#define SQL_AT_SET_COLUMN_DEFAULT 0x00000100L +#define SQL_AT_DROP_COLUMN_DEFAULT 0x00000200L +#define SQL_AT_DROP_COLUMN_CASCADE 0x00000400L +#define SQL_AT_DROP_COLUMN_RESTRICT 0x00000800L +#define SQL_AT_ADD_TABLE_CONSTRAINT 0x00001000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE 0x00002000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT 0x00004000L +#define SQL_AT_CONSTRAINT_NAME_DEFINITION 0x00008000L +#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED 0x00010000L +#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00020000L +#define SQL_AT_CONSTRAINT_DEFERRABLE 0x00040000L +#define SQL_AT_CONSTRAINT_NON_DEFERRABLE 0x00080000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_CONVERT_* return value bitmasks */ + +#define SQL_CVT_CHAR 0x00000001L +#define SQL_CVT_NUMERIC 0x00000002L +#define SQL_CVT_DECIMAL 0x00000004L +#define SQL_CVT_INTEGER 0x00000008L +#define SQL_CVT_SMALLINT 0x00000010L +#define SQL_CVT_FLOAT 0x00000020L +#define SQL_CVT_REAL 0x00000040L +#define SQL_CVT_DOUBLE 0x00000080L +#define SQL_CVT_VARCHAR 0x00000100L +#define SQL_CVT_LONGVARCHAR 0x00000200L +#define SQL_CVT_BINARY 0x00000400L +#define SQL_CVT_VARBINARY 0x00000800L +#define SQL_CVT_BIT 0x00001000L +#define SQL_CVT_TINYINT 0x00002000L +#define SQL_CVT_BIGINT 0x00004000L +#define SQL_CVT_DATE 0x00008000L +#define SQL_CVT_TIME 0x00010000L +#define SQL_CVT_TIMESTAMP 0x00020000L +#define SQL_CVT_LONGVARBINARY 0x00040000L +#if (ODBCVER >= 0x0300) +#define SQL_CVT_INTERVAL_YEAR_MONTH 0x00080000L +#define SQL_CVT_INTERVAL_DAY_TIME 0x00100000L +#define SQL_CVT_WCHAR 0x00200000L +#define SQL_CVT_WLONGVARCHAR 0x00400000L +#define SQL_CVT_WVARCHAR 0x00800000L +#define SQL_CVT_GUID 0x01000000L + +#endif /* ODBCVER >= 0x0300 */ + + +/* SQL_CONVERT_FUNCTIONS functions */ +#define SQL_FN_CVT_CONVERT 0x00000001L +#if (ODBCVER >= 0x0300) +#define SQL_FN_CVT_CAST 0x00000002L +#endif /* ODBCVER >= 0x0300 */ + + +/* SQL_STRING_FUNCTIONS functions */ + +#define SQL_FN_STR_CONCAT 0x00000001L +#define SQL_FN_STR_INSERT 0x00000002L +#define SQL_FN_STR_LEFT 0x00000004L +#define SQL_FN_STR_LTRIM 0x00000008L +#define SQL_FN_STR_LENGTH 0x00000010L +#define SQL_FN_STR_LOCATE 0x00000020L +#define SQL_FN_STR_LCASE 0x00000040L +#define SQL_FN_STR_REPEAT 0x00000080L +#define SQL_FN_STR_REPLACE 0x00000100L +#define SQL_FN_STR_RIGHT 0x00000200L +#define SQL_FN_STR_RTRIM 0x00000400L +#define SQL_FN_STR_SUBSTRING 0x00000800L +#define SQL_FN_STR_UCASE 0x00001000L +#define SQL_FN_STR_ASCII 0x00002000L +#define SQL_FN_STR_CHAR 0x00004000L +#define SQL_FN_STR_DIFFERENCE 0x00008000L +#define SQL_FN_STR_LOCATE_2 0x00010000L +#define SQL_FN_STR_SOUNDEX 0x00020000L +#define SQL_FN_STR_SPACE 0x00040000L +#if (ODBCVER >= 0x0300) +#define SQL_FN_STR_BIT_LENGTH 0x00080000L +#define SQL_FN_STR_CHAR_LENGTH 0x00100000L +#define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L +#define SQL_FN_STR_OCTET_LENGTH 0x00400000L +#define SQL_FN_STR_POSITION 0x00800000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SQL92_STRING_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SSF_CONVERT 0x00000001L +#define SQL_SSF_LOWER 0x00000002L +#define SQL_SSF_UPPER 0x00000004L +#define SQL_SSF_SUBSTRING 0x00000008L +#define SQL_SSF_TRANSLATE 0x00000010L +#define SQL_SSF_TRIM_BOTH 0x00000020L +#define SQL_SSF_TRIM_LEADING 0x00000040L +#define SQL_SSF_TRIM_TRAILING 0x00000080L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_NUMERIC_FUNCTIONS functions */ + +#define SQL_FN_NUM_ABS 0x00000001L +#define SQL_FN_NUM_ACOS 0x00000002L +#define SQL_FN_NUM_ASIN 0x00000004L +#define SQL_FN_NUM_ATAN 0x00000008L +#define SQL_FN_NUM_ATAN2 0x00000010L +#define SQL_FN_NUM_CEILING 0x00000020L +#define SQL_FN_NUM_COS 0x00000040L +#define SQL_FN_NUM_COT 0x00000080L +#define SQL_FN_NUM_EXP 0x00000100L +#define SQL_FN_NUM_FLOOR 0x00000200L +#define SQL_FN_NUM_LOG 0x00000400L +#define SQL_FN_NUM_MOD 0x00000800L +#define SQL_FN_NUM_SIGN 0x00001000L +#define SQL_FN_NUM_SIN 0x00002000L +#define SQL_FN_NUM_SQRT 0x00004000L +#define SQL_FN_NUM_TAN 0x00008000L +#define SQL_FN_NUM_PI 0x00010000L +#define SQL_FN_NUM_RAND 0x00020000L +#define SQL_FN_NUM_DEGREES 0x00040000L +#define SQL_FN_NUM_LOG10 0x00080000L +#define SQL_FN_NUM_POWER 0x00100000L +#define SQL_FN_NUM_RADIANS 0x00200000L +#define SQL_FN_NUM_ROUND 0x00400000L +#define SQL_FN_NUM_TRUNCATE 0x00800000L + +/* SQL_SQL92_NUMERIC_VALUE_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SNVF_BIT_LENGTH 0x00000001L +#define SQL_SNVF_CHAR_LENGTH 0x00000002L +#define SQL_SNVF_CHARACTER_LENGTH 0x00000004L +#define SQL_SNVF_EXTRACT 0x00000008L +#define SQL_SNVF_OCTET_LENGTH 0x00000010L +#define SQL_SNVF_POSITION 0x00000020L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_TIMEDATE_FUNCTIONS functions */ + +#define SQL_FN_TD_NOW 0x00000001L +#define SQL_FN_TD_CURDATE 0x00000002L +#define SQL_FN_TD_DAYOFMONTH 0x00000004L +#define SQL_FN_TD_DAYOFWEEK 0x00000008L +#define SQL_FN_TD_DAYOFYEAR 0x00000010L +#define SQL_FN_TD_MONTH 0x00000020L +#define SQL_FN_TD_QUARTER 0x00000040L +#define SQL_FN_TD_WEEK 0x00000080L +#define SQL_FN_TD_YEAR 0x00000100L +#define SQL_FN_TD_CURTIME 0x00000200L +#define SQL_FN_TD_HOUR 0x00000400L +#define SQL_FN_TD_MINUTE 0x00000800L +#define SQL_FN_TD_SECOND 0x00001000L +#define SQL_FN_TD_TIMESTAMPADD 0x00002000L +#define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L +#define SQL_FN_TD_DAYNAME 0x00008000L +#define SQL_FN_TD_MONTHNAME 0x00010000L +#if (ODBCVER >= 0x0300) +#define SQL_FN_TD_CURRENT_DATE 0x00020000L +#define SQL_FN_TD_CURRENT_TIME 0x00040000L +#define SQL_FN_TD_CURRENT_TIMESTAMP 0x00080000L +#define SQL_FN_TD_EXTRACT 0x00100000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SQL92_DATETIME_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SDF_CURRENT_DATE 0x00000001L +#define SQL_SDF_CURRENT_TIME 0x00000002L +#define SQL_SDF_CURRENT_TIMESTAMP 0x00000004L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SYSTEM_FUNCTIONS functions */ + +#define SQL_FN_SYS_USERNAME 0x00000001L +#define SQL_FN_SYS_DBNAME 0x00000002L +#define SQL_FN_SYS_IFNULL 0x00000004L + +/* SQL_TIMEDATE_ADD_INTERVALS and SQL_TIMEDATE_DIFF_INTERVALS functions */ + +#define SQL_FN_TSI_FRAC_SECOND 0x00000001L +#define SQL_FN_TSI_SECOND 0x00000002L +#define SQL_FN_TSI_MINUTE 0x00000004L +#define SQL_FN_TSI_HOUR 0x00000008L +#define SQL_FN_TSI_DAY 0x00000010L +#define SQL_FN_TSI_WEEK 0x00000020L +#define SQL_FN_TSI_MONTH 0x00000040L +#define SQL_FN_TSI_QUARTER 0x00000080L +#define SQL_FN_TSI_YEAR 0x00000100L + +/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES1, + * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1, + * SQL_KEYSET_CURSOR_ATTRIBUTES1, and SQL_STATIC_CURSOR_ATTRIBUTES1 + */ +#if (ODBCVER >= 0x0300) +/* supported SQLFetchScroll FetchOrientation's */ +#define SQL_CA1_NEXT 0x00000001L +#define SQL_CA1_ABSOLUTE 0x00000002L +#define SQL_CA1_RELATIVE 0x00000004L +#define SQL_CA1_BOOKMARK 0x00000008L + +/* supported SQLSetPos LockType's */ +#define SQL_CA1_LOCK_NO_CHANGE 0x00000040L +#define SQL_CA1_LOCK_EXCLUSIVE 0x00000080L +#define SQL_CA1_LOCK_UNLOCK 0x00000100L + +/* supported SQLSetPos Operations */ +#define SQL_CA1_POS_POSITION 0x00000200L +#define SQL_CA1_POS_UPDATE 0x00000400L +#define SQL_CA1_POS_DELETE 0x00000800L +#define SQL_CA1_POS_REFRESH 0x00001000L + +/* positioned updates and deletes */ +#define SQL_CA1_POSITIONED_UPDATE 0x00002000L +#define SQL_CA1_POSITIONED_DELETE 0x00004000L +#define SQL_CA1_SELECT_FOR_UPDATE 0x00008000L + +/* supported SQLBulkOperations operations */ +#define SQL_CA1_BULK_ADD 0x00010000L +#define SQL_CA1_BULK_UPDATE_BY_BOOKMARK 0x00020000L +#define SQL_CA1_BULK_DELETE_BY_BOOKMARK 0x00040000L +#define SQL_CA1_BULK_FETCH_BY_BOOKMARK 0x00080000L +#endif /* ODBCVER >= 0x0300 */ + +/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES2, + * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2, + * SQL_KEYSET_CURSOR_ATTRIBUTES2, and SQL_STATIC_CURSOR_ATTRIBUTES2 + */ +#if (ODBCVER >= 0x0300) +/* supported values for SQL_ATTR_SCROLL_CONCURRENCY */ +#define SQL_CA2_READ_ONLY_CONCURRENCY 0x00000001L +#define SQL_CA2_LOCK_CONCURRENCY 0x00000002L +#define SQL_CA2_OPT_ROWVER_CONCURRENCY 0x00000004L +#define SQL_CA2_OPT_VALUES_CONCURRENCY 0x00000008L + +/* sensitivity of the cursor to its own inserts, deletes, and updates */ +#define SQL_CA2_SENSITIVITY_ADDITIONS 0x00000010L +#define SQL_CA2_SENSITIVITY_DELETIONS 0x00000020L +#define SQL_CA2_SENSITIVITY_UPDATES 0x00000040L + +/* semantics of SQL_ATTR_MAX_ROWS */ +#define SQL_CA2_MAX_ROWS_SELECT 0x00000080L +#define SQL_CA2_MAX_ROWS_INSERT 0x00000100L +#define SQL_CA2_MAX_ROWS_DELETE 0x00000200L +#define SQL_CA2_MAX_ROWS_UPDATE 0x00000400L +#define SQL_CA2_MAX_ROWS_CATALOG 0x00000800L +#define SQL_CA2_MAX_ROWS_AFFECTS_ALL (SQL_CA2_MAX_ROWS_SELECT | \ + SQL_CA2_MAX_ROWS_INSERT | SQL_CA2_MAX_ROWS_DELETE | \ + SQL_CA2_MAX_ROWS_UPDATE | SQL_CA2_MAX_ROWS_CATALOG) + +/* semantics of SQL_DIAG_CURSOR_ROW_COUNT */ +#define SQL_CA2_CRC_EXACT 0x00001000L +#define SQL_CA2_CRC_APPROXIMATE 0x00002000L + +/* the kinds of positioned statements that can be simulated */ +#define SQL_CA2_SIMULATE_NON_UNIQUE 0x00004000L +#define SQL_CA2_SIMULATE_TRY_UNIQUE 0x00008000L +#define SQL_CA2_SIMULATE_UNIQUE 0x00010000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_ODBC_API_CONFORMANCE values */ + +#define SQL_OAC_NONE 0x0000 +#define SQL_OAC_LEVEL1 0x0001 +#define SQL_OAC_LEVEL2 0x0002 + +/* SQL_ODBC_SAG_CLI_CONFORMANCE values */ + +#define SQL_OSCC_NOT_COMPLIANT 0x0000 +#define SQL_OSCC_COMPLIANT 0x0001 + +/* SQL_ODBC_SQL_CONFORMANCE values */ + +#define SQL_OSC_MINIMUM 0x0000 +#define SQL_OSC_CORE 0x0001 +#define SQL_OSC_EXTENDED 0x0002 + + +/* SQL_CONCAT_NULL_BEHAVIOR values */ + +#define SQL_CB_NULL 0x0000 +#define SQL_CB_NON_NULL 0x0001 + +/* SQL_SCROLL_OPTIONS masks */ + +#define SQL_SO_FORWARD_ONLY 0x00000001L +#define SQL_SO_KEYSET_DRIVEN 0x00000002L +#define SQL_SO_DYNAMIC 0x00000004L +#define SQL_SO_MIXED 0x00000008L +#define SQL_SO_STATIC 0x00000010L + +/* SQL_FETCH_DIRECTION masks */ + +/* SQL_FETCH_RESUME is no longer supported +#define SQL_FD_FETCH_RESUME 0x00000040L +*/ +#define SQL_FD_FETCH_BOOKMARK 0x00000080L + +/* SQL_TXN_ISOLATION_OPTION masks */ +/* SQL_TXN_VERSIONING is no longer supported +#define SQL_TXN_VERSIONING 0x00000010L +*/ + +/* SQL_CORRELATION_NAME values */ + +#define SQL_CN_NONE 0x0000 +#define SQL_CN_DIFFERENT 0x0001 +#define SQL_CN_ANY 0x0002 + +/* SQL_NON_NULLABLE_COLUMNS values */ + +#define SQL_NNC_NULL 0x0000 +#define SQL_NNC_NON_NULL 0x0001 + +/* SQL_NULL_COLLATION values */ + +#define SQL_NC_START 0x0002 +#define SQL_NC_END 0x0004 + +/* SQL_FILE_USAGE values */ + +#define SQL_FILE_NOT_SUPPORTED 0x0000 +#define SQL_FILE_TABLE 0x0001 +#define SQL_FILE_QUALIFIER 0x0002 +#define SQL_FILE_CATALOG SQL_FILE_QUALIFIER // ODBC 3.0 + + +/* SQL_GETDATA_EXTENSIONS values */ + +#define SQL_GD_BLOCK 0x00000004L +#define SQL_GD_BOUND 0x00000008L + +/* SQL_POSITIONED_STATEMENTS masks */ + +#define SQL_PS_POSITIONED_DELETE 0x00000001L +#define SQL_PS_POSITIONED_UPDATE 0x00000002L +#define SQL_PS_SELECT_FOR_UPDATE 0x00000004L + +/* SQL_GROUP_BY values */ + +#define SQL_GB_NOT_SUPPORTED 0x0000 +#define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001 +#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002 +#define SQL_GB_NO_RELATION 0x0003 +#if (ODBCVER >= 0x0300) +#define SQL_GB_COLLATE 0x0004 + +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_OWNER_USAGE masks */ + +#define SQL_OU_DML_STATEMENTS 0x00000001L +#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_OU_TABLE_DEFINITION 0x00000004L +#define SQL_OU_INDEX_DEFINITION 0x00000008L +#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L + +/* SQL_SCHEMA_USAGE masks */ +#if (ODBCVER >= 0x0300) +#define SQL_SU_DML_STATEMENTS SQL_OU_DML_STATEMENTS +#define SQL_SU_PROCEDURE_INVOCATION SQL_OU_PROCEDURE_INVOCATION +#define SQL_SU_TABLE_DEFINITION SQL_OU_TABLE_DEFINITION +#define SQL_SU_INDEX_DEFINITION SQL_OU_INDEX_DEFINITION +#define SQL_SU_PRIVILEGE_DEFINITION SQL_OU_PRIVILEGE_DEFINITION +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_QUALIFIER_USAGE masks */ + +#define SQL_QU_DML_STATEMENTS 0x00000001L +#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_QU_TABLE_DEFINITION 0x00000004L +#define SQL_QU_INDEX_DEFINITION 0x00000008L +#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L + +#if (ODBCVER >= 0x0300) +/* SQL_CATALOG_USAGE masks */ +#define SQL_CU_DML_STATEMENTS SQL_QU_DML_STATEMENTS +#define SQL_CU_PROCEDURE_INVOCATION SQL_QU_PROCEDURE_INVOCATION +#define SQL_CU_TABLE_DEFINITION SQL_QU_TABLE_DEFINITION +#define SQL_CU_INDEX_DEFINITION SQL_QU_INDEX_DEFINITION +#define SQL_CU_PRIVILEGE_DEFINITION SQL_QU_PRIVILEGE_DEFINITION +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SUBQUERIES masks */ + +#define SQL_SQ_COMPARISON 0x00000001L +#define SQL_SQ_EXISTS 0x00000002L +#define SQL_SQ_IN 0x00000004L +#define SQL_SQ_QUANTIFIED 0x00000008L +#define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L + +/* SQL_UNION masks */ + +#define SQL_U_UNION 0x00000001L +#define SQL_U_UNION_ALL 0x00000002L + +/* SQL_BOOKMARK_PERSISTENCE values */ + +#define SQL_BP_CLOSE 0x00000001L +#define SQL_BP_DELETE 0x00000002L +#define SQL_BP_DROP 0x00000004L +#define SQL_BP_TRANSACTION 0x00000008L +#define SQL_BP_UPDATE 0x00000010L +#define SQL_BP_OTHER_HSTMT 0x00000020L +#define SQL_BP_SCROLL 0x00000040L + +/* SQL_STATIC_SENSITIVITY values */ + +#define SQL_SS_ADDITIONS 0x00000001L +#define SQL_SS_DELETIONS 0x00000002L +#define SQL_SS_UPDATES 0x00000004L + +/* SQL_VIEW values */ +#define SQL_CV_CREATE_VIEW 0x00000001L +#define SQL_CV_CHECK_OPTION 0x00000002L +#define SQL_CV_CASCADED 0x00000004L +#define SQL_CV_LOCAL 0x00000008L + +/* SQL_LOCK_TYPES masks */ + +#define SQL_LCK_NO_CHANGE 0x00000001L +#define SQL_LCK_EXCLUSIVE 0x00000002L +#define SQL_LCK_UNLOCK 0x00000004L + +/* SQL_POS_OPERATIONS masks */ + +#define SQL_POS_POSITION 0x00000001L +#define SQL_POS_REFRESH 0x00000002L +#define SQL_POS_UPDATE 0x00000004L +#define SQL_POS_DELETE 0x00000008L +#define SQL_POS_ADD 0x00000010L + +/* SQL_QUALIFIER_LOCATION values */ + +#define SQL_QL_START 0x0001 +#define SQL_QL_END 0x0002 + +/* Here start return values for ODBC 3.0 SQLGetInfo */ + +#if (ODBCVER >= 0x0300) +/* SQL_AGGREGATE_FUNCTIONS bitmasks */ +#define SQL_AF_AVG 0x00000001L +#define SQL_AF_COUNT 0x00000002L +#define SQL_AF_MAX 0x00000004L +#define SQL_AF_MIN 0x00000008L +#define SQL_AF_SUM 0x00000010L +#define SQL_AF_DISTINCT 0x00000020L +#define SQL_AF_ALL 0x00000040L + +/* SQL_SQL_CONFORMANCE bit masks */ +#define SQL_SC_SQL92_ENTRY 0x00000001L +#define SQL_SC_FIPS127_2_TRANSITIONAL 0x00000002L +#define SQL_SC_SQL92_INTERMEDIATE 0x00000004L +#define SQL_SC_SQL92_FULL 0x00000008L + +/* SQL_DATETIME_LITERALS masks */ +#define SQL_DL_SQL92_DATE 0x00000001L +#define SQL_DL_SQL92_TIME 0x00000002L +#define SQL_DL_SQL92_TIMESTAMP 0x00000004L +#define SQL_DL_SQL92_INTERVAL_YEAR 0x00000008L +#define SQL_DL_SQL92_INTERVAL_MONTH 0x00000010L +#define SQL_DL_SQL92_INTERVAL_DAY 0x00000020L +#define SQL_DL_SQL92_INTERVAL_HOUR 0x00000040L +#define SQL_DL_SQL92_INTERVAL_MINUTE 0x00000080L +#define SQL_DL_SQL92_INTERVAL_SECOND 0x00000100L +#define SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH 0x00000200L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR 0x00000400L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE 0x00000800L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND 0x00001000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE 0x00002000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND 0x00004000L +#define SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND 0x00008000L + +/* SQL_CATALOG_LOCATION values */ +#define SQL_CL_START SQL_QL_START +#define SQL_CL_END SQL_QL_END + +/* values for SQL_BATCH_ROW_COUNT */ +#define SQL_BRC_PROCEDURES 0x0000001 +#define SQL_BRC_EXPLICIT 0x0000002 +#define SQL_BRC_ROLLED_UP 0x0000004 + +/* bitmasks for SQL_BATCH_SUPPORT */ +#define SQL_BS_SELECT_EXPLICIT 0x00000001L +#define SQL_BS_ROW_COUNT_EXPLICIT 0x00000002L +#define SQL_BS_SELECT_PROC 0x00000004L +#define SQL_BS_ROW_COUNT_PROC 0x00000008L + +/* Values for SQL_PARAM_ARRAY_ROW_COUNTS getinfo */ +#define SQL_PARC_BATCH 1 +#define SQL_PARC_NO_BATCH 2 + +/* values for SQL_PARAM_ARRAY_SELECTS */ +#define SQL_PAS_BATCH 1 +#define SQL_PAS_NO_BATCH 2 +#define SQL_PAS_NO_SELECT 3 + +/* Bitmasks for SQL_INDEX_KEYWORDS */ +#define SQL_IK_NONE 0x00000000L +#define SQL_IK_ASC 0x00000001L +#define SQL_IK_DESC 0x00000002L +#define SQL_IK_ALL (SQL_IK_ASC | SQL_IK_DESC) + +/* Bitmasks for SQL_INFO_SCHEMA_VIEWS */ + +#define SQL_ISV_ASSERTIONS 0x00000001L +#define SQL_ISV_CHARACTER_SETS 0x00000002L +#define SQL_ISV_CHECK_CONSTRAINTS 0x00000004L +#define SQL_ISV_COLLATIONS 0x00000008L +#define SQL_ISV_COLUMN_DOMAIN_USAGE 0x00000010L +#define SQL_ISV_COLUMN_PRIVILEGES 0x00000020L +#define SQL_ISV_COLUMNS 0x00000040L +#define SQL_ISV_CONSTRAINT_COLUMN_USAGE 0x00000080L +#define SQL_ISV_CONSTRAINT_TABLE_USAGE 0x00000100L +#define SQL_ISV_DOMAIN_CONSTRAINTS 0x00000200L +#define SQL_ISV_DOMAINS 0x00000400L +#define SQL_ISV_KEY_COLUMN_USAGE 0x00000800L +#define SQL_ISV_REFERENTIAL_CONSTRAINTS 0x00001000L +#define SQL_ISV_SCHEMATA 0x00002000L +#define SQL_ISV_SQL_LANGUAGES 0x00004000L +#define SQL_ISV_TABLE_CONSTRAINTS 0x00008000L +#define SQL_ISV_TABLE_PRIVILEGES 0x00010000L +#define SQL_ISV_TABLES 0x00020000L +#define SQL_ISV_TRANSLATIONS 0x00040000L +#define SQL_ISV_USAGE_PRIVILEGES 0x00080000L +#define SQL_ISV_VIEW_COLUMN_USAGE 0x00100000L +#define SQL_ISV_VIEW_TABLE_USAGE 0x00200000L +#define SQL_ISV_VIEWS 0x00400000L + +/* Bitmasks for SQL_ASYNC_MODE */ + +#define SQL_AM_NONE 0 +#define SQL_AM_CONNECTION 1 +#define SQL_AM_STATEMENT 2 + +/* Bitmasks for SQL_ALTER_DOMAIN */ +#define SQL_AD_CONSTRAINT_NAME_DEFINITION 0x00000001L +#define SQL_AD_ADD_DOMAIN_CONSTRAINT 0x00000002L +#define SQL_AD_DROP_DOMAIN_CONSTRAINT 0x00000004L +#define SQL_AD_ADD_DOMAIN_DEFAULT 0x00000008L +#define SQL_AD_DROP_DOMAIN_DEFAULT 0x00000010L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_AD_ADD_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE 0x00000100L + + +/* SQL_CREATE_SCHEMA bitmasks */ +#define SQL_CS_CREATE_SCHEMA 0x00000001L +#define SQL_CS_AUTHORIZATION 0x00000002L +#define SQL_CS_DEFAULT_CHARACTER_SET 0x00000004L + +/* SQL_CREATE_TRANSLATION bitmasks */ +#define SQL_CTR_CREATE_TRANSLATION 0x00000001L + +/* SQL_CREATE_ASSERTION bitmasks */ +#define SQL_CA_CREATE_ASSERTION 0x00000001L +#define SQL_CA_CONSTRAINT_INITIALLY_DEFERRED 0x00000010L +#define SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000020L +#define SQL_CA_CONSTRAINT_DEFERRABLE 0x00000040L +#define SQL_CA_CONSTRAINT_NON_DEFERRABLE 0x00000080L + +/* SQL_CREATE_CHARACTER_SET bitmasks */ +#define SQL_CCS_CREATE_CHARACTER_SET 0x00000001L +#define SQL_CCS_COLLATE_CLAUSE 0x00000002L +#define SQL_CCS_LIMITED_COLLATION 0x00000004L + +/* SQL_CREATE_COLLATION bitmasks */ +#define SQL_CCOL_CREATE_COLLATION 0x00000001L + +/* SQL_CREATE_DOMAIN bitmasks */ +#define SQL_CDO_CREATE_DOMAIN 0x00000001L +#define SQL_CDO_DEFAULT 0x00000002L +#define SQL_CDO_CONSTRAINT 0x00000004L +#define SQL_CDO_COLLATION 0x00000008L +#define SQL_CDO_CONSTRAINT_NAME_DEFINITION 0x00000010L +#define SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CDO_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CDO_CONSTRAINT_NON_DEFERRABLE 0x00000100L + +/* SQL_CREATE_TABLE bitmasks */ +#define SQL_CT_CREATE_TABLE 0x00000001L +#define SQL_CT_COMMIT_PRESERVE 0x00000002L +#define SQL_CT_COMMIT_DELETE 0x00000004L +#define SQL_CT_GLOBAL_TEMPORARY 0x00000008L +#define SQL_CT_LOCAL_TEMPORARY 0x00000010L +#define SQL_CT_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CT_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CT_CONSTRAINT_NON_DEFERRABLE 0x00000100L +#define SQL_CT_COLUMN_CONSTRAINT 0x00000200L +#define SQL_CT_COLUMN_DEFAULT 0x00000400L +#define SQL_CT_COLUMN_COLLATION 0x00000800L +#define SQL_CT_TABLE_CONSTRAINT 0x00001000L +#define SQL_CT_CONSTRAINT_NAME_DEFINITION 0x00002000L + +/* SQL_DDL_INDEX bitmasks */ +#define SQL_DI_CREATE_INDEX 0x00000001L +#define SQL_DI_DROP_INDEX 0x00000002L + +/* SQL_DROP_COLLATION bitmasks */ +#define SQL_DC_DROP_COLLATION 0x00000001L + +/* SQL_DROP_DOMAIN bitmasks */ +#define SQL_DD_DROP_DOMAIN 0x00000001L +#define SQL_DD_RESTRICT 0x00000002L +#define SQL_DD_CASCADE 0x00000004L + +/* SQL_DROP_SCHEMA bitmasks */ +#define SQL_DS_DROP_SCHEMA 0x00000001L +#define SQL_DS_RESTRICT 0x00000002L +#define SQL_DS_CASCADE 0x00000004L + +/* SQL_DROP_CHARACTER_SET bitmasks */ +#define SQL_DCS_DROP_CHARACTER_SET 0x00000001L + +/* SQL_DROP_ASSERTION bitmasks */ +#define SQL_DA_DROP_ASSERTION 0x00000001L + +/* SQL_DROP_TABLE bitmasks */ +#define SQL_DT_DROP_TABLE 0x00000001L +#define SQL_DT_RESTRICT 0x00000002L +#define SQL_DT_CASCADE 0x00000004L + +/* SQL_DROP_TRANSLATION bitmasks */ +#define SQL_DTR_DROP_TRANSLATION 0x00000001L + +/* SQL_DROP_VIEW bitmasks */ +#define SQL_DV_DROP_VIEW 0x00000001L +#define SQL_DV_RESTRICT 0x00000002L +#define SQL_DV_CASCADE 0x00000004L + +/* SQL_INSERT_STATEMENT bitmasks */ +#define SQL_IS_INSERT_LITERALS 0x00000001L +#define SQL_IS_INSERT_SEARCHED 0x00000002L +#define SQL_IS_SELECT_INTO 0x00000004L + +/* SQL_ODBC_INTERFACE_CONFORMANCE values */ +#define SQL_OIC_CORE 1UL +#define SQL_OIC_LEVEL1 2UL +#define SQL_OIC_LEVEL2 3UL + +/* SQL_SQL92_FOREIGN_KEY_DELETE_RULE bitmasks */ +#define SQL_SFKD_CASCADE 0x00000001L +#define SQL_SFKD_NO_ACTION 0x00000002L +#define SQL_SFKD_SET_DEFAULT 0x00000004L +#define SQL_SFKD_SET_NULL 0x00000008L + +/* SQL_SQL92_FOREIGN_KEY_UPDATE_RULE bitmasks */ +#define SQL_SFKU_CASCADE 0x00000001L +#define SQL_SFKU_NO_ACTION 0x00000002L +#define SQL_SFKU_SET_DEFAULT 0x00000004L +#define SQL_SFKU_SET_NULL 0x00000008L + +/* SQL_SQL92_GRANT bitmasks */ +#define SQL_SG_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SG_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SG_USAGE_ON_COLLATION 0x00000004L +#define SQL_SG_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SG_WITH_GRANT_OPTION 0x00000010L +#define SQL_SG_DELETE_TABLE 0x00000020L +#define SQL_SG_INSERT_TABLE 0x00000040L +#define SQL_SG_INSERT_COLUMN 0x00000080L +#define SQL_SG_REFERENCES_TABLE 0x00000100L +#define SQL_SG_REFERENCES_COLUMN 0x00000200L +#define SQL_SG_SELECT_TABLE 0x00000400L +#define SQL_SG_UPDATE_TABLE 0x00000800L +#define SQL_SG_UPDATE_COLUMN 0x00001000L + +/* SQL_SQL92_PREDICATES bitmasks */ +#define SQL_SP_EXISTS 0x00000001L +#define SQL_SP_ISNOTNULL 0x00000002L +#define SQL_SP_ISNULL 0x00000004L +#define SQL_SP_MATCH_FULL 0x00000008L +#define SQL_SP_MATCH_PARTIAL 0x00000010L +#define SQL_SP_MATCH_UNIQUE_FULL 0x00000020L +#define SQL_SP_MATCH_UNIQUE_PARTIAL 0x00000040L +#define SQL_SP_OVERLAPS 0x00000080L +#define SQL_SP_UNIQUE 0x00000100L +#define SQL_SP_LIKE 0x00000200L +#define SQL_SP_IN 0x00000400L +#define SQL_SP_BETWEEN 0x00000800L +#define SQL_SP_COMPARISON 0x00001000L +#define SQL_SP_QUANTIFIED_COMPARISON 0x00002000L + +/* SQL_SQL92_RELATIONAL_JOIN_OPERATORS bitmasks */ +#define SQL_SRJO_CORRESPONDING_CLAUSE 0x00000001L +#define SQL_SRJO_CROSS_JOIN 0x00000002L +#define SQL_SRJO_EXCEPT_JOIN 0x00000004L +#define SQL_SRJO_FULL_OUTER_JOIN 0x00000008L +#define SQL_SRJO_INNER_JOIN 0x00000010L +#define SQL_SRJO_INTERSECT_JOIN 0x00000020L +#define SQL_SRJO_LEFT_OUTER_JOIN 0x00000040L +#define SQL_SRJO_NATURAL_JOIN 0x00000080L +#define SQL_SRJO_RIGHT_OUTER_JOIN 0x00000100L +#define SQL_SRJO_UNION_JOIN 0x00000200L + +/* SQL_SQL92_REVOKE bitmasks */ +#define SQL_SR_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SR_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SR_USAGE_ON_COLLATION 0x00000004L +#define SQL_SR_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SR_GRANT_OPTION_FOR 0x00000010L +#define SQL_SR_CASCADE 0x00000020L +#define SQL_SR_RESTRICT 0x00000040L +#define SQL_SR_DELETE_TABLE 0x00000080L +#define SQL_SR_INSERT_TABLE 0x00000100L +#define SQL_SR_INSERT_COLUMN 0x00000200L +#define SQL_SR_REFERENCES_TABLE 0x00000400L +#define SQL_SR_REFERENCES_COLUMN 0x00000800L +#define SQL_SR_SELECT_TABLE 0x00001000L +#define SQL_SR_UPDATE_TABLE 0x00002000L +#define SQL_SR_UPDATE_COLUMN 0x00004000L + +/* SQL_SQL92_ROW_VALUE_CONSTRUCTOR bitmasks */ +#define SQL_SRVC_VALUE_EXPRESSION 0x00000001L +#define SQL_SRVC_NULL 0x00000002L +#define SQL_SRVC_DEFAULT 0x00000004L +#define SQL_SRVC_ROW_SUBQUERY 0x00000008L + +/* SQL_SQL92_VALUE_EXPRESSIONS bitmasks */ +#define SQL_SVE_CASE 0x00000001L +#define SQL_SVE_CAST 0x00000002L +#define SQL_SVE_COALESCE 0x00000004L +#define SQL_SVE_NULLIF 0x00000008L + +/* SQL_STANDARD_CLI_CONFORMANCE bitmasks */ +#define SQL_SCC_XOPEN_CLI_VERSION1 0x00000001L +#define SQL_SCC_ISO92_CLI 0x00000002L + +/* SQL_UNION_STATEMENT bitmasks */ +#define SQL_US_UNION SQL_U_UNION +#define SQL_US_UNION_ALL SQL_U_UNION_ALL + +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_DTC_TRANSITION_COST bitmasks */ +#define SQL_DTC_ENLIST_EXPENSIVE 0x00000001L +#define SQL_DTC_UNENLIST_EXPENSIVE 0x00000002L + +/* additional SQLDataSources fetch directions */ +#if (ODBCVER >= 0x0300) +#define SQL_FETCH_FIRST_USER 31 +#define SQL_FETCH_FIRST_SYSTEM 32 +#endif /* ODBCVER >= 0x0300 */ + + +/* Defines for SQLSetPos */ +#define SQL_ENTIRE_ROWSET 0 + +/* Operations in SQLSetPos */ +#define SQL_POSITION 0 /* 1.0 FALSE */ +#define SQL_REFRESH 1 /* 1.0 TRUE */ +#define SQL_UPDATE 2 +#define SQL_DELETE 3 + +/* Operations in SQLBulkOperations */ +#define SQL_ADD 4 +#define SQL_SETPOS_MAX_OPTION_VALUE SQL_ADD +#if (ODBCVER >= 0x0300) +#define SQL_UPDATE_BY_BOOKMARK 5 +#define SQL_DELETE_BY_BOOKMARK 6 +#define SQL_FETCH_BY_BOOKMARK 7 + +#endif /* ODBCVER >= 0x0300 */ + +/* Lock options in SQLSetPos */ +#define SQL_LOCK_NO_CHANGE 0 /* 1.0 FALSE */ +#define SQL_LOCK_EXCLUSIVE 1 /* 1.0 TRUE */ +#define SQL_LOCK_UNLOCK 2 + +#define SQL_SETPOS_MAX_LOCK_VALUE SQL_LOCK_UNLOCK + +/* Macros for SQLSetPos */ +#define SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE) +#define SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock) +#define SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock) +#define SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE) +#define SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE) +#define SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE) + +/* Column types and scopes in SQLSpecialColumns. */ +#define SQL_BEST_ROWID 1 +#define SQL_ROWVER 2 + +/* Defines for SQLSpecialColumns (returned in the result set) + SQL_PC_UNKNOWN and SQL_PC_PSEUDO are defined in sql.h */ +#define SQL_PC_NOT_PSEUDO 1 + +/* Defines for SQLStatistics */ +#define SQL_QUICK 0 +#define SQL_ENSURE 1 + +/* Defines for SQLStatistics (returned in the result set) + SQL_INDEX_CLUSTERED, SQL_INDEX_HASHED, and SQL_INDEX_OTHER are + defined in sql.h */ +#define SQL_TABLE_STAT 0 + + +/* Defines for SQLTables */ +#if (ODBCVER >= 0x0300) +#define SQL_ALL_CATALOGS "%" +#define SQL_ALL_SCHEMAS "%" +#define SQL_ALL_TABLE_TYPES "%" +#endif /* ODBCVER >= 0x0300 */ + +/* Options for SQLDriverConnect */ +#define SQL_DRIVER_NOPROMPT 0 +#define SQL_DRIVER_COMPLETE 1 +#define SQL_DRIVER_PROMPT 2 +#define SQL_DRIVER_COMPLETE_REQUIRED 3 + +#ifndef RC_INVOKED + +SQLRETURN SQL_API SQLDriverConnect( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + +#endif /* RC_INVOKED */ + +/* Level 2 Functions */ + +/* SQLExtendedFetch "fFetchType" values */ +#define SQL_FETCH_BOOKMARK 8 + +/* SQLExtendedFetch "rgfRowStatus" element values */ +#define SQL_ROW_SUCCESS 0 +#define SQL_ROW_DELETED 1 +#define SQL_ROW_UPDATED 2 +#define SQL_ROW_NOROW 3 +#define SQL_ROW_ADDED 4 +#define SQL_ROW_ERROR 5 +#if (ODBCVER >= 0x0300) +#define SQL_ROW_SUCCESS_WITH_INFO 6 +#define SQL_ROW_PROCEED 0 +#define SQL_ROW_IGNORE 1 +#endif + +/* value for SQL_DESC_ARRAY_STATUS_PTR */ +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_SUCCESS 0 +#define SQL_PARAM_SUCCESS_WITH_INFO 6 +#define SQL_PARAM_ERROR 5 +#define SQL_PARAM_UNUSED 7 +#define SQL_PARAM_DIAG_UNAVAILABLE 1 + +#define SQL_PARAM_PROCEED 0 +#define SQL_PARAM_IGNORE 1 +#endif /* ODBCVER >= 0x0300 */ + +/* Defines for SQLForeignKeys (UPDATE_RULE and DELETE_RULE) */ +#define SQL_CASCADE 0 +#define SQL_RESTRICT 1 +#define SQL_SET_NULL 2 +#if (ODBCVER >= 0x0250) +#define SQL_NO_ACTION 3 +#define SQL_SET_DEFAULT 4 +#endif /* ODBCVER >= 0x0250 */ + +#if (ODBCVER >= 0x0300) +/* Note that the following are in a different column of SQLForeignKeys than */ +/* the previous #defines. These are for DEFERRABILITY. */ + +#define SQL_INITIALLY_DEFERRED 5 +#define SQL_INITIALLY_IMMEDIATE 6 +#define SQL_NOT_DEFERRABLE 7 + +#endif /* ODBCVER >= 0x0300 */ + +/* Defines for SQLBindParameter and + SQLProcedureColumns (returned in the result set) */ +#define SQL_PARAM_TYPE_UNKNOWN 0 +#define SQL_PARAM_INPUT 1 +#define SQL_PARAM_INPUT_OUTPUT 2 +#define SQL_RESULT_COL 3 +#define SQL_PARAM_OUTPUT 4 +#define SQL_RETURN_VALUE 5 + +/* Defines for SQLProcedures (returned in the result set) */ +#define SQL_PT_UNKNOWN 0 +#define SQL_PT_PROCEDURE 1 +#define SQL_PT_FUNCTION 2 + +#ifndef RC_INVOKED + +/* This define is too large for RC */ +#define SQL_ODBC_KEYWORDS \ +"ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\ +"ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\ +"BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\ +"CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\ +"COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\ +"CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\ +"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\ +"DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\ +"DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\ +"DISTINCT,DOMAIN,DOUBLE,DROP,"\ +"ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\ +"EXISTS,EXTERNAL,EXTRACT,"\ +"FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\ +"GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\ +"IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\ +"INPUT,INSENSITIVE,INSERT,INT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\ +"JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\ +"MATCH,MAX,MIN,MINUTE,MODULE,MONTH,"\ +"NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\ +"OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\ +"PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\ +"PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\ +"READ,REAL,REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS"\ +"SCHEMA,SCROLL,SECOND,SECTION,SELECT,SESSION,SESSION_USER,SET,SIZE,"\ +"SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\ +"SUBSTRING,SUM,SYSTEM_USER,"\ +"TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\ +"TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\ +"UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\ +"VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,"\ +"YEAR,ZONE" + +SQLRETURN SQL_API SQLBrowseConnect( + SQLHDBC hdbc, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLBulkOperations( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +#endif /* ODBCVER >= 0x0300 */ + +SQLRETURN SQL_API SQLColAttributes( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN * pfDesc); + +SQLRETURN SQL_API SQLColumnPrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLDescribeParam( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + +SQLRETURN SQL_API SQLExtendedFetch( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLLEN irow, + SQLULEN *pcrow, + SQLUSMALLINT *rgfRowStatus); + +SQLRETURN SQL_API SQLForeignKeys( + SQLHSTMT hstmt, + SQLCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + +SQLRETURN SQL_API SQLMoreResults( + SQLHSTMT hstmt); + +SQLRETURN SQL_API SQLNativeSql( + SQLHDBC hdbc, + SQLCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + +SQLRETURN SQL_API SQLNumParams( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); + +SQLRETURN SQL_API SQLParamOptions( + SQLHSTMT hstmt, + SQLULEN crow, + SQLULEN *pirow); + +SQLRETURN SQL_API SQLPrimaryKeys( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLProcedureColumns( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLProcedures( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName); + + + +SQLRETURN SQL_API SQLSetPos( + SQLHSTMT hstmt, + SQLSETPOSIROW irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); + +SQLRETURN SQL_API SQLTablePrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLDrivers( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); + +SQLRETURN SQL_API SQLBindParameter( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN *pcbValue); + + +#endif /* RC_INVOKED */ + +/*---------------------------------------------------------*/ +/* SQLAllocHandleStd is implemented to make SQLAllocHandle */ +/* compatible with X/Open standard. an application should */ +/* not call SQLAllocHandleStd directly */ +/*---------------------------------------------------------*/ +#ifdef ODBC_STD +#define SQLAllocHandle SQLAllocHandleStd +#define SQLAllocEnv(phenv) SQLAllocHandleStd(SQL_HANDLE_ENV, SQL_NULL_HANDLE, phenv) + +/* Internal type subcodes */ +#define SQL_YEAR SQL_CODE_YEAR +#define SQL_MONTH SQL_CODE_MONTH +#define SQL_DAY SQL_CODE_DAY +#define SQL_HOUR SQL_CODE_HOUR +#define SQL_MINUTE SQL_CODE_MINUTE +#define SQL_SECOND SQL_CODE_SECOND +#define SQL_YEAR_TO_MONTH SQL_CODE_YEAR_TO_MONTH +#define SQL_DAY_TO_HOUR SQL_CODE_DAY_TO_HOUR +#define SQL_DAY_TO_MINUTE SQL_CODE_DAY_TO_MINUTE +#define SQL_DAY_TO_SECOND SQL_CODE_DAY_TO_SECOND +#define SQL_HOUR_TO_MINUTE SQL_CODE_HOUR_TO_MINUTE +#define SQL_HOUR_TO_SECOND SQL_CODE_HOUR_TO_SECOND +#define SQL_MINUTE_TO_SECOND SQL_CODE_MINUTE_TO_SECOND +#endif /* ODBC_STD */ + +#if (ODBCVER >= 0x0300) +#ifndef RC_INVOKED +SQLRETURN SQL_API SQLAllocHandleStd( + SQLSMALLINT fHandleType, + SQLHANDLE hInput, + SQLHANDLE *phOutput); +#endif /* RC_INVOKED */ +#endif + +/* Deprecated defines from prior versions of ODBC */ +#define SQL_DATABASE_NAME 16 /* Use SQLGetConnectOption/SQL_CURRENT_QUALIFIER */ +#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR +#define SQL_FETCH_PREV SQL_FETCH_PRIOR +#define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER +#define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER +#define SQL_CC_DELETE SQL_CB_DELETE +#define SQL_CR_DELETE SQL_CB_DELETE +#define SQL_CC_CLOSE SQL_CB_CLOSE +#define SQL_CR_CLOSE SQL_CB_CLOSE +#define SQL_CC_PRESERVE SQL_CB_PRESERVE +#define SQL_CR_PRESERVE SQL_CB_PRESERVE +/* SQL_FETCH_RESUME is not supported by 2.0+ drivers +#define SQL_FETCH_RESUME 7 +*/ +#define SQL_SCROLL_FORWARD_ONLY 0L /*-SQL_CURSOR_FORWARD_ONLY */ +#define SQL_SCROLL_KEYSET_DRIVEN (-1L) /*-SQL_CURSOR_KEYSET_DRIVEN */ +#define SQL_SCROLL_DYNAMIC (-2L) /*-SQL_CURSOR_DYNAMIC */ +#define SQL_SCROLL_STATIC (-3L) /*-SQL_CURSOR_STATIC */ + +/* Deprecated functions from prior versions of ODBC */ +#ifndef RC_INVOKED + +SQLRETURN SQL_API SQLSetScrollOptions( /* Use SQLSetStmtOptions */ + SQLHSTMT hstmt, + SQLUSMALLINT fConcurrency, + SQLLEN crowKeyset, + SQLUSMALLINT crowRowset); + +/* Tracing section */ + +#define TRACE_VERSION 1000 /* Version of trace API */ + +RETCODE SQL_API TraceOpenLogFile(LPWSTR,LPWSTR,DWORD);// open a trace log file +RETCODE SQL_API TraceCloseLogFile(); // Request to close a trace log +VOID SQL_API TraceReturn(RETCODE,RETCODE); // Processes trace after FN is called +DWORD SQL_API TraceVersion(); // Returns trace API version + +/* Functions for Visual Studio Analyzer*/ +/* to turn on/off tracing or VS events, call TraceVSControl by setting or clearing the following bits */ +#define TRACE_ON 0x00000001L +#define TRACE_VS_EVENT_ON 0x00000002L + +RETCODE SQL_API TraceVSControl(DWORD); + +/* Functions for setting the connection pooling failure detection code */ +/* The "TryWait" value is the time (in seconds) that the DM will wait */ +/* between detecting that a connection is dead (using */ +/* SQL_ATTR_CONNECTION_DEAD) and retrying the connection. During that */ +/* interval, connection requests will get "The server appears to be */ +/* dead" error returns. */ + + +BOOL SQL_API ODBCSetTryWaitValue(DWORD dwValue); /* In seconds */ +DWORD SQL_API ODBCGetTryWaitValue(); /* In Milliseconds(!) */ + + +/* the flags in ODBC_VS_ARGS */ +#define ODBC_VS_FLAG_UNICODE_ARG 0x00000001L /* the argument is unicode */ +#define ODBC_VS_FLAG_UNICODE_COR 0x00000002L /* the correlation is unicode */ +#define ODBC_VS_FLAG_RETCODE 0x00000004L /* RetCode field is set */ +#define ODBC_VS_FLAG_STOP 0x00000008L /* Stop firing visual studio analyzer events */ + +typedef struct tagODBC_VS_ARGS { + const GUID *pguidEvent; /* the GUID for event */ + DWORD dwFlags; /* flags for the call */ + union { + WCHAR *wszArg; + CHAR *szArg; + }; + union { + WCHAR *wszCorrelation; + CHAR *szCorrelation; + }; + RETCODE RetCode; +} ODBC_VS_ARGS, *PODBC_VS_ARGS; +VOID SQL_API FireVSDebugEvent(PODBC_VS_ARGS); + +#endif /* RC_INVOKED */ + + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ + +#if defined(WIN32) || defined(_WIN64) +#include "sqlucode.h" +#endif + +#endif /* __SQLEXT */ diff --git a/libraries/SQLAPI/include/myAPI.h b/libraries/SQLAPI/include/myAPI.h new file mode 100644 index 000000000..55bedd6dc --- /dev/null +++ b/libraries/SQLAPI/include/myAPI.h @@ -0,0 +1,303 @@ +// myAPI.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__MYAPI_H__) +#define __MYAPI_H__ + +#include "SQLAPI.h" + +// API header(s) +#include +#include + +extern void AddMySQLSupport(const SAConnection * pCon); +extern void ReleaseMySQLSupport(); + +/* Functions to get information from the MYSQL and MYSQL_RES structures */ +/* Should definitely be used if one uses shared libraries */ + +typedef my_ulonglong (STDCALL *mysql_num_rows_t)(MYSQL_RES *res); +typedef unsigned int (STDCALL *mysql_num_fields_t)(MYSQL_RES *res); +typedef my_bool (STDCALL *mysql_eof_t)(MYSQL_RES *res); +typedef MYSQL_FIELD * (STDCALL *mysql_fetch_field_direct_t)(MYSQL_RES *res, + unsigned int fieldnr); +typedef MYSQL_FIELD * (STDCALL *mysql_fetch_fields_t)(MYSQL_RES *res); +typedef MYSQL_ROWS * (STDCALL *mysql_row_tell_t)(MYSQL_RES *res); +typedef unsigned int (STDCALL *mysql_field_tell_t)(MYSQL_RES *res); + +typedef unsigned int (STDCALL *mysql_field_count_t)(MYSQL *mysql); +typedef my_ulonglong (STDCALL *mysql_affected_rows_t)(MYSQL *mysql); +typedef my_ulonglong (STDCALL *mysql_insert_id_t)(MYSQL *mysql); +typedef unsigned int (STDCALL *mysql_errno_t)(MYSQL *mysql); +typedef const char * (STDCALL *mysql_error_t)(MYSQL *mysql); +typedef const char * (STDCALL *mysql_info_t)(MYSQL *mysql); +typedef unsigned long (STDCALL *mysql_thread_id_t)(MYSQL *mysql); +typedef const char * (STDCALL *mysql_character_set_name_t)(MYSQL *mysql); + +typedef MYSQL * (STDCALL *mysql_init_t)(MYSQL *mysql); +//#ifdef HAVE_OPENSSL +typedef int (STDCALL *mysql_ssl_set_t)(MYSQL *mysql, const char *key, + const char *cert, const char *ca, + const char *capath, const char *cipher); +typedef char * (STDCALL *mysql_ssl_cipher_t)(MYSQL *mysql); +typedef int (STDCALL *mysql_ssl_clear_t)(MYSQL *mysql); +//#endif /* HAVE_OPENSSL */ +typedef MYSQL * (STDCALL *mysql_connect_t)(MYSQL *mysql, const char *host, + const char *user, const char *passwd); +typedef my_bool (STDCALL *mysql_change_user_t)(MYSQL *mysql, const char *user, + const char *passwd, const char *db); +//#if MYSQL_VERSION_ID >= 32200 +typedef MYSQL * (STDCALL *mysql_real_connect2_t)(MYSQL *mysql, const char *host, + const char *user, + const char *passwd, + const char *db, + unsigned int port, + const char *unix_socket, + long unsigned int clientflag); +//#else +typedef MYSQL * (STDCALL *mysql_real_connect1_t)(MYSQL *mysql, const char *host, + const char *user, + const char *passwd, + unsigned int port, + const char *unix_socket, + long unsigned int clientflag); +//#endif +typedef void (STDCALL *mysql_close_t)(MYSQL *sock); +typedef int (STDCALL *mysql_next_result_t)(MYSQL *mysql); +typedef int (STDCALL *mysql_select_db_t)(MYSQL *mysql, const char *db); +typedef int (STDCALL *mysql_query_t)(MYSQL *mysql, const char *q); +typedef int (STDCALL *mysql_send_query_t)(MYSQL *mysql, const char *q, + long unsigned int length); +typedef my_bool (STDCALL *mysql_read_query_result_t)(MYSQL *mysql); +typedef int (STDCALL *mysql_real_query_t)(MYSQL *mysql, const char *q, + long unsigned int length); +typedef int (STDCALL *mysql_create_db_t)(MYSQL *mysql, const char *DB); +typedef int (STDCALL *mysql_drop_db_t)(MYSQL *mysql, const char *DB); +typedef int (STDCALL *mysql_shutdown_t)(MYSQL *mysql, mysql_enum_shutdown_level); +typedef int (STDCALL *mysql_dump_debug_info_t)(MYSQL *mysql); +typedef int (STDCALL *mysql_refresh_t)(MYSQL *mysql, + unsigned int refresh_options); +typedef int (STDCALL *mysql_kill_t)(MYSQL *mysql,unsigned long pid); +typedef int (STDCALL *mysql_ping_t)(MYSQL *mysql); +typedef const char * (STDCALL *mysql_stat_t)(MYSQL *mysql); +typedef const char * (STDCALL *mysql_get_server_info_t)(MYSQL *mysql); +typedef const char * (STDCALL *mysql_get_client_info_t)(void); +typedef const char * (STDCALL *mysql_get_host_info_t)(MYSQL *mysql); +typedef unsigned int (STDCALL *mysql_get_proto_info_t)(MYSQL *mysql); +typedef MYSQL_RES * (STDCALL *mysql_list_dbs_t)(MYSQL *mysql,const char *wild); +typedef MYSQL_RES * (STDCALL *mysql_list_tables_t)(MYSQL *mysql,const char *wild); +typedef MYSQL_RES * (STDCALL *mysql_list_fields_t)(MYSQL *mysql, const char *table, + const char *wild); +typedef MYSQL_RES * (STDCALL *mysql_list_processes_t)(MYSQL *mysql); +typedef MYSQL_RES * (STDCALL *mysql_store_result_t)(MYSQL *mysql); +typedef MYSQL_RES * (STDCALL *mysql_use_result_t)(MYSQL *mysql); +typedef int (STDCALL *mysql_options_t)(MYSQL *mysql,enum mysql_option option, + const void *arg); +typedef void (STDCALL *mysql_free_result_t)(MYSQL_RES *result); +typedef void (STDCALL *mysql_data_seek_t)(MYSQL_RES *result, + my_ulonglong offset); +typedef MYSQL_ROW_OFFSET (STDCALL *mysql_row_seek_t)(MYSQL_RES *result, MYSQL_ROW_OFFSET); +typedef MYSQL_FIELD_OFFSET (STDCALL *mysql_field_seek_t)(MYSQL_RES *result, + MYSQL_FIELD_OFFSET offset); +typedef MYSQL_ROW (STDCALL *mysql_fetch_row_t)(MYSQL_RES *result); +typedef unsigned long * (STDCALL *mysql_fetch_lengths_t)(MYSQL_RES *result); +typedef MYSQL_FIELD * (STDCALL *mysql_fetch_field_t)(MYSQL_RES *result); +typedef unsigned long (STDCALL *mysql_escape_string_t)(char *to,const char *from, + unsigned long from_length); +typedef unsigned long (STDCALL *mysql_real_escape_string_t)(MYSQL *mysql, + char *to,const char *from, + unsigned long length); +typedef void (STDCALL *mysql_debug_t)(const char *debug); +typedef char * (STDCALL *mysql_odbc_escape_string_t)(MYSQL *mysql, + char *to, + unsigned long to_length, + const char *from, + unsigned long from_length, + void *param, + char * + (*extend_buffer) + (void *, char *to, + unsigned long *length)); +typedef void (STDCALL *myodbc_remove_escape_t)(MYSQL *mysql,char *name); + +typedef my_bool (STDCALL *mysql_thread_init_t)(void); +typedef void (STDCALL *mysql_thread_end_t)(void); +typedef unsigned int (STDCALL *mysql_thread_safe_t)(void); + +//#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) + +typedef int (STDCALL *mysql_server_init_t)(int argc, char **argv, char **groups); +typedef void (STDCALL *mysql_server_end_t)(void); + +typedef int (STDCALL *mysql_set_character_set_t)(MYSQL *mysql, const char *csname); + + +// MySQL statement API functions +typedef MYSQL_STMT * (STDCALL *mysql_stmt_init_t)(MYSQL *mysql); +typedef int (STDCALL *mysql_stmt_prepare_t)(MYSQL_STMT *stmt, const char *query, + unsigned long length); +typedef int (STDCALL *mysql_stmt_execute_t)(MYSQL_STMT *stmt); +typedef int (STDCALL *mysql_stmt_fetch_t)(MYSQL_STMT *stmt); +typedef int (STDCALL *mysql_stmt_fetch_column_t)(MYSQL_STMT *stmt, MYSQL_BIND *bind, + unsigned int column, + unsigned long offset); +typedef int (STDCALL *mysql_stmt_store_result_t)(MYSQL_STMT *stmt); +typedef unsigned long (STDCALL *mysql_stmt_param_count_t)(MYSQL_STMT * stmt); +typedef my_bool (STDCALL *mysql_stmt_attr_set_t)(MYSQL_STMT *stmt, + enum enum_stmt_attr_type attr_type, + const void *attr); +typedef my_bool (STDCALL *mysql_stmt_attr_get_t)(MYSQL_STMT *stmt, + enum enum_stmt_attr_type attr_type, + void *attr); +typedef my_bool (STDCALL *mysql_stmt_bind_param_t)(MYSQL_STMT * stmt, MYSQL_BIND * bnd); +typedef my_bool (STDCALL *mysql_stmt_bind_result_t)(MYSQL_STMT * stmt, MYSQL_BIND * bnd); +typedef my_bool (STDCALL *mysql_stmt_close_t)(MYSQL_STMT * stmt); +typedef my_bool (STDCALL *mysql_stmt_reset_t)(MYSQL_STMT * stmt); +typedef my_bool (STDCALL *mysql_stmt_free_result_t)(MYSQL_STMT *stmt); +typedef my_bool (STDCALL *mysql_stmt_send_long_data_t)(MYSQL_STMT *stmt, + unsigned int param_number, + const char *data, + unsigned long length); +typedef MYSQL_RES * (STDCALL *mysql_stmt_result_metadata_t)(MYSQL_STMT *stmt); +typedef MYSQL_RES * (STDCALL *mysql_stmt_param_metadata_t)(MYSQL_STMT *stmt); +typedef unsigned int (STDCALL *mysql_stmt_errno_t)(MYSQL_STMT * stmt); +typedef const char * (STDCALL *mysql_stmt_error_t)(MYSQL_STMT * stmt); +typedef const char * (STDCALL *mysql_stmt_sqlstate_t)(MYSQL_STMT * stmt); +typedef MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_seek_t)(MYSQL_STMT *stmt, + MYSQL_ROW_OFFSET offset); +typedef MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_tell_t)(MYSQL_STMT *stmt); +typedef void (STDCALL *mysql_stmt_data_seek_t)(MYSQL_STMT *stmt, my_ulonglong offset); +typedef my_ulonglong (STDCALL *mysql_stmt_num_rows_t)(MYSQL_STMT *stmt); +typedef my_ulonglong (STDCALL *mysql_stmt_affected_rows_t)(MYSQL_STMT *stmt); +typedef my_ulonglong (STDCALL *mysql_stmt_insert_id_t)(MYSQL_STMT *stmt); +typedef unsigned int (STDCALL *mysql_stmt_field_count_t)(MYSQL_STMT *stmt); + +typedef void (STDCALL *mysql_get_character_set_info_t)(MYSQL *mysql, + MY_CHARSET_INFO *charset); + +// API declarations +class SQLAPI_API myAPI : public saAPI +{ +public: + myAPI(); + + mysql_num_rows_t mysql_num_rows; + mysql_num_fields_t mysql_num_fields; + mysql_eof_t mysql_eof; + mysql_fetch_field_direct_t mysql_fetch_field_direct; + mysql_fetch_fields_t mysql_fetch_fields; + mysql_row_tell_t mysql_row_tell; + mysql_field_tell_t mysql_field_tell; + mysql_field_count_t mysql_field_count; + mysql_affected_rows_t mysql_affected_rows; + mysql_insert_id_t mysql_insert_id; + mysql_errno_t mysql_errno; + mysql_error_t mysql_error; + mysql_info_t mysql_info; + mysql_thread_id_t mysql_thread_id; + mysql_character_set_name_t mysql_character_set_name; + mysql_init_t mysql_init; + mysql_ssl_set_t mysql_ssl_set; + mysql_ssl_cipher_t mysql_ssl_cipher; + mysql_ssl_clear_t mysql_ssl_clear; + mysql_connect_t mysql_connect; + mysql_change_user_t mysql_change_user; + mysql_real_connect1_t mysql_real_connect1; + mysql_real_connect2_t mysql_real_connect2; + mysql_close_t mysql_close; + mysql_next_result_t mysql_next_result; + mysql_select_db_t mysql_select_db; + mysql_query_t mysql_query; + mysql_send_query_t mysql_send_query; + mysql_read_query_result_t mysql_read_query_result; + mysql_real_query_t mysql_real_query; + mysql_create_db_t mysql_create_db; + mysql_drop_db_t mysql_drop_db; + mysql_shutdown_t mysql_shutdown; + mysql_dump_debug_info_t mysql_dump_debug_info; + mysql_refresh_t mysql_refresh; + mysql_kill_t mysql_kill; + mysql_ping_t mysql_ping; + mysql_stat_t mysql_stat; + mysql_get_server_info_t mysql_get_server_info; + mysql_get_client_info_t mysql_get_client_info; + mysql_get_host_info_t mysql_get_host_info; + mysql_get_proto_info_t mysql_get_proto_info; + mysql_list_dbs_t mysql_list_dbs; + mysql_list_tables_t mysql_list_tables; + mysql_list_fields_t mysql_list_fields; + mysql_list_processes_t mysql_list_processes; + mysql_store_result_t mysql_store_result; + mysql_use_result_t mysql_use_result; + mysql_options_t mysql_options; + mysql_free_result_t mysql_free_result; + mysql_data_seek_t mysql_data_seek; + mysql_row_seek_t mysql_row_seek; + mysql_field_seek_t mysql_field_seek; + mysql_fetch_row_t mysql_fetch_row; + mysql_fetch_lengths_t mysql_fetch_lengths; + mysql_fetch_field_t mysql_fetch_field; + mysql_escape_string_t mysql_escape_string; + mysql_real_escape_string_t mysql_real_escape_string; + mysql_debug_t mysql_debug; + mysql_odbc_escape_string_t mysql_odbc_escape_string; + myodbc_remove_escape_t myodbc_remove_escape; + mysql_thread_init_t mysql_thread_init; + mysql_thread_end_t mysql_thread_end; + mysql_thread_safe_t mysql_thread_safe; + mysql_server_init_t mysql_server_init; + mysql_server_end_t mysql_server_end; + mysql_set_character_set_t mysql_set_character_set; + // MySQL statement API functions + mysql_stmt_init_t mysql_stmt_init; + mysql_stmt_prepare_t mysql_stmt_prepare; + mysql_stmt_execute_t mysql_stmt_execute; + mysql_stmt_fetch_t mysql_stmt_fetch; + mysql_stmt_fetch_column_t mysql_stmt_fetch_column; + mysql_stmt_store_result_t mysql_stmt_store_result; + mysql_stmt_param_count_t mysql_stmt_param_count; + mysql_stmt_attr_set_t mysql_stmt_attr_set; + mysql_stmt_attr_get_t mysql_stmt_attr_get; + mysql_stmt_bind_param_t mysql_stmt_bind_param; + mysql_stmt_bind_result_t mysql_stmt_bind_result; + mysql_stmt_close_t mysql_stmt_close; + mysql_stmt_reset_t mysql_stmt_reset; + mysql_stmt_free_result_t mysql_stmt_free_result; + mysql_stmt_send_long_data_t mysql_stmt_send_long_data; + mysql_stmt_result_metadata_t mysql_stmt_result_metadata; + mysql_stmt_param_metadata_t mysql_stmt_param_metadata; + mysql_stmt_errno_t mysql_stmt_errno; + mysql_stmt_error_t mysql_stmt_error; + mysql_stmt_sqlstate_t mysql_stmt_sqlstate; + mysql_stmt_row_seek_t mysql_stmt_row_seek; + mysql_stmt_row_tell_t mysql_stmt_row_tell; + mysql_stmt_data_seek_t mysql_stmt_data_seek; + mysql_stmt_num_rows_t mysql_stmt_num_rows; + mysql_stmt_affected_rows_t mysql_stmt_affected_rows; + mysql_stmt_insert_id_t mysql_stmt_insert_id; + mysql_stmt_field_count_t mysql_stmt_field_count; + + mysql_get_character_set_info_t mysql_get_character_set_info; +}; + +class SQLAPI_API myConnectionHandles : public saConnectionHandles +{ +public: + myConnectionHandles(); + + MYSQL *mysql; // MySQL connection struct +}; + +class SQLAPI_API myCommandHandles : public saCommandHandles +{ +public: + myCommandHandles(); + + MYSQL_RES *result; // MySQL result struct + MYSQL_STMT *stmt; // MySQL statement struct +}; + +extern myAPI g_myAPI; + +#endif // !defined(__MYAPI_H__) diff --git a/libraries/SQLAPI/include/mysql/errmsg.h b/libraries/SQLAPI/include/mysql/errmsg.h new file mode 100644 index 000000000..4b5857746 --- /dev/null +++ b/libraries/SQLAPI/include/mysql/errmsg.h @@ -0,0 +1,112 @@ +#ifndef ERRMSG_INCLUDED +#define ERRMSG_INCLUDED + +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* Error messages for MySQL clients */ +/* (Error messages for the daemon are in sql/share/errmsg.txt) */ + +#ifdef __cplusplus +extern "C" { +#endif +void init_client_errs(void); +void finish_client_errs(void); +extern const char *client_errors[]; /* Error messages */ +#ifdef __cplusplus +} +#endif + +#define CR_MIN_ERROR 2000 /* For easier client code */ +#define CR_MAX_ERROR 2999 +#if !defined(ER) +#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \ + client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR]) + +#endif +#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ + +/* Do not add error numbers before CR_ERROR_FIRST. */ +/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */ +#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/ +#define CR_UNKNOWN_ERROR 2000 +#define CR_SOCKET_CREATE_ERROR 2001 +#define CR_CONNECTION_ERROR 2002 +#define CR_CONN_HOST_ERROR 2003 +#define CR_IPSOCK_ERROR 2004 +#define CR_UNKNOWN_HOST 2005 +#define CR_SERVER_GONE_ERROR 2006 +#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 +#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_EMBEDDED_CONNECTION 2021 +#define CR_PROBE_SLAVE_STATUS 2022 +#define CR_PROBE_SLAVE_HOSTS 2023 +#define CR_PROBE_SLAVE_CONNECT 2024 +#define CR_PROBE_MASTER_CONNECT 2025 +#define CR_SSL_CONNECTION_ERROR 2026 +#define CR_MALFORMED_PACKET 2027 +#define CR_WRONG_LICENSE 2028 + +/* new 4.1 error codes */ +#define CR_NULL_POINTER 2029 +#define CR_NO_PREPARE_STMT 2030 +#define CR_PARAMS_NOT_BOUND 2031 +#define CR_DATA_TRUNCATED 2032 +#define CR_NO_PARAMETERS_EXISTS 2033 +#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_REQUEST_ERROR 2038 +#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039 +#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040 +#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041 +#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042 +#define CR_SHARED_MEMORY_MAP_ERROR 2043 +#define CR_SHARED_MEMORY_EVENT_ERROR 2044 +#define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045 +#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046 +#define CR_CONN_UNKNOW_PROTOCOL 2047 +#define CR_INVALID_CONN_HANDLE 2048 +#define CR_SECURE_AUTH 2049 +#define CR_FETCH_CANCELED 2050 +#define CR_NO_DATA 2051 +#define CR_NO_STMT_METADATA 2052 +#define CR_NO_RESULT_SET 2053 +#define CR_NOT_IMPLEMENTED 2054 +#define CR_SERVER_LOST_EXTENDED 2055 +#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 +#define CR_ERROR_LAST /*Copy last error nr:*/ 2061 +/* Add error numbers before CR_ERROR_LAST and change it accordingly. */ + +#endif /* ERRMSG_INCLUDED */ diff --git a/libraries/SQLAPI/include/mysql/my_alloc.h b/libraries/SQLAPI/include/mysql/my_alloc.h new file mode 100644 index 000000000..9e2ef541b --- /dev/null +++ b/libraries/SQLAPI/include/mysql/my_alloc.h @@ -0,0 +1,60 @@ +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* + Data structures for mysys/my_alloc.c (root memory allocator) +*/ + +#ifndef _my_alloc_h +#define _my_alloc_h + +#define ALLOC_MAX_BLOCK_TO_DROP 4096 +#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_used_mem +{ /* struct for once_alloc (block) */ + struct st_used_mem *next; /* Next block in use */ + unsigned int left; /* memory left in block */ + unsigned int size; /* size of block */ +} USED_MEM; + + +typedef struct st_mem_root +{ + USED_MEM *free; /* blocks with free memory in it */ + USED_MEM *used; /* blocks almost without free memory */ + USED_MEM *pre_alloc; /* preallocated block */ + /* if block have less memory it will be put in 'used' list */ + size_t min_malloc; + size_t block_size; /* initial block size */ + unsigned int block_num; /* allocated blocks counter */ + /* + first free block in queue test counter (if it exceed + MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list) + */ + unsigned int first_block_usage; + + void (*error_handler)(void); +} MEM_ROOT; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/SQLAPI/include/mysql/my_list.h b/libraries/SQLAPI/include/mysql/my_list.h new file mode 100644 index 000000000..294be663d --- /dev/null +++ b/libraries/SQLAPI/include/mysql/my_list.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-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 *); +extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); + +#define list_rest(a) ((a)->next) +#define list_push(a,b) (a)=list_cons((b),(a)) +#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } + +#ifdef __cplusplus +} +#endif +#endif diff --git a/libraries/SQLAPI/include/mysql/mysql.h b/libraries/SQLAPI/include/mysql/mysql.h new file mode 100644 index 000000000..38b54de2e --- /dev/null +++ b/libraries/SQLAPI/include/mysql/mysql.h @@ -0,0 +1,739 @@ +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* + This file defines the client API to MySQL and also the ABI of the + dynamically linked libmysqlclient. + + The ABI should never be changed in a released product of MySQL, + thus you need to take great care when changing the file. In case + the file is changed so the ABI is broken, you must also update + the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake +*/ + +#ifndef _mysql_h +#define _mysql_h + +#ifdef _AIX /* large-file support will break without this */ +#include +#endif + +#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ +#undef WIN +#undef _WIN +#undef _WIN32 +#undef _WIN64 +#undef __WIN__ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MY_GLOBAL_INCLUDED /* If not standard header */ +#ifndef MYSQL_ABI_CHECK +#include +#endif +#ifdef __LCC__ +#include /* For windows */ +#endif +typedef char my_bool; +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) +#define __WIN__ +#endif +#if !defined(__WIN__) +#define STDCALL +#else +#define STDCALL __stdcall +#endif + +#ifndef my_socket_defined +#ifdef __WIN__ +#define my_socket SOCKET +#else +typedef int my_socket; +#endif /* __WIN__ */ +#endif /* my_socket_defined */ +#endif /* MY_GLOBAL_INCLUDED */ + +#include "mysql_version.h" +#include "mysql_com.h" +#include "mysql_time.h" + +#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ + +extern unsigned int mysql_port; +extern char *mysql_unix_port; + +#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */ +#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */ + +#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) +/** + Returns true if the value is a number which does not need quotes for + the sql_lex.cc parser to parse correctly. +*/ +#define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) +#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING) + + +typedef struct st_mysql_field { + char *name; /* Name of column */ + char *org_name; /* Original column name, if an alias */ + char *table; /* Table of column if column was a field */ + char *org_table; /* Org table name, if table was an alias */ + char *db; /* Database for table */ + char *catalog; /* Catalog for table */ + char *def; /* Default value (set by mysql_list_fields) */ + unsigned long length; /* Width of column (create length) */ + unsigned long max_length; /* Max width for selected set */ + 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; /* Character set */ + enum enum_field_types type; /* Type of field. See mysql_com.h for types */ + void *extension; +} MYSQL_FIELD; + +typedef char **MYSQL_ROW; /* return data as array of strings */ +typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ + +#ifndef MY_GLOBAL_INCLUDED +#if defined(NO_CLIENT_LONG_LONG) +typedef unsigned long my_ulonglong; +#elif defined (__WIN__) +typedef unsigned __int64 my_ulonglong; +#else +typedef unsigned long long my_ulonglong; +#endif +#endif + +#include "typelib.h" + +#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) + +/* backward compatibility define - to be removed eventually */ +#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED + +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 */ + +#include "my_alloc.h" + +typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; +typedef struct st_mysql_data { + MYSQL_ROWS *data; + struct embedded_query_result *embedded_info; + MEM_ROOT alloc; + my_ulonglong rows; + unsigned int fields; + /* extra info for embedded library */ + 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, + 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 +}; + +/** + @todo remove the "extension", move st_mysql_options completely + out of mysql.h +*/ +struct st_mysql_options_extention; + +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_commands; + 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; /* cipher to use */ + 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 unused1; + my_bool unused2; + my_bool unused3; + my_bool unused4; + enum mysql_option methods_to_use; + union { + /* + The ip/hostname to use when authenticating + client against embedded server built with + grant tables - only used in embedded server + */ + char *client_ip; + + /* + The local address to bind when connecting to + remote server - not used in embedded server + */ + char *bind_address; + } ci; + /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */ + my_bool secure_auth; + /* 0 - never report, 1 - always report (default) */ + 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_extention *extension; +}; + +enum mysql_status +{ + MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, + MYSQL_STATUS_STATEMENT_GET_RESULT +}; + +enum mysql_protocol_type +{ + MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, + MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY +}; + +typedef struct character_set +{ + unsigned int number; /* character set number */ + unsigned int state; /* character set state */ + const char *csname; /* collation name */ + const char *name; /* character set 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; + +struct st_mysql_methods; +struct st_mysql_stmt; + +typedef struct st_mysql +{ + NET net; /* Communication parameters */ + unsigned char *connector_fd; /* ConnectorFd for SSL */ + char *host,*user,*passwd,*unix_socket,*server_version,*host_info; + char *info, *db; + struct charset_info_st *charset; + MYSQL_FIELD *fields; + MEM_ROOT field_alloc; + my_ulonglong affected_rows; + my_ulonglong insert_id; /* id if insert on table with NEXTNR */ + my_ulonglong extra_info; /* Not used */ + unsigned long thread_id; /* Id for connection in server */ + unsigned long packet_length; + unsigned int port; + unsigned long client_flag,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; /* If free in mysql_close */ + my_bool reconnect; /* set to 1 if automatic reconnect */ + + /* session-wide random string */ + char scramble[SCRAMBLE_LENGTH+1]; + my_bool unused1; + void *unused2, *unused3, *unused4, *unused5; + + LIST *stmts; /* list of all statements */ + const struct st_mysql_methods *methods; + void *thd; + /* + Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag + from mysql_stmt_close if close had to cancel result set of this object. + */ + my_bool *unbuffered_fetch_owner; + /* needed for embedded server - no net buffer to store the 'info' */ + char *info_buffer; + void *extension; +} MYSQL; + + +typedef struct st_mysql_res { + my_ulonglong row_count; + MYSQL_FIELD *fields; + MYSQL_DATA *data; + MYSQL_ROWS *data_cursor; + unsigned long *lengths; /* column lengths of current row */ + MYSQL *handle; /* for unbuffered reads */ + const struct st_mysql_methods *methods; + MYSQL_ROW row; /* If unbuffered read */ + MYSQL_ROW current_row; /* buffer to current row */ + MEM_ROOT field_alloc; + unsigned int field_count, current_field; + my_bool eof; /* Used by mysql_fetch_row */ + /* mysql_stmt_close() had to cancel this result */ + my_bool unbuffered_fetch_cancelled; + void *extension; +} MYSQL_RES; + + +#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) +#define MYSQL_CLIENT +#endif + + +typedef struct st_mysql_parameters +{ + unsigned long *p_max_allowed_packet; + unsigned long *p_net_buffer_length; + void *extension; +} MYSQL_PARAMETERS; + +#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY) +#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet) +#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length) +#endif + +/* + Set up and bring down the server; to ensure that applications will + work when linked against either the standard client library or the + embedded server library, these functions should be called. +*/ +int STDCALL mysql_server_init(int argc, char **argv, char **groups); +void STDCALL mysql_server_end(void); + +/* + mysql_server_init/end need to be called when using libmysqld or + libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so + you don't need to call it explicitely; but you need to call + mysql_server_end() to free memory). The names are a bit misleading + (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general + names which suit well whether you're using libmysqld or libmysqlclient. We + intend to promote these aliases over the mysql_server* ones. +*/ +#define mysql_library_init mysql_server_init +#define mysql_library_end mysql_server_end + +MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void); + +/* + Set up and bring down a thread; these function should be called + for each thread in an application which opens at least one MySQL + connection. All uses of the connection(s) should be between these + function calls. +*/ +my_bool STDCALL mysql_thread_init(void); +void STDCALL mysql_thread_end(void); + +/* + 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_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res); +MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res); + +unsigned int STDCALL mysql_field_count(MYSQL *mysql); +my_ulonglong STDCALL mysql_affected_rows(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_sqlstate(MYSQL *mysql); +unsigned int STDCALL mysql_warning_count(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); +int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname); + +MYSQL * STDCALL mysql_init(MYSQL *mysql); +my_bool 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); +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); +int STDCALL mysql_real_query(MYSQL *mysql, const char *q, + unsigned long length); +MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); + +void STDCALL mysql_get_character_set_info(MYSQL *mysql, + MY_CHARSET_INFO *charset); + +/* local infile support */ + +#define LOCAL_INFILE_ERROR_LEN 512 + +void +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); + +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_set_server_option(MYSQL *mysql, + enum enum_mysql_set_option + option); +int STDCALL mysql_ping(MYSQL *mysql); +const char * STDCALL mysql_stat(MYSQL *mysql); +const char * STDCALL mysql_get_server_info(MYSQL *mysql); +const char * STDCALL mysql_get_client_info(void); +unsigned long STDCALL mysql_get_client_version(void); +const char * STDCALL mysql_get_host_info(MYSQL *mysql); +unsigned long STDCALL mysql_get_server_version(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_processes(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, + my_ulonglong offset); +MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, + MYSQL_ROW_OFFSET 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); +MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, + const char *wild); +unsigned long STDCALL mysql_escape_string(char *to,const char *from, + unsigned long from_length); +unsigned long STDCALL mysql_hex_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); +void STDCALL mysql_debug(const char *debug); +void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); +unsigned int STDCALL mysql_thread_safe(void); +my_bool STDCALL mysql_embedded(void); +my_bool STDCALL mysql_read_query_result(MYSQL *mysql); + + +/* + The following definitions are added for the enhanced + client-server protocol +*/ + +/* statement state */ +enum enum_mysql_stmt_state +{ + MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE, + MYSQL_STMT_FETCH_DONE +}; + + +/* + This structure is used to define bind information, and + internally by the client library. + Public members with their descriptions are listed below + (conventionally `On input' refers to the binds given to + mysql_stmt_bind_param, `On output' refers to the binds given + to mysql_stmt_bind_result): + + buffer_type - One of the MYSQL_* types, used to describe + the host language type of buffer. + On output: if column type is different from + buffer_type, column value is automatically converted + to buffer_type before it is stored in the buffer. + buffer - On input: points to the buffer with input data. + On output: points to the buffer capable to store + output data. + The type of memory pointed by buffer must correspond + to buffer_type. See the correspondence table in + the comment to mysql_stmt_bind_param. + + The two above members are mandatory for any kind of bind. + + buffer_length - the length of the buffer. You don't have to set + it for any fixed length buffer: float, double, + int, etc. It must be set however for variable-length + types, such as BLOBs or STRINGs. + + length - On input: in case when lengths of input values + are different for each execute, you can set this to + point at a variable containining value length. This + way the value length can be different in each execute. + If length is not NULL, buffer_length is not used. + Note, length can even point at buffer_length if + you keep bind structures around while fetching: + this way you can change buffer_length before + each execution, everything will work ok. + On output: if length is set, mysql_stmt_fetch will + write column length into it. + + is_null - On input: points to a boolean variable that should + be set to TRUE for NULL values. + This member is useful only if your data may be + NULL in some but not all cases. + If your data is never NULL, is_null should be set to 0. + If your data is always NULL, set buffer_type + to MYSQL_TYPE_NULL, and is_null will not be used. + + is_unsigned - On input: used to signify that values provided for one + of numeric types are unsigned. + On output describes signedness of the output buffer. + If, taking into account is_unsigned flag, column data + is out of range of the output buffer, data for this column + is regarded truncated. Note that this has no correspondence + to the sign of result set column, if you need to find it out + use mysql_stmt_result_metadata. + error - where to write a truncation error if it is present. + possible error value is: + 0 no truncation + 1 value is out of range or buffer is too small + + Please note that MYSQL_BIND also has internals members. +*/ + +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; + unsigned char *row_ptr; /* for the current data position */ + 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 param_number; /* For null count and error messages */ + 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; + + +struct st_mysql_stmt_extension; + +/* statement handler */ +typedef struct st_mysql_stmt +{ + MEM_ROOT mem_root; /* root allocations */ + LIST list; /* list to keep track of all stmts */ + MYSQL *mysql; /* connection handle */ + MYSQL_BIND *params; /* input parameters */ + MYSQL_BIND *bind; /* output parameters */ + MYSQL_FIELD *fields; /* result set metadata */ + MYSQL_DATA result; /* cached result set */ + MYSQL_ROWS *data_cursor; /* current row in cached result */ + /* + mysql_stmt_fetch() calls this function to fetch one row (it's different + for buffered, unbuffered and cursor fetch). + */ + int (*read_row_func)(struct st_mysql_stmt *stmt, + unsigned char **row); + /* copy of mysql->affected_rows after statement execution */ + my_ulonglong affected_rows; + my_ulonglong insert_id; /* copy of mysql->insert_id */ + unsigned long stmt_id; /* Id for prepared statement */ + unsigned long flags; /* i.e. type of cursor to open */ + unsigned long prefetch_rows; /* number of rows per one COM_FETCH */ + /* + Copied from mysql->server_status after execute/fetch to know + server-side cursor status for this statement. + */ + unsigned int server_status; + unsigned int last_errno; /* error code */ + unsigned int param_count; /* input parameter count */ + unsigned int field_count; /* number of columns in result set */ + enum enum_mysql_stmt_state state; /* statement state */ + char last_error[MYSQL_ERRMSG_SIZE]; /* error message */ + char sqlstate[SQLSTATE_LENGTH+1]; + /* Types of input parameters should be sent to server */ + my_bool send_types_to_server; + my_bool bind_param_done; /* input buffers were supplied */ + unsigned char bind_result_done; /* output buffers were supplied */ + /* mysql_stmt_close() had to cancel this result */ + my_bool unbuffered_fetch_cancelled; + /* + Is set to true if we need to calculate field->max_length for + metadata fields when doing mysql_stmt_store_result. + */ + my_bool update_max_length; + struct st_mysql_stmt_extension *extension; +} MYSQL_STMT; + +enum enum_stmt_attr_type +{ + /* + When doing mysql_stmt_store_result calculate max_length attribute + of statement metadata. This is to be consistent with the old API, + where this was done automatically. + In the new API we do that only by request because it slows down + mysql_stmt_store_result sufficiently. + */ + STMT_ATTR_UPDATE_MAX_LENGTH, + /* + unsigned long with combination of cursor flags (read only, for update, + etc) + */ + STMT_ATTR_CURSOR_TYPE, + /* + Amount of rows to retrieve from server per one fetch if using cursors. + Accepts unsigned long attribute in the range 1 - ulong_max + */ + STMT_ATTR_PREFETCH_ROWS +}; + + +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, my_ulonglong offset); +my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt); +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); +my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt); +unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt); + +my_bool STDCALL mysql_commit(MYSQL * mysql); +my_bool STDCALL mysql_rollback(MYSQL * mysql); +my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode); +my_bool STDCALL mysql_more_results(MYSQL *mysql); +int STDCALL mysql_next_result(MYSQL *mysql); +int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt); +void STDCALL mysql_close(MYSQL *sock); + + +/* status return codes */ +#define MYSQL_NO_DATA 100 +#define MYSQL_DATA_TRUNCATED 101 + +#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) + +#ifdef USE_OLD_FUNCTIONS +MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, + const char *user, const char *passwd); +int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); +int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); +#endif +#define HAVE_MYSQL_REAL_CONNECT + +#ifdef __cplusplus +} +#endif + +#endif /* _mysql_h */ diff --git a/libraries/SQLAPI/include/mysql/mysql_com.h b/libraries/SQLAPI/include/mysql/mysql_com.h new file mode 100644 index 000000000..a25af23fa --- /dev/null +++ b/libraries/SQLAPI/include/mysql/mysql_com.h @@ -0,0 +1,602 @@ +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* +** Common definition between mysql server & client +*/ + +#ifndef _mysql_com_h +#define _mysql_com_h + +#define HOSTNAME_LENGTH 60 +#define SYSTEM_CHARSET_MBMAXLEN 3 +#define NAME_CHAR_LEN 64 /* Field/table name length */ +#define USERNAME_CHAR_LENGTH 16 +#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN) +#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN) + +#define MYSQL_AUTODETECT_CHARSET_NAME "auto" + +#define SERVER_VERSION_LENGTH 60 +#define SQLSTATE_LENGTH 5 + +/* + Maximum length of comments +*/ +#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */ +#define TABLE_COMMENT_MAXLEN 2048 +#define COLUMN_COMMENT_MAXLEN 1024 +#define INDEX_COMMENT_MAXLEN 1024 +#define TABLE_PARTITION_COMMENT_MAXLEN 1024 + +/* + USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain + username and hostname parts of the user identifier with trailing zero in + MySQL standard format: + user_name_part@host_name_part\0 +*/ +#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2 + +#define LOCAL_HOST "localhost" +#define LOCAL_HOST_NAMEDPIPE "." + + +#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) +#define MYSQL_NAMEDPIPE "MySQL" +#define MYSQL_SERVICENAME "MySQL" +#endif /* __WIN__ */ + +/* + You should add new commands to the end of this list, otherwise old + servers won't be able to handle them as 'unsupported'. +*/ + +enum enum_server_command +{ + COM_SLEEP, 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, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, + COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, + COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, + COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, + COM_BINLOG_DUMP_GTID, + /* don't forget to update const char *command_name[] in sql_parse.cc */ + + /* Must be last */ + COM_END +}; + + +/* + Length of random string sent by server on handshake; this is also length of + obfuscated password, recieved from client +*/ +#define SCRAMBLE_LENGTH 20 +#define SCRAMBLE_LENGTH_323 8 +/* length of password stored in the db: new passwords are preceeded with '*' */ +#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1) +#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2) + + +#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 /* Field is binary */ + +/* 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 */ +#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 */ +#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 BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */ +#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */ +#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */ +/** + Intern: Field in TABLE object for new version of altered table, + which participates in a newly added index. +*/ +#define FIELD_IN_ADD_INDEX (1 << 20) +#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */ +#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */ +#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA) +#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */ +#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT) +#define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */ + +#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 */ +#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */ +#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */ +#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */ +#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */ +#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */ +#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */ + +/* The following can't be set with mysql_refresh() */ +#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ +#define REFRESH_FAST 32768 /* Intern flag */ + +/* RESET (remove all queries) from query cache */ +#define REFRESH_QUERY_CACHE 65536 +#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ +#define REFRESH_DES_KEY_FILE 0x40000L +#define REFRESH_USER_RESOURCES 0x80000L +#define REFRESH_FOR_EXPORT 0x100000L /* FLUSH TABLES ... FOR EXPORT */ + +#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ +#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_PROTOCOL_41 512 /* New 4.1 protocol */ +#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 */ +#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ +#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ +#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */ +#define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */ +#define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */ + +#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */ +#define CLIENT_CONNECT_ATTRS (1UL << 20) /* Client supports connection attributes */ + +/* Enable authentication response packet to be larger than 255 bytes. */ +#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) + +/* Don't close the connection for a connection with expired password. */ +#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) + +#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) +#define CLIENT_REMEMBER_OPTIONS (1UL << 31) + +#ifdef HAVE_COMPRESS +#define CAN_CLIENT_COMPRESS CLIENT_COMPRESS +#else +#define CAN_CLIENT_COMPRESS 0 +#endif + +/* Gather all possible capabilites (flags) supported by the server */ +#define CLIENT_ALL_FLAGS (CLIENT_LONG_PASSWORD \ + | CLIENT_FOUND_ROWS \ + | CLIENT_LONG_FLAG \ + | CLIENT_CONNECT_WITH_DB \ + | CLIENT_NO_SCHEMA \ + | CLIENT_COMPRESS \ + | CLIENT_ODBC \ + | CLIENT_LOCAL_FILES \ + | CLIENT_IGNORE_SPACE \ + | CLIENT_PROTOCOL_41 \ + | CLIENT_INTERACTIVE \ + | CLIENT_SSL \ + | CLIENT_IGNORE_SIGPIPE \ + | CLIENT_TRANSACTIONS \ + | CLIENT_RESERVED \ + | CLIENT_SECURE_CONNECTION \ + | CLIENT_MULTI_STATEMENTS \ + | CLIENT_MULTI_RESULTS \ + | CLIENT_PS_MULTI_RESULTS \ + | CLIENT_SSL_VERIFY_SERVER_CERT \ + | CLIENT_REMEMBER_OPTIONS \ + | CLIENT_PLUGIN_AUTH \ + | CLIENT_CONNECT_ATTRS \ + | CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA \ + | CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS \ +) + +/* + Switch off the flags that are optional and depending on build flags + If any of the optional flags is supported by the build it will be switched + on before sending to the client during the connection handshake. +*/ +#define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \ + & ~CLIENT_COMPRESS) \ + & ~CLIENT_SSL_VERIFY_SERVER_CERT) + +/** + Is raised when a multi-statement transaction + has been started, either explicitly, by means + of BEGIN or COMMIT AND CHAIN, or + implicitly, by the first transactional + statement, when autocommit=off. +*/ +#define SERVER_STATUS_IN_TRANS 1 +#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ +#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ +#define SERVER_QUERY_NO_GOOD_INDEX_USED 16 +#define SERVER_QUERY_NO_INDEX_USED 32 +/** + The server was able to fulfill the clients request and opened a + read-only non-scrollable cursor for a query. This flag comes + in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands. +*/ +#define SERVER_STATUS_CURSOR_EXISTS 64 +/** + This flag is sent when a read-only cursor is exhausted, in reply to + COM_STMT_FETCH command. +*/ +#define SERVER_STATUS_LAST_ROW_SENT 128 +#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ +#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512 +/** + Sent to the client if after a prepared statement reprepare + we discovered that the new statement returns a different + number of result set columns. +*/ +#define SERVER_STATUS_METADATA_CHANGED 1024 +#define SERVER_QUERY_WAS_SLOW 2048 + +/** + To mark ResultSet containing output parameter values. +*/ +#define SERVER_PS_OUT_PARAMS 4096 + +/** + Set at the same time as SERVER_STATUS_IN_TRANS if the started + multi-statement transaction is a read-only transaction. Cleared + when the transaction commits or aborts. Since this flag is sent + to clients in OK and EOF packets, the flag indicates the + transaction status at the end of command execution. +*/ +#define SERVER_STATUS_IN_TRANS_READONLY 8192 + + +/** + Server status flags that must be cleared when starting + execution of a new SQL statement. + Flags from this set are only added to the + current server status by the execution engine, but + never removed -- the execution engine expects them + to disappear automagically by the next command. +*/ +#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \ + SERVER_QUERY_NO_INDEX_USED|\ + SERVER_MORE_RESULTS_EXISTS|\ + SERVER_STATUS_METADATA_CHANGED |\ + SERVER_QUERY_WAS_SLOW |\ + SERVER_STATUS_DB_DROPPED |\ + SERVER_STATUS_CURSOR_EXISTS|\ + SERVER_STATUS_LAST_ROW_SENT) + +#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 */ + +#define ONLY_KILL_QUERY 1 + + +struct st_vio; /* Only C */ +typedef struct st_vio Vio; + +#define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */ +#define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */ +#define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */ +#define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ +#define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ +#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */ +#define MAX_BLOB_WIDTH 16777216 /* Default width for blob */ + +typedef struct st_net { +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) + Vio *vio; + unsigned char *buff,*buff_end,*write_pos,*read_pos; + my_socket fd; /* For Perl DBI/dbd */ + /* + The following variable is set if we are doing several queries in one + command ( as in LOAD TABLE ... FROM MASTER ), + and do not want to confuse the client with OK at the wrong time + */ + unsigned long remain_in_buf,length, 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; + my_bool unused1; /* Please remove with the next incompatible ABI change */ + my_bool unused2; /* Please remove with the next incompatible ABI change */ + my_bool compress; + my_bool unused3; /* Please remove with the next incompatible ABI change. */ + /* + Pointer to query object in query cache, do not equal NULL (0) for + queries in cache that have not stored its results yet + */ +#endif + /* + Unused, please remove with the next incompatible ABI change. + */ + unsigned char *unused; + unsigned int last_errno; + unsigned char error; + my_bool unused4; /* Please remove with the next incompatible ABI change. */ + my_bool unused5; /* Please remove with the next incompatible ABI change. */ + /** Client library error message buffer. Actually belongs to struct MYSQL. */ + char last_error[MYSQL_ERRMSG_SIZE]; + /** Client library sqlstate buffer. Set along with the error message. */ + char sqlstate[SQLSTATE_LENGTH+1]; + /** + Extension pointer, for the caller private use. + Any program linking with the networking library can use this pointer, + which is handy when private connection specific data needs to be + maintained. + The mysqld server process uses this pointer internally, + to maintain the server internal instrumentation for the connection. + */ + void *extension; +} NET; + + +#define packet_error (~(unsigned long) 0) + +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, + MYSQL_TYPE_TIMESTAMP2, + MYSQL_TYPE_DATETIME2, + MYSQL_TYPE_TIME2, + 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 + +}; + +/* For backward compatibility */ +#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS +#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_CHAR MYSQL_TYPE_TINY +#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM +#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY +#define FIELD_TYPE_BIT MYSQL_TYPE_BIT + + +/* Shutdown/kill enums and constants */ + +/* Bits for THD::killable. */ +#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) +#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) +#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) +#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) + +enum mysql_enum_shutdown_level { + /* + We want levels to be in growing order of hardness (because we use number + comparisons). Note that DEFAULT does not respect the growing property, but + it's ok. + */ + SHUTDOWN_DEFAULT = 0, + /* wait for existing connections to finish */ + SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, + /* wait for existing trans to finish */ + SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, + /* wait for existing updates to finish (=> no partial MyISAM update) */ + SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, + /* flush InnoDB buffers and other storage engines' buffers*/ + SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), + /* don't flush InnoDB buffers, flush other storage engines' buffers*/ + SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1, + /* Now the 2 levels of the KILL command */ +#if MYSQL_VERSION_ID >= 50000 + KILL_QUERY= 254, +#endif + KILL_CONNECTION= 255 +}; + + +enum enum_cursor_type +{ + CURSOR_TYPE_NO_CURSOR= 0, + CURSOR_TYPE_READ_ONLY= 1, + CURSOR_TYPE_FOR_UPDATE= 2, + CURSOR_TYPE_SCROLLABLE= 4 +}; + + +/* options for mysql_set_option */ +enum enum_mysql_set_option +{ + MYSQL_OPTION_MULTI_STATEMENTS_ON, + MYSQL_OPTION_MULTI_STATEMENTS_OFF +}; + +#define net_new_transaction(net) ((net)->pkt_nr=0) + +#ifdef __cplusplus +extern "C" { +#endif + +my_bool my_net_init(NET *net, Vio* vio); +void my_net_local_init(NET *net); +void net_end(NET *net); +void net_clear(NET *net, my_bool check_buffer); +my_bool net_realloc(NET *net, size_t length); +my_bool net_flush(NET *net); +my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); +my_bool net_write_command(NET *net,unsigned char command, + const unsigned char *header, size_t head_len, + const unsigned char *packet, size_t len); +my_bool net_write_packet(NET *net, const unsigned char *packet, size_t length); +unsigned long my_net_read(NET *net); + +#ifdef MY_GLOBAL_INCLUDED +void my_net_set_write_timeout(NET *net, uint timeout); +void my_net_set_read_timeout(NET *net, uint timeout); +#endif + +struct rand_struct { + unsigned long seed1,seed2,max_value; + double max_value_dbl; +}; + +#ifdef __cplusplus +} +#endif + + /* The following is for user defined functions */ + +enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, + DECIMAL_RESULT}; + +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 */ + char **attributes; /* Pointer to attribute name */ + unsigned long *attribute_lengths; /* Length of attribute arguments */ + void *extension; +} 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 long max_length; /* For string functions */ + char *ptr; /* free pointer for function data */ + my_bool const_item; /* 1 if function always returns the same value */ + void *extension; +} UDF_INIT; +/* + TODO: add a notion for determinism of the UDF. + See Item_udf_func::update_used_tables () +*/ + + /* 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 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + These functions are used for authentication by client and server and + implemented in sql/password.c +*/ + +void randominit(struct rand_struct *, unsigned long seed1, + unsigned long seed2); +double my_rnd(struct rand_struct *); +void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st); + +void hash_password(unsigned long *to, const char *password, unsigned int password_len); +void make_scrambled_password_323(char *to, const char *password); +void scramble_323(char *to, const char *message, const char *password); +my_bool check_scramble_323(const unsigned char *reply, const char *message, + unsigned long *salt); +void get_salt_from_password_323(unsigned long *res, const char *password); +void make_password_from_salt_323(char *to, const unsigned long *salt); + +void make_scrambled_password(char *to, const char *password); +void scramble(char *to, const char *message, const char *password); +my_bool check_scramble(const unsigned char *reply, const char *message, + const unsigned char *hash_stage2); +void get_salt_from_password(unsigned char *res, const char *password); +void make_password_from_salt(char *to, const unsigned char *hash_stage2); +char *octet2hex(char *to, const char *str, unsigned int len); + +/* end of password.c */ + +char *get_tty_password(const char *opt_message); +const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); + +/* Some other useful functions */ + +my_bool my_thread_init(void); +void my_thread_end(void); + +#ifdef MY_GLOBAL_INCLUDED +ulong STDCALL net_field_length(uchar **packet); +my_ulonglong net_field_length_ll(uchar **packet); +uchar *net_store_length(uchar *pkg, ulonglong length); +#endif + +#ifdef __cplusplus +} +#endif + +#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ +#define MYSQL_STMT_HEADER 4 +#define MYSQL_LONG_DATA_HEADER 6 + +#define NOT_FIXED_DEC 31 +#endif diff --git a/libraries/SQLAPI/include/mysql/mysql_time.h b/libraries/SQLAPI/include/mysql/mysql_time.h new file mode 100644 index 000000000..ac9719c68 --- /dev/null +++ b/libraries/SQLAPI/include/mysql/mysql_time.h @@ -0,0 +1,55 @@ +/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + +#ifndef _mysql_time_h_ +#define _mysql_time_h_ + +/* + Time declarations shared between the server and client API: + you should not add anything to this header unless it's used + (and hence should be visible) in mysql.h. + If you're looking for a place to add new time-related declaration, + it's most likely my_time.h. See also "C API Handling of Date + and Time Values" chapter in documentation. +*/ + +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 +}; + + +/* + Structure which is used to represent datetime values inside MySQL. + + We assume that values in this structure are normalized, i.e. year <= 9999, + month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions + in server such as my_system_gmt_sec() or make_time() family of functions + rely on this (actually now usage of make_*() family relies on a bit weaker + restriction). Also functions that produce MYSQL_TIME as result ensure this. + There is one exception to this rule though if this structure holds time + value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold + bigger values. +*/ +typedef struct st_mysql_time +{ + unsigned int year, month, day, hour, minute, second; + unsigned long second_part; /**< microseconds */ + my_bool neg; + enum enum_mysql_timestamp_type time_type; +} MYSQL_TIME; + +#endif /* _mysql_time_h_ */ diff --git a/libraries/SQLAPI/include/mysql/mysql_version.h b/libraries/SQLAPI/include/mysql/mysql_version.h new file mode 100644 index 000000000..3e27fbbd0 --- /dev/null +++ b/libraries/SQLAPI/include/mysql/mysql_version.h @@ -0,0 +1,32 @@ +/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB + & Detron HB, 1996, 1999-2004, 2007 MySQL AB. + This file is public domain and comes with NO WARRANTY of any kind +*/ + +/* Version numbers for protocol & mysqld */ + +#ifndef _mysql_version_h +#define _mysql_version_h +#ifdef _CUSTOMCONFIG_ +#include +#else +#define PROTOCOL_VERSION 10 +#define MYSQL_SERVER_VERSION "5.6.23" +#define MYSQL_BASE_VERSION "mysqld-5.6" +#define MYSQL_SERVER_SUFFIX_DEF "" +#define FRM_VER 6 +#define MYSQL_VERSION_ID 50623 +#define MYSQL_PORT 3306 +#define MYSQL_PORT_DEFAULT 0 +#define MYSQL_UNIX_ADDR "/tmp/mysql.sock" +#define MYSQL_CONFIG_NAME "my" +#define MYSQL_COMPILATION_COMMENT "MySQL Community Server (GPL)" + +/* mysqld compile time options */ +#endif /* _CUSTOMCONFIG_ */ + +#ifndef LICENSE +#define LICENSE GPL +#endif /* LICENSE */ + +#endif /* _mysql_version_h */ diff --git a/libraries/SQLAPI/include/mysql/typelib.h b/libraries/SQLAPI/include/mysql/typelib.h new file mode 100644 index 000000000..919dd69d6 --- /dev/null +++ b/libraries/SQLAPI/include/mysql/typelib.h @@ -0,0 +1,54 @@ +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + + +#ifndef _typelib_h +#define _typelib_h + +#include "my_alloc.h" + +typedef struct st_typelib { /* Different types saved here */ + unsigned int count; /* How many types */ + const char *name; /* Name of typelib */ + const char **type_names; + unsigned int *type_lengths; +} TYPELIB; + +extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); +extern int find_type_or_exit(const char *x, TYPELIB *typelib, + const char *option); +#define FIND_TYPE_BASIC 0 +/** makes @c find_type() require the whole name, no prefix */ +#define FIND_TYPE_NO_PREFIX (1 << 0) +/** always implicitely on, so unused, but old code may pass it */ +#define FIND_TYPE_NO_OVERWRITE (1 << 1) +/** makes @c find_type() accept a number */ +#define FIND_TYPE_ALLOW_NUMBER (1 << 2) +/** makes @c find_type() treat ',' as terminator */ +#define FIND_TYPE_COMMA_TERM (1 << 3) + +extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); +extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); +extern const char *get_type(TYPELIB *typelib,unsigned int nr); +extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); + +extern TYPELIB sql_protocol_typelib; + +my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, + my_ulonglong cur_set, my_ulonglong default_set, + const char *str, unsigned int length, + char **err_pos, unsigned int *err_len); + +#endif /* _typelib_h */ diff --git a/libraries/SQLAPI/include/odbcAPI.h b/libraries/SQLAPI/include/odbcAPI.h new file mode 100644 index 000000000..20f2dd5f5 --- /dev/null +++ b/libraries/SQLAPI/include/odbcAPI.h @@ -0,0 +1,472 @@ +// odbcAPI.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__ODBCAPI_H__) +#define __ODBCAPI_H__ + +#include "SQLAPI.h" + +// API header(s) +#include +#include + +extern long g_nODBCDLLVersionLoaded; + +extern void AddODBCSupport(const SAConnection *pCon); +extern void ReleaseODBCSupport(); + +typedef SQLRETURN (SQL_API *SQLAllocConnect_t)(SQLHENV EnvironmentHandle, + SQLHDBC *ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLAllocEnv_t)(SQLHENV *EnvironmentHandle); +typedef SQLRETURN (SQL_API *SQLAllocHandle_t)(SQLSMALLINT HandleType, + SQLHANDLE InputHandle, SQLHANDLE *OutputHandle); +typedef SQLRETURN (SQL_API *SQLAllocStmt_t)(SQLHDBC ConnectionHandle, + SQLHSTMT *StatementHandle); +typedef SQLRETURN (SQL_API *SQLBindCol_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValue, + SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLBindParameter_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN *pcbValue); +typedef SQLRETURN (SQL_API *SQLBrowseConnect_t)( + SQLHDBC hdbc, + SQLTCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLTCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); +typedef SQLRETURN (SQL_API *SQLBulkOperations_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +typedef SQLRETURN (SQL_API *SQLCancel_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLCloseCursor_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLColAttribute_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, + SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, + SQLLEN *NumericAttribute); +typedef SQLRETURN (SQL_API *SQLColAttributes_t)( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); +typedef SQLRETURN (SQL_API *SQLColumnPrivileges_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLTCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLColumns_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLTCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLTCHAR *TableName, SQLSMALLINT NameLength3, + SQLTCHAR *ColumnName, SQLSMALLINT NameLength4); +typedef SQLRETURN (SQL_API *SQLConnect_t)(SQLHDBC ConnectionHandle, + SQLTCHAR *ServerName, SQLSMALLINT NameLength1, + SQLTCHAR *UserName, SQLSMALLINT NameLength2, + SQLTCHAR *Authentication, SQLSMALLINT NameLength3); +typedef SQLRETURN (SQL_API *SQLCopyDesc_t)(SQLHDESC SourceDescHandle, + SQLHDESC TargetDescHandle); +typedef SQLRETURN (SQL_API *SQLDataSources_t)(SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, SQLTCHAR *ServerName, + SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, + SQLTCHAR *Description, SQLSMALLINT BufferLength2, + SQLSMALLINT *NameLength2); +typedef SQLRETURN (SQL_API *SQLDescribeCol_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLTCHAR *ColumnName, + SQLSMALLINT BufferLength, + SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, + SQLULEN *ColumnSize, + SQLSMALLINT *DecimalDigits, + SQLSMALLINT *Nullable); +typedef SQLRETURN (SQL_API *SQLDescribeParam_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); +typedef SQLRETURN (SQL_API *SQLDisconnect_t)(SQLHDBC ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLDriverConnect_t)( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLTCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLTCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); +typedef SQLRETURN (SQL_API *SQLDrivers_t)( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLTCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLTCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); +typedef SQLRETURN (SQL_API *SQLEndTran_t)(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT CompletionType); +typedef SQLRETURN (SQL_API *SQLError_t)(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, + SQLTCHAR *Sqlstate, SQLINTEGER *NativeError, + SQLTCHAR *MessageText, SQLSMALLINT BufferLength, + SQLSMALLINT *TextLength); +typedef SQLRETURN (SQL_API *SQLExecDirect_t)(SQLHSTMT StatementHandle, + SQLTCHAR *StatementText, SQLINTEGER TextLength); +typedef SQLRETURN (SQL_API *SQLExecute_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLExtendedFetch_t)( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLLEN irow, + SQLULEN *pcrow, + SQLUSMALLINT *rgfRowStatus); +typedef SQLRETURN (SQL_API *SQLFetch_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLFetchScroll_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, + SQLLEN FetchOffset); +typedef SQLRETURN (SQL_API *SQLForeignKeys_t)( + SQLHSTMT hstmt, + SQLTCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLTCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLTCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLTCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLTCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLTCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); +typedef SQLRETURN (SQL_API *SQLFreeConnect_t)(SQLHDBC ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLFreeEnv_t)(SQLHENV EnvironmentHandle); +typedef SQLRETURN (SQL_API *SQLFreeHandle_t)(SQLSMALLINT HandleType, SQLHANDLE Handle); +typedef SQLRETURN (SQL_API *SQLFreeStmt_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT Option); +typedef SQLRETURN (SQL_API *SQLGetConnectAttr_t)(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetConnectOption_t)(SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, SQLPOINTER Value); +typedef SQLRETURN (SQL_API *SQLGetCursorName_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CursorName, SQLSMALLINT BufferLength, + SQLSMALLINT *NameLength); +typedef SQLRETURN (SQL_API *SQLGetData_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValue, + SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLGetDescField_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength, + SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetDescRec_t)( + SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLTCHAR *Name, + SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, + SQLSMALLINT *Type, + SQLSMALLINT *SubType, + SQLLEN *Length, + SQLSMALLINT *Precision, + SQLSMALLINT *Scale, + SQLSMALLINT *Nullable); +typedef SQLRETURN (SQL_API *SQLGetDiagRec_t)( + SQLSMALLINT HandleType, + SQLHANDLE Handle, + SQLSMALLINT RecNumber, + SQLTCHAR *Sqlstate, + SQLINTEGER *NativeError, + SQLTCHAR *MessageText, + SQLSMALLINT BufferLength, + SQLSMALLINT *TextLength); +typedef SQLRETURN (SQL_API *SQLGetDiagField_t)(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength); +typedef SQLRETURN (SQL_API *SQLGetEnvAttr_t)(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetFunctions_t)(SQLHDBC ConnectionHandle, + SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported); +typedef SQLRETURN (SQL_API *SQLGetInfo_t)(SQLHDBC ConnectionHandle, + SQLUSMALLINT InfoType, SQLPOINTER InfoValue, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength); +typedef SQLRETURN (SQL_API *SQLGetStmtAttr_t)(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetStmtOption_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT Option, SQLPOINTER Value); +typedef SQLRETURN (SQL_API *SQLGetTypeInfo_t)(SQLHSTMT StatementHandle, + SQLSMALLINT DataType); +typedef SQLRETURN (SQL_API *SQLMoreResults_t)( + SQLHSTMT hstmt); +typedef SQLRETURN (SQL_API *SQLNativeSql_t)( + SQLHDBC hdbc, + SQLTCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLTCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); +typedef SQLRETURN (SQL_API *SQLNumParams_t)( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); +typedef SQLRETURN (SQL_API *SQLNumResultCols_t)(SQLHSTMT StatementHandle, + SQLSMALLINT *ColumnCount); +typedef SQLRETURN (SQL_API *SQLParamData_t)(SQLHSTMT StatementHandle, + SQLPOINTER *Value); +typedef SQLRETURN (SQL_API *SQLParamOptions_t)( + SQLHSTMT hstmt, + SQLULEN crow, + SQLULEN *pirow); +typedef SQLRETURN (SQL_API *SQLPrepare_t)(SQLHSTMT StatementHandle, + SQLTCHAR *StatementText, SQLINTEGER TextLength); +typedef SQLRETURN (SQL_API *SQLPrimaryKeys_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API *SQLProcedureColumns_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLTCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLProcedures_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szProcName, + SQLSMALLINT cbProcName); +typedef SQLRETURN (SQL_API *SQLPutData_t)( + SQLHSTMT StatementHandle, + SQLPOINTER Data, + SQLLEN StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLRowCount_t)( + SQLHSTMT StatementHandle, + SQLLEN *RowCount); +typedef SQLRETURN (SQL_API *SQLSetConnectAttr_t)( + SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API *SQLSetConnectOption_t)( + SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, + SQLULEN Value); +typedef SQLRETURN (SQL_API *SQLSetCursorName_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CursorName, SQLSMALLINT NameLength); +typedef SQLRETURN (SQL_API *SQLSetDescField_t)(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength); +typedef SQLRETURN (SQL_API *SQLSetDescRec_t)( + SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT Type, + SQLSMALLINT SubType, + SQLLEN Length, + SQLSMALLINT Precision, + SQLSMALLINT Scale, + SQLPOINTER Data, + SQLLEN *StringLength, + SQLLEN *Indicator); +typedef SQLRETURN (SQL_API *SQLSetEnvAttr_t)(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API *SQLSetParam_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, + SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, + SQLPOINTER ParameterValue, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLSetPos_t)( + SQLHSTMT hstmt, + SQLSETPOSIROW irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); +typedef SQLRETURN (SQL_API *SQLSetScrollOptions_t)( /* Use SQLSetStmtOptions */ + SQLHSTMT hstmt, + SQLUSMALLINT fConcurrency, + SQLLEN crowKeyset, + SQLUSMALLINT crowRowset); +typedef SQLRETURN (SQL_API *SQLSetStmtAttr_t)(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API *SQLSetStmtOption_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT Option, + SQLULEN Value); +typedef SQLRETURN (SQL_API *SQLSpecialColumns_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT IdentifierType, SQLTCHAR *CatalogName, + SQLSMALLINT NameLength1, SQLTCHAR *SchemaName, + SQLSMALLINT NameLength2, SQLTCHAR *TableName, + SQLSMALLINT NameLength3, SQLUSMALLINT Scope, + SQLUSMALLINT Nullable); +typedef SQLRETURN (SQL_API *SQLStatistics_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLTCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLTCHAR *TableName, SQLSMALLINT NameLength3, + SQLUSMALLINT Unique, SQLUSMALLINT Reserved); +typedef SQLRETURN (SQL_API *SQLTablePrivileges_t)( + SQLHSTMT hstmt, + SQLTCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLTCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLTCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API *SQLTables_t)(SQLHSTMT StatementHandle, + SQLTCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLTCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLTCHAR *TableName, SQLSMALLINT NameLength3, + SQLTCHAR *TableType, SQLSMALLINT NameLength4); +typedef SQLRETURN (SQL_API *SQLTransact_t)(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType); + + +class SQLAPI_API odbcAPI : public saAPI +{ +public: + odbcAPI(); + + SQLAllocConnect_t SQLAllocConnect; // 1.0 + SQLAllocEnv_t SQLAllocEnv; // 1.0 + SQLAllocHandle_t SQLAllocHandle; // 3.0 + SQLAllocStmt_t SQLAllocStmt; // 1.0 + SQLBindCol_t SQLBindCol; // 1.0 + SQLBindParameter_t SQLBindParameter; // 2.0 + SQLBrowseConnect_t SQLBrowseConnect; // 1.0 + SQLBulkOperations_t SQLBulkOperations; // 3.0 + SQLCancel_t SQLCancel; // 1.0 + SQLCloseCursor_t SQLCloseCursor; // 3.0 + SQLColAttribute_t SQLColAttribute; // 3.0 + SQLColAttributes_t SQLColAttributes; // 1.0 + SQLColumnPrivileges_t SQLColumnPrivileges;// 1.0 + SQLColumns_t SQLColumns; // 1.0 + SQLConnect_t SQLConnect; // 1.0 + SQLCopyDesc_t SQLCopyDesc; // 3.0 + SQLDataSources_t SQLDataSources; // 1.0 + SQLDescribeCol_t SQLDescribeCol; // 1.0 + SQLDescribeParam_t SQLDescribeParam; // 1.0 + SQLDisconnect_t SQLDisconnect; // 1.0 + SQLDriverConnect_t SQLDriverConnect; // 1.0 + SQLDrivers_t SQLDrivers; // 2.0 + SQLEndTran_t SQLEndTran; // 3.0 + SQLError_t SQLError; // 1.0 + SQLExecDirect_t SQLExecDirect; // 1.0 + SQLExecute_t SQLExecute; // 1.0 + SQLExtendedFetch_t SQLExtendedFetch; // 1.0 + SQLFetch_t SQLFetch; // 1.0 + SQLFetchScroll_t SQLFetchScroll; // 1.0 + SQLForeignKeys_t SQLForeignKeys; // 1.0 + SQLFreeConnect_t SQLFreeConnect; // 1.0 + SQLFreeEnv_t SQLFreeEnv; // 1.0 + SQLFreeHandle_t SQLFreeHandle; // 3.0 + SQLFreeStmt_t SQLFreeStmt; // 1.0 + SQLGetConnectAttr_t SQLGetConnectAttr; // 3.0 + SQLGetConnectOption_t SQLGetConnectOption;// 1.0 + SQLGetCursorName_t SQLGetCursorName; // 1.0 + SQLGetData_t SQLGetData; // 1.0 + SQLGetDescField_t SQLGetDescField; // 3.0 + SQLGetDescRec_t SQLGetDescRec; // 3.0 + SQLGetDiagField_t SQLGetDiagField; // 3.0 + SQLGetDiagRec_t SQLGetDiagRec; // 3.0 + SQLGetEnvAttr_t SQLGetEnvAttr; // 3.0 + SQLGetFunctions_t SQLGetFunctions; // 1.0 + SQLGetInfo_t SQLGetInfo; // 1.0 + SQLGetStmtAttr_t SQLGetStmtAttr; // 3.0 + SQLGetStmtOption_t SQLGetStmtOption; // 1.0 + SQLGetTypeInfo_t SQLGetTypeInfo; // 1.0 + SQLMoreResults_t SQLMoreResults; // 1.0 + SQLNativeSql_t SQLNativeSql; // 1.0 + SQLNumParams_t SQLNumParams; // 1.0 + SQLNumResultCols_t SQLNumResultCols; // 1.0 + SQLParamData_t SQLParamData; // 1.0 + SQLParamOptions_t SQLParamOptions; // 1.0 + SQLPrepare_t SQLPrepare; // 1.0 + SQLPrimaryKeys_t SQLPrimaryKeys; // 1.0 + SQLProcedureColumns_t SQLProcedureColumns;// 1.0 + SQLProcedures_t SQLProcedures; // 1.0 + SQLPutData_t SQLPutData; // 1.0 + SQLRowCount_t SQLRowCount; // 1.0 + SQLSetConnectAttr_t SQLSetConnectAttr; // 3.0 + SQLSetConnectOption_t SQLSetConnectOption;// 1.0 + SQLSetCursorName_t SQLSetCursorName; // 1.0 + SQLSetDescField_t SQLSetDescField; // 3.0 + SQLSetDescRec_t SQLSetDescRec; // 3.0 + SQLSetEnvAttr_t SQLSetEnvAttr; // 3.0 + SQLSetParam_t SQLSetParam; // 1.0 + SQLSetPos_t SQLSetPos; // 1.0 + SQLSetScrollOptions_t SQLSetScrollOptions;// 1.0 + SQLSetStmtAttr_t SQLSetStmtAttr; // 3.0 + SQLSetStmtOption_t SQLSetStmtOption; // 1.0 + SQLSpecialColumns_t SQLSpecialColumns; // 1.0 + SQLStatistics_t SQLStatistics; // 1.0 + SQLTablePrivileges_t SQLTablePrivileges; // 1.0 + SQLTables_t SQLTables; // 1.0 + SQLTransact_t SQLTransact; // 1.0 +}; + +class SQLAPI_API odbcConnectionHandles : public saConnectionHandles +{ +public: + odbcConnectionHandles(); + + SQLHENV m_hevn; + SQLHDBC m_hdbc; +}; + +class SQLAPI_API odbcCommandHandles : public saCommandHandles +{ +public: + odbcCommandHandles(); + + SQLHSTMT m_hstmt; +}; + +extern odbcAPI g_odbcAPI; + +#endif // !defined(__ODBCAPI_H__) diff --git a/libraries/SQLAPI/include/odbc_win/sql.h b/libraries/SQLAPI/include/odbc_win/sql.h new file mode 100644 index 000000000..ae4d95a98 --- /dev/null +++ b/libraries/SQLAPI/include/odbc_win/sql.h @@ -0,0 +1,839 @@ +//----------------------------------------------------------------------------- +// File: sql.h +// +// Copyright: Copyright (c) Microsoft Corporation +// +// Contents: This is the the main include for ODBC Core functions. +// +// Comments: preconditions: #include "windows.h" +// +//----------------------------------------------------------------------------- + +#ifndef __SQL +#define __SQL + +/* +* ODBCVER ODBC version number (0x0351). To exclude +* definitions introduced in version 3.5 (or above) +* #define ODBCVER 0x0300 before #including +*/ +#ifndef ODBCVER +#define ODBCVER 0x0351 +#endif + +#ifndef __SQLTYPES +#include "sqltypes.h" +#endif + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +/* special length/indicator values */ +#define SQL_NULL_DATA (-1) +#define SQL_DATA_AT_EXEC (-2) + + +/* return values from functions */ +#define SQL_SUCCESS 0 +#define SQL_SUCCESS_WITH_INFO 1 +#if (ODBCVER >= 0x0300) +#define SQL_NO_DATA 100 +#endif +#define SQL_ERROR (-1) +#define SQL_INVALID_HANDLE (-2) + +#define SQL_STILL_EXECUTING 2 +#define SQL_NEED_DATA 99 + +/* test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO */ +#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) + +/* flags for null-terminated string */ +#define SQL_NTS (-3) +#define SQL_NTSL (-3L) + +/* maximum message length */ +#define SQL_MAX_MESSAGE_LENGTH 512 + +/* date/time length constants */ +#if (ODBCVER >= 0x0300) +#define SQL_DATE_LEN 10 +#define SQL_TIME_LEN 8 /* add P+1 if precision is nonzero */ +#define SQL_TIMESTAMP_LEN 19 /* add P+1 if precision is nonzero */ +#endif + +/* handle type identifiers */ +#if (ODBCVER >= 0x0300) +#define SQL_HANDLE_ENV 1 +#define SQL_HANDLE_DBC 2 +#define SQL_HANDLE_STMT 3 +#define SQL_HANDLE_DESC 4 +#endif + +/* environment attribute */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_OUTPUT_NTS 10001 +#endif + +/* connection attributes */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_AUTO_IPD 10001 +#define SQL_ATTR_METADATA_ID 10014 +#endif /* ODBCVER >= 0x0300 */ + +/* statement attributes */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_APP_ROW_DESC 10010 +#define SQL_ATTR_APP_PARAM_DESC 10011 +#define SQL_ATTR_IMP_ROW_DESC 10012 +#define SQL_ATTR_IMP_PARAM_DESC 10013 +#define SQL_ATTR_CURSOR_SCROLLABLE (-1) +#define SQL_ATTR_CURSOR_SENSITIVITY (-2) +#endif + +/* SQL_ATTR_CURSOR_SCROLLABLE values */ +#if (ODBCVER >= 0x0300) +#define SQL_NONSCROLLABLE 0 +#define SQL_SCROLLABLE 1 +#endif /* ODBCVER >= 0x0300 */ + +/* identifiers of fields in the SQL descriptor */ +#if (ODBCVER >= 0x0300) +#define SQL_DESC_COUNT 1001 +#define SQL_DESC_TYPE 1002 +#define SQL_DESC_LENGTH 1003 +#define SQL_DESC_OCTET_LENGTH_PTR 1004 +#define SQL_DESC_PRECISION 1005 +#define SQL_DESC_SCALE 1006 +#define SQL_DESC_DATETIME_INTERVAL_CODE 1007 +#define SQL_DESC_NULLABLE 1008 +#define SQL_DESC_INDICATOR_PTR 1009 +#define SQL_DESC_DATA_PTR 1010 +#define SQL_DESC_NAME 1011 +#define SQL_DESC_UNNAMED 1012 +#define SQL_DESC_OCTET_LENGTH 1013 +#define SQL_DESC_ALLOC_TYPE 1099 +#endif + +/* identifiers of fields in the diagnostics area */ +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_RETURNCODE 1 +#define SQL_DIAG_NUMBER 2 +#define SQL_DIAG_ROW_COUNT 3 +#define SQL_DIAG_SQLSTATE 4 +#define SQL_DIAG_NATIVE 5 +#define SQL_DIAG_MESSAGE_TEXT 6 +#define SQL_DIAG_DYNAMIC_FUNCTION 7 +#define SQL_DIAG_CLASS_ORIGIN 8 +#define SQL_DIAG_SUBCLASS_ORIGIN 9 +#define SQL_DIAG_CONNECTION_NAME 10 +#define SQL_DIAG_SERVER_NAME 11 +#define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12 +#endif + +/* dynamic function codes */ +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_ALTER_DOMAIN 3 +#define SQL_DIAG_ALTER_TABLE 4 +#define SQL_DIAG_CALL 7 +#define SQL_DIAG_CREATE_ASSERTION 6 +#define SQL_DIAG_CREATE_CHARACTER_SET 8 +#define SQL_DIAG_CREATE_COLLATION 10 +#define SQL_DIAG_CREATE_DOMAIN 23 +#define SQL_DIAG_CREATE_INDEX (-1) +#define SQL_DIAG_CREATE_SCHEMA 64 +#define SQL_DIAG_CREATE_TABLE 77 +#define SQL_DIAG_CREATE_TRANSLATION 79 +#define SQL_DIAG_CREATE_VIEW 84 +#define SQL_DIAG_DELETE_WHERE 19 +#define SQL_DIAG_DROP_ASSERTION 24 +#define SQL_DIAG_DROP_CHARACTER_SET 25 +#define SQL_DIAG_DROP_COLLATION 26 +#define SQL_DIAG_DROP_DOMAIN 27 +#define SQL_DIAG_DROP_INDEX (-2) +#define SQL_DIAG_DROP_SCHEMA 31 +#define SQL_DIAG_DROP_TABLE 32 +#define SQL_DIAG_DROP_TRANSLATION 33 +#define SQL_DIAG_DROP_VIEW 36 +#define SQL_DIAG_DYNAMIC_DELETE_CURSOR 38 +#define SQL_DIAG_DYNAMIC_UPDATE_CURSOR 81 +#define SQL_DIAG_GRANT 48 +#define SQL_DIAG_INSERT 50 +#define SQL_DIAG_REVOKE 59 +#define SQL_DIAG_SELECT_CURSOR 85 +#define SQL_DIAG_UNKNOWN_STATEMENT 0 +#define SQL_DIAG_UPDATE_WHERE 82 +#endif /* ODBCVER >= 0x0300 */ + +/* SQL data type codes */ +#define SQL_UNKNOWN_TYPE 0 +#define SQL_CHAR 1 +#define SQL_NUMERIC 2 +#define SQL_DECIMAL 3 +#define SQL_INTEGER 4 +#define SQL_SMALLINT 5 +#define SQL_FLOAT 6 +#define SQL_REAL 7 +#define SQL_DOUBLE 8 +#if (ODBCVER >= 0x0300) +#define SQL_DATETIME 9 +#endif +#define SQL_VARCHAR 12 + +/* One-parameter shortcuts for date/time data types */ +#if (ODBCVER >= 0x0300) +#define SQL_TYPE_DATE 91 +#define SQL_TYPE_TIME 92 +#define SQL_TYPE_TIMESTAMP 93 +#endif + +/* Statement attribute values for cursor sensitivity */ +#if (ODBCVER >= 0x0300) +#define SQL_UNSPECIFIED 0 +#define SQL_INSENSITIVE 1 +#define SQL_SENSITIVE 2 +#endif + +/* GetTypeInfo() request for all data types */ +#define SQL_ALL_TYPES 0 + +/* Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */ +#if (ODBCVER >= 0x0300) +#define SQL_DEFAULT 99 +#endif + +/* SQLSQLLEN GetData() code indicating that the application row descriptor + * specifies the data type + */ +#if (ODBCVER >= 0x0300) +#define SQL_ARD_TYPE (-99) +#endif + +/* SQL date/time type subcodes */ +#if (ODBCVER >= 0x0300) +#define SQL_CODE_DATE 1 +#define SQL_CODE_TIME 2 +#define SQL_CODE_TIMESTAMP 3 +#endif + +/* CLI option values */ +#if (ODBCVER >= 0x0300) +#define SQL_FALSE 0 +#define SQL_TRUE 1 +#endif + +/* values of NULLABLE field in descriptor */ +#define SQL_NO_NULLS 0 +#define SQL_NULLABLE 1 + +/* Value returned by SQLGetTypeInfo() to denote that it is + * not known whether or not a data type supports null values. + */ +#define SQL_NULLABLE_UNKNOWN 2 + +/* Values returned by SQLGetTypeInfo() to show WHERE clause + * supported + */ +#if (ODBCVER >= 0x0300) +#define SQL_PRED_NONE 0 +#define SQL_PRED_CHAR 1 +#define SQL_PRED_BASIC 2 +#endif + +/* values of UNNAMED field in descriptor */ +#if (ODBCVER >= 0x0300) +#define SQL_NAMED 0 +#define SQL_UNNAMED 1 +#endif + +/* values of ALLOC_TYPE field in descriptor */ +#if (ODBCVER >= 0x0300) +#define SQL_DESC_ALLOC_AUTO 1 +#define SQL_DESC_ALLOC_USER 2 +#endif + +/* FreeStmt() options */ +#define SQL_CLOSE 0 +#define SQL_DROP 1 +#define SQL_UNBIND 2 +#define SQL_RESET_PARAMS 3 + +/* Codes used for FetchOrientation in SQLFetchScroll(), + and in SQLDataSources() +*/ +#define SQL_FETCH_NEXT 1 +#define SQL_FETCH_FIRST 2 + +/* Other codes used for FetchOrientation in SQLFetchScroll() */ +#define SQL_FETCH_LAST 3 +#define SQL_FETCH_PRIOR 4 +#define SQL_FETCH_ABSOLUTE 5 +#define SQL_FETCH_RELATIVE 6 + +/* SQLEndTran() options */ +#define SQL_COMMIT 0 +#define SQL_ROLLBACK 1 + +/* null handles returned by SQLAllocHandle() */ +#define SQL_NULL_HENV 0 +#define SQL_NULL_HDBC 0 +#define SQL_NULL_HSTMT 0 +#if (ODBCVER >= 0x0300) +#define SQL_NULL_HDESC 0 +#endif + +/* null handle used in place of parent handle when allocating HENV */ +#if (ODBCVER >= 0x0300) +#define SQL_NULL_HANDLE 0L +#endif + +/* Values that may appear in the result set of SQLSpecialColumns() */ +#define SQL_SCOPE_CURROW 0 +#define SQL_SCOPE_TRANSACTION 1 +#define SQL_SCOPE_SESSION 2 + +#define SQL_PC_UNKNOWN 0 +#if (ODBCVER >= 0x0300) +#define SQL_PC_NON_PSEUDO 1 +#endif +#define SQL_PC_PSEUDO 2 + +/* Reserved value for the IdentifierType argument of SQLSpecialColumns() */ +#if (ODBCVER >= 0x0300) +#define SQL_ROW_IDENTIFIER 1 +#endif + +/* Reserved values for UNIQUE argument of SQLStatistics() */ +#define SQL_INDEX_UNIQUE 0 +#define SQL_INDEX_ALL 1 + +/* Values that may appear in the result set of SQLStatistics() */ +#define SQL_INDEX_CLUSTERED 1 +#define SQL_INDEX_HASHED 2 +#define SQL_INDEX_OTHER 3 + +/* SQLGetFunctions() values to identify ODBC APIs */ +#define SQL_API_SQLALLOCCONNECT 1 +#define SQL_API_SQLALLOCENV 2 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLALLOCHANDLE 1001 +#endif +#define SQL_API_SQLALLOCSTMT 3 +#define SQL_API_SQLBINDCOL 4 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLBINDPARAM 1002 +#endif +#define SQL_API_SQLCANCEL 5 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLCLOSECURSOR 1003 +#define SQL_API_SQLCOLATTRIBUTE 6 +#endif +#define SQL_API_SQLCOLUMNS 40 +#define SQL_API_SQLCONNECT 7 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLCOPYDESC 1004 +#endif +#define SQL_API_SQLDATASOURCES 57 +#define SQL_API_SQLDESCRIBECOL 8 +#define SQL_API_SQLDISCONNECT 9 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLENDTRAN 1005 +#endif +#define SQL_API_SQLERROR 10 +#define SQL_API_SQLEXECDIRECT 11 +#define SQL_API_SQLEXECUTE 12 +#define SQL_API_SQLFETCH 13 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLFETCHSCROLL 1021 +#endif +#define SQL_API_SQLFREECONNECT 14 +#define SQL_API_SQLFREEENV 15 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLFREEHANDLE 1006 +#endif +#define SQL_API_SQLFREESTMT 16 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLGETCONNECTATTR 1007 +#endif +#define SQL_API_SQLGETCONNECTOPTION 42 +#define SQL_API_SQLGETCURSORNAME 17 +#define SQL_API_SQLGETDATA 43 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLGETDESCFIELD 1008 +#define SQL_API_SQLGETDESCREC 1009 +#define SQL_API_SQLGETDIAGFIELD 1010 +#define SQL_API_SQLGETDIAGREC 1011 +#define SQL_API_SQLGETENVATTR 1012 +#endif +#define SQL_API_SQLGETFUNCTIONS 44 +#define SQL_API_SQLGETINFO 45 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLGETSTMTATTR 1014 +#endif +#define SQL_API_SQLGETSTMTOPTION 46 +#define SQL_API_SQLGETTYPEINFO 47 +#define SQL_API_SQLNUMRESULTCOLS 18 +#define SQL_API_SQLPARAMDATA 48 +#define SQL_API_SQLPREPARE 19 +#define SQL_API_SQLPUTDATA 49 +#define SQL_API_SQLROWCOUNT 20 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLSETCONNECTATTR 1016 +#endif +#define SQL_API_SQLSETCONNECTOPTION 50 +#define SQL_API_SQLSETCURSORNAME 21 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLSETDESCFIELD 1017 +#define SQL_API_SQLSETDESCREC 1018 +#define SQL_API_SQLSETENVATTR 1019 +#endif +#define SQL_API_SQLSETPARAM 22 +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLSETSTMTATTR 1020 +#endif +#define SQL_API_SQLSETSTMTOPTION 51 +#define SQL_API_SQLSPECIALCOLUMNS 52 +#define SQL_API_SQLSTATISTICS 53 +#define SQL_API_SQLTABLES 54 +#define SQL_API_SQLTRANSACT 23 + +/* Information requested by SQLGetInfo() */ +#if (ODBCVER >= 0x0300) +#define SQL_MAX_DRIVER_CONNECTIONS 0 +#define SQL_MAXIMUM_DRIVER_CONNECTIONS SQL_MAX_DRIVER_CONNECTIONS +#define SQL_MAX_CONCURRENT_ACTIVITIES 1 +#define SQL_MAXIMUM_CONCURRENT_ACTIVITIES SQL_MAX_CONCURRENT_ACTIVITIES +#endif +#define SQL_DATA_SOURCE_NAME 2 +#define SQL_FETCH_DIRECTION 8 +#define SQL_SERVER_NAME 13 +#define SQL_SEARCH_PATTERN_ESCAPE 14 +#define SQL_DBMS_NAME 17 +#define SQL_DBMS_VER 18 +#define SQL_ACCESSIBLE_TABLES 19 +#define SQL_ACCESSIBLE_PROCEDURES 20 +#define SQL_CURSOR_COMMIT_BEHAVIOR 23 +#define SQL_DATA_SOURCE_READ_ONLY 25 +#define SQL_DEFAULT_TXN_ISOLATION 26 +#define SQL_IDENTIFIER_CASE 28 +#define SQL_IDENTIFIER_QUOTE_CHAR 29 +#define SQL_MAX_COLUMN_NAME_LEN 30 +#define SQL_MAXIMUM_COLUMN_NAME_LENGTH SQL_MAX_COLUMN_NAME_LEN +#define SQL_MAX_CURSOR_NAME_LEN 31 +#define SQL_MAXIMUM_CURSOR_NAME_LENGTH SQL_MAX_CURSOR_NAME_LEN +#define SQL_MAX_SCHEMA_NAME_LEN 32 +#define SQL_MAXIMUM_SCHEMA_NAME_LENGTH SQL_MAX_SCHEMA_NAME_LEN +#define SQL_MAX_CATALOG_NAME_LEN 34 +#define SQL_MAXIMUM_CATALOG_NAME_LENGTH SQL_MAX_CATALOG_NAME_LEN +#define SQL_MAX_TABLE_NAME_LEN 35 +#define SQL_SCROLL_CONCURRENCY 43 +#define SQL_TXN_CAPABLE 46 +#define SQL_TRANSACTION_CAPABLE SQL_TXN_CAPABLE +#define SQL_USER_NAME 47 +#define SQL_TXN_ISOLATION_OPTION 72 +#define SQL_TRANSACTION_ISOLATION_OPTION SQL_TXN_ISOLATION_OPTION +#define SQL_INTEGRITY 73 +#define SQL_GETDATA_EXTENSIONS 81 +#define SQL_NULL_COLLATION 85 +#define SQL_ALTER_TABLE 86 +#define SQL_ORDER_BY_COLUMNS_IN_SELECT 90 +#define SQL_SPECIAL_CHARACTERS 94 +#define SQL_MAX_COLUMNS_IN_GROUP_BY 97 +#define SQL_MAXIMUM_COLUMNS_IN_GROUP_BY SQL_MAX_COLUMNS_IN_GROUP_BY +#define SQL_MAX_COLUMNS_IN_INDEX 98 +#define SQL_MAXIMUM_COLUMNS_IN_INDEX SQL_MAX_COLUMNS_IN_INDEX +#define SQL_MAX_COLUMNS_IN_ORDER_BY 99 +#define SQL_MAXIMUM_COLUMNS_IN_ORDER_BY SQL_MAX_COLUMNS_IN_ORDER_BY +#define SQL_MAX_COLUMNS_IN_SELECT 100 +#define SQL_MAXIMUM_COLUMNS_IN_SELECT SQL_MAX_COLUMNS_IN_SELECT +#define SQL_MAX_COLUMNS_IN_TABLE 101 +#define SQL_MAX_INDEX_SIZE 102 +#define SQL_MAXIMUM_INDEX_SIZE SQL_MAX_INDEX_SIZE +#define SQL_MAX_ROW_SIZE 104 +#define SQL_MAXIMUM_ROW_SIZE SQL_MAX_ROW_SIZE +#define SQL_MAX_STATEMENT_LEN 105 +#define SQL_MAXIMUM_STATEMENT_LENGTH SQL_MAX_STATEMENT_LEN +#define SQL_MAX_TABLES_IN_SELECT 106 +#define SQL_MAXIMUM_TABLES_IN_SELECT SQL_MAX_TABLES_IN_SELECT +#define SQL_MAX_USER_NAME_LEN 107 +#define SQL_MAXIMUM_USER_NAME_LENGTH SQL_MAX_USER_NAME_LEN +#if (ODBCVER >= 0x0300) +#define SQL_OJ_CAPABILITIES 115 +#define SQL_OUTER_JOIN_CAPABILITIES SQL_OJ_CAPABILITIES +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER >= 0x0300) +#define SQL_XOPEN_CLI_YEAR 10000 +#define SQL_CURSOR_SENSITIVITY 10001 +#define SQL_DESCRIBE_PARAMETER 10002 +#define SQL_CATALOG_NAME 10003 +#define SQL_COLLATION_SEQ 10004 +#define SQL_MAX_IDENTIFIER_LEN 10005 +#define SQL_MAXIMUM_IDENTIFIER_LENGTH SQL_MAX_IDENTIFIER_LEN +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_ALTER_TABLE bitmasks */ +#if (ODBCVER >= 0x0200) +#define SQL_AT_ADD_COLUMN 0x00000001L +#define SQL_AT_DROP_COLUMN 0x00000002L +#endif /* ODBCVER >= 0x0200 */ + +#if (ODBCVER >= 0x0300) +#define SQL_AT_ADD_CONSTRAINT 0x00000008L + +/* The following bitmasks are ODBC extensions and defined in sqlext.h +*#define SQL_AT_COLUMN_SINGLE 0x00000020L +*#define SQL_AT_ADD_COLUMN_DEFAULT 0x00000040L +*#define SQL_AT_ADD_COLUMN_COLLATION 0x00000080L +*#define SQL_AT_SET_COLUMN_DEFAULT 0x00000100L +*#define SQL_AT_DROP_COLUMN_DEFAULT 0x00000200L +*#define SQL_AT_DROP_COLUMN_CASCADE 0x00000400L +*#define SQL_AT_DROP_COLUMN_RESTRICT 0x00000800L +*#define SQL_AT_ADD_TABLE_CONSTRAINT 0x00001000L +*#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE 0x00002000L +*#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT 0x00004000L +*#define SQL_AT_CONSTRAINT_NAME_DEFINITION 0x00008000L +*#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED 0x00010000L +*#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00020000L +*#define SQL_AT_CONSTRAINT_DEFERRABLE 0x00040000L +*#define SQL_AT_CONSTRAINT_NON_DEFERRABLE 0x00080000L +*/ +#endif /* ODBCVER >= 0x0300 */ + + +/* SQL_ASYNC_MODE values */ +#if (ODBCVER >= 0x0300) +#define SQL_AM_NONE 0 +#define SQL_AM_CONNECTION 1 +#define SQL_AM_STATEMENT 2 +#endif + +/* SQL_CURSOR_COMMIT_BEHAVIOR values */ +#define SQL_CB_DELETE 0 +#define SQL_CB_CLOSE 1 +#define SQL_CB_PRESERVE 2 + +/* SQL_FETCH_DIRECTION bitmasks */ +#define SQL_FD_FETCH_NEXT 0x00000001L +#define SQL_FD_FETCH_FIRST 0x00000002L +#define SQL_FD_FETCH_LAST 0x00000004L +#define SQL_FD_FETCH_PRIOR 0x00000008L +#define SQL_FD_FETCH_ABSOLUTE 0x00000010L +#define SQL_FD_FETCH_RELATIVE 0x00000020L + +/* SQL_GETDATA_EXTENSIONS bitmasks */ +#define SQL_GD_ANY_COLUMN 0x00000001L +#define SQL_GD_ANY_ORDER 0x00000002L + +/* SQL_IDENTIFIER_CASE values */ +#define SQL_IC_UPPER 1 +#define SQL_IC_LOWER 2 +#define SQL_IC_SENSITIVE 3 +#define SQL_IC_MIXED 4 + +/* SQL_OJ_CAPABILITIES bitmasks */ +/* NB: this means 'outer join', not what you may be thinking */ + + +#if (ODBCVER >= 0x0201) +#define SQL_OJ_LEFT 0x00000001L +#define SQL_OJ_RIGHT 0x00000002L +#define SQL_OJ_FULL 0x00000004L +#define SQL_OJ_NESTED 0x00000008L +#define SQL_OJ_NOT_ORDERED 0x00000010L +#define SQL_OJ_INNER 0x00000020L +#define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L +#endif + +/* SQL_SCROLL_CONCURRENCY bitmasks */ +#define SQL_SCCO_READ_ONLY 0x00000001L +#define SQL_SCCO_LOCK 0x00000002L +#define SQL_SCCO_OPT_ROWVER 0x00000004L +#define SQL_SCCO_OPT_VALUES 0x00000008L + +/* SQL_TXN_CAPABLE values */ +#define SQL_TC_NONE 0 +#define SQL_TC_DML 1 +#define SQL_TC_ALL 2 +#define SQL_TC_DDL_COMMIT 3 +#define SQL_TC_DDL_IGNORE 4 + +/* SQL_TXN_ISOLATION_OPTION bitmasks */ +#define SQL_TXN_READ_UNCOMMITTED 0x00000001L +#define SQL_TRANSACTION_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED +#define SQL_TXN_READ_COMMITTED 0x00000002L +#define SQL_TRANSACTION_READ_COMMITTED SQL_TXN_READ_COMMITTED +#define SQL_TXN_REPEATABLE_READ 0x00000004L +#define SQL_TRANSACTION_REPEATABLE_READ SQL_TXN_REPEATABLE_READ +#define SQL_TXN_SERIALIZABLE 0x00000008L +#define SQL_TRANSACTION_SERIALIZABLE SQL_TXN_SERIALIZABLE + +/* SQL_NULL_COLLATION values */ +#define SQL_NC_HIGH 0 +#define SQL_NC_LOW 1 + +#ifndef RC_INVOKED + +SQLRETURN SQL_API SQLAllocConnect(SQLHENV EnvironmentHandle, + SQLHDBC *ConnectionHandle); + +SQLRETURN SQL_API SQLAllocEnv(SQLHENV *EnvironmentHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT HandleType, + SQLHANDLE InputHandle, SQLHANDLE *OutputHandle); +#endif + +SQLRETURN SQL_API SQLAllocStmt(SQLHDBC ConnectionHandle, + SQLHSTMT *StatementHandle); + +SQLRETURN SQL_API SQLBindCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLBindParam(SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, + SQLLEN *StrLen_or_Ind); +#endif + +SQLRETURN SQL_API SQLCancel(SQLHSTMT StatementHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLCloseCursor(SQLHSTMT StatementHandle); + +#ifdef _WIN64 +SQLRETURN SQL_API SQLColAttribute (SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLLEN *NumericAttribute); +#else +SQLRETURN SQL_API SQLColAttribute (SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute); +#endif +#endif + + +SQLRETURN SQL_API SQLColumns(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLCHAR *ColumnName, SQLSMALLINT NameLength4); + + +SQLRETURN SQL_API SQLConnect(SQLHDBC ConnectionHandle, + SQLCHAR *ServerName, SQLSMALLINT NameLength1, + SQLCHAR *UserName, SQLSMALLINT NameLength2, + SQLCHAR *Authentication, SQLSMALLINT NameLength3); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLCopyDesc(SQLHDESC SourceDescHandle, + SQLHDESC TargetDescHandle); +#endif + +SQLRETURN SQL_API SQLDataSources(SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, SQLCHAR *ServerName, + SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, + SQLCHAR *Description, SQLSMALLINT BufferLength2, + SQLSMALLINT *NameLength2); + +SQLRETURN SQL_API SQLDescribeCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, + SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, + SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable); + +SQLRETURN SQL_API SQLDisconnect(SQLHDBC ConnectionHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT CompletionType); +#endif + +SQLRETURN SQL_API SQLError(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, + SQLCHAR *Sqlstate, SQLINTEGER *NativeError, + SQLCHAR *MessageText, SQLSMALLINT BufferLength, + SQLSMALLINT *TextLength); + +SQLRETURN SQL_API SQLExecDirect(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength); + +SQLRETURN SQL_API SQLExecute(SQLHSTMT StatementHandle); + +SQLRETURN SQL_API SQLFetch(SQLHSTMT StatementHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLFetchScroll(SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, SQLLEN FetchOffset); +#endif + +SQLRETURN SQL_API SQLFreeConnect(SQLHDBC ConnectionHandle); + +SQLRETURN SQL_API SQLFreeEnv(SQLHENV EnvironmentHandle); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle); +#endif + +SQLRETURN SQL_API SQLFreeStmt(SQLHSTMT StatementHandle, + SQLUSMALLINT Option); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLGetConnectAttr(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +#endif + +SQLRETURN SQL_API SQLGetConnectOption(SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, SQLPOINTER Value); + +SQLRETURN SQL_API SQLGetCursorName(SQLHSTMT StatementHandle, + SQLCHAR *CursorName, SQLSMALLINT BufferLength, + SQLSMALLINT *NameLength); + +SQLRETURN SQL_API SQLGetData(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLGetDescField(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength, + SQLINTEGER *StringLength); + +SQLRETURN SQL_API SQLGetDescRec(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLCHAR *Name, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, + SQLSMALLINT *Type, SQLSMALLINT *SubType, + SQLLEN *Length, SQLSMALLINT *Precision, + SQLSMALLINT *Scale, SQLSMALLINT *Nullable); + +SQLRETURN SQL_API SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength); + +SQLRETURN SQL_API SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, + SQLINTEGER *NativeError, SQLCHAR *MessageText, + SQLSMALLINT BufferLength, SQLSMALLINT *TextLength); + +SQLRETURN SQL_API SQLGetEnvAttr(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +#endif /* ODBCVER >= 0x0300 */ + +SQLRETURN SQL_API SQLGetFunctions(SQLHDBC ConnectionHandle, + SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported); + +SQLRETURN SQL_API SQLGetInfo(SQLHDBC ConnectionHandle, + SQLUSMALLINT InfoType, SQLPOINTER InfoValue, + SQLSMALLINT BufferLength, SQLSMALLINT *StringLength); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLGetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER BufferLength, SQLINTEGER *StringLength); +#endif /* ODBCVER >= 0x0300 */ + +SQLRETURN SQL_API SQLGetStmtOption(SQLHSTMT StatementHandle, + SQLUSMALLINT Option, SQLPOINTER Value); + +SQLRETURN SQL_API SQLGetTypeInfo(SQLHSTMT StatementHandle, + SQLSMALLINT DataType); + +SQLRETURN SQL_API SQLNumResultCols(SQLHSTMT StatementHandle, + SQLSMALLINT *ColumnCount); + +SQLRETURN SQL_API SQLParamData(SQLHSTMT StatementHandle, + SQLPOINTER *Value); + +SQLRETURN SQL_API SQLPrepare(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength); + +SQLRETURN SQL_API SQLPutData(SQLHSTMT StatementHandle, + SQLPOINTER Data, SQLLEN StrLen_or_Ind); + +SQLRETURN SQL_API SQLRowCount(SQLHSTMT StatementHandle, + SQLLEN* RowCount); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLSetConnectAttr(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +#endif /* ODBCVER >= 0x0300 */ + +SQLRETURN SQL_API SQLSetConnectOption(SQLHDBC ConnectionHandle, + SQLUSMALLINT Option, SQLULEN Value); + +SQLRETURN SQL_API SQLSetCursorName(SQLHSTMT StatementHandle, + SQLCHAR *CursorName, SQLSMALLINT NameLength); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLSetDescField(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, SQLINTEGER BufferLength); + +SQLRETURN SQL_API SQLSetDescRec(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, SQLSMALLINT Type, + SQLSMALLINT SubType, SQLLEN Length, + SQLSMALLINT Precision, SQLSMALLINT Scale, + SQLPOINTER Data, SQLLEN *StringLength, + SQLLEN *Indicator); + +SQLRETURN SQL_API SQLSetEnvAttr(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +#endif /* ODBCVER >= 0x0300 */ + +SQLRETURN SQL_API SQLSetParam(SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue, + SQLLEN *StrLen_or_Ind); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLSetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +#endif + +SQLRETURN SQL_API SQLSetStmtOption(SQLHSTMT StatementHandle, + SQLUSMALLINT Option, SQLULEN Value); + +SQLRETURN SQL_API SQLSpecialColumns(SQLHSTMT StatementHandle, + SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName, + SQLSMALLINT NameLength1, SQLCHAR *SchemaName, + SQLSMALLINT NameLength2, SQLCHAR *TableName, + SQLSMALLINT NameLength3, SQLUSMALLINT Scope, + SQLUSMALLINT Nullable); + +SQLRETURN SQL_API SQLStatistics(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLUSMALLINT Unique, SQLUSMALLINT Reserved); + +SQLRETURN SQL_API SQLTables(SQLHSTMT StatementHandle, + SQLCHAR *CatalogName, SQLSMALLINT NameLength1, + SQLCHAR *SchemaName, SQLSMALLINT NameLength2, + SQLCHAR *TableName, SQLSMALLINT NameLength3, + SQLCHAR *TableType, SQLSMALLINT NameLength4); + +SQLRETURN SQL_API SQLTransact(SQLHENV EnvironmentHandle, + SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType); + +#endif /* RC_INVOKED */ + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ +#endif /* #ifndef __SQL */ diff --git a/libraries/SQLAPI/include/odbc_win/sqlext.h b/libraries/SQLAPI/include/odbc_win/sqlext.h new file mode 100644 index 000000000..de912657f --- /dev/null +++ b/libraries/SQLAPI/include/odbc_win/sqlext.h @@ -0,0 +1,2069 @@ +//----------------------------------------------------------------------------- +// File: sqlext.h +// +// Copyright: Copyright (c) Microsoft Corporation +// +// Contents: This is the include for applications using the Microsoft SQL Extensions +// +// Comments: +// +//----------------------------------------------------------------------------- + +#ifndef __SQLEXT +#define __SQLEXT + +#ifndef __SQL +#include "sql.h" +#endif + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +/* generally useful constants */ +#define SQL_SPEC_MAJOR 3 /* Major version of specification */ +#define SQL_SPEC_MINOR 52 /* Minor version of specification */ +#define SQL_SPEC_STRING "03.52" /* String constant for version */ + +#define SQL_SQLSTATE_SIZE 5 /* size of SQLSTATE */ +#define SQL_MAX_DSN_LENGTH 32 /* maximum data source name size */ + +#define SQL_MAX_OPTION_STRING_LENGTH 256 + +/* return code SQL_NO_DATA_FOUND is the same as SQL_NO_DATA */ +#if (ODBCVER < 0x0300) +#define SQL_NO_DATA_FOUND 100 +#else +#define SQL_NO_DATA_FOUND SQL_NO_DATA +#endif + +/* an end handle type */ +#if (ODBCVER >= 0x0300) +#define SQL_HANDLE_SENV 5 +#endif /* ODBCVER >= 0x0300 */ + +/* env attribute */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ODBC_VERSION 200 +#define SQL_ATTR_CONNECTION_POOLING 201 +#define SQL_ATTR_CP_MATCH 202 +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER >= 0x0300) +/* values for SQL_ATTR_CONNECTION_POOLING */ +#define SQL_CP_OFF 0UL +#define SQL_CP_ONE_PER_DRIVER 1UL +#define SQL_CP_ONE_PER_HENV 2UL +#define SQL_CP_DEFAULT SQL_CP_OFF + +/* values for SQL_ATTR_CP_MATCH */ +#define SQL_CP_STRICT_MATCH 0UL +#define SQL_CP_RELAXED_MATCH 1UL +#define SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH + +/* values for SQL_ATTR_ODBC_VERSION */ +#define SQL_OV_ODBC2 2UL +#define SQL_OV_ODBC3 3UL +#endif /* ODBCVER >= 0x0300 */ + +/* connection attributes */ +#define SQL_ACCESS_MODE 101 +#define SQL_AUTOCOMMIT 102 +#define SQL_LOGIN_TIMEOUT 103 +#define SQL_OPT_TRACE 104 +#define SQL_OPT_TRACEFILE 105 +#define SQL_TRANSLATE_DLL 106 +#define SQL_TRANSLATE_OPTION 107 +#define SQL_TXN_ISOLATION 108 +#define SQL_CURRENT_QUALIFIER 109 +#define SQL_ODBC_CURSORS 110 +#define SQL_QUIET_MODE 111 +#define SQL_PACKET_SIZE 112 + +/* connection attributes with new names */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE +#define SQL_ATTR_AUTOCOMMIT SQL_AUTOCOMMIT +#define SQL_ATTR_CONNECTION_TIMEOUT 113 +#define SQL_ATTR_CURRENT_CATALOG SQL_CURRENT_QUALIFIER +#define SQL_ATTR_DISCONNECT_BEHAVIOR 114 +#define SQL_ATTR_ENLIST_IN_DTC 1207 +#define SQL_ATTR_ENLIST_IN_XA 1208 +#define SQL_ATTR_LOGIN_TIMEOUT SQL_LOGIN_TIMEOUT +#define SQL_ATTR_ODBC_CURSORS SQL_ODBC_CURSORS +#define SQL_ATTR_PACKET_SIZE SQL_PACKET_SIZE +#define SQL_ATTR_QUIET_MODE SQL_QUIET_MODE +#define SQL_ATTR_TRACE SQL_OPT_TRACE +#define SQL_ATTR_TRACEFILE SQL_OPT_TRACEFILE +#define SQL_ATTR_TRANSLATE_LIB SQL_TRANSLATE_DLL +#define SQL_ATTR_TRANSLATE_OPTION SQL_TRANSLATE_OPTION +#define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION +#endif /* ODBCVER >= 0x0300 */ + +#define SQL_ATTR_CONNECTION_DEAD 1209 /* GetConnectAttr only */ + +#if (ODBCVER >= 0x0351) +/* ODBC Driver Manager sets this connection attribute to a unicode driver + (which supports SQLConnectW) when the application is an ANSI application + (which calls SQLConnect, SQLDriverConnect, or SQLBrowseConnect). + This is SetConnectAttr only and application does not set this attribute + This attribute was introduced because some unicode driver's some APIs may + need to behave differently on ANSI or Unicode applications. A unicode + driver, which has same behavior for both ANSI or Unicode applications, + should return SQL_ERROR when the driver manager sets this connection + attribute. When a unicode driver returns SQL_SUCCESS on this attribute, + the driver manager treates ANSI and Unicode connections differently in + connection pooling. +*/ +#define SQL_ATTR_ANSI_APP 115 +#endif + +/* SQL_CONNECT_OPT_DRVR_START is not meaningful for 3.0 driver */ +#if (ODBCVER < 0x0300) +#define SQL_CONNECT_OPT_DRVR_START 1000 +#endif /* ODBCVER < 0x0300 */ + +#if (ODBCVER < 0x0300) +#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE +#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE +#endif /* ODBCVER < 0x0300 */ + +/* SQL_ACCESS_MODE options */ +#define SQL_MODE_READ_WRITE 0UL +#define SQL_MODE_READ_ONLY 1UL +#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE + +/* SQL_AUTOCOMMIT options */ +#define SQL_AUTOCOMMIT_OFF 0UL +#define SQL_AUTOCOMMIT_ON 1UL +#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON + +/* SQL_LOGIN_TIMEOUT options */ +#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL + +/* SQL_OPT_TRACE options */ +#define SQL_OPT_TRACE_OFF 0UL +#define SQL_OPT_TRACE_ON 1UL +#define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF +#define SQL_OPT_TRACE_FILE_DEFAULT "\\SQL.LOG" + +/* SQL_ODBC_CURSORS options */ +#define SQL_CUR_USE_IF_NEEDED 0UL +#define SQL_CUR_USE_ODBC 1UL +#define SQL_CUR_USE_DRIVER 2UL +#define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER + +#if (ODBCVER >= 0x0300) +/* values for SQL_ATTR_DISCONNECT_BEHAVIOR */ +#define SQL_DB_RETURN_TO_POOL 0UL +#define SQL_DB_DISCONNECT 1UL +#define SQL_DB_DEFAULT SQL_DB_RETURN_TO_POOL + +/* values for SQL_ATTR_ENLIST_IN_DTC */ +#define SQL_DTC_DONE 0L +#endif /* ODBCVER >= 0x0300 */ + +/* values for SQL_ATTR_CONNECTION_DEAD */ +#define SQL_CD_TRUE 1L /* Connection is closed/dead */ +#define SQL_CD_FALSE 0L /* Connection is open/available */ + +/* values for SQL_ATTR_ANSI_APP */ +#if (ODBCVER >= 0x0351) +#define SQL_AA_TRUE 1L /* the application is an ANSI app */ +#define SQL_AA_FALSE 0L /* the application is a Unicode app */ +#endif + +/* statement attributes */ +#define SQL_QUERY_TIMEOUT 0 +#define SQL_MAX_ROWS 1 +#define SQL_NOSCAN 2 +#define SQL_MAX_LENGTH 3 +#define SQL_ASYNC_ENABLE 4 /* same as SQL_ATTR_ASYNC_ENABLE */ +#define SQL_BIND_TYPE 5 +#define SQL_CURSOR_TYPE 6 +#define SQL_CONCURRENCY 7 +#define SQL_KEYSET_SIZE 8 +#define SQL_ROWSET_SIZE 9 +#define SQL_SIMULATE_CURSOR 10 +#define SQL_RETRIEVE_DATA 11 +#define SQL_USE_BOOKMARKS 12 +#define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */ +#define SQL_ROW_NUMBER 14 /* GetStmtOption Only */ + +/* statement attributes for ODBC 3.0 */ +#if (ODBCVER >= 0x0300) +#define SQL_ATTR_ASYNC_ENABLE 4 +#define SQL_ATTR_CONCURRENCY SQL_CONCURRENCY +#define SQL_ATTR_CURSOR_TYPE SQL_CURSOR_TYPE +#define SQL_ATTR_ENABLE_AUTO_IPD 15 +#define SQL_ATTR_FETCH_BOOKMARK_PTR 16 +#define SQL_ATTR_KEYSET_SIZE SQL_KEYSET_SIZE +#define SQL_ATTR_MAX_LENGTH SQL_MAX_LENGTH +#define SQL_ATTR_MAX_ROWS SQL_MAX_ROWS +#define SQL_ATTR_NOSCAN SQL_NOSCAN +#define SQL_ATTR_PARAM_BIND_OFFSET_PTR 17 +#define SQL_ATTR_PARAM_BIND_TYPE 18 +#define SQL_ATTR_PARAM_OPERATION_PTR 19 +#define SQL_ATTR_PARAM_STATUS_PTR 20 +#define SQL_ATTR_PARAMS_PROCESSED_PTR 21 +#define SQL_ATTR_PARAMSET_SIZE 22 +#define SQL_ATTR_QUERY_TIMEOUT SQL_QUERY_TIMEOUT +#define SQL_ATTR_RETRIEVE_DATA SQL_RETRIEVE_DATA +#define SQL_ATTR_ROW_BIND_OFFSET_PTR 23 +#define SQL_ATTR_ROW_BIND_TYPE SQL_BIND_TYPE +#define SQL_ATTR_ROW_NUMBER SQL_ROW_NUMBER /*GetStmtAttr*/ +#define SQL_ATTR_ROW_OPERATION_PTR 24 +#define SQL_ATTR_ROW_STATUS_PTR 25 +#define SQL_ATTR_ROWS_FETCHED_PTR 26 +#define SQL_ATTR_ROW_ARRAY_SIZE 27 +#define SQL_ATTR_SIMULATE_CURSOR SQL_SIMULATE_CURSOR +#define SQL_ATTR_USE_BOOKMARKS SQL_USE_BOOKMARKS + +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER < 0x0300) +#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER +#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT +#endif /* ODBCVER < 0x0300 */ + +/* New defines for SEARCHABLE column in SQLGetTypeInfo */ + +#if (ODBCVER >= 0x0300) +#define SQL_COL_PRED_CHAR SQL_LIKE_ONLY +#define SQL_COL_PRED_BASIC SQL_ALL_EXCEPT_LIKE +#endif /* ODBCVER >= 0x0300 */ + + + +/* whether an attribute is a pointer or not */ +#if (ODBCVER >= 0x0300) +#define SQL_IS_POINTER (-4) +#define SQL_IS_UINTEGER (-5) +#define SQL_IS_INTEGER (-6) +#define SQL_IS_USMALLINT (-7) +#define SQL_IS_SMALLINT (-8) +#endif /* ODBCVER >= 0x0300 */ + +/* the value of SQL_ATTR_PARAM_BIND_TYPE */ +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_BIND_BY_COLUMN 0UL +#define SQL_PARAM_BIND_TYPE_DEFAULT SQL_PARAM_BIND_BY_COLUMN +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_QUERY_TIMEOUT options */ +#define SQL_QUERY_TIMEOUT_DEFAULT 0UL + +/* SQL_MAX_ROWS options */ +#define SQL_MAX_ROWS_DEFAULT 0UL + +/* SQL_NOSCAN options */ +#define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */ +#define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */ +#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF + +/* SQL_MAX_LENGTH options */ +#define SQL_MAX_LENGTH_DEFAULT 0UL + +/* values for SQL_ATTR_ASYNC_ENABLE */ +#define SQL_ASYNC_ENABLE_OFF 0UL +#define SQL_ASYNC_ENABLE_ON 1UL +#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF + +/* SQL_BIND_TYPE options */ +#define SQL_BIND_BY_COLUMN 0UL +#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN /* Default value */ + +/* SQL_CONCURRENCY options */ +#define SQL_CONCUR_READ_ONLY 1 +#define SQL_CONCUR_LOCK 2 +#define SQL_CONCUR_ROWVER 3 +#define SQL_CONCUR_VALUES 4 +#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY /* Default value */ + +/* SQL_CURSOR_TYPE options */ +#define SQL_CURSOR_FORWARD_ONLY 0UL +#define SQL_CURSOR_KEYSET_DRIVEN 1UL +#define SQL_CURSOR_DYNAMIC 2UL +#define SQL_CURSOR_STATIC 3UL +#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY /* Default value */ + +/* SQL_ROWSET_SIZE options */ +#define SQL_ROWSET_SIZE_DEFAULT 1UL + +/* SQL_KEYSET_SIZE options */ +#define SQL_KEYSET_SIZE_DEFAULT 0UL + +/* SQL_SIMULATE_CURSOR options */ +#define SQL_SC_NON_UNIQUE 0UL +#define SQL_SC_TRY_UNIQUE 1UL +#define SQL_SC_UNIQUE 2UL + +/* SQL_RETRIEVE_DATA options */ +#define SQL_RD_OFF 0UL +#define SQL_RD_ON 1UL +#define SQL_RD_DEFAULT SQL_RD_ON + +/* SQL_USE_BOOKMARKS options */ +#define SQL_UB_OFF 0UL +#define SQL_UB_ON 01UL +#define SQL_UB_DEFAULT SQL_UB_OFF + +/* New values for SQL_USE_BOOKMARKS attribute */ +#if (ODBCVER >= 0x0300) +#define SQL_UB_FIXED SQL_UB_ON +#define SQL_UB_VARIABLE 2UL +#endif /* ODBCVER >= 0x0300 */ + +/* extended descriptor field */ +#if (ODBCVER >= 0x0300) +#define SQL_DESC_ARRAY_SIZE 20 +#define SQL_DESC_ARRAY_STATUS_PTR 21 +#define SQL_DESC_AUTO_UNIQUE_VALUE SQL_COLUMN_AUTO_INCREMENT +#define SQL_DESC_BASE_COLUMN_NAME 22 +#define SQL_DESC_BASE_TABLE_NAME 23 +#define SQL_DESC_BIND_OFFSET_PTR 24 +#define SQL_DESC_BIND_TYPE 25 +#define SQL_DESC_CASE_SENSITIVE SQL_COLUMN_CASE_SENSITIVE +#define SQL_DESC_CATALOG_NAME SQL_COLUMN_QUALIFIER_NAME +#define SQL_DESC_CONCISE_TYPE SQL_COLUMN_TYPE +#define SQL_DESC_DATETIME_INTERVAL_PRECISION 26 +#define SQL_DESC_DISPLAY_SIZE SQL_COLUMN_DISPLAY_SIZE +#define SQL_DESC_FIXED_PREC_SCALE SQL_COLUMN_MONEY +#define SQL_DESC_LABEL SQL_COLUMN_LABEL +#define SQL_DESC_LITERAL_PREFIX 27 +#define SQL_DESC_LITERAL_SUFFIX 28 +#define SQL_DESC_LOCAL_TYPE_NAME 29 +#define SQL_DESC_MAXIMUM_SCALE 30 +#define SQL_DESC_MINIMUM_SCALE 31 +#define SQL_DESC_NUM_PREC_RADIX 32 +#define SQL_DESC_PARAMETER_TYPE 33 +#define SQL_DESC_ROWS_PROCESSED_PTR 34 +#if (ODBCVER >= 0x0350) +#define SQL_DESC_ROWVER 35 +#endif /* ODBCVER >= 0x0350 */ +#define SQL_DESC_SCHEMA_NAME SQL_COLUMN_OWNER_NAME +#define SQL_DESC_SEARCHABLE SQL_COLUMN_SEARCHABLE +#define SQL_DESC_TYPE_NAME SQL_COLUMN_TYPE_NAME +#define SQL_DESC_TABLE_NAME SQL_COLUMN_TABLE_NAME +#define SQL_DESC_UNSIGNED SQL_COLUMN_UNSIGNED +#define SQL_DESC_UPDATABLE SQL_COLUMN_UPDATABLE +#endif /* ODBCVER >= 0x0300 */ + + +/* defines for diagnostics fields */ +#if (ODBCVER >= 0x0300) +#define SQL_DIAG_CURSOR_ROW_COUNT (-1249) +#define SQL_DIAG_ROW_NUMBER (-1248) +#define SQL_DIAG_COLUMN_NUMBER (-1247) +#endif /* ODBCVER >= 0x0300 */ + +/* SQL extended datatypes */ +#define SQL_DATE 9 +#if (ODBCVER >= 0x0300) +#define SQL_INTERVAL 10 +#endif /* ODBCVER >= 0x0300 */ +#define SQL_TIME 10 +#define SQL_TIMESTAMP 11 +#define SQL_LONGVARCHAR (-1) +#define SQL_BINARY (-2) +#define SQL_VARBINARY (-3) +#define SQL_LONGVARBINARY (-4) +#define SQL_BIGINT (-5) +#define SQL_TINYINT (-6) +#define SQL_BIT (-7) +#if (ODBCVER >= 0x0350) +#define SQL_GUID (-11) +#endif /* ODBCVER >= 0x0350 */ + +#if (ODBCVER >= 0x0300) +/* interval code */ +#define SQL_CODE_YEAR 1 +#define SQL_CODE_MONTH 2 +#define SQL_CODE_DAY 3 +#define SQL_CODE_HOUR 4 +#define SQL_CODE_MINUTE 5 +#define SQL_CODE_SECOND 6 +#define SQL_CODE_YEAR_TO_MONTH 7 +#define SQL_CODE_DAY_TO_HOUR 8 +#define SQL_CODE_DAY_TO_MINUTE 9 +#define SQL_CODE_DAY_TO_SECOND 10 +#define SQL_CODE_HOUR_TO_MINUTE 11 +#define SQL_CODE_HOUR_TO_SECOND 12 +#define SQL_CODE_MINUTE_TO_SECOND 13 + +#define SQL_INTERVAL_YEAR (100 + SQL_CODE_YEAR) +#define SQL_INTERVAL_MONTH (100 + SQL_CODE_MONTH) +#define SQL_INTERVAL_DAY (100 + SQL_CODE_DAY) +#define SQL_INTERVAL_HOUR (100 + SQL_CODE_HOUR) +#define SQL_INTERVAL_MINUTE (100 + SQL_CODE_MINUTE) +#define SQL_INTERVAL_SECOND (100 + SQL_CODE_SECOND) +#define SQL_INTERVAL_YEAR_TO_MONTH (100 + SQL_CODE_YEAR_TO_MONTH) +#define SQL_INTERVAL_DAY_TO_HOUR (100 + SQL_CODE_DAY_TO_HOUR) +#define SQL_INTERVAL_DAY_TO_MINUTE (100 + SQL_CODE_DAY_TO_MINUTE) +#define SQL_INTERVAL_DAY_TO_SECOND (100 + SQL_CODE_DAY_TO_SECOND) +#define SQL_INTERVAL_HOUR_TO_MINUTE (100 + SQL_CODE_HOUR_TO_MINUTE) +#define SQL_INTERVAL_HOUR_TO_SECOND (100 + SQL_CODE_HOUR_TO_SECOND) +#define SQL_INTERVAL_MINUTE_TO_SECOND (100 + SQL_CODE_MINUTE_TO_SECOND) + +#else +#define SQL_INTERVAL_YEAR (-80) +#define SQL_INTERVAL_MONTH (-81) +#define SQL_INTERVAL_YEAR_TO_MONTH (-82) +#define SQL_INTERVAL_DAY (-83) +#define SQL_INTERVAL_HOUR (-84) +#define SQL_INTERVAL_MINUTE (-85) +#define SQL_INTERVAL_SECOND (-86) +#define SQL_INTERVAL_DAY_TO_HOUR (-87) +#define SQL_INTERVAL_DAY_TO_MINUTE (-88) +#define SQL_INTERVAL_DAY_TO_SECOND (-89) +#define SQL_INTERVAL_HOUR_TO_MINUTE (-90) +#define SQL_INTERVAL_HOUR_TO_SECOND (-91) +#define SQL_INTERVAL_MINUTE_TO_SECOND (-92) +#endif /* ODBCVER >= 0x0300 */ + + +#if (ODBCVER <= 0x0300) +#define SQL_UNICODE (-95) +#define SQL_UNICODE_VARCHAR (-96) +#define SQL_UNICODE_LONGVARCHAR (-97) +#define SQL_UNICODE_CHAR SQL_UNICODE +#else +/* The previous definitions for SQL_UNICODE_ are historical and obsolete */ + +#define SQL_UNICODE SQL_WCHAR + +#define SQL_UNICODE_VARCHAR SQL_WVARCHAR +#define SQL_UNICODE_LONGVARCHAR SQL_WLONGVARCHAR +#define SQL_UNICODE_CHAR SQL_WCHAR +#endif + +#if (ODBCVER < 0x0300) +#define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR +#define SQL_TYPE_DRIVER_END SQL_UNICODE_LONGVARCHAR +#endif /* ODBCVER < 0x0300 */ + +/* C datatype to SQL datatype mapping SQL types + ------------------- */ +#define SQL_C_CHAR SQL_CHAR /* CHAR, VARCHAR, DECIMAL, NUMERIC */ +#define SQL_C_LONG SQL_INTEGER /* INTEGER */ +#define SQL_C_SHORT SQL_SMALLINT /* SMALLINT */ +#define SQL_C_FLOAT SQL_REAL /* REAL */ +#define SQL_C_DOUBLE SQL_DOUBLE /* FLOAT, DOUBLE */ +#if (ODBCVER >= 0x0300) +#define SQL_C_NUMERIC SQL_NUMERIC +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_DEFAULT 99 + +#define SQL_SIGNED_OFFSET (-20) +#define SQL_UNSIGNED_OFFSET (-22) + +/* C datatype to SQL datatype mapping */ +#define SQL_C_DATE SQL_DATE +#define SQL_C_TIME SQL_TIME +#define SQL_C_TIMESTAMP SQL_TIMESTAMP +#if (ODBCVER >= 0x0300) +#define SQL_C_TYPE_DATE SQL_TYPE_DATE +#define SQL_C_TYPE_TIME SQL_TYPE_TIME +#define SQL_C_TYPE_TIMESTAMP SQL_TYPE_TIMESTAMP +#define SQL_C_INTERVAL_YEAR SQL_INTERVAL_YEAR +#define SQL_C_INTERVAL_MONTH SQL_INTERVAL_MONTH +#define SQL_C_INTERVAL_DAY SQL_INTERVAL_DAY +#define SQL_C_INTERVAL_HOUR SQL_INTERVAL_HOUR +#define SQL_C_INTERVAL_MINUTE SQL_INTERVAL_MINUTE +#define SQL_C_INTERVAL_SECOND SQL_INTERVAL_SECOND +#define SQL_C_INTERVAL_YEAR_TO_MONTH SQL_INTERVAL_YEAR_TO_MONTH +#define SQL_C_INTERVAL_DAY_TO_HOUR SQL_INTERVAL_DAY_TO_HOUR +#define SQL_C_INTERVAL_DAY_TO_MINUTE SQL_INTERVAL_DAY_TO_MINUTE +#define SQL_C_INTERVAL_DAY_TO_SECOND SQL_INTERVAL_DAY_TO_SECOND +#define SQL_C_INTERVAL_HOUR_TO_MINUTE SQL_INTERVAL_HOUR_TO_MINUTE +#define SQL_C_INTERVAL_HOUR_TO_SECOND SQL_INTERVAL_HOUR_TO_SECOND +#define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_BINARY SQL_BINARY +#define SQL_C_BIT SQL_BIT +#if (ODBCVER >= 0x0300) +#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) /* SIGNED BIGINT */ +#define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED BIGINT */ +#endif /* ODBCVER >= 0x0300 */ +#define SQL_C_TINYINT SQL_TINYINT +#define SQL_C_SLONG (SQL_C_LONG+SQL_SIGNED_OFFSET) /* SIGNED INTEGER */ +#define SQL_C_SSHORT (SQL_C_SHORT+SQL_SIGNED_OFFSET) /* SIGNED SMALLINT */ +#define SQL_C_STINYINT (SQL_TINYINT+SQL_SIGNED_OFFSET) /* SIGNED TINYINT */ +#define SQL_C_ULONG (SQL_C_LONG+SQL_UNSIGNED_OFFSET) /* UNSIGNED INTEGER*/ +#define SQL_C_USHORT (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED SMALLINT*/ +#define SQL_C_UTINYINT (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED TINYINT*/ + +#ifdef _WIN64 +#define SQL_C_BOOKMARK SQL_C_UBIGINT /* BOOKMARK */ +#else +#define SQL_C_BOOKMARK SQL_C_ULONG /* BOOKMARK */ +#endif + +#if (ODBCVER >= 0x0350) +#define SQL_C_GUID SQL_GUID +#endif /* ODBCVER >= 0x0350 */ + +#define SQL_TYPE_NULL 0 +#if (ODBCVER < 0x0300) +#define SQL_TYPE_MIN SQL_BIT +#define SQL_TYPE_MAX SQL_VARCHAR +#endif + +#if (ODBCVER >= 0x0300) +#define SQL_C_VARBOOKMARK SQL_C_BINARY +#endif /* ODBCVER >= 0x0300 */ + +/* define for SQL_DIAG_ROW_NUMBER and SQL_DIAG_COLUMN_NUMBER */ +#if (ODBCVER >= 0x0300) +#define SQL_NO_ROW_NUMBER (-1) +#define SQL_NO_COLUMN_NUMBER (-1) +#define SQL_ROW_NUMBER_UNKNOWN (-2) +#define SQL_COLUMN_NUMBER_UNKNOWN (-2) +#endif + +/* SQLBindParameter extensions */ +#define SQL_DEFAULT_PARAM (-5) +#define SQL_IGNORE (-6) +#if (ODBCVER >= 0x0300) +#define SQL_COLUMN_IGNORE SQL_IGNORE +#endif /* ODBCVER >= 0x0300 */ +#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) +#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET) + +/* binary length for driver specific attributes */ +#define SQL_LEN_BINARY_ATTR_OFFSET (-100) +#define SQL_LEN_BINARY_ATTR(length) (-(length)+SQL_LEN_BINARY_ATTR_OFFSET) + +/* Defines used by Driver Manager when mapping SQLSetParam to SQLBindParameter +*/ +#define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT +#define SQL_SETPARAM_VALUE_MAX (-1L) + +/* SQLColAttributes defines */ +#define SQL_COLUMN_COUNT 0 +#define SQL_COLUMN_NAME 1 +#define SQL_COLUMN_TYPE 2 +#define SQL_COLUMN_LENGTH 3 +#define SQL_COLUMN_PRECISION 4 +#define SQL_COLUMN_SCALE 5 +#define SQL_COLUMN_DISPLAY_SIZE 6 +#define SQL_COLUMN_NULLABLE 7 +#define SQL_COLUMN_UNSIGNED 8 +#define SQL_COLUMN_MONEY 9 +#define SQL_COLUMN_UPDATABLE 10 +#define SQL_COLUMN_AUTO_INCREMENT 11 +#define SQL_COLUMN_CASE_SENSITIVE 12 +#define SQL_COLUMN_SEARCHABLE 13 +#define SQL_COLUMN_TYPE_NAME 14 +#define SQL_COLUMN_TABLE_NAME 15 +#define SQL_COLUMN_OWNER_NAME 16 +#define SQL_COLUMN_QUALIFIER_NAME 17 +#define SQL_COLUMN_LABEL 18 +#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL +#if (ODBCVER < 0x0300) +#define SQL_COLUMN_DRIVER_START 1000 +#endif /* ODBCVER < 0x0300 */ + +#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT + +/* SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE */ +#define SQL_ATTR_READONLY 0 +#define SQL_ATTR_WRITE 1 +#define SQL_ATTR_READWRITE_UNKNOWN 2 + +/* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */ +/* These are also used by SQLGetInfo */ +#define SQL_UNSEARCHABLE 0 +#define SQL_LIKE_ONLY 1 +#define SQL_ALL_EXCEPT_LIKE 2 +#define SQL_SEARCHABLE 3 +#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE + + +/* Special return values for SQLGetData */ +#define SQL_NO_TOTAL (-4) + +/********************************************/ +/* SQLGetFunctions: additional values for */ +/* fFunction to represent functions that */ +/* are not in the X/Open spec. */ +/********************************************/ + +#if (ODBCVER >= 0x0300) +#define SQL_API_SQLALLOCHANDLESTD 73 +#define SQL_API_SQLBULKOPERATIONS 24 +#endif /* ODBCVER >= 0x0300 */ +#define SQL_API_SQLBINDPARAMETER 72 +#define SQL_API_SQLBROWSECONNECT 55 +#define SQL_API_SQLCOLATTRIBUTES 6 +#define SQL_API_SQLCOLUMNPRIVILEGES 56 +#define SQL_API_SQLDESCRIBEPARAM 58 +#define SQL_API_SQLDRIVERCONNECT 41 +#define SQL_API_SQLDRIVERS 71 +#define SQL_API_SQLEXTENDEDFETCH 59 +#define SQL_API_SQLFOREIGNKEYS 60 +#define SQL_API_SQLMORERESULTS 61 +#define SQL_API_SQLNATIVESQL 62 +#define SQL_API_SQLNUMPARAMS 63 +#define SQL_API_SQLPARAMOPTIONS 64 +#define SQL_API_SQLPRIMARYKEYS 65 +#define SQL_API_SQLPROCEDURECOLUMNS 66 +#define SQL_API_SQLPROCEDURES 67 +#define SQL_API_SQLSETPOS 68 +#define SQL_API_SQLSETSCROLLOPTIONS 69 +#define SQL_API_SQLTABLEPRIVILEGES 70 + +/*-------------------------------------------*/ +/* SQL_EXT_API_LAST is not useful with ODBC */ +/* version 3.0 because some of the values */ +/* from X/Open are in the 10000 range. */ +/*-------------------------------------------*/ + +#if (ODBCVER < 0x0300) +#define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER +#define SQL_NUM_FUNCTIONS 23 +#define SQL_EXT_API_START 40 +#define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1) +#endif + +/*--------------------------------------------*/ +/* SQL_API_ALL_FUNCTIONS returns an array */ +/* of 'booleans' representing whether a */ +/* function is implemented by the driver. */ +/* */ +/* CAUTION: Only functions defined in ODBC */ +/* version 2.0 and earlier are returned, the */ +/* new high-range function numbers defined by */ +/* X/Open break this scheme. See the new */ +/* method -- SQL_API_ODBC3_ALL_FUNCTIONS */ +/*--------------------------------------------*/ + +#define SQL_API_ALL_FUNCTIONS 0 /* See CAUTION above */ + +/*----------------------------------------------*/ +/* 2.X drivers export a dummy function with */ +/* ordinal number SQL_API_LOADBYORDINAL to speed*/ +/* loading under the windows operating system. */ +/* */ +/* CAUTION: Loading by ordinal is not supported */ +/* for 3.0 and above drivers. */ +/*----------------------------------------------*/ + +#define SQL_API_LOADBYORDINAL 199 /* See CAUTION above */ + +/*----------------------------------------------*/ +/* SQL_API_ODBC3_ALL_FUNCTIONS */ +/* This returns a bitmap, which allows us to */ +/* handle the higher-valued function numbers. */ +/* Use SQL_FUNC_EXISTS(bitmap,function_number) */ +/* to determine if the function exists. */ +/*----------------------------------------------*/ + + +#if (ODBCVER >= 0x0300) +#define SQL_API_ODBC3_ALL_FUNCTIONS 999 +#define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE 250 /* array of 250 words */ + +#define SQL_FUNC_EXISTS(pfExists, uwAPI) \ + ((*(((UWORD*) (pfExists)) + ((uwAPI) >> 4)) \ + & (1 << ((uwAPI) & 0x000F)) \ + ) ? SQL_TRUE : SQL_FALSE \ + ) +#endif /* ODBCVER >= 0x0300 */ + + +/************************************************/ +/* Extended definitions for SQLGetInfo */ +/************************************************/ + +/*---------------------------------*/ +/* Values in ODBC 2.0 that are not */ +/* in the X/Open spec */ +/*---------------------------------*/ + +#define SQL_INFO_FIRST 0 +#define SQL_ACTIVE_CONNECTIONS 0 /* MAX_DRIVER_CONNECTIONS */ +#define SQL_ACTIVE_STATEMENTS 1 /* MAX_CONCURRENT_ACTIVITIES */ +#define SQL_DRIVER_HDBC 3 +#define SQL_DRIVER_HENV 4 +#define SQL_DRIVER_HSTMT 5 +#define SQL_DRIVER_NAME 6 +#define SQL_DRIVER_VER 7 +#define SQL_ODBC_API_CONFORMANCE 9 +#define SQL_ODBC_VER 10 +#define SQL_ROW_UPDATES 11 +#define SQL_ODBC_SAG_CLI_CONFORMANCE 12 +#define SQL_ODBC_SQL_CONFORMANCE 15 +#define SQL_PROCEDURES 21 +#define SQL_CONCAT_NULL_BEHAVIOR 22 +#define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 +#define SQL_EXPRESSIONS_IN_ORDERBY 27 +#define SQL_MAX_OWNER_NAME_LEN 32 /* MAX_SCHEMA_NAME_LEN */ +#define SQL_MAX_PROCEDURE_NAME_LEN 33 +#define SQL_MAX_QUALIFIER_NAME_LEN 34 /* MAX_CATALOG_NAME_LEN */ +#define SQL_MULT_RESULT_SETS 36 +#define SQL_MULTIPLE_ACTIVE_TXN 37 +#define SQL_OUTER_JOINS 38 +#define SQL_OWNER_TERM 39 +#define SQL_PROCEDURE_TERM 40 +#define SQL_QUALIFIER_NAME_SEPARATOR 41 +#define SQL_QUALIFIER_TERM 42 +#define SQL_SCROLL_OPTIONS 44 +#define SQL_TABLE_TERM 45 +#define SQL_CONVERT_FUNCTIONS 48 +#define SQL_NUMERIC_FUNCTIONS 49 +#define SQL_STRING_FUNCTIONS 50 +#define SQL_SYSTEM_FUNCTIONS 51 +#define SQL_TIMEDATE_FUNCTIONS 52 +#define SQL_CONVERT_BIGINT 53 +#define SQL_CONVERT_BINARY 54 +#define SQL_CONVERT_BIT 55 +#define SQL_CONVERT_CHAR 56 +#define SQL_CONVERT_DATE 57 +#define SQL_CONVERT_DECIMAL 58 +#define SQL_CONVERT_DOUBLE 59 +#define SQL_CONVERT_FLOAT 60 +#define SQL_CONVERT_INTEGER 61 +#define SQL_CONVERT_LONGVARCHAR 62 +#define SQL_CONVERT_NUMERIC 63 +#define SQL_CONVERT_REAL 64 +#define SQL_CONVERT_SMALLINT 65 +#define SQL_CONVERT_TIME 66 +#define SQL_CONVERT_TIMESTAMP 67 +#define SQL_CONVERT_TINYINT 68 +#define SQL_CONVERT_VARBINARY 69 +#define SQL_CONVERT_VARCHAR 70 +#define SQL_CONVERT_LONGVARBINARY 71 +#define SQL_ODBC_SQL_OPT_IEF 73 /* SQL_INTEGRITY */ +#define SQL_CORRELATION_NAME 74 +#define SQL_NON_NULLABLE_COLUMNS 75 +#define SQL_DRIVER_HLIB 76 +#define SQL_DRIVER_ODBC_VER 77 +#define SQL_LOCK_TYPES 78 +#define SQL_POS_OPERATIONS 79 +#define SQL_POSITIONED_STATEMENTS 80 +#define SQL_BOOKMARK_PERSISTENCE 82 +#define SQL_STATIC_SENSITIVITY 83 +#define SQL_FILE_USAGE 84 +#define SQL_COLUMN_ALIAS 87 +#define SQL_GROUP_BY 88 +#define SQL_KEYWORDS 89 +#define SQL_OWNER_USAGE 91 +#define SQL_QUALIFIER_USAGE 92 +#define SQL_QUOTED_IDENTIFIER_CASE 93 +#define SQL_SUBQUERIES 95 +#define SQL_UNION 96 +#define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103 +#define SQL_MAX_CHAR_LITERAL_LEN 108 +#define SQL_TIMEDATE_ADD_INTERVALS 109 +#define SQL_TIMEDATE_DIFF_INTERVALS 110 +#define SQL_NEED_LONG_DATA_LEN 111 +#define SQL_MAX_BINARY_LITERAL_LEN 112 +#define SQL_LIKE_ESCAPE_CLAUSE 113 +#define SQL_QUALIFIER_LOCATION 114 + +#if (ODBCVER >= 0x0201 && ODBCVER < 0x0300) +#define SQL_OJ_CAPABILITIES 65003 /* Temp value until ODBC 3.0 */ +#endif /* ODBCVER >= 0x0201 && ODBCVER < 0x0300 */ + +/*----------------------------------------------*/ +/* SQL_INFO_LAST and SQL_INFO_DRIVER_START are */ +/* not useful anymore, because X/Open has */ +/* values in the 10000 range. You */ +/* must contact X/Open directly to get a range */ +/* of numbers for driver-specific values. */ +/*----------------------------------------------*/ + +#if (ODBCVER < 0x0300) +#define SQL_INFO_LAST SQL_QUALIFIER_LOCATION +#define SQL_INFO_DRIVER_START 1000 +#endif /* ODBCVER < 0x0300 */ + +/*-----------------------------------------------*/ +/* ODBC 3.0 SQLGetInfo values that are not part */ +/* of the X/Open standard at this time. X/Open */ +/* standard values are in sql.h. */ +/*-----------------------------------------------*/ + +#if (ODBCVER >= 0x0300) +#define SQL_ACTIVE_ENVIRONMENTS 116 +#define SQL_ALTER_DOMAIN 117 + +#define SQL_SQL_CONFORMANCE 118 +#define SQL_DATETIME_LITERALS 119 + +#define SQL_ASYNC_MODE 10021 /* new X/Open spec */ +#define SQL_BATCH_ROW_COUNT 120 +#define SQL_BATCH_SUPPORT 121 +#define SQL_CATALOG_LOCATION SQL_QUALIFIER_LOCATION +#define SQL_CATALOG_NAME_SEPARATOR SQL_QUALIFIER_NAME_SEPARATOR +#define SQL_CATALOG_TERM SQL_QUALIFIER_TERM +#define SQL_CATALOG_USAGE SQL_QUALIFIER_USAGE +#define SQL_CONVERT_WCHAR 122 +#define SQL_CONVERT_INTERVAL_DAY_TIME 123 +#define SQL_CONVERT_INTERVAL_YEAR_MONTH 124 +#define SQL_CONVERT_WLONGVARCHAR 125 +#define SQL_CONVERT_WVARCHAR 126 +#define SQL_CREATE_ASSERTION 127 +#define SQL_CREATE_CHARACTER_SET 128 +#define SQL_CREATE_COLLATION 129 +#define SQL_CREATE_DOMAIN 130 +#define SQL_CREATE_SCHEMA 131 +#define SQL_CREATE_TABLE 132 +#define SQL_CREATE_TRANSLATION 133 +#define SQL_CREATE_VIEW 134 +#define SQL_DRIVER_HDESC 135 +#define SQL_DROP_ASSERTION 136 +#define SQL_DROP_CHARACTER_SET 137 +#define SQL_DROP_COLLATION 138 +#define SQL_DROP_DOMAIN 139 +#define SQL_DROP_SCHEMA 140 +#define SQL_DROP_TABLE 141 +#define SQL_DROP_TRANSLATION 142 +#define SQL_DROP_VIEW 143 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES1 144 +#define SQL_DYNAMIC_CURSOR_ATTRIBUTES2 145 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 146 +#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 147 +#define SQL_INDEX_KEYWORDS 148 +#define SQL_INFO_SCHEMA_VIEWS 149 +#define SQL_KEYSET_CURSOR_ATTRIBUTES1 150 +#define SQL_KEYSET_CURSOR_ATTRIBUTES2 151 +#define SQL_MAX_ASYNC_CONCURRENT_STATEMENTS 10022 /* new X/Open spec */ +#define SQL_ODBC_INTERFACE_CONFORMANCE 152 +#define SQL_PARAM_ARRAY_ROW_COUNTS 153 +#define SQL_PARAM_ARRAY_SELECTS 154 +#define SQL_SCHEMA_TERM SQL_OWNER_TERM +#define SQL_SCHEMA_USAGE SQL_OWNER_USAGE +#define SQL_SQL92_DATETIME_FUNCTIONS 155 +#define SQL_SQL92_FOREIGN_KEY_DELETE_RULE 156 +#define SQL_SQL92_FOREIGN_KEY_UPDATE_RULE 157 +#define SQL_SQL92_GRANT 158 +#define SQL_SQL92_NUMERIC_VALUE_FUNCTIONS 159 +#define SQL_SQL92_PREDICATES 160 +#define SQL_SQL92_RELATIONAL_JOIN_OPERATORS 161 +#define SQL_SQL92_REVOKE 162 +#define SQL_SQL92_ROW_VALUE_CONSTRUCTOR 163 +#define SQL_SQL92_STRING_FUNCTIONS 164 +#define SQL_SQL92_VALUE_EXPRESSIONS 165 +#define SQL_STANDARD_CLI_CONFORMANCE 166 +#define SQL_STATIC_CURSOR_ATTRIBUTES1 167 +#define SQL_STATIC_CURSOR_ATTRIBUTES2 168 + +#define SQL_AGGREGATE_FUNCTIONS 169 +#define SQL_DDL_INDEX 170 +#define SQL_DM_VER 171 +#define SQL_INSERT_STATEMENT 172 +#define SQL_CONVERT_GUID 173 +#define SQL_UNION_STATEMENT SQL_UNION +#endif /* ODBCVER >= 0x0300 */ + +#define SQL_DTC_TRANSITION_COST 1750 + +/* SQL_ALTER_TABLE bitmasks */ +#if (ODBCVER >= 0x0300) +/* the following 5 bitmasks are defined in sql.h +*#define SQL_AT_ADD_COLUMN 0x00000001L +*#define SQL_AT_DROP_COLUMN 0x00000002L +*#define SQL_AT_ADD_CONSTRAINT 0x00000008L +*/ +#define SQL_AT_ADD_COLUMN_SINGLE 0x00000020L +#define SQL_AT_ADD_COLUMN_DEFAULT 0x00000040L +#define SQL_AT_ADD_COLUMN_COLLATION 0x00000080L +#define SQL_AT_SET_COLUMN_DEFAULT 0x00000100L +#define SQL_AT_DROP_COLUMN_DEFAULT 0x00000200L +#define SQL_AT_DROP_COLUMN_CASCADE 0x00000400L +#define SQL_AT_DROP_COLUMN_RESTRICT 0x00000800L +#define SQL_AT_ADD_TABLE_CONSTRAINT 0x00001000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE 0x00002000L +#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT 0x00004000L +#define SQL_AT_CONSTRAINT_NAME_DEFINITION 0x00008000L +#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED 0x00010000L +#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00020000L +#define SQL_AT_CONSTRAINT_DEFERRABLE 0x00040000L +#define SQL_AT_CONSTRAINT_NON_DEFERRABLE 0x00080000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_CONVERT_* return value bitmasks */ + +#define SQL_CVT_CHAR 0x00000001L +#define SQL_CVT_NUMERIC 0x00000002L +#define SQL_CVT_DECIMAL 0x00000004L +#define SQL_CVT_INTEGER 0x00000008L +#define SQL_CVT_SMALLINT 0x00000010L +#define SQL_CVT_FLOAT 0x00000020L +#define SQL_CVT_REAL 0x00000040L +#define SQL_CVT_DOUBLE 0x00000080L +#define SQL_CVT_VARCHAR 0x00000100L +#define SQL_CVT_LONGVARCHAR 0x00000200L +#define SQL_CVT_BINARY 0x00000400L +#define SQL_CVT_VARBINARY 0x00000800L +#define SQL_CVT_BIT 0x00001000L +#define SQL_CVT_TINYINT 0x00002000L +#define SQL_CVT_BIGINT 0x00004000L +#define SQL_CVT_DATE 0x00008000L +#define SQL_CVT_TIME 0x00010000L +#define SQL_CVT_TIMESTAMP 0x00020000L +#define SQL_CVT_LONGVARBINARY 0x00040000L +#if (ODBCVER >= 0x0300) +#define SQL_CVT_INTERVAL_YEAR_MONTH 0x00080000L +#define SQL_CVT_INTERVAL_DAY_TIME 0x00100000L +#define SQL_CVT_WCHAR 0x00200000L +#define SQL_CVT_WLONGVARCHAR 0x00400000L +#define SQL_CVT_WVARCHAR 0x00800000L +#define SQL_CVT_GUID 0x01000000L + +#endif /* ODBCVER >= 0x0300 */ + + +/* SQL_CONVERT_FUNCTIONS functions */ +#define SQL_FN_CVT_CONVERT 0x00000001L +#if (ODBCVER >= 0x0300) +#define SQL_FN_CVT_CAST 0x00000002L +#endif /* ODBCVER >= 0x0300 */ + + +/* SQL_STRING_FUNCTIONS functions */ + +#define SQL_FN_STR_CONCAT 0x00000001L +#define SQL_FN_STR_INSERT 0x00000002L +#define SQL_FN_STR_LEFT 0x00000004L +#define SQL_FN_STR_LTRIM 0x00000008L +#define SQL_FN_STR_LENGTH 0x00000010L +#define SQL_FN_STR_LOCATE 0x00000020L +#define SQL_FN_STR_LCASE 0x00000040L +#define SQL_FN_STR_REPEAT 0x00000080L +#define SQL_FN_STR_REPLACE 0x00000100L +#define SQL_FN_STR_RIGHT 0x00000200L +#define SQL_FN_STR_RTRIM 0x00000400L +#define SQL_FN_STR_SUBSTRING 0x00000800L +#define SQL_FN_STR_UCASE 0x00001000L +#define SQL_FN_STR_ASCII 0x00002000L +#define SQL_FN_STR_CHAR 0x00004000L +#define SQL_FN_STR_DIFFERENCE 0x00008000L +#define SQL_FN_STR_LOCATE_2 0x00010000L +#define SQL_FN_STR_SOUNDEX 0x00020000L +#define SQL_FN_STR_SPACE 0x00040000L +#if (ODBCVER >= 0x0300) +#define SQL_FN_STR_BIT_LENGTH 0x00080000L +#define SQL_FN_STR_CHAR_LENGTH 0x00100000L +#define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L +#define SQL_FN_STR_OCTET_LENGTH 0x00400000L +#define SQL_FN_STR_POSITION 0x00800000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SQL92_STRING_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SSF_CONVERT 0x00000001L +#define SQL_SSF_LOWER 0x00000002L +#define SQL_SSF_UPPER 0x00000004L +#define SQL_SSF_SUBSTRING 0x00000008L +#define SQL_SSF_TRANSLATE 0x00000010L +#define SQL_SSF_TRIM_BOTH 0x00000020L +#define SQL_SSF_TRIM_LEADING 0x00000040L +#define SQL_SSF_TRIM_TRAILING 0x00000080L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_NUMERIC_FUNCTIONS functions */ + +#define SQL_FN_NUM_ABS 0x00000001L +#define SQL_FN_NUM_ACOS 0x00000002L +#define SQL_FN_NUM_ASIN 0x00000004L +#define SQL_FN_NUM_ATAN 0x00000008L +#define SQL_FN_NUM_ATAN2 0x00000010L +#define SQL_FN_NUM_CEILING 0x00000020L +#define SQL_FN_NUM_COS 0x00000040L +#define SQL_FN_NUM_COT 0x00000080L +#define SQL_FN_NUM_EXP 0x00000100L +#define SQL_FN_NUM_FLOOR 0x00000200L +#define SQL_FN_NUM_LOG 0x00000400L +#define SQL_FN_NUM_MOD 0x00000800L +#define SQL_FN_NUM_SIGN 0x00001000L +#define SQL_FN_NUM_SIN 0x00002000L +#define SQL_FN_NUM_SQRT 0x00004000L +#define SQL_FN_NUM_TAN 0x00008000L +#define SQL_FN_NUM_PI 0x00010000L +#define SQL_FN_NUM_RAND 0x00020000L +#define SQL_FN_NUM_DEGREES 0x00040000L +#define SQL_FN_NUM_LOG10 0x00080000L +#define SQL_FN_NUM_POWER 0x00100000L +#define SQL_FN_NUM_RADIANS 0x00200000L +#define SQL_FN_NUM_ROUND 0x00400000L +#define SQL_FN_NUM_TRUNCATE 0x00800000L + +/* SQL_SQL92_NUMERIC_VALUE_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SNVF_BIT_LENGTH 0x00000001L +#define SQL_SNVF_CHAR_LENGTH 0x00000002L +#define SQL_SNVF_CHARACTER_LENGTH 0x00000004L +#define SQL_SNVF_EXTRACT 0x00000008L +#define SQL_SNVF_OCTET_LENGTH 0x00000010L +#define SQL_SNVF_POSITION 0x00000020L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_TIMEDATE_FUNCTIONS functions */ + +#define SQL_FN_TD_NOW 0x00000001L +#define SQL_FN_TD_CURDATE 0x00000002L +#define SQL_FN_TD_DAYOFMONTH 0x00000004L +#define SQL_FN_TD_DAYOFWEEK 0x00000008L +#define SQL_FN_TD_DAYOFYEAR 0x00000010L +#define SQL_FN_TD_MONTH 0x00000020L +#define SQL_FN_TD_QUARTER 0x00000040L +#define SQL_FN_TD_WEEK 0x00000080L +#define SQL_FN_TD_YEAR 0x00000100L +#define SQL_FN_TD_CURTIME 0x00000200L +#define SQL_FN_TD_HOUR 0x00000400L +#define SQL_FN_TD_MINUTE 0x00000800L +#define SQL_FN_TD_SECOND 0x00001000L +#define SQL_FN_TD_TIMESTAMPADD 0x00002000L +#define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L +#define SQL_FN_TD_DAYNAME 0x00008000L +#define SQL_FN_TD_MONTHNAME 0x00010000L +#if (ODBCVER >= 0x0300) +#define SQL_FN_TD_CURRENT_DATE 0x00020000L +#define SQL_FN_TD_CURRENT_TIME 0x00040000L +#define SQL_FN_TD_CURRENT_TIMESTAMP 0x00080000L +#define SQL_FN_TD_EXTRACT 0x00100000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SQL92_DATETIME_FUNCTIONS */ +#if (ODBCVER >= 0x0300) +#define SQL_SDF_CURRENT_DATE 0x00000001L +#define SQL_SDF_CURRENT_TIME 0x00000002L +#define SQL_SDF_CURRENT_TIMESTAMP 0x00000004L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SYSTEM_FUNCTIONS functions */ + +#define SQL_FN_SYS_USERNAME 0x00000001L +#define SQL_FN_SYS_DBNAME 0x00000002L +#define SQL_FN_SYS_IFNULL 0x00000004L + +/* SQL_TIMEDATE_ADD_INTERVALS and SQL_TIMEDATE_DIFF_INTERVALS functions */ + +#define SQL_FN_TSI_FRAC_SECOND 0x00000001L +#define SQL_FN_TSI_SECOND 0x00000002L +#define SQL_FN_TSI_MINUTE 0x00000004L +#define SQL_FN_TSI_HOUR 0x00000008L +#define SQL_FN_TSI_DAY 0x00000010L +#define SQL_FN_TSI_WEEK 0x00000020L +#define SQL_FN_TSI_MONTH 0x00000040L +#define SQL_FN_TSI_QUARTER 0x00000080L +#define SQL_FN_TSI_YEAR 0x00000100L + +/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES1, + * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1, + * SQL_KEYSET_CURSOR_ATTRIBUTES1, and SQL_STATIC_CURSOR_ATTRIBUTES1 + */ +#if (ODBCVER >= 0x0300) +/* supported SQLFetchScroll FetchOrientation's */ +#define SQL_CA1_NEXT 0x00000001L +#define SQL_CA1_ABSOLUTE 0x00000002L +#define SQL_CA1_RELATIVE 0x00000004L +#define SQL_CA1_BOOKMARK 0x00000008L + +/* supported SQLSetPos LockType's */ +#define SQL_CA1_LOCK_NO_CHANGE 0x00000040L +#define SQL_CA1_LOCK_EXCLUSIVE 0x00000080L +#define SQL_CA1_LOCK_UNLOCK 0x00000100L + +/* supported SQLSetPos Operations */ +#define SQL_CA1_POS_POSITION 0x00000200L +#define SQL_CA1_POS_UPDATE 0x00000400L +#define SQL_CA1_POS_DELETE 0x00000800L +#define SQL_CA1_POS_REFRESH 0x00001000L + +/* positioned updates and deletes */ +#define SQL_CA1_POSITIONED_UPDATE 0x00002000L +#define SQL_CA1_POSITIONED_DELETE 0x00004000L +#define SQL_CA1_SELECT_FOR_UPDATE 0x00008000L + +/* supported SQLBulkOperations operations */ +#define SQL_CA1_BULK_ADD 0x00010000L +#define SQL_CA1_BULK_UPDATE_BY_BOOKMARK 0x00020000L +#define SQL_CA1_BULK_DELETE_BY_BOOKMARK 0x00040000L +#define SQL_CA1_BULK_FETCH_BY_BOOKMARK 0x00080000L +#endif /* ODBCVER >= 0x0300 */ + +/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES2, + * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2, + * SQL_KEYSET_CURSOR_ATTRIBUTES2, and SQL_STATIC_CURSOR_ATTRIBUTES2 + */ +#if (ODBCVER >= 0x0300) +/* supported values for SQL_ATTR_SCROLL_CONCURRENCY */ +#define SQL_CA2_READ_ONLY_CONCURRENCY 0x00000001L +#define SQL_CA2_LOCK_CONCURRENCY 0x00000002L +#define SQL_CA2_OPT_ROWVER_CONCURRENCY 0x00000004L +#define SQL_CA2_OPT_VALUES_CONCURRENCY 0x00000008L + +/* sensitivity of the cursor to its own inserts, deletes, and updates */ +#define SQL_CA2_SENSITIVITY_ADDITIONS 0x00000010L +#define SQL_CA2_SENSITIVITY_DELETIONS 0x00000020L +#define SQL_CA2_SENSITIVITY_UPDATES 0x00000040L + +/* semantics of SQL_ATTR_MAX_ROWS */ +#define SQL_CA2_MAX_ROWS_SELECT 0x00000080L +#define SQL_CA2_MAX_ROWS_INSERT 0x00000100L +#define SQL_CA2_MAX_ROWS_DELETE 0x00000200L +#define SQL_CA2_MAX_ROWS_UPDATE 0x00000400L +#define SQL_CA2_MAX_ROWS_CATALOG 0x00000800L +#define SQL_CA2_MAX_ROWS_AFFECTS_ALL (SQL_CA2_MAX_ROWS_SELECT | \ + SQL_CA2_MAX_ROWS_INSERT | SQL_CA2_MAX_ROWS_DELETE | \ + SQL_CA2_MAX_ROWS_UPDATE | SQL_CA2_MAX_ROWS_CATALOG) + +/* semantics of SQL_DIAG_CURSOR_ROW_COUNT */ +#define SQL_CA2_CRC_EXACT 0x00001000L +#define SQL_CA2_CRC_APPROXIMATE 0x00002000L + +/* the kinds of positioned statements that can be simulated */ +#define SQL_CA2_SIMULATE_NON_UNIQUE 0x00004000L +#define SQL_CA2_SIMULATE_TRY_UNIQUE 0x00008000L +#define SQL_CA2_SIMULATE_UNIQUE 0x00010000L +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_ODBC_API_CONFORMANCE values */ + +#define SQL_OAC_NONE 0x0000 +#define SQL_OAC_LEVEL1 0x0001 +#define SQL_OAC_LEVEL2 0x0002 + +/* SQL_ODBC_SAG_CLI_CONFORMANCE values */ + +#define SQL_OSCC_NOT_COMPLIANT 0x0000 +#define SQL_OSCC_COMPLIANT 0x0001 + +/* SQL_ODBC_SQL_CONFORMANCE values */ + +#define SQL_OSC_MINIMUM 0x0000 +#define SQL_OSC_CORE 0x0001 +#define SQL_OSC_EXTENDED 0x0002 + + +/* SQL_CONCAT_NULL_BEHAVIOR values */ + +#define SQL_CB_NULL 0x0000 +#define SQL_CB_NON_NULL 0x0001 + +/* SQL_SCROLL_OPTIONS masks */ + +#define SQL_SO_FORWARD_ONLY 0x00000001L +#define SQL_SO_KEYSET_DRIVEN 0x00000002L +#define SQL_SO_DYNAMIC 0x00000004L +#define SQL_SO_MIXED 0x00000008L +#define SQL_SO_STATIC 0x00000010L + +/* SQL_FETCH_DIRECTION masks */ + +/* SQL_FETCH_RESUME is no longer supported +#define SQL_FD_FETCH_RESUME 0x00000040L +*/ +#define SQL_FD_FETCH_BOOKMARK 0x00000080L + +/* SQL_TXN_ISOLATION_OPTION masks */ +/* SQL_TXN_VERSIONING is no longer supported +#define SQL_TXN_VERSIONING 0x00000010L +*/ + +/* SQL_CORRELATION_NAME values */ + +#define SQL_CN_NONE 0x0000 +#define SQL_CN_DIFFERENT 0x0001 +#define SQL_CN_ANY 0x0002 + +/* SQL_NON_NULLABLE_COLUMNS values */ + +#define SQL_NNC_NULL 0x0000 +#define SQL_NNC_NON_NULL 0x0001 + +/* SQL_NULL_COLLATION values */ + +#define SQL_NC_START 0x0002 +#define SQL_NC_END 0x0004 + +/* SQL_FILE_USAGE values */ + +#define SQL_FILE_NOT_SUPPORTED 0x0000 +#define SQL_FILE_TABLE 0x0001 +#define SQL_FILE_QUALIFIER 0x0002 +#define SQL_FILE_CATALOG SQL_FILE_QUALIFIER // ODBC 3.0 + + +/* SQL_GETDATA_EXTENSIONS values */ + +#define SQL_GD_BLOCK 0x00000004L +#define SQL_GD_BOUND 0x00000008L + +/* SQL_POSITIONED_STATEMENTS masks */ + +#define SQL_PS_POSITIONED_DELETE 0x00000001L +#define SQL_PS_POSITIONED_UPDATE 0x00000002L +#define SQL_PS_SELECT_FOR_UPDATE 0x00000004L + +/* SQL_GROUP_BY values */ + +#define SQL_GB_NOT_SUPPORTED 0x0000 +#define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001 +#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002 +#define SQL_GB_NO_RELATION 0x0003 +#if (ODBCVER >= 0x0300) +#define SQL_GB_COLLATE 0x0004 + +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_OWNER_USAGE masks */ + +#define SQL_OU_DML_STATEMENTS 0x00000001L +#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_OU_TABLE_DEFINITION 0x00000004L +#define SQL_OU_INDEX_DEFINITION 0x00000008L +#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L + +/* SQL_SCHEMA_USAGE masks */ +#if (ODBCVER >= 0x0300) +#define SQL_SU_DML_STATEMENTS SQL_OU_DML_STATEMENTS +#define SQL_SU_PROCEDURE_INVOCATION SQL_OU_PROCEDURE_INVOCATION +#define SQL_SU_TABLE_DEFINITION SQL_OU_TABLE_DEFINITION +#define SQL_SU_INDEX_DEFINITION SQL_OU_INDEX_DEFINITION +#define SQL_SU_PRIVILEGE_DEFINITION SQL_OU_PRIVILEGE_DEFINITION +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_QUALIFIER_USAGE masks */ + +#define SQL_QU_DML_STATEMENTS 0x00000001L +#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L +#define SQL_QU_TABLE_DEFINITION 0x00000004L +#define SQL_QU_INDEX_DEFINITION 0x00000008L +#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L + +#if (ODBCVER >= 0x0300) +/* SQL_CATALOG_USAGE masks */ +#define SQL_CU_DML_STATEMENTS SQL_QU_DML_STATEMENTS +#define SQL_CU_PROCEDURE_INVOCATION SQL_QU_PROCEDURE_INVOCATION +#define SQL_CU_TABLE_DEFINITION SQL_QU_TABLE_DEFINITION +#define SQL_CU_INDEX_DEFINITION SQL_QU_INDEX_DEFINITION +#define SQL_CU_PRIVILEGE_DEFINITION SQL_QU_PRIVILEGE_DEFINITION +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_SUBQUERIES masks */ + +#define SQL_SQ_COMPARISON 0x00000001L +#define SQL_SQ_EXISTS 0x00000002L +#define SQL_SQ_IN 0x00000004L +#define SQL_SQ_QUANTIFIED 0x00000008L +#define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L + +/* SQL_UNION masks */ + +#define SQL_U_UNION 0x00000001L +#define SQL_U_UNION_ALL 0x00000002L + +/* SQL_BOOKMARK_PERSISTENCE values */ + +#define SQL_BP_CLOSE 0x00000001L +#define SQL_BP_DELETE 0x00000002L +#define SQL_BP_DROP 0x00000004L +#define SQL_BP_TRANSACTION 0x00000008L +#define SQL_BP_UPDATE 0x00000010L +#define SQL_BP_OTHER_HSTMT 0x00000020L +#define SQL_BP_SCROLL 0x00000040L + +/* SQL_STATIC_SENSITIVITY values */ + +#define SQL_SS_ADDITIONS 0x00000001L +#define SQL_SS_DELETIONS 0x00000002L +#define SQL_SS_UPDATES 0x00000004L + +/* SQL_VIEW values */ +#define SQL_CV_CREATE_VIEW 0x00000001L +#define SQL_CV_CHECK_OPTION 0x00000002L +#define SQL_CV_CASCADED 0x00000004L +#define SQL_CV_LOCAL 0x00000008L + +/* SQL_LOCK_TYPES masks */ + +#define SQL_LCK_NO_CHANGE 0x00000001L +#define SQL_LCK_EXCLUSIVE 0x00000002L +#define SQL_LCK_UNLOCK 0x00000004L + +/* SQL_POS_OPERATIONS masks */ + +#define SQL_POS_POSITION 0x00000001L +#define SQL_POS_REFRESH 0x00000002L +#define SQL_POS_UPDATE 0x00000004L +#define SQL_POS_DELETE 0x00000008L +#define SQL_POS_ADD 0x00000010L + +/* SQL_QUALIFIER_LOCATION values */ + +#define SQL_QL_START 0x0001 +#define SQL_QL_END 0x0002 + +/* Here start return values for ODBC 3.0 SQLGetInfo */ + +#if (ODBCVER >= 0x0300) +/* SQL_AGGREGATE_FUNCTIONS bitmasks */ +#define SQL_AF_AVG 0x00000001L +#define SQL_AF_COUNT 0x00000002L +#define SQL_AF_MAX 0x00000004L +#define SQL_AF_MIN 0x00000008L +#define SQL_AF_SUM 0x00000010L +#define SQL_AF_DISTINCT 0x00000020L +#define SQL_AF_ALL 0x00000040L + +/* SQL_SQL_CONFORMANCE bit masks */ +#define SQL_SC_SQL92_ENTRY 0x00000001L +#define SQL_SC_FIPS127_2_TRANSITIONAL 0x00000002L +#define SQL_SC_SQL92_INTERMEDIATE 0x00000004L +#define SQL_SC_SQL92_FULL 0x00000008L + +/* SQL_DATETIME_LITERALS masks */ +#define SQL_DL_SQL92_DATE 0x00000001L +#define SQL_DL_SQL92_TIME 0x00000002L +#define SQL_DL_SQL92_TIMESTAMP 0x00000004L +#define SQL_DL_SQL92_INTERVAL_YEAR 0x00000008L +#define SQL_DL_SQL92_INTERVAL_MONTH 0x00000010L +#define SQL_DL_SQL92_INTERVAL_DAY 0x00000020L +#define SQL_DL_SQL92_INTERVAL_HOUR 0x00000040L +#define SQL_DL_SQL92_INTERVAL_MINUTE 0x00000080L +#define SQL_DL_SQL92_INTERVAL_SECOND 0x00000100L +#define SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH 0x00000200L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR 0x00000400L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE 0x00000800L +#define SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND 0x00001000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE 0x00002000L +#define SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND 0x00004000L +#define SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND 0x00008000L + +/* SQL_CATALOG_LOCATION values */ +#define SQL_CL_START SQL_QL_START +#define SQL_CL_END SQL_QL_END + +/* values for SQL_BATCH_ROW_COUNT */ +#define SQL_BRC_PROCEDURES 0x0000001 +#define SQL_BRC_EXPLICIT 0x0000002 +#define SQL_BRC_ROLLED_UP 0x0000004 + +/* bitmasks for SQL_BATCH_SUPPORT */ +#define SQL_BS_SELECT_EXPLICIT 0x00000001L +#define SQL_BS_ROW_COUNT_EXPLICIT 0x00000002L +#define SQL_BS_SELECT_PROC 0x00000004L +#define SQL_BS_ROW_COUNT_PROC 0x00000008L + +/* Values for SQL_PARAM_ARRAY_ROW_COUNTS getinfo */ +#define SQL_PARC_BATCH 1 +#define SQL_PARC_NO_BATCH 2 + +/* values for SQL_PARAM_ARRAY_SELECTS */ +#define SQL_PAS_BATCH 1 +#define SQL_PAS_NO_BATCH 2 +#define SQL_PAS_NO_SELECT 3 + +/* Bitmasks for SQL_INDEX_KEYWORDS */ +#define SQL_IK_NONE 0x00000000L +#define SQL_IK_ASC 0x00000001L +#define SQL_IK_DESC 0x00000002L +#define SQL_IK_ALL (SQL_IK_ASC | SQL_IK_DESC) + +/* Bitmasks for SQL_INFO_SCHEMA_VIEWS */ + +#define SQL_ISV_ASSERTIONS 0x00000001L +#define SQL_ISV_CHARACTER_SETS 0x00000002L +#define SQL_ISV_CHECK_CONSTRAINTS 0x00000004L +#define SQL_ISV_COLLATIONS 0x00000008L +#define SQL_ISV_COLUMN_DOMAIN_USAGE 0x00000010L +#define SQL_ISV_COLUMN_PRIVILEGES 0x00000020L +#define SQL_ISV_COLUMNS 0x00000040L +#define SQL_ISV_CONSTRAINT_COLUMN_USAGE 0x00000080L +#define SQL_ISV_CONSTRAINT_TABLE_USAGE 0x00000100L +#define SQL_ISV_DOMAIN_CONSTRAINTS 0x00000200L +#define SQL_ISV_DOMAINS 0x00000400L +#define SQL_ISV_KEY_COLUMN_USAGE 0x00000800L +#define SQL_ISV_REFERENTIAL_CONSTRAINTS 0x00001000L +#define SQL_ISV_SCHEMATA 0x00002000L +#define SQL_ISV_SQL_LANGUAGES 0x00004000L +#define SQL_ISV_TABLE_CONSTRAINTS 0x00008000L +#define SQL_ISV_TABLE_PRIVILEGES 0x00010000L +#define SQL_ISV_TABLES 0x00020000L +#define SQL_ISV_TRANSLATIONS 0x00040000L +#define SQL_ISV_USAGE_PRIVILEGES 0x00080000L +#define SQL_ISV_VIEW_COLUMN_USAGE 0x00100000L +#define SQL_ISV_VIEW_TABLE_USAGE 0x00200000L +#define SQL_ISV_VIEWS 0x00400000L + +/* Bitmasks for SQL_ASYNC_MODE */ + +#define SQL_AM_NONE 0 +#define SQL_AM_CONNECTION 1 +#define SQL_AM_STATEMENT 2 + +/* Bitmasks for SQL_ALTER_DOMAIN */ +#define SQL_AD_CONSTRAINT_NAME_DEFINITION 0x00000001L +#define SQL_AD_ADD_DOMAIN_CONSTRAINT 0x00000002L +#define SQL_AD_DROP_DOMAIN_CONSTRAINT 0x00000004L +#define SQL_AD_ADD_DOMAIN_DEFAULT 0x00000008L +#define SQL_AD_DROP_DOMAIN_DEFAULT 0x00000010L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_AD_ADD_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE 0x00000100L + + +/* SQL_CREATE_SCHEMA bitmasks */ +#define SQL_CS_CREATE_SCHEMA 0x00000001L +#define SQL_CS_AUTHORIZATION 0x00000002L +#define SQL_CS_DEFAULT_CHARACTER_SET 0x00000004L + +/* SQL_CREATE_TRANSLATION bitmasks */ +#define SQL_CTR_CREATE_TRANSLATION 0x00000001L + +/* SQL_CREATE_ASSERTION bitmasks */ +#define SQL_CA_CREATE_ASSERTION 0x00000001L +#define SQL_CA_CONSTRAINT_INITIALLY_DEFERRED 0x00000010L +#define SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000020L +#define SQL_CA_CONSTRAINT_DEFERRABLE 0x00000040L +#define SQL_CA_CONSTRAINT_NON_DEFERRABLE 0x00000080L + +/* SQL_CREATE_CHARACTER_SET bitmasks */ +#define SQL_CCS_CREATE_CHARACTER_SET 0x00000001L +#define SQL_CCS_COLLATE_CLAUSE 0x00000002L +#define SQL_CCS_LIMITED_COLLATION 0x00000004L + +/* SQL_CREATE_COLLATION bitmasks */ +#define SQL_CCOL_CREATE_COLLATION 0x00000001L + +/* SQL_CREATE_DOMAIN bitmasks */ +#define SQL_CDO_CREATE_DOMAIN 0x00000001L +#define SQL_CDO_DEFAULT 0x00000002L +#define SQL_CDO_CONSTRAINT 0x00000004L +#define SQL_CDO_COLLATION 0x00000008L +#define SQL_CDO_CONSTRAINT_NAME_DEFINITION 0x00000010L +#define SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CDO_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CDO_CONSTRAINT_NON_DEFERRABLE 0x00000100L + +/* SQL_CREATE_TABLE bitmasks */ +#define SQL_CT_CREATE_TABLE 0x00000001L +#define SQL_CT_COMMIT_PRESERVE 0x00000002L +#define SQL_CT_COMMIT_DELETE 0x00000004L +#define SQL_CT_GLOBAL_TEMPORARY 0x00000008L +#define SQL_CT_LOCAL_TEMPORARY 0x00000010L +#define SQL_CT_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L +#define SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L +#define SQL_CT_CONSTRAINT_DEFERRABLE 0x00000080L +#define SQL_CT_CONSTRAINT_NON_DEFERRABLE 0x00000100L +#define SQL_CT_COLUMN_CONSTRAINT 0x00000200L +#define SQL_CT_COLUMN_DEFAULT 0x00000400L +#define SQL_CT_COLUMN_COLLATION 0x00000800L +#define SQL_CT_TABLE_CONSTRAINT 0x00001000L +#define SQL_CT_CONSTRAINT_NAME_DEFINITION 0x00002000L + +/* SQL_DDL_INDEX bitmasks */ +#define SQL_DI_CREATE_INDEX 0x00000001L +#define SQL_DI_DROP_INDEX 0x00000002L + +/* SQL_DROP_COLLATION bitmasks */ +#define SQL_DC_DROP_COLLATION 0x00000001L + +/* SQL_DROP_DOMAIN bitmasks */ +#define SQL_DD_DROP_DOMAIN 0x00000001L +#define SQL_DD_RESTRICT 0x00000002L +#define SQL_DD_CASCADE 0x00000004L + +/* SQL_DROP_SCHEMA bitmasks */ +#define SQL_DS_DROP_SCHEMA 0x00000001L +#define SQL_DS_RESTRICT 0x00000002L +#define SQL_DS_CASCADE 0x00000004L + +/* SQL_DROP_CHARACTER_SET bitmasks */ +#define SQL_DCS_DROP_CHARACTER_SET 0x00000001L + +/* SQL_DROP_ASSERTION bitmasks */ +#define SQL_DA_DROP_ASSERTION 0x00000001L + +/* SQL_DROP_TABLE bitmasks */ +#define SQL_DT_DROP_TABLE 0x00000001L +#define SQL_DT_RESTRICT 0x00000002L +#define SQL_DT_CASCADE 0x00000004L + +/* SQL_DROP_TRANSLATION bitmasks */ +#define SQL_DTR_DROP_TRANSLATION 0x00000001L + +/* SQL_DROP_VIEW bitmasks */ +#define SQL_DV_DROP_VIEW 0x00000001L +#define SQL_DV_RESTRICT 0x00000002L +#define SQL_DV_CASCADE 0x00000004L + +/* SQL_INSERT_STATEMENT bitmasks */ +#define SQL_IS_INSERT_LITERALS 0x00000001L +#define SQL_IS_INSERT_SEARCHED 0x00000002L +#define SQL_IS_SELECT_INTO 0x00000004L + +/* SQL_ODBC_INTERFACE_CONFORMANCE values */ +#define SQL_OIC_CORE 1UL +#define SQL_OIC_LEVEL1 2UL +#define SQL_OIC_LEVEL2 3UL + +/* SQL_SQL92_FOREIGN_KEY_DELETE_RULE bitmasks */ +#define SQL_SFKD_CASCADE 0x00000001L +#define SQL_SFKD_NO_ACTION 0x00000002L +#define SQL_SFKD_SET_DEFAULT 0x00000004L +#define SQL_SFKD_SET_NULL 0x00000008L + +/* SQL_SQL92_FOREIGN_KEY_UPDATE_RULE bitmasks */ +#define SQL_SFKU_CASCADE 0x00000001L +#define SQL_SFKU_NO_ACTION 0x00000002L +#define SQL_SFKU_SET_DEFAULT 0x00000004L +#define SQL_SFKU_SET_NULL 0x00000008L + +/* SQL_SQL92_GRANT bitmasks */ +#define SQL_SG_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SG_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SG_USAGE_ON_COLLATION 0x00000004L +#define SQL_SG_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SG_WITH_GRANT_OPTION 0x00000010L +#define SQL_SG_DELETE_TABLE 0x00000020L +#define SQL_SG_INSERT_TABLE 0x00000040L +#define SQL_SG_INSERT_COLUMN 0x00000080L +#define SQL_SG_REFERENCES_TABLE 0x00000100L +#define SQL_SG_REFERENCES_COLUMN 0x00000200L +#define SQL_SG_SELECT_TABLE 0x00000400L +#define SQL_SG_UPDATE_TABLE 0x00000800L +#define SQL_SG_UPDATE_COLUMN 0x00001000L + +/* SQL_SQL92_PREDICATES bitmasks */ +#define SQL_SP_EXISTS 0x00000001L +#define SQL_SP_ISNOTNULL 0x00000002L +#define SQL_SP_ISNULL 0x00000004L +#define SQL_SP_MATCH_FULL 0x00000008L +#define SQL_SP_MATCH_PARTIAL 0x00000010L +#define SQL_SP_MATCH_UNIQUE_FULL 0x00000020L +#define SQL_SP_MATCH_UNIQUE_PARTIAL 0x00000040L +#define SQL_SP_OVERLAPS 0x00000080L +#define SQL_SP_UNIQUE 0x00000100L +#define SQL_SP_LIKE 0x00000200L +#define SQL_SP_IN 0x00000400L +#define SQL_SP_BETWEEN 0x00000800L +#define SQL_SP_COMPARISON 0x00001000L +#define SQL_SP_QUANTIFIED_COMPARISON 0x00002000L + +/* SQL_SQL92_RELATIONAL_JOIN_OPERATORS bitmasks */ +#define SQL_SRJO_CORRESPONDING_CLAUSE 0x00000001L +#define SQL_SRJO_CROSS_JOIN 0x00000002L +#define SQL_SRJO_EXCEPT_JOIN 0x00000004L +#define SQL_SRJO_FULL_OUTER_JOIN 0x00000008L +#define SQL_SRJO_INNER_JOIN 0x00000010L +#define SQL_SRJO_INTERSECT_JOIN 0x00000020L +#define SQL_SRJO_LEFT_OUTER_JOIN 0x00000040L +#define SQL_SRJO_NATURAL_JOIN 0x00000080L +#define SQL_SRJO_RIGHT_OUTER_JOIN 0x00000100L +#define SQL_SRJO_UNION_JOIN 0x00000200L + +/* SQL_SQL92_REVOKE bitmasks */ +#define SQL_SR_USAGE_ON_DOMAIN 0x00000001L +#define SQL_SR_USAGE_ON_CHARACTER_SET 0x00000002L +#define SQL_SR_USAGE_ON_COLLATION 0x00000004L +#define SQL_SR_USAGE_ON_TRANSLATION 0x00000008L +#define SQL_SR_GRANT_OPTION_FOR 0x00000010L +#define SQL_SR_CASCADE 0x00000020L +#define SQL_SR_RESTRICT 0x00000040L +#define SQL_SR_DELETE_TABLE 0x00000080L +#define SQL_SR_INSERT_TABLE 0x00000100L +#define SQL_SR_INSERT_COLUMN 0x00000200L +#define SQL_SR_REFERENCES_TABLE 0x00000400L +#define SQL_SR_REFERENCES_COLUMN 0x00000800L +#define SQL_SR_SELECT_TABLE 0x00001000L +#define SQL_SR_UPDATE_TABLE 0x00002000L +#define SQL_SR_UPDATE_COLUMN 0x00004000L + +/* SQL_SQL92_ROW_VALUE_CONSTRUCTOR bitmasks */ +#define SQL_SRVC_VALUE_EXPRESSION 0x00000001L +#define SQL_SRVC_NULL 0x00000002L +#define SQL_SRVC_DEFAULT 0x00000004L +#define SQL_SRVC_ROW_SUBQUERY 0x00000008L + +/* SQL_SQL92_VALUE_EXPRESSIONS bitmasks */ +#define SQL_SVE_CASE 0x00000001L +#define SQL_SVE_CAST 0x00000002L +#define SQL_SVE_COALESCE 0x00000004L +#define SQL_SVE_NULLIF 0x00000008L + +/* SQL_STANDARD_CLI_CONFORMANCE bitmasks */ +#define SQL_SCC_XOPEN_CLI_VERSION1 0x00000001L +#define SQL_SCC_ISO92_CLI 0x00000002L + +/* SQL_UNION_STATEMENT bitmasks */ +#define SQL_US_UNION SQL_U_UNION +#define SQL_US_UNION_ALL SQL_U_UNION_ALL + +#endif /* ODBCVER >= 0x0300 */ + +/* SQL_DTC_TRANSITION_COST bitmasks */ +#define SQL_DTC_ENLIST_EXPENSIVE 0x00000001L +#define SQL_DTC_UNENLIST_EXPENSIVE 0x00000002L + +/* additional SQLDataSources fetch directions */ +#if (ODBCVER >= 0x0300) +#define SQL_FETCH_FIRST_USER 31 +#define SQL_FETCH_FIRST_SYSTEM 32 +#endif /* ODBCVER >= 0x0300 */ + + +/* Defines for SQLSetPos */ +#define SQL_ENTIRE_ROWSET 0 + +/* Operations in SQLSetPos */ +#define SQL_POSITION 0 /* 1.0 FALSE */ +#define SQL_REFRESH 1 /* 1.0 TRUE */ +#define SQL_UPDATE 2 +#define SQL_DELETE 3 + +/* Operations in SQLBulkOperations */ +#define SQL_ADD 4 +#define SQL_SETPOS_MAX_OPTION_VALUE SQL_ADD +#if (ODBCVER >= 0x0300) +#define SQL_UPDATE_BY_BOOKMARK 5 +#define SQL_DELETE_BY_BOOKMARK 6 +#define SQL_FETCH_BY_BOOKMARK 7 + +#endif /* ODBCVER >= 0x0300 */ + +/* Lock options in SQLSetPos */ +#define SQL_LOCK_NO_CHANGE 0 /* 1.0 FALSE */ +#define SQL_LOCK_EXCLUSIVE 1 /* 1.0 TRUE */ +#define SQL_LOCK_UNLOCK 2 + +#define SQL_SETPOS_MAX_LOCK_VALUE SQL_LOCK_UNLOCK + +/* Macros for SQLSetPos */ +#define SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE) +#define SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock) +#define SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock) +#define SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE) +#define SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE) +#define SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE) + +/* Column types and scopes in SQLSpecialColumns. */ +#define SQL_BEST_ROWID 1 +#define SQL_ROWVER 2 + +/* Defines for SQLSpecialColumns (returned in the result set) + SQL_PC_UNKNOWN and SQL_PC_PSEUDO are defined in sql.h */ +#define SQL_PC_NOT_PSEUDO 1 + +/* Defines for SQLStatistics */ +#define SQL_QUICK 0 +#define SQL_ENSURE 1 + +/* Defines for SQLStatistics (returned in the result set) + SQL_INDEX_CLUSTERED, SQL_INDEX_HASHED, and SQL_INDEX_OTHER are + defined in sql.h */ +#define SQL_TABLE_STAT 0 + + +/* Defines for SQLTables */ +#if (ODBCVER >= 0x0300) +#define SQL_ALL_CATALOGS "%" +#define SQL_ALL_SCHEMAS "%" +#define SQL_ALL_TABLE_TYPES "%" +#endif /* ODBCVER >= 0x0300 */ + +/* Options for SQLDriverConnect */ +#define SQL_DRIVER_NOPROMPT 0 +#define SQL_DRIVER_COMPLETE 1 +#define SQL_DRIVER_PROMPT 2 +#define SQL_DRIVER_COMPLETE_REQUIRED 3 + +#ifndef RC_INVOKED + +SQLRETURN SQL_API SQLDriverConnect( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + +#endif /* RC_INVOKED */ + +/* Level 2 Functions */ + +/* SQLExtendedFetch "fFetchType" values */ +#define SQL_FETCH_BOOKMARK 8 + +/* SQLExtendedFetch "rgfRowStatus" element values */ +#define SQL_ROW_SUCCESS 0 +#define SQL_ROW_DELETED 1 +#define SQL_ROW_UPDATED 2 +#define SQL_ROW_NOROW 3 +#define SQL_ROW_ADDED 4 +#define SQL_ROW_ERROR 5 +#if (ODBCVER >= 0x0300) +#define SQL_ROW_SUCCESS_WITH_INFO 6 +#define SQL_ROW_PROCEED 0 +#define SQL_ROW_IGNORE 1 +#endif + +/* value for SQL_DESC_ARRAY_STATUS_PTR */ +#if (ODBCVER >= 0x0300) +#define SQL_PARAM_SUCCESS 0 +#define SQL_PARAM_SUCCESS_WITH_INFO 6 +#define SQL_PARAM_ERROR 5 +#define SQL_PARAM_UNUSED 7 +#define SQL_PARAM_DIAG_UNAVAILABLE 1 + +#define SQL_PARAM_PROCEED 0 +#define SQL_PARAM_IGNORE 1 +#endif /* ODBCVER >= 0x0300 */ + +/* Defines for SQLForeignKeys (UPDATE_RULE and DELETE_RULE) */ +#define SQL_CASCADE 0 +#define SQL_RESTRICT 1 +#define SQL_SET_NULL 2 +#if (ODBCVER >= 0x0250) +#define SQL_NO_ACTION 3 +#define SQL_SET_DEFAULT 4 +#endif /* ODBCVER >= 0x0250 */ + +#if (ODBCVER >= 0x0300) +/* Note that the following are in a different column of SQLForeignKeys than */ +/* the previous #defines. These are for DEFERRABILITY. */ + +#define SQL_INITIALLY_DEFERRED 5 +#define SQL_INITIALLY_IMMEDIATE 6 +#define SQL_NOT_DEFERRABLE 7 + +#endif /* ODBCVER >= 0x0300 */ + +/* Defines for SQLBindParameter and + SQLProcedureColumns (returned in the result set) */ +#define SQL_PARAM_TYPE_UNKNOWN 0 +#define SQL_PARAM_INPUT 1 +#define SQL_PARAM_INPUT_OUTPUT 2 +#define SQL_RESULT_COL 3 +#define SQL_PARAM_OUTPUT 4 +#define SQL_RETURN_VALUE 5 + +/* Defines for SQLProcedures (returned in the result set) */ +#define SQL_PT_UNKNOWN 0 +#define SQL_PT_PROCEDURE 1 +#define SQL_PT_FUNCTION 2 + +#ifndef RC_INVOKED + +/* This define is too large for RC */ +#define SQL_ODBC_KEYWORDS \ +"ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\ +"ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\ +"BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\ +"CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\ +"COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\ +"CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\ +"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\ +"DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\ +"DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\ +"DISTINCT,DOMAIN,DOUBLE,DROP,"\ +"ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\ +"EXISTS,EXTERNAL,EXTRACT,"\ +"FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\ +"GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\ +"IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\ +"INPUT,INSENSITIVE,INSERT,INT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\ +"JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\ +"MATCH,MAX,MIN,MINUTE,MODULE,MONTH,"\ +"NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\ +"OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\ +"PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\ +"PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\ +"READ,REAL,REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS"\ +"SCHEMA,SCROLL,SECOND,SECTION,SELECT,SESSION,SESSION_USER,SET,SIZE,"\ +"SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\ +"SUBSTRING,SUM,SYSTEM_USER,"\ +"TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\ +"TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\ +"UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\ +"VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,"\ +"YEAR,ZONE" + +SQLRETURN SQL_API SQLBrowseConnect( + SQLHDBC hdbc, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLBulkOperations( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +#endif /* ODBCVER >= 0x0300 */ + +SQLRETURN SQL_API SQLColAttributes( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN * pfDesc); + +SQLRETURN SQL_API SQLColumnPrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLDescribeParam( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + +SQLRETURN SQL_API SQLExtendedFetch( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLLEN irow, + SQLULEN *pcrow, + SQLUSMALLINT *rgfRowStatus); + +SQLRETURN SQL_API SQLForeignKeys( + SQLHSTMT hstmt, + SQLCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + +SQLRETURN SQL_API SQLMoreResults( + SQLHSTMT hstmt); + +SQLRETURN SQL_API SQLNativeSql( + SQLHDBC hdbc, + SQLCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + +SQLRETURN SQL_API SQLNumParams( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); + +SQLRETURN SQL_API SQLParamOptions( + SQLHSTMT hstmt, + SQLULEN crow, + SQLULEN *pirow); + +SQLRETURN SQL_API SQLPrimaryKeys( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLProcedureColumns( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLProcedures( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName); + + + +SQLRETURN SQL_API SQLSetPos( + SQLHSTMT hstmt, + SQLSETPOSIROW irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); + +SQLRETURN SQL_API SQLTablePrivileges( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLDrivers( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); + +SQLRETURN SQL_API SQLBindParameter( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN *pcbValue); + + +#endif /* RC_INVOKED */ + +/*---------------------------------------------------------*/ +/* SQLAllocHandleStd is implemented to make SQLAllocHandle */ +/* compatible with X/Open standard. an application should */ +/* not call SQLAllocHandleStd directly */ +/*---------------------------------------------------------*/ +#ifdef ODBC_STD +#define SQLAllocHandle SQLAllocHandleStd +#define SQLAllocEnv(phenv) SQLAllocHandleStd(SQL_HANDLE_ENV, SQL_NULL_HANDLE, phenv) + +/* Internal type subcodes */ +#define SQL_YEAR SQL_CODE_YEAR +#define SQL_MONTH SQL_CODE_MONTH +#define SQL_DAY SQL_CODE_DAY +#define SQL_HOUR SQL_CODE_HOUR +#define SQL_MINUTE SQL_CODE_MINUTE +#define SQL_SECOND SQL_CODE_SECOND +#define SQL_YEAR_TO_MONTH SQL_CODE_YEAR_TO_MONTH +#define SQL_DAY_TO_HOUR SQL_CODE_DAY_TO_HOUR +#define SQL_DAY_TO_MINUTE SQL_CODE_DAY_TO_MINUTE +#define SQL_DAY_TO_SECOND SQL_CODE_DAY_TO_SECOND +#define SQL_HOUR_TO_MINUTE SQL_CODE_HOUR_TO_MINUTE +#define SQL_HOUR_TO_SECOND SQL_CODE_HOUR_TO_SECOND +#define SQL_MINUTE_TO_SECOND SQL_CODE_MINUTE_TO_SECOND +#endif /* ODBC_STD */ + +#if (ODBCVER >= 0x0300) +#ifndef RC_INVOKED +SQLRETURN SQL_API SQLAllocHandleStd( + SQLSMALLINT fHandleType, + SQLHANDLE hInput, + SQLHANDLE *phOutput); +#endif /* RC_INVOKED */ +#endif + +/* Deprecated defines from prior versions of ODBC */ +#define SQL_DATABASE_NAME 16 /* Use SQLGetConnectOption/SQL_CURRENT_QUALIFIER */ +#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR +#define SQL_FETCH_PREV SQL_FETCH_PRIOR +#define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER +#define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER +#define SQL_CC_DELETE SQL_CB_DELETE +#define SQL_CR_DELETE SQL_CB_DELETE +#define SQL_CC_CLOSE SQL_CB_CLOSE +#define SQL_CR_CLOSE SQL_CB_CLOSE +#define SQL_CC_PRESERVE SQL_CB_PRESERVE +#define SQL_CR_PRESERVE SQL_CB_PRESERVE +/* SQL_FETCH_RESUME is not supported by 2.0+ drivers +#define SQL_FETCH_RESUME 7 +*/ +#define SQL_SCROLL_FORWARD_ONLY 0L /*-SQL_CURSOR_FORWARD_ONLY */ +#define SQL_SCROLL_KEYSET_DRIVEN (-1L) /*-SQL_CURSOR_KEYSET_DRIVEN */ +#define SQL_SCROLL_DYNAMIC (-2L) /*-SQL_CURSOR_DYNAMIC */ +#define SQL_SCROLL_STATIC (-3L) /*-SQL_CURSOR_STATIC */ + +/* Deprecated functions from prior versions of ODBC */ +#ifndef RC_INVOKED + +SQLRETURN SQL_API SQLSetScrollOptions( /* Use SQLSetStmtOptions */ + SQLHSTMT hstmt, + SQLUSMALLINT fConcurrency, + SQLLEN crowKeyset, + SQLUSMALLINT crowRowset); + +/* Tracing section */ + +#define TRACE_VERSION 1000 /* Version of trace API */ + +RETCODE SQL_API TraceOpenLogFile(LPWSTR,LPWSTR,DWORD);// open a trace log file +RETCODE SQL_API TraceCloseLogFile(); // Request to close a trace log +VOID SQL_API TraceReturn(RETCODE,RETCODE); // Processes trace after FN is called +DWORD SQL_API TraceVersion(); // Returns trace API version + +/* Functions for Visual Studio Analyzer*/ +/* to turn on/off tracing or VS events, call TraceVSControl by setting or clearing the following bits */ +#define TRACE_ON 0x00000001L +#define TRACE_VS_EVENT_ON 0x00000002L + +RETCODE SQL_API TraceVSControl(DWORD); + +/* Functions for setting the connection pooling failure detection code */ +/* The "TryWait" value is the time (in seconds) that the DM will wait */ +/* between detecting that a connection is dead (using */ +/* SQL_ATTR_CONNECTION_DEAD) and retrying the connection. During that */ +/* interval, connection requests will get "The server appears to be */ +/* dead" error returns. */ + + +BOOL SQL_API ODBCSetTryWaitValue(DWORD dwValue); /* In seconds */ +DWORD SQL_API ODBCGetTryWaitValue(); /* In Milliseconds(!) */ + + +/* the flags in ODBC_VS_ARGS */ +#define ODBC_VS_FLAG_UNICODE_ARG 0x00000001L /* the argument is unicode */ +#define ODBC_VS_FLAG_UNICODE_COR 0x00000002L /* the correlation is unicode */ +#define ODBC_VS_FLAG_RETCODE 0x00000004L /* RetCode field is set */ +#define ODBC_VS_FLAG_STOP 0x00000008L /* Stop firing visual studio analyzer events */ + +typedef struct tagODBC_VS_ARGS { + const GUID *pguidEvent; /* the GUID for event */ + DWORD dwFlags; /* flags for the call */ + union { + WCHAR *wszArg; + CHAR *szArg; + }; + union { + WCHAR *wszCorrelation; + CHAR *szCorrelation; + }; + RETCODE RetCode; +} ODBC_VS_ARGS, *PODBC_VS_ARGS; +VOID SQL_API FireVSDebugEvent(PODBC_VS_ARGS); + +#endif /* RC_INVOKED */ + + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ + +#if defined(WIN32) || defined(_WIN64) +#include "sqlucode.h" +#endif + +#endif /* __SQLEXT */ diff --git a/libraries/SQLAPI/include/odbc_win/sqltypes.h b/libraries/SQLAPI/include/odbc_win/sqltypes.h new file mode 100644 index 000000000..8cc7d1bb5 --- /dev/null +++ b/libraries/SQLAPI/include/odbc_win/sqltypes.h @@ -0,0 +1,305 @@ +//----------------------------------------------------------------------------- +// File: sqltypes.h +// +// Copyright: Copyright (c) Microsoft Corporation +// +// Contents: This file defines the types used in ODBC +// +// Comments: +// +//----------------------------------------------------------------------------- + +#ifndef __SQLTYPES +#define __SQLTYPES + +/* if ODBCVER is not defined, assume version 3.51 */ +#ifndef ODBCVER +#define ODBCVER 0x0351 +#endif /* ODBCVER */ + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +/* environment specific definitions */ +#ifndef EXPORT +#define EXPORT +#endif + +#ifdef WIN32 +#define SQL_API __stdcall +#else +#define SQL_API +#endif + +#ifndef RC_INVOKED + +/* API declaration data types */ +typedef unsigned char SQLCHAR; +#if (ODBCVER >= 0x0300) +typedef signed char SQLSCHAR; +typedef unsigned char SQLDATE; +typedef unsigned char SQLDECIMAL; +typedef double SQLDOUBLE; +typedef double SQLFLOAT; +#endif +typedef long SQLINTEGER; +typedef unsigned long SQLUINTEGER; + +#ifdef _WIN64 +typedef INT64 SQLLEN; +typedef UINT64 SQLULEN; +typedef UINT64 SQLSETPOSIROW; +#else +#define SQLLEN SQLINTEGER +#define SQLULEN SQLUINTEGER +#define SQLSETPOSIROW SQLUSMALLINT +#endif + +//For Backward compatibility +#ifdef WIN32 +typedef SQLULEN SQLROWCOUNT; +typedef SQLULEN SQLROWSETSIZE; +typedef SQLULEN SQLTRANSID; +typedef SQLLEN SQLROWOFFSET; +#endif + +#if (ODBCVER >= 0x0300) +typedef unsigned char SQLNUMERIC; +#endif +typedef void * SQLPOINTER; +#if (ODBCVER >= 0x0300) +typedef float SQLREAL; +#endif +typedef short SQLSMALLINT; +typedef unsigned short SQLUSMALLINT; +#if (ODBCVER >= 0x0300) +typedef unsigned char SQLTIME; +typedef unsigned char SQLTIMESTAMP; +typedef unsigned char SQLVARCHAR; +#endif + +/* function return type */ +typedef SQLSMALLINT SQLRETURN; + +/* generic data structures */ +#if (ODBCVER >= 0x0300) +#if defined(WIN32) || defined(_WIN64) +typedef void* SQLHANDLE; +#else +typedef SQLINTEGER SQLHANDLE; +#endif /* defined(WIN32) || defined(_WIN64) */ +typedef SQLHANDLE SQLHENV; +typedef SQLHANDLE SQLHDBC; +typedef SQLHANDLE SQLHSTMT; +typedef SQLHANDLE SQLHDESC; +#else //ODBCVER < 0x0300 +#if defined(WIN32) || defined(_WIN64) +typedef void* SQLHENV; +typedef void* SQLHDBC; +typedef void* SQLHSTMT; +#else +typedef SQLINTEGER SQLHENV; +typedef SQLINTEGER SQLHDBC; +typedef SQLINTEGER SQLHSTMT; +#endif /* defined(WIN32) || defined(_WIN64) */ +#endif /* ODBCVER >= 0x0300 */ + +/* SQL portable types for C */ +typedef unsigned char UCHAR; +typedef signed char SCHAR; +typedef SCHAR SQLSCHAR; +typedef long int SDWORD; +typedef short int SWORD; +typedef unsigned long int UDWORD; +typedef unsigned short int UWORD; +#ifndef _WIN64 +typedef UDWORD SQLUINTEGER; +#endif + +typedef signed long SLONG; +typedef signed short SSHORT; +typedef unsigned long ULONG; +typedef unsigned short USHORT; +typedef double SDOUBLE; +typedef double LDOUBLE; +typedef float SFLOAT; + +typedef void* PTR; + +typedef void* HENV; +typedef void* HDBC; +typedef void* HSTMT; + +typedef signed short RETCODE; + +#if defined(WIN32) || defined(OS2) +typedef HWND SQLHWND; +#elif defined (UNIX) +typedef Widget SQLHWND; +#else +/* placehold for future O/S GUI window handle definition */ +typedef SQLPOINTER SQLHWND; +#endif + +#ifndef __SQLDATE +#define __SQLDATE +/* transfer types for DATE, TIME, TIMESTAMP */ +typedef struct tagDATE_STRUCT +{ + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; +} DATE_STRUCT; + +#if (ODBCVER >= 0x0300) +typedef DATE_STRUCT SQL_DATE_STRUCT; +#endif /* ODBCVER >= 0x0300 */ + +typedef struct tagTIME_STRUCT +{ + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; +} TIME_STRUCT; + +#if (ODBCVER >= 0x0300) +typedef TIME_STRUCT SQL_TIME_STRUCT; +#endif /* ODBCVER >= 0x0300 */ + +typedef struct tagTIMESTAMP_STRUCT +{ + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + SQLUINTEGER fraction; +} TIMESTAMP_STRUCT; + +#if (ODBCVER >= 0x0300) +typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT; +#endif /* ODBCVER >= 0x0300 */ + + +/* + * enumerations for DATETIME_INTERVAL_SUBCODE values for interval data types + * these values are from SQL-92 + */ + +#if (ODBCVER >= 0x0300) +typedef enum +{ + SQL_IS_YEAR = 1, + SQL_IS_MONTH = 2, + SQL_IS_DAY = 3, + SQL_IS_HOUR = 4, + SQL_IS_MINUTE = 5, + SQL_IS_SECOND = 6, + SQL_IS_YEAR_TO_MONTH = 7, + SQL_IS_DAY_TO_HOUR = 8, + SQL_IS_DAY_TO_MINUTE = 9, + SQL_IS_DAY_TO_SECOND = 10, + SQL_IS_HOUR_TO_MINUTE = 11, + SQL_IS_HOUR_TO_SECOND = 12, + SQL_IS_MINUTE_TO_SECOND = 13 +} SQLINTERVAL; + +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER >= 0x0300) +typedef struct tagSQL_YEAR_MONTH +{ + SQLUINTEGER year; + SQLUINTEGER month; +} SQL_YEAR_MONTH_STRUCT; + +typedef struct tagSQL_DAY_SECOND +{ + SQLUINTEGER day; + SQLUINTEGER hour; + SQLUINTEGER minute; + SQLUINTEGER second; + SQLUINTEGER fraction; +} SQL_DAY_SECOND_STRUCT; + +typedef struct tagSQL_INTERVAL_STRUCT +{ + SQLINTERVAL interval_type; + SQLSMALLINT interval_sign; + union { + SQL_YEAR_MONTH_STRUCT year_month; + SQL_DAY_SECOND_STRUCT day_second; + } intval; + +} SQL_INTERVAL_STRUCT; + +#endif /* ODBCVER >= 0x0300 */ + +#endif /* __SQLDATE */ + +/* the ODBC C types for SQL_C_SBIGINT and SQL_C_UBIGINT */ +#if (ODBCVER >= 0x0300) +#if (_MSC_VER >= 900) +#define ODBCINT64 __int64 +#endif + +/* If using other compilers, define ODBCINT64 to the + approriate 64 bit integer type */ +#ifdef ODBCINT64 +typedef ODBCINT64 SQLBIGINT; +typedef unsigned ODBCINT64 SQLUBIGINT; +#endif +#endif /* ODBCVER >= 0x0300 */ + +/* internal representation of numeric data type */ +#if (ODBCVER >= 0x0300) +#define SQL_MAX_NUMERIC_LEN 16 +typedef struct tagSQL_NUMERIC_STRUCT +{ + SQLCHAR precision; + SQLSCHAR scale; + SQLCHAR sign; /* 1 if positive, 0 if negative */ + SQLCHAR val[SQL_MAX_NUMERIC_LEN]; +} SQL_NUMERIC_STRUCT; +#endif /* ODBCVER >= 0x0300 */ + +#if (ODBCVER >= 0x0350) +#ifdef GUID_DEFINED +typedef GUID SQLGUID; +#else +/* size is 16 */ +typedef struct tagSQLGUID +{ + DWORD Data1; + WORD Data2; + WORD Data3; + BYTE Data4[ 8 ]; +} SQLGUID; +#endif /* GUID_DEFINED */ +#endif /* ODBCVER >= 0x0350 */ + +typedef SQLULEN BOOKMARK; + +#ifdef _WCHAR_T_DEFINED +typedef wchar_t SQLWCHAR; +#else +typedef unsigned short SQLWCHAR; +#endif + +#ifdef UNICODE +typedef SQLWCHAR SQLTCHAR; +#else +typedef SQLCHAR SQLTCHAR; +#endif /* UNICODE */ + + +#endif /* RC_INVOKED */ + + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ + +#endif /* #ifndef __SQLTYPES */ diff --git a/libraries/SQLAPI/include/odbc_win/sqlucode.h b/libraries/SQLAPI/include/odbc_win/sqlucode.h new file mode 100644 index 000000000..360edc974 --- /dev/null +++ b/libraries/SQLAPI/include/odbc_win/sqlucode.h @@ -0,0 +1,817 @@ +//----------------------------------------------------------------------------- +// File: sqlucode.h +// +// Copyright: Copyright (c) Microsoft Corporation +// +// Contents: This is the the unicode include for ODBC Core functions +// +// Comments: +// +//----------------------------------------------------------------------------- + +#ifndef __SQLUCODE +#define __SQLUCODE + + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +#include + +#define SQL_WCHAR (-8) +#define SQL_WVARCHAR (-9) +#define SQL_WLONGVARCHAR (-10) +#define SQL_C_WCHAR SQL_WCHAR + +#ifdef UNICODE +#define SQL_C_TCHAR SQL_C_WCHAR +#else +#define SQL_C_TCHAR SQL_C_CHAR +#endif + +#define SQL_SQLSTATE_SIZEW 10 /* size of SQLSTATE for unicode */ + +#ifndef RC_INVOKED + +// UNICODE versions + +#ifdef _WIN64 +SQLRETURN SQL_API SQLColAttributeW( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLLEN *pNumAttr); +#else +SQLRETURN SQL_API SQLColAttributeW( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLPOINTER pNumAttr); +#endif + +SQLRETURN SQL_API SQLColAttributesW( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); + +SQLRETURN SQL_API SQLConnectW( + SQLHDBC hdbc, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSN, + SQLWCHAR *szUID, + SQLSMALLINT cbUID, + SQLWCHAR *szAuthStr, + SQLSMALLINT cbAuthStr); + + +SQLRETURN SQL_API SQLDescribeColW( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLWCHAR *szColName, + SQLSMALLINT cbColNameMax, + SQLSMALLINT *pcbColName, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbColDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + + +SQLRETURN SQL_API SQLErrorW( + SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + SQLWCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLWCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + +SQLRETURN SQL_API SQLExecDirectW( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API SQLGetConnectAttrW( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetCursorNameW( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT *pcbCursor); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLSetDescFieldW(SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength); + + + +SQLRETURN SQL_API SQLGetDescFieldW( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLSMALLINT iField, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetDescRecW( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLWCHAR *szName, + SQLSMALLINT cbNameMax, + SQLSMALLINT *pcbName, + SQLSMALLINT *pfType, + SQLSMALLINT *pfSubType, + SQLLEN *pLength, + SQLSMALLINT *pPrecision, + SQLSMALLINT *pScale, + SQLSMALLINT *pNullable); + +SQLRETURN SQL_API SQLGetDiagFieldW( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLSMALLINT fDiagField, + SQLPOINTER rgbDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT *pcbDiagInfo); + +SQLRETURN SQL_API SQLGetDiagRecW( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLWCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLWCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + + +#endif + + +SQLRETURN SQL_API SQLPrepareW( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API SQLSetConnectAttrW( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValue); + +SQLRETURN SQL_API SQLSetCursorNameW( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursor); + + + + + + + +SQLRETURN SQL_API SQLColumnsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLGetConnectOptionW( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); + + + +SQLRETURN SQL_API SQLGetInfoW( + SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT *pcbInfoValue); + +SQLRETURN SQL_API SQLGetTypeInfoW( + SQLHSTMT StatementHandle, + SQLSMALLINT DataType); + + +SQLRETURN SQL_API SQLSetConnectOptionW( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLULEN vParam); + + +SQLRETURN SQL_API SQLSpecialColumnsW( + SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); + +SQLRETURN SQL_API SQLStatisticsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + SQLUSMALLINT fAccuracy); + +SQLRETURN SQL_API SQLTablesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szTableType, + SQLSMALLINT cbTableType); + + + +SQLRETURN SQL_API SQLDataSourcesW( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSNMax, + SQLSMALLINT *pcbDSN, + SQLWCHAR *szDescription, + SQLSMALLINT cbDescriptionMax, + SQLSMALLINT *pcbDescription); + + + + +SQLRETURN SQL_API SQLDriverConnectW( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + + +SQLRETURN SQL_API SQLBrowseConnectW( + SQLHDBC hdbc, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +SQLRETURN SQL_API SQLColumnPrivilegesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLGetStmtAttrW( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLSetStmtAttrW( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax); + +SQLRETURN SQL_API SQLForeignKeysW( + SQLHSTMT hstmt, + SQLWCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLWCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLWCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLWCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLWCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLWCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + + +SQLRETURN SQL_API SQLNativeSqlW( + SQLHDBC hdbc, + SQLWCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + + +SQLRETURN SQL_API SQLPrimaryKeysW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLProcedureColumnsW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLProceduresW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName); + + +SQLRETURN SQL_API SQLTablePrivilegesW( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLDriversW( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLWCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLWCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); + + +// ANSI versions +#ifdef _WIN64 +SQLRETURN SQL_API SQLColAttributeA( + SQLHSTMT hstmt, + SQLSMALLINT iCol, + SQLSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLLEN *pNumAttr); +#else +SQLRETURN SQL_API SQLColAttributeA( + SQLHSTMT hstmt, + SQLSMALLINT iCol, + SQLSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLPOINTER pNumAttr); +#endif + +SQLRETURN SQL_API SQLColAttributesA( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLUSMALLINT fDescType, + SQLPOINTER rgbDesc, + SQLSMALLINT cbDescMax, + SQLSMALLINT *pcbDesc, + SQLLEN *pfDesc); + +SQLRETURN SQL_API SQLConnectA( + SQLHDBC hdbc, + SQLCHAR *szDSN, + SQLSMALLINT cbDSN, + SQLCHAR *szUID, + SQLSMALLINT cbUID, + SQLCHAR *szAuthStr, + SQLSMALLINT cbAuthStr); + + +SQLRETURN SQL_API SQLDescribeColA( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLCHAR *szColName, + SQLSMALLINT cbColNameMax, + SQLSMALLINT *pcbColName, + SQLSMALLINT *pfSqlType, + SQLUINTEGER *pcbColDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + + +SQLRETURN SQL_API SQLErrorA( + SQLHENV henv, + SQLHDBC hdbc, + SQLHSTMT hstmt, + SQLCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + +SQLRETURN SQL_API SQLExecDirectA( + SQLHSTMT hstmt, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API SQLGetConnectAttrA( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetCursorNameA( + SQLHSTMT hstmt, + SQLCHAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT *pcbCursor); + +#if (ODBCVER >= 0x0300) +SQLRETURN SQL_API SQLGetDescFieldA( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLSMALLINT iField, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +SQLRETURN SQL_API SQLGetDescRecA( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLCHAR *szName, + SQLSMALLINT cbNameMax, + SQLSMALLINT *pcbName, + SQLSMALLINT *pfType, + SQLSMALLINT *pfSubType, + SQLINTEGER *pLength, + SQLSMALLINT *pPrecision, + SQLSMALLINT *pScale, + SQLSMALLINT *pNullable); + +SQLRETURN SQL_API SQLGetDiagFieldA( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLSMALLINT fDiagField, + SQLPOINTER rgbDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT *pcbDiagInfo); + +SQLRETURN SQL_API SQLGetDiagRecA( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); + + +SQLRETURN SQL_API SQLGetStmtAttrA( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); + +#endif + +SQLRETURN SQL_API SQLGetTypeInfoA( + SQLHSTMT StatementHandle, + SQLSMALLINT DataTyoe); + +SQLRETURN SQL_API SQLPrepareA( + SQLHSTMT hstmt, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStr); + +SQLRETURN SQL_API SQLSetConnectAttrA( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValue); + +SQLRETURN SQL_API SQLSetCursorNameA( + SQLHSTMT hstmt, + SQLCHAR *szCursor, + SQLSMALLINT cbCursor); + + + + + + + +SQLRETURN SQL_API SQLColumnsA( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLGetConnectOptionA( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); + + + +SQLRETURN SQL_API SQLGetInfoA( + SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT* pcbInfoValue); + +SQLRETURN SQL_API SQLGetStmtOptionA( + SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); + +SQLRETURN SQL_API SQLSetConnectOptionA( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLULEN vParam); + +SQLRETURN SQL_API SQLSetStmtOptionA( + SQLHSTMT hstmt, + SQLUSMALLINT fOption, + SQLULEN vParam); + +SQLRETURN SQL_API SQLSpecialColumnsA( + SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); + +SQLRETURN SQL_API SQLStatisticsA( + SQLHSTMT hstmt, + + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + SQLUSMALLINT fAccuracy); + +SQLRETURN SQL_API SQLTablesA( + SQLHSTMT hstmt, + + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szTableType, + + SQLSMALLINT cbTableType); + + + +SQLRETURN SQL_API SQLDataSourcesA( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR *szDSN, + SQLSMALLINT cbDSNMax, + SQLSMALLINT *pcbDSN, + SQLCHAR *szDescription, + SQLSMALLINT cbDescriptionMax, + SQLSMALLINT *pcbDescription); + + + + +SQLRETURN SQL_API SQLDriverConnectA( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); + + +SQLRETURN SQL_API SQLBrowseConnectA( + SQLHDBC hdbc, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); + +SQLRETURN SQL_API SQLColumnPrivilegesA( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLDescribeParamA( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLUINTEGER *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); + + +SQLRETURN SQL_API SQLForeignKeysA( + SQLHSTMT hstmt, + SQLCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); + + +SQLRETURN SQL_API SQLNativeSqlA( + SQLHDBC hdbc, + SQLCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); + + +SQLRETURN SQL_API SQLPrimaryKeysA( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLProcedureColumnsA( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLCHAR *szColumnName, + SQLSMALLINT cbColumnName); + +SQLRETURN SQL_API SQLProceduresA( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szProcName, + SQLSMALLINT cbProcName); + + +SQLRETURN SQL_API SQLTablePrivilegesA( + SQLHSTMT hstmt, + SQLCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLCHAR *szTableName, + SQLSMALLINT cbTableName); + +SQLRETURN SQL_API SQLDriversA( + SQLHENV henv, + SQLUSMALLINT fDirection, + SQLCHAR *szDriverDesc, + SQLSMALLINT cbDriverDescMax, + SQLSMALLINT *pcbDriverDesc, + SQLCHAR *szDriverAttributes, + SQLSMALLINT cbDrvrAttrMax, + SQLSMALLINT *pcbDrvrAttr); + + + + + +//--------------------------------------------- +// Mapping macros for Unicode +//--------------------------------------------- + +#ifndef SQL_NOUNICODEMAP // define this to disable the mapping +#ifdef UNICODE + +#define SQLColAttribute SQLColAttributeW +#define SQLColAttributes SQLColAttributesW +#define SQLConnect SQLConnectW +#define SQLDescribeCol SQLDescribeColW +#define SQLError SQLErrorW +#define SQLExecDirect SQLExecDirectW +#define SQLGetConnectAttr SQLGetConnectAttrW +#define SQLGetCursorName SQLGetCursorNameW +#define SQLGetDescField SQLGetDescFieldW +#define SQLGetDescRec SQLGetDescRecW +#define SQLGetDiagField SQLGetDiagFieldW +#define SQLGetDiagRec SQLGetDiagRecW +#define SQLPrepare SQLPrepareW +#define SQLSetConnectAttr SQLSetConnectAttrW +#define SQLSetCursorName SQLSetCursorNameW +#define SQLSetDescField SQLSetDescFieldW +#define SQLSetStmtAttr SQLSetStmtAttrW +#define SQLGetStmtAttr SQLGetStmtAttrW +#define SQLColumns SQLColumnsW +#define SQLGetConnectOption SQLGetConnectOptionW +#define SQLGetInfo SQLGetInfoW +#define SQLGetTypeInfo SQLGetTypeInfoW +#define SQLSetConnectOption SQLSetConnectOptionW +#define SQLSpecialColumns SQLSpecialColumnsW +#define SQLStatistics SQLStatisticsW +#define SQLTables SQLTablesW +#define SQLDataSources SQLDataSourcesW +#define SQLDriverConnect SQLDriverConnectW +#define SQLBrowseConnect SQLBrowseConnectW +#define SQLColumnPrivileges SQLColumnPrivilegesW +#define SQLForeignKeys SQLForeignKeysW +#define SQLNativeSql SQLNativeSqlW +#define SQLPrimaryKeys SQLPrimaryKeysW +#define SQLProcedureColumns SQLProcedureColumnsW +#define SQLProcedures SQLProceduresW +#define SQLTablePrivileges SQLTablePrivilegesW +#define SQLDrivers SQLDriversW + +#endif /* UNICODE */ +#endif /* SQL_NOUNICODEMAP */ + +#endif /* RC_INVOKED */ + + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ + +#endif /* #ifndef __SQLUCODE */ diff --git a/libraries/SQLAPI/include/ora7API.h b/libraries/SQLAPI/include/ora7API.h new file mode 100644 index 000000000..d9fe9a813 --- /dev/null +++ b/libraries/SQLAPI/include/ora7API.h @@ -0,0 +1,201 @@ +// ora7API.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__ORA7API_H__) +#define __ORA7API_H__ + +#include "SQLAPI.h" + +// API header(s) +#include +#include + +extern long g_nORA7DLLVersionLoaded; + +extern void AddORA7Support(); +extern void ReleaseORA7Support(); + +/* + * Oci BIND (Piecewise or with Skips) + */ +typedef sword (*obindps_t)(struct cda_def *cursor, ub1 opcode, text *sqlvar, + sb4 sqlvl, ub1 *pvctx, sb4 progvl, + sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip, + ub4 maxsiz, ub4 *cursiz, + text *fmt, sb4 fmtl, sword fmtt); +typedef sword (*obreak_t)(struct cda_def *lda); +typedef sword (*ocan_t)(struct cda_def *cursor); +typedef sword (*oclose_t)(struct cda_def *cursor); +typedef sword (*ocof_t)(struct cda_def *lda); +typedef sword (*ocom_t)(struct cda_def *lda); +typedef sword (*ocon_t)(struct cda_def *lda); + + +/* + * Oci DEFINe (Piecewise or with Skips) + */ +typedef sword (*odefinps_t)(struct cda_def *cursor, ub1 opcode, sword pos,ub1 *bufctx, + sb4 bufl, sword ftype, sword scale, + sb2 *indp, text *fmt, sb4 fmtl, sword fmtt, + ub2 *rlen, ub2 *rcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip); +typedef sword (*odessp_t)(struct cda_def *cursor, text *objnam, size_t onlen, + ub1 *rsv1, size_t rsv1ln, ub1 *rsv2, size_t rsv2ln, + ub2 *ovrld, ub2 *pos, ub2 *level, text **argnam, + ub2 *arnlen, ub2 *dtype, ub1 *defsup, ub1* mode, + ub4 *dtsiz, sb2 *prec, sb2 *scale, ub1 *radix, + ub4 *spare, ub4 *arrsiz); +typedef sword (*odescr_t)(struct cda_def *cursor, sword pos, sb4 *dbsize, + sb2 *dbtype, sb1 *cbuf, sb4 *cbufl, sb4 *dsize, + sb2 *prec, sb2 *scale, sb2 *nullok); +typedef sword (*oerhms_t)(struct cda_def *lda, sb2 rcode, text *buf, + sword bufsiz); +typedef sword (*oermsg_t)(sb2 rcode, text *buf); +typedef sword (*oexec_t)(struct cda_def *cursor); +typedef sword (*oexfet_t)(struct cda_def *cursor, ub4 nrows, + sword cancel, sword exact); +typedef sword (*oexn_t)(struct cda_def *cursor, sword iters, sword rowoff); +typedef sword (*ofen_t)(struct cda_def *cursor, sword nrows); +typedef sword (*ofetch_t)(struct cda_def *cursor); +typedef sword (*oflng_t)(struct cda_def *cursor, sword pos, ub1 *buf, + sb4 bufl, sword dtype, ub4 *retl, sb4 offset); +typedef sword (*ogetpi_t) (struct cda_def *cursor, ub1 *piecep, dvoid **ctxpp, + ub4 *iterp, ub4 *indexp); +typedef sword (*oopt_t) (struct cda_def *cursor, sword rbopt, sword waitopt); +typedef sword (*opinit_t) (ub4 mode); +typedef sword (*olog_t) (struct cda_def *lda, ub1* hda, + text *uid, sword uidl, + text *pswd, sword pswdl, + text *conn, sword connl, + ub4 mode); +typedef sword (*ologof_t) (struct cda_def *lda); +typedef sword (*oopen_t) (struct cda_def *cursor, struct cda_def *lda, + text *dbn, sword dbnl, sword arsize, + text *uid, sword uidl); +typedef sword (*oparse_t) (struct cda_def *cursor, text *sqlstm, sb4 sqllen, + sword defflg, ub4 lngflg); +typedef sword (*orol_t) (struct cda_def *lda); +typedef sword (*osetpi_t) (struct cda_def *cursor, ub1 piece, dvoid *bufp, ub4 *lenp); + +typedef void (*sqlld2_t) (struct cda_def *lda, text *cname, sb4 *cnlen); +typedef void (*sqllda_t) (struct cda_def *lda); + +/* non-blocking functions */ +typedef sword (*onbset_t) (struct cda_def *lda ); +typedef sword (*onbtst_t) (struct cda_def *lda ); +typedef sword (*onbclr_t) (struct cda_def *lda ); +typedef sword (*ognfd_t) (struct cda_def *lda, dvoid *fdp); + +/* + * OBSOLETE CALLS + */ + +/* + * OBSOLETE BIND CALLS + */ +typedef sword (*obndra_t)(struct cda_def *cursor, text *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, ub4 maxsiz, + ub4 *cursiz, text *fmt, sword fmtl, sword fmtt); +typedef sword (*obndrn_t)(struct cda_def *cursor, sword sqlvn, ub1 *progv, + sword progvl, sword ftype, sword scale, sb2 *indp, + text *fmt, sword fmtl, sword fmtt); +typedef sword (*obndrv_t)(struct cda_def *cursor, text *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, text *fmt, sword fmtl, sword fmtt); + +/* + * OBSOLETE DEFINE CALLS + */ +typedef sword (*odefin_t)(struct cda_def *cursor, sword pos, ub1 *buf, + sword bufl, sword ftype, sword scale, sb2 *indp, + text *fmt, sword fmtl, sword fmtt, ub2 *rlen, ub2 *rcode); + +/* older calls ; preferred equivalent calls above */ + +typedef sword (*oname_t) (struct cda_def *cursor, sword pos, sb1 *tbuf, + sb2 *tbufl, sb1 *buf, sb2 *bufl); +typedef sword (*orlon_t) (struct cda_def *lda, ub1 *hda, + text *uid, sword uidl, + text *pswd, sword pswdl, + sword audit); +typedef sword (*olon_t) (struct cda_def *lda, text *uid, sword uidl, + text *pswd, sword pswdl, sword audit); +typedef sword (*osql3_t) (struct cda_def *cda, text *sqlstm, sword sqllen); +typedef sword (*odsc_t) (struct cda_def *cursor, sword pos, sb2 *dbsize, + sb2 *fsize, sb2 *rcode, sb2 *dtype, sb1 *buf, + sb2 *bufl, sb2 *dsize); + +// API declarations +class SQLAPI_API ora7API : public saAPI +{ +public: + ora7API(); + + obindps_t obindps; + obreak_t obreak; + ocan_t ocan; + oclose_t oclose; + ocof_t ocof; + ocom_t ocom; + ocon_t ocon; + odefinps_t odefinps; + odessp_t odessp; + odescr_t odescr; + oerhms_t oerhms; + oermsg_t oermsg; + oexec_t oexec; + oexfet_t oexfet; + oexn_t oexn; + ofen_t ofen; + ofetch_t ofetch; + oflng_t oflng; + ogetpi_t ogetpi; + oopt_t oopt; + opinit_t opinit; + olog_t olog; + ologof_t ologof; + oopen_t oopen; + oparse_t oparse; + orol_t orol; + osetpi_t osetpi; + sqlld2_t sqlld2; + sqllda_t sqllda; + onbset_t onbset; + onbtst_t onbtst; + onbclr_t onbclr; + ognfd_t ognfd; + obndra_t obndra; + obndrn_t obndrn; + obndrv_t obndrv; + odefin_t odefin; + oname_t oname; + orlon_t orlon; + olon_t olon; + osql3_t osql3; + odsc_t odsc; +}; + +class SQLAPI_API ora7ConnectionHandles : public saConnectionHandles +{ +public: + ora7ConnectionHandles(); + + Lda_Def m_lda; + ub1 m_hda[512]; +}; + +class SQLAPI_API ora7CommandHandles : public saCommandHandles +{ +public: + ora7CommandHandles(); + + Cda_Def m_cda; +}; + +extern ora7API g_ora7API; + +#endif // !defined(__ORA7API_H__) diff --git a/libraries/SQLAPI/include/oraAPI.h b/libraries/SQLAPI/include/oraAPI.h new file mode 100644 index 000000000..d27c86686 --- /dev/null +++ b/libraries/SQLAPI/include/oraAPI.h @@ -0,0 +1,532 @@ +// ora8API.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__ORA8API_H__) +#define __ORA8API_H__ + +#include "SQLAPI.h" + +// API header(s) +#include + +extern long g_nORA8DLLVersionLoaded; + +extern void AddORA8Support(const SAConnection * pCon); +extern void ReleaseORA8Support(); + +// 8.0.x calls +typedef sword (*OCIInitialize_t)(ub4 mode, dvoid *ctxp, + dvoid *(*malocfp)(dvoid *ctxp, size_t size), + dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t newsize), + void (*mfreefp)(dvoid *ctxp, dvoid *memptr) ); + +typedef sword (*OCIHandleAlloc_t)(CONST dvoid *parenth, dvoid **hndlpp, CONST ub4 type, + CONST size_t xtramem_sz, dvoid **usrmempp); + +typedef sword (*OCIHandleFree_t)(dvoid *hndlp, CONST ub4 type); + + +typedef sword (*OCIDescriptorAlloc_t)(CONST dvoid *parenth, dvoid **descpp, CONST ub4 type, + CONST size_t xtramem_sz, dvoid **usrmempp); + +typedef sword (*OCIDescriptorFree_t)(dvoid *descp, CONST ub4 type); + +typedef sword (*OCIEnvInit_t)(OCIEnv **envp, ub4 mode, + size_t xtramem_sz, dvoid **usrmempp); + +typedef sword (*OCIServerAttach_t)(OCIServer *srvhp, OCIError *errhp, + CONST text *dblink, sb4 dblink_len, ub4 mode); + +typedef sword (*OCIServerDetach_t)(OCIServer *srvhp, OCIError *errhp, ub4 mode); + +typedef sword (*OCISessionBegin_t)(OCISvcCtx *svchp, OCIError *errhp, OCISession *usrhp, + ub4 credt, ub4 mode); + +typedef sword (*OCISessionEnd_t)(OCISvcCtx *svchp, OCIError *errhp, OCISession *usrhp, + ub4 mode); + +typedef sword (*OCILogon_t)(OCIEnv *envhp, OCIError *errhp, OCISvcCtx **svchp, + CONST text *username, ub4 uname_len, + CONST text *password, ub4 passwd_len, + CONST text *dbname, ub4 dbname_len); + +typedef sword (*OCILogoff_t)(OCISvcCtx *svchp, OCIError *errhp); + + +typedef sword (*OCIPasswordChange_t)(OCISvcCtx *svchp, OCIError *errhp, + CONST text *user_name, ub4 usernm_len, + CONST text *opasswd, ub4 opasswd_len, + CONST text *npasswd, ub4 npasswd_len, ub4 mode); + +typedef sword (*OCIStmtPrepare_t)(OCIStmt *stmtp, OCIError *errhp, CONST text *stmt, + ub4 stmt_len, ub4 language, ub4 mode); + +typedef sword (*OCIBindByPos_t)(OCIStmt *stmtp, OCIBind **bindp, OCIError *errhp, + ub4 position, dvoid *valuep, sb4 value_sz, + ub2 dty, dvoid *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + +typedef sword (*OCIBindByName_t)(OCIStmt *stmtp, OCIBind **bindp, OCIError *errhp, + CONST text *placeholder, sb4 placeh_len, + dvoid *valuep, sb4 value_sz, ub2 dty, + dvoid *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + +typedef sword (*OCIBindObject_t)(OCIBind *bindp, OCIError *errhp, CONST OCIType *type, + dvoid **pgvpp, ub4 *pvszsp, dvoid **indpp, + ub4 *indszp); + +typedef sword (*OCIBindDynamic_t)(OCIBind *bindp, OCIError *errhp, dvoid *ictxp, + OCICallbackInBind icbfp, dvoid *octxp, + OCICallbackOutBind ocbfp); + +typedef sword (*OCIBindArrayOfStruct_t)(OCIBind *bindp, OCIError *errhp, + ub4 pvskip, ub4 indskip, + ub4 alskip, ub4 rcskip); + +typedef sword (*OCIStmtGetPieceInfo_t)(OCIStmt *stmtp, OCIError *errhp, + dvoid **hndlpp, ub4 *typep, + ub1 *in_outp, ub4 *iterp, ub4 *idxp, + ub1 *piecep); + +typedef sword (*OCIStmtSetPieceInfo_t)(dvoid *hndlp, ub4 type, OCIError *errhp, + CONST dvoid *bufp, ub4 *alenp, ub1 piece, + CONST dvoid *indp, ub2 *rcodep); + +typedef sword (*OCIStmtExecute_t)(OCISvcCtx *svchp, OCIStmt *stmtp, OCIError *errhp, + ub4 iters, ub4 rowoff, CONST OCISnapshot *snap_in, + OCISnapshot *snap_out, ub4 mode); + +typedef sword (*OCIDefineByPos_t)(OCIStmt *stmtp, OCIDefine **defnp, OCIError *errhp, + ub4 position, dvoid *valuep, sb4 value_sz, ub2 dty, + dvoid *indp, ub2 *rlenp, ub2 *rcodep, ub4 mode); + +typedef sword (*OCIDefineObject_t)(OCIDefine *defnp, OCIError *errhp, + CONST OCIType *type, dvoid **pgvpp, + ub4 *pvszsp, dvoid **indpp, ub4 *indszp); + +typedef sword (*OCIDefineDynamic_t)(OCIDefine *defnp, OCIError *errhp, dvoid *octxp, + OCICallbackDefine ocbfp); + +typedef sword (*OCIDefineArrayOfStruct_t)(OCIDefine *defnp, OCIError *errhp, ub4 pvskip, + ub4 indskip, ub4 rlskip, ub4 rcskip); + +typedef sword (*OCIStmtFetch_t)(OCIStmt *stmtp, OCIError *errhp, ub4 nrows, + ub2 orientation, ub4 mode); + +typedef sword (*OCIStmtGetBindInfo_t)(OCIStmt *stmtp, OCIError *errhp, ub4 size, + ub4 startloc, + sb4 *found, text *bvnp[], ub1 bvnl[], + text *invp[], ub1 inpl[], ub1 dupl[], + OCIBind *hndl[]); + +typedef sword (*OCIDescribeAny_t)(OCISvcCtx *svchp, OCIError *errhp, + dvoid *objptr, + ub4 objnm_len, ub1 objptr_typ, ub1 info_level, + ub1 objtyp, OCIDescribe *dschp); + +typedef sword (*OCIParamGet_t)(CONST dvoid *hndlp, ub4 htype, OCIError *errhp, + dvoid **parmdpp, ub4 pos); + +typedef sword (*OCIParamSet_t)(dvoid *hdlp, ub4 htyp, OCIError *errhp, CONST dvoid *dscp, + ub4 dtyp, ub4 pos); + +typedef sword (*OCITransStart_t)(OCISvcCtx *svchp, OCIError *errhp, + uword timeout, ub4 flags ); + +typedef sword (*OCITransDetach_t)(OCISvcCtx *svchp, OCIError *errhp, ub4 flags ); + +typedef sword (*OCITransCommit_t)(OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +typedef sword (*OCITransRollback_t)(OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +typedef sword (*OCITransPrepare_t)(OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +typedef sword (*OCITransForget_t)(OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +typedef sword (*OCIErrorGet_t)(dvoid *hndlp, ub4 recordno, text *sqlstate, + sb4 *errcodep, text *bufp, ub4 bufsiz, ub4 type); + +typedef sword (*OCILobAppend_t)(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp); + +typedef sword (*OCILobAssign_t)(OCIEnv *envhp, OCIError *errhp, + CONST OCILobLocator *src_locp, + OCILobLocator **dst_locpp); + +typedef sword (*OCILobCharSetForm_t)(OCIEnv *envhp, OCIError *errhp, + CONST OCILobLocator *locp, ub1 *csfrm); + +typedef sword (*OCILobCharSetId_t)(OCIEnv *envhp, OCIError *errhp, + CONST OCILobLocator *locp, ub2 *csid); + +typedef sword (*OCILobCopy_t)(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *dst_locp, + OCILobLocator *src_locp, ub4 amount, ub4 dst_offset, + ub4 src_offset); + +typedef sword (*OCILobDisableBuffering_t)(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +typedef sword (*OCILobEnableBuffering_t)(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +typedef sword (*OCILobErase_t)(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amount, ub4 offset); + +typedef sword (*OCILobFileClose_t)(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep); + +typedef sword (*OCILobFileCloseAll_t)(OCISvcCtx *svchp, OCIError *errhp); + +typedef sword (*OCILobFileExists_t)(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + boolean *flag); + +typedef sword (*OCILobFileGetName_t)(OCIEnv *envhp, OCIError *errhp, + CONST OCILobLocator *filep, + text *dir_alias, ub2 *d_length, + text *filename, ub2 *f_length); + +typedef sword (*OCILobFileIsOpen_t)(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + boolean *flag); + +typedef sword (*OCILobFileOpen_t)(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + ub1 mode); + +typedef sword (*OCILobFileSetName_t)(OCIEnv *envhp, OCIError *errhp, + OCILobLocator **filepp, + CONST text *dir_alias, ub2 d_length, + CONST text *filename, ub2 f_length); + +typedef sword (*OCILobFlushBuffer_t)(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 flag); + +typedef sword (*OCILobGetLength_t)(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *locp, + ub4 *lenp); + +typedef sword (*OCILobIsEqual_t)(OCIEnv *envhp, CONST OCILobLocator *x, + CONST OCILobLocator *y, + boolean *is_equal); + +typedef sword (*OCILobLoadFromFile_t)(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_filep, + ub4 amount, ub4 dst_offset, + ub4 src_offset); + +typedef sword (*OCILobLocatorIsInit_t)(OCIEnv *envhp, OCIError *errhp, + CONST OCILobLocator *locp, + boolean *is_initialized); + +typedef sword (*OCILobRead_t)(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amtp, ub4 offset, dvoid *bufp, ub4 bufl, + dvoid *ctxp, sb4 (*cbfp)(dvoid *ctxp, + CONST dvoid *bufp, + ub4 len, + ub1 piece), + ub2 csid, ub1 csfrm); + +typedef sword (*OCILobRead2_t)(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *byte_amtp, oraub8 *char_amtp, oraub8 offset, dvoid *bufp, oraub8 bufl, + ub1 piece, dvoid *ctxp, sb4 (*cbfp)(dvoid *ctxp, + CONST dvoid *bufp, + oraub8 len, ub1 piecep, + dvoid **changed_bufpp,oraub8 *changed_lenp), + ub2 csid, ub1 csfrm); + +typedef sword (*OCILobTrim_t)(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 newlen); + +typedef sword (*OCILobWrite_t)(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amtp, ub4 offset, dvoid *bufp, ub4 buflen, + ub1 piece, dvoid *ctxp, + sb4 (*cbfp)(dvoid *ctxp, + dvoid *bufp, + ub4 *len, + ub1 *piece), + ub2 csid, ub1 csfrm); + +typedef sword (*OCILobWrite2_t)(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *byte_amtp, oraub8 *char_amtp, oraub8 offset, + void *bufp, oraub8 buflen, ub1 piece, void *ctxp, + OCICallbackLobWrite2 cbfp, ub2 csid, ub1 csfrm); + +typedef sword (*OCIBreak_t)(dvoid *hndlp, OCIError *errhp); + +typedef sword (*OCIReset_t)(dvoid *hndlp, OCIError *errhp); + +typedef sword (*OCIServerVersion_t)(dvoid *hndlp, OCIError *errhp, text *bufp, + ub4 bufsz, + ub1 hndltype); + + +typedef sword (*OCIAttrGet_t)(CONST dvoid *trgthndlp, ub4 trghndltyp, + dvoid *attributep, ub4 *sizep, ub4 attrtype, + OCIError *errhp); + +typedef sword (*OCIAttrSet_t)(dvoid *trgthndlp, ub4 trghndltyp, dvoid *attributep, + ub4 size, ub4 attrtype, OCIError *errhp); + +typedef sword (*OCISvcCtxToLda_t)(OCISvcCtx *svchp, OCIError *errhp, Lda_Def *ldap); + +typedef sword (*OCILdaToSvcCtx_t)(OCISvcCtx **svchpp, OCIError *errhp, Lda_Def *ldap); + +typedef sword (*OCIResultSetToStmt_t)(OCIResult *rsetdp, OCIError *errhp); + + +// 8.1.x (8i) calls +typedef sword (*OCIEnvCreate_t)(OCIEnv **envp, ub4 mode, dvoid *ctxp, + dvoid *(*malocfp)(dvoid *ctxp, size_t size), + dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t newsize), + void (*mfreefp)(dvoid *ctxp, dvoid *memptr), + size_t xtramem_sz, dvoid **usrmempp); + +typedef sword (*OCIEnvNlsCreate_t)(OCIEnv **envhpp, ub4 mode, dvoid *ctxp, + dvoid *(*malocfp)(dvoid *ctxp, size_t size), + dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t newsize), + void (*mfreefp)(dvoid *ctxp, dvoid *memptr), + size_t xtramemsz, dvoid **usrmempp, + ub2 charset, ub2 ncharset); + +typedef sword (*OCIDurationBegin_t)( OCIEnv *env, OCIError *err, CONST OCISvcCtx *svc, + OCIDuration parent, OCIDuration *dur ); + +typedef sword (*OCIDurationEnd_t)( OCIEnv *env, OCIError *err, CONST OCISvcCtx *svc, + OCIDuration duration ); + +typedef sword (*OCILobCreateTemporary_t)(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub2 csid, + ub1 csfrm, + ub1 lobtype, + boolean cache, + OCIDuration duration); + +typedef sword (*OCILobFreeTemporary_t)(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +typedef sword (*OCILobIsTemporary_t)(OCIEnv *envp, + OCIError *errhp, + OCILobLocator *locp, + boolean *is_temporary); + +typedef sword (*OCIAQEnq_t)(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQEnqOptions *enqopt, OCIAQMsgProperties *msgprop, + OCIType *payload_tdo, dvoid **payload, dvoid **payload_ind, + OCIRaw **msgid, ub4 flags); + +typedef sword (*OCIAQDeq_t)(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQDeqOptions *deqopt, OCIAQMsgProperties *msgprop, + OCIType *payload_tdo, dvoid **payload, dvoid **payload_ind, + OCIRaw **msgid, ub4 flags); + +typedef sword (*OCIAQListen_t)(OCISvcCtx *svchp, OCIError *errhp, + OCIAQAgent **agent_list, ub4 num_agents, + sb4 wait, OCIAQAgent **agent, + ub4 flags); + +typedef sword (*OCIStmtFetch2_t)(OCIStmt *stmtp, OCIError *errhp, ub4 nrows, + ub2 orientation, sb4 scrollOffset, ub4 mode ); + +//--------------- Begin OCI Client Notification Interfaces ------------------ + +typedef sword (*OCISubscriptionRegister_t)(OCISvcCtx *svchp, OCISubscription **subscrhpp, + ub2 count, OCIError *errhp, ub4 mode); + +typedef sword (*OCISubscriptionPost_t)(OCISvcCtx *svchp, OCISubscription **subscrhpp, + ub2 count, OCIError *errhp, ub4 mode); + +typedef sword (*OCISubscriptionUnRegister_t)(OCISvcCtx *svchp, OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +typedef sword (*OCISubscriptionDisable_t)(OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +typedef sword (*OCISubscriptionEnable_t)(OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +//------------------- End OCI Publish/Subscribe Interfaces ------------------ + + +typedef sword (*OCIDateTimeConstruct_t)( dvoid *hndl, + OCIError *err, OCIDateTime *datetime, + sb2 year, ub1 month, ub1 day, + ub1 hour, ub1 min, ub1 sec, ub4 fsec, + OraText *timezone, size_t timezone_length); + +typedef sword (*OCIDateTimeGetDate_t)(dvoid *hndl, + OCIError *err, CONST OCIDateTime *datetime, + sb2 *year, ub1 *month, ub1 *day); + +typedef sword (*OCIDateTimeGetTime_t)(dvoid *hndl, + OCIError *err, OCIDateTime *datetime, + ub1 *hour, ub1 *min, ub1 *sec, ub4 *fsec); + + +typedef sword (*OCIDateTimeGetTimeZoneOffset_t)(void *hndl, OCIError *err, + const OCIDateTime *datetime, + sb1 *hr, sb1 *mm); + +typedef sword (*OCINlsNumericInfoGet_t)(dvoid *envhp, OCIError *errhp, sb4 *val, ub2 item); + +// API declarations +class SQLAPI_API ora8API : public saAPI +{ +public: + ora8API(); + + // 8.0.x calls + OCIInitialize_t OCIInitialize; + OCIHandleAlloc_t OCIHandleAlloc; + OCIHandleFree_t OCIHandleFree; + OCIDescriptorAlloc_t OCIDescriptorAlloc; + OCIDescriptorFree_t OCIDescriptorFree; + OCIEnvInit_t OCIEnvInit; + OCIServerAttach_t OCIServerAttach; + OCIServerDetach_t OCIServerDetach; + OCISessionBegin_t OCISessionBegin; + OCISessionEnd_t OCISessionEnd; + OCILogon_t OCILogon; + OCILogoff_t OCILogoff; + OCIPasswordChange_t OCIPasswordChange; + OCIStmtPrepare_t OCIStmtPrepare; + OCIBindByPos_t OCIBindByPos; + OCIBindByName_t OCIBindByName; + OCIBindObject_t OCIBindObject; + OCIBindDynamic_t OCIBindDynamic; + OCIBindArrayOfStruct_t OCIBindArrayOfStruct; + OCIStmtGetPieceInfo_t OCIStmtGetPieceInfo; + OCIStmtSetPieceInfo_t OCIStmtSetPieceInfo; + OCIStmtExecute_t OCIStmtExecute; + OCIDefineByPos_t OCIDefineByPos; + OCIDefineObject_t OCIDefineObject; + OCIDefineDynamic_t OCIDefineDynamic; + OCIDefineArrayOfStruct_t OCIDefineArrayOfStruct; + OCIStmtFetch_t OCIStmtFetch; + OCIStmtGetBindInfo_t OCIStmtGetBindInfo; + OCIDescribeAny_t OCIDescribeAny; + OCIParamGet_t OCIParamGet; + OCIParamSet_t OCIParamSet; + OCITransStart_t OCITransStart; + OCITransDetach_t OCITransDetach; + OCITransCommit_t OCITransCommit; + OCITransRollback_t OCITransRollback; + OCITransPrepare_t OCITransPrepare; + OCITransForget_t OCITransForget; + OCIErrorGet_t OCIErrorGet; + OCILobAppend_t OCILobAppend; + OCILobAssign_t OCILobAssign; + OCILobCharSetForm_t OCILobCharSetForm; + OCILobCharSetId_t OCILobCharSetId; + OCILobCopy_t OCILobCopy; + OCILobDisableBuffering_t OCILobDisableBuffering; + OCILobEnableBuffering_t OCILobEnableBuffering; + OCILobErase_t OCILobErase; + OCILobFileClose_t OCILobFileClose; + OCILobFileCloseAll_t OCILobFileCloseAll; + OCILobFileExists_t OCILobFileExists; + OCILobFileGetName_t OCILobFileGetName; + OCILobFileIsOpen_t OCILobFileIsOpen; + OCILobFileOpen_t OCILobFileOpen; + OCILobFileSetName_t OCILobFileSetName; + OCILobFlushBuffer_t OCILobFlushBuffer; + OCILobGetLength_t OCILobGetLength; + OCILobIsEqual_t OCILobIsEqual; + OCILobLoadFromFile_t OCILobLoadFromFile; + OCILobLocatorIsInit_t OCILobLocatorIsInit; + OCILobRead_t OCILobRead; + OCILobRead2_t OCILobRead2; + OCILobTrim_t OCILobTrim; + OCILobWrite_t OCILobWrite; + OCILobWrite2_t OCILobWrite2; + OCIBreak_t OCIBreak; + OCIReset_t OCIReset; + OCIServerVersion_t OCIServerVersion; + OCIAttrGet_t OCIAttrGet; + OCIAttrSet_t OCIAttrSet; + OCISvcCtxToLda_t OCISvcCtxToLda; + OCILdaToSvcCtx_t OCILdaToSvcCtx; + OCIResultSetToStmt_t OCIResultSetToStmt; + + // 8.1.x (8i) calls + OCIEnvCreate_t OCIEnvCreate; + OCIEnvNlsCreate_t OCIEnvNlsCreate; + OCIDurationBegin_t OCIDurationBegin; + OCIDurationEnd_t OCIDurationEnd; + OCILobCreateTemporary_t OCILobCreateTemporary; + OCILobFreeTemporary_t OCILobFreeTemporary; + OCILobIsTemporary_t OCILobIsTemporary; + + OCIAQEnq_t OCIAQEnq; + OCIAQDeq_t OCIAQDeq; + OCIAQListen_t OCIAQListen; + OCISubscriptionRegister_t OCISubscriptionRegister; + OCISubscriptionPost_t OCISubscriptionPost; + OCISubscriptionUnRegister_t OCISubscriptionUnRegister; + OCISubscriptionDisable_t OCISubscriptionDisable; + OCISubscriptionEnable_t OCISubscriptionEnable; + + OCIDateTimeConstruct_t OCIDateTimeConstruct; + OCIDateTimeGetDate_t OCIDateTimeGetDate; + OCIDateTimeGetTime_t OCIDateTimeGetTime; + OCIDateTimeGetTimeZoneOffset_t OCIDateTimeGetTimeZoneOffset; + + OCINlsNumericInfoGet_t OCINlsNumericInfoGet; + + OCIStmtFetch2_t OCIStmtFetch2; +}; + +class SQLAPI_API ora8ConnectionHandles : public saConnectionHandles +{ +public: + ora8ConnectionHandles(); + + OCIEnv *m_pOCIEnv; + OCIError *m_pOCIError; + OCISvcCtx *m_pOCISvcCtx; + OCIServer *m_pOCIServer; + OCISession *m_pOCISession; +}; + +class SQLAPI_API ora8CommandHandles : public saCommandHandles +{ +public: + ora8CommandHandles(); + + OCIStmt *m_pOCIStmt; + OCIError *m_pOCIError; // cursor owned error handle +}; + +class SQLAPI_API ora8ExternalConnection +{ + bool m_bAttached; + SAConnection *m_pCon; + +public: + OCIEnv *m_pOCIEnv; + OCISvcCtx *m_pOCISvcCtx; + +public: + ora8ExternalConnection( + SAConnection *pCon, + OCIEnv *pOCIEnv, + OCISvcCtx *pOCISvcCtx); + void Attach(); + void Detach(); + ~ora8ExternalConnection(); +}; + +extern ora8API g_ora8API; + +#endif // !defined(__ORA8API_H__) diff --git a/libraries/SQLAPI/include/ora_win/nzerror.h b/libraries/SQLAPI/include/ora_win/nzerror.h new file mode 100644 index 000000000..08cc707fb --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/nzerror.h @@ -0,0 +1,674 @@ +/* DISABLE check_long_lines */ + +/* + * $Header: security_src/public/nzerror.h /st_ldap_db11.2/1 2009/07/15 13:57:04 rchahal Exp $ + * + * Copyright (c) 1995, 2009, Oracle and/or its affiliates. + * All rights reserved. + */ + +/* ENABLE check_long_lines */ +/* + NAME + nzerror.h - error numbers for the Oracle Security Server + DESCRIPTION + None. + PUBLIC FUNCTION(S) + None. + PRIVATE FUNCTION(S) + None. + NOTES + A pragma is used to silence olint about the enum value names not being + unique within 7 characters. This limit is being changed to 30. + MODIFIED + rchahal 06/12/06 - + skalyana 01/30/05 - + rchahal 07/16/04 - add cert label + rchahal 07/06/04 - + rchahal 10/15/03 - bug 2513821 + rchahal 08/14/03 - new error range (43000 - 43499) + skalyana 08/25/03 - Error changes + rchahal 06/27/03 - RSA errors + rchahal 05/27/03 - convert wallet + skalyana 03/07/03 - Move FIPS errors + rchahal 02/28/03 - bug 2648177 + rchahal 01/20/03 - use sltsky + rchahal 11/11/02 - pkcs11 support + skalyana 11/29/02 - Add mutex errors + akoyfman 11/01/02 - adding crl cache + rchahal 10/23/02 - crldp error + rchahal 10/15/02 - fetch crl from ldap + rchahal 10/07/02 - crl support + akoyfman 10/16/02 - Update with SSL PLus 4.2 errors + skalyana 10/04/02 - Certicom SSL Plus 4.2 Upgrade changes + akoyfman 08/06/02 - adding sso wallet errors + akoyfman 07/12/02 - adding secret store errors + skalyana 07/07/02 - Add more errors for FIPS self tests + skalyana 07/01/02 - Add more errors + skalyana 06/03/02 - Add NZ error for self test failure. + ajacobs 02/22/01 - Add some entrust errors + vle 02/09/01 - add error mesg + lkethana 08/11/00 - Extension Errors + lkethana 07/30/00 - add pkcs12 errors + lkethana 06/17/00 - mult cert errors + lkethana 06/11/00 - multiple cert support + rturlapa 03/29/00 - Add error meesage for Entrust Login failure. + rwessman 07/07/99 - Deleted include of sslerrs.h. It caused the RDBMS bu + rwessman 07/02/99 - fixed merge errors + rwessman 07/01/99 - moved NZOS errors to nzerror to make them visible + supriya 12/16/98 - add new error for cert chain. + arswamin 12/04/98 - add NZERROR_NO_MATCHING_PRIVATE_KEY + qdinh 11/12/98 - add NZERROR_VALIDITY_EXPIRED. + arswamin 06/17/98 - add INIT_FAILED + sdange 06/10/98 - change wrong password to bad password + amthakur 06/09/98 - adding error messages + wliau 03/10/97 - Add new error message for snzdfo.c. + rwessman 03/14/97 - Consolidated PL/SQL toolkit errors into generic erro + rwessman 02/26/97 - Added NZERROR_UNSUPPORTED. Corrected values of + errors outside the valid range. + asriniva 03/02/97 - Fix olint warning + rwessman 02/26/97 - Added NZERROR_UNSUPPORTED + rwessman 01/02/97 - Changed PLSQL package errors to be TK_PLSQL to + separate them from the errors generated by the + Oracle interface. + rwessman 12/30/96 - Merged in PL/SQL toolkit errors + sdange 11/14/96 - (Added NZERROR_DECRYPT_FAILED to the enum list) + rwessman 12/02/96 - + rwessman 11/25/96 - Added error messages for PL/SQL functions. + asriniva 10/31/96 - Include oratypes.h + asriniva 10/29/96 - Fix numbering. + asriniva 10/29/96 - Fix error numbers + asriniva 10/29/96 - Correct type-o + asriniva 10/28/96 - Add more TK errors + asriniva 10/28/96 - Convert OKAPI errors to TK errors. + rwessman 10/17/96 - still more OSS TK errors + asriniva 10/16/96 - OKAPI errors + asriniva 10/15/96 - OSSTK errors + rwessman 10/15/96 - Added more OSS TK errors + asriniva 10/09/96 - Add OSSTK errors. + rwessman 09/05/96 - Added errors for PL/SQL functions. + wliau 09/05/96 - correct error numbers. + $Log: $ + * Revision 1.26 1996/07/15 23:07:23 wliau + * Added NZERROR_AUTH_SHARED_MEMORY + * + * Revision 1.25 1996/07/01 20:40:15 asriniva + * Finished RSA verify/sign. + * + * Revision 1.24 1996/06/27 20:39:41 rwessman + * Added more errors. + * + * Revision 1.23 1996/05/31 17:33:40 rwessman + * Updated nzerror.h to contain bug # for olint enum bug. + * + * Revision 1.22 1996/05/31 17:12:30 rwessman + * Assigned values to the various errors. + * + * Revision 1.21 1996/05/13 20:46:58 ggilchri + * Added more attribute related error conditions + * +*/ + +#ifndef NZERROR_ORACLE +# define NZERROR_ORACLE + +#ifndef ORATYPES +# include +#endif /* ORATYPES */ + +/* +** Errors - when an error is added here, a message corresponding to the +** error number must be added to the message file. +** New errors must be assigned numbers, otherwise the compiler can assign any +** value that it wants, which may lead to invalid error numbers being +** generated. +** The number range currently assigned to the OSS is 28750 - 29249 +** New number range 43000 - 43499 +*/ + +typedef enum nzerror +{ + NZERROR_OK = 0, + NZERROR_GENERIC = 28750, /* A catchall for errors */ + NZERROR_NO_MEMORY = 28751, /* No more memory */ + NZERROR_DATA_SOURCE_INIT_FAILED = 28752, /* Failed to init data source */ + NZERROR_DATA_SOURCE_TERM_FAILED = 28753,/* Failed to terminate data source */ + NZERROR_OBJECT_STORE_FAILED = 28754, /* Store object in data source failed */ + NZERROR_OBJECT_GET_FAILED = 28755, + /* Failed to obtain object from data source */ + NZERROR_MEMORY_ALLOC_FAILED = 28756, + /* Callback failed to allocate memory */ + NZERROR_MEMORY_ALLOC_0_BYTES = 28757, + /* Attempted to ask for 0 bytes of memory */ + NZERROR_MEMORY_FREE_FAILED = 28758, + /* Callback failed to free memory */ + NZERROR_FILE_OPEN_FAILED = 28759, + /* Open of file failed */ + NZERROR_LIST_CREATION_FAILED = 28760, + /* Creation of list failed */ + NZERROR_NO_ELEMENT = 28761, + /* No list element found */ + NZERROR_ELEMENT_ADD_FAILED = 28762, + /* Addition of list element failed */ + NZERROR_PARAMETER_BAD_TYPE = 28763, + /* Retrieval of an unknown parameter type */ + NZERROR_PARAMETER_RETRIEVAL = 28764, /* Retrieval of parameter failed */ + + NZERROR_NO_LIST = 28765, /* Data method list does not exist */ + NZERROR_TERMINATE_FAIL = 28766, /* Failed to terminate */ + NZERROR_BAD_VERSION_NUMBER = 28767, /* Bad version number */ + NZERROR_BAD_MAGIC_NUMBER = 28768, /* Bad magic number */ + NZERROR_METHOD_NOT_FOUND = 28769, + /* Data retrieval method specified does not exist */ + NZERROR_ALREADY_INITIALIZED = 28770, + /*The data source is already initialized */ + NZERROR_NOT_INITIALIZED = 28771, /* The data source is not initialized */ + NZERROR_BAD_FILE_ID = 28772, /* File ID is bad */ + NZERROR_WRITE_MAGIC_VERSION = 28773, /* Failed to write magic and version */ + NZERROR_FILE_WRITE_FAILED = 28774, /* Failed to write to file */ + NZERROR_FILE_CLOSE_FAILED = 28775, /* Failed to close file */ + NZERROR_OUTPUT_BUFFER_TOO_SMALL = 28776, + /* The buffer supplied by the caller is too small */ + NZERROR_BINDING_CREATION_FAILED = 28777,/* NL failed in creating a binding */ + NZERROR_PARAMETER_MALFORMED = 28778, /* A parameter was in a bad format */ + NZERROR_PARAMETER_NO_METHOD = 28779, + /* No method was specified for a data type */ + NZERROR_BAD_PARAMETER_METHOD = 28780, /* Illegal method for data type */ + NZERROR_PARAMETER_NO_DATA = 28781, /* No method specified when required */ + NZERROR_NOT_ALLOCATED = 28782, /* Data source is not allocated */ + NZERROR_INVALID_PARAMETER = 28783, /* Invalid parameter name */ + NZERROR_FILE_NAME_TRANSLATION = 28784,/* Could not translate OSD file name */ + NZERROR_NO_SUCH_PARAMETER = 28785, /* Selected parameter is non-existent */ + + NZERROR_DECRYPT_FAILED = 28786, + /* Encrypted private key decryption failure */ + NZERROR_ENCRYPT_FAILED = 28787, /* Private key encryption failed */ + + NZERROR_INVALID_INPUT = 28788, /* Incorrect input or unknown error */ + + NZERROR_NAME_TYPE_NOT_FOUND = 28789, + /* Type of name requested is not available */ + NZERROR_NLS_STRING_OPEN_FAILED = 28790, + /* Failure to generate an NLS string */ + NZERROR_CERTIFICATE_VERIFY = 28791, /* Failed to verify a certificate */ + NZERROR_OCI_PLSQL_FAILED = 28792, + /* an OCI call to process some plsql failed */ + NZERROR_OCI_BIND_FAILED = 28793, + /* an OCI call to bind an internal var. failed */ + NZERROR_ATTRIBUTE_INIT = 28794, /* failed to init role retrieval */ + NZERROR_ATTRIBUTE_FINISH_FAILED = 28795,/* Did not complete role retrieval */ + NZERROR_UNSUPPORTED_METHOD = 28796, /* Data method specified not supported */ + NZERROR_INVALID_KEY_DATA_TYPE = 28797, + /* Invalid data type specified for key */ + NZEROR_BIND_SUBKEY_COUNT = 28798, + /* Number of sub-keys to bind does not match count in initialized key */ + NZERROR_AUTH_SHARED_MEMORY = 28799, + /* Failed to retreieve authentication information from the shared memory */ + NZERROR_RIO_OPEN = 28800, /* RIO Open Failed */ + NZERROR_RIO_OBJECT_TYPE = 28801, /* RIO object type invalid */ + NZERROR_RIO_MODE = 28802, /* RIO mode invalid */ + NZERROR_RIO_IO = 28803, /* RIO io set or numberinvalid */ + NZERROR_RIO_CLOSE = 28804, /* RIO close failed */ + NZERROR_RIO_RETRIEVE = 28805, /* RIO retrieve failed */ + NZERROR_RIO_STORE = 28806, /* RIO store failed */ + NZERROR_RIO_UPDATE = 28807, /* RIO update failed */ + NZERROR_RIO_INFO = 28808, /* RIO info failed */ + NZERROR_RIO_DELETE = 28809, /* RIO delete failed */ + NZERROR_KD_CREATE = 28810, /* Key descriptor create failed */ + NZERROR_RIO_ACCESS_DESCRIPTOR = 28811, /* access descriptor invalid */ + NZERROR_RIO_RECORD = 28812, /* record invalid */ + NZERROR_RIO_RECORD_TYPE = 28813, /* record type and AD type not matched */ + NZERROR_PLSQL_ORACLE_TO_REAL = 28814, + /* A number passed to PL/SQL could not be converted to real format */ + NZERROR_PLSQL_REAL_TO_ORACLE = 28815, + /* A number in machine format could not be converted to Oracle format */ + NZERROR_TK_PLSQL_NO_PASSWORD = 28816, + /* A password was not provided to a PL/SQL function */ + NZERROR_TK_PLSQL_GENERIC = 28817, + /* A PL/SQL function returned an error */ + NZERROR_TK_PLSQL_NO_CONTEXT = 28818, + /* The package context was not specified to a PL/SQL function */ + NZERROR_TK_PLSQL_NO_DIST_NAME = 28819, + /* The user's distinguished name was not provided to a PL/SQL function */ + NZERROR_TK_PLSQL_NO_STATE = 28820, +/* The state of either a signature or decryption/encryption was not provided */ + NZERROR_TK_PLSQL_NO_INPUT = 28821, + /* An input buffer was specified to a PL/SQL function */ + NZERROR_TK_PLSQL_NO_SEED = 28822, + /* No seed was specified to the PL/SQL seed initialization function */ + NZERROR_TK_PLSQL_NO_BYTES = 28823, + /* Number of bytes was not specified to the PL/SQL random number generator */ + NZERROR_TK_INVALID_STATE = 28824, + /* Invalid encryption/decryption/signature state passed */ + NZERROR_TK_PLSQL_NO_ENG_FUNC = 28825, + /* No crypto engine function was passed in */ + NZERROR_TK_INV_ENG_FUNC = 28826, + /* An invalid crypto engine function was passed in */ + NZERROR_TK_INV_CIPHR_TYPE = 28827, + /* An invalid cipher type was passed in */ + NZERROR_TK_INV_IDENT_TYPE = 28828, + /* An invalid identity type was specified */ + NZERROR_TK_PLSQL_NO_CIPHER_TYPE = 28829, + /* No cipher type was specified */ + NZERROR_TK_PLSQL_NO_IDENT_TYPE = 28830, + /* No identity type was specified */ + NZERROR_TK_PLSQL_NO_DATA_FMT = 28831, + /* No data unit format was specified */ + NZERROR_TK_INV_DATA_FMT = 28832, + /* Invalid data unit format was provided to function */ + NZERROR_TK_PLSQL_INSUFF_INFO = 28833, + /* Not enough info (usually parameters) provided to a PL/SQL function */ + NZERROR_TK_PLSQL_BUF_TOO_SMALL = 28834, + /* Buffer provided by PL/SQL is too small for data to be returned */ + NZERROR_TK_PLSQL_INV_IDENT_DESC = 28835, + /* Identity descriptor not present or too small */ + NZERROR_TK_PLSQL_WALLET_NOTOPEN = 28836, + /* Wallet has not been opened yet */ + NZERROR_TK_PLSQL_NO_WALLET = 28837, + /* No wallet descriptor specified to PL/SQL function */ + NZERROR_TK_PLSQL_NO_IDENTITY = 28838, + /* No identity descriptor specified to PL/SQL function */ + NZERROR_TK_PLSQL_NO_PERSONA = 28839, + /* No persona descriptor was specified to PL/SQL function */ + NZERROR_TK_PLSQL_WALLET_OPEN = 28840, + /* Wallet was already opened */ + NZERROR_UNSUPPORTED = 28841, /* Operation is not supported */ + NZERROR_FILE_BAD_PERMISSION = 28842, /* Bad file permission specified */ + NZERROR_FILE_OSD_ERROR = 28843, /* OSD error when opening file */ + NZERROR_NO_WALLET = 28844, /* cert + privkey + tp files do not exist */ + NZERROR_NO_CERTIFICATE_ALERT = 28845, /* no certificate */ + NZERROR_NO_PRIVATE_KEY = 28846, /* no private-key */ + NZERROR_NO_CLEAR_PRIVATE_KEY_FILE = 28847, /* no clear key-file */ + NZERROR_NO_ENCRYPTED_PRIVATE_KEY_FILE = 28848, /* no encrypted priv key */ + NZERROR_NO_TRUSTPOINTS = 28849, /* no trustpoints */ + NZERROR_NO_CLEAR_TRUSTPOINT_FILE = 28850, /* no clear trustpoints */ + NZERROR_NO_ENCRYPTED_TRUSTPOINT_FILE = 28851, /* no encrypted trustpoints */ + NZERROR_BAD_PASSWORD = 28852, /* bad password */ + NZERROR_INITIALIZATION_FAILED = 28853, /* init failed or + module loading failed */ + /******************************* SSL ERRORS ********************************/ + /* + * In order to allow SSL errors to be mapped to Oracle errors, space is + * provided here. One Oracle error is provided for each SSL error to make + * error handling easier. A macro is provided to do the conversion. + * NOTE: ANY CHANGE IN SSL ERRORS MUST BE REFLECTED HERE. + * To add an SSL error, use the following formula to calculate the Oracle + * error: + * new_oracle_error = (new_ssl_error - SSLMemoryError) + NZERROR_SSLMemoryErr + * or numerically: + * new_oracle_error = (new_ssl_error - -7000) + 28854 + */ + NZERROR_SSLMemoryErr = 28854, + NZERROR_SSLUnsupportedErr = 28855, + NZERROR_SSLOverflowErr = 28856, + NZERROR_SSLUnknownErr = 28857, + NZERROR_SSLProtocolErr = 28858, + NZERROR_SSLNegotiationErr = 28859, + NZERROR_SSLFatalAlert = 28860, + NZERROR_SSLWouldBlockErr = 28861, + NZERROR_SSLIOErr = 28862, + NZERROR_SSLSessionNotFoundErr = 28863, + NZERROR_SSLConnectionClosedGraceful = 28864, + NZERROR_SSLConnectionClosedError = 28865, + NZERROR_ASNBadEncodingErr = 28866, + NZERROR_ASNIntegerTooBigErr = 28867, + NZERROR_X509CertChainInvalidErr = 28868, + NZERROR_X509CertExpiredErr = 28869, + NZERROR_X509NamesNotEqualErr = 28870, + NZERROR_X509CertChainIncompleteErr = 28871, + NZERROR_X509DataNotFoundErr = 28872, + NZERROR_SSLBadParameterErr = 28873, + NZERROR_SSLIOClosedOverrideGoodbyeKiss = 28874, + NZERROR_X509MozillaSGCErr = 28875, + NZERROR_X509IESGCErr = 28876, + NZERROR_ImproperServerCredentials = 28877, + NZERROR_ImproperClientCredentials = 28878, + NZERROR_NoProtocolSideSet = 28879, + NZERROR_setPersonaFailed = 28880, + NZERROR_setCertFailed = 28881, + NZERROR_setVKeyFailed = 28882, + NZERROR_setTPFailed = 28883, + NZERROR_BadCipherSuite = 28884, + NZERROR_NoKeyPairForKeyUsage = 28885, + +/* ============>>> ENTRUST ERRORS */ + NZERROR_EntrustLoginFailed = 28890, + NZERROR_EntrustGetInfoFailed = 28891, + NZERROR_EntrustLoadCertificateFailed = 28892, + NZERROR_EntrustGetNameFailed = 28893, + +/* ============>>> NZERRORS CONTINUED */ + NZERROR_CertNotInstalled = 29000, + NZERROR_ServerDNMisMatched = 29002, + NZERROR_ServerDNMisConfigured = 29003, + +/* ============>>> PKI VENDORS ERRORS 29050 - 29099 */ + +/* ============>>> SSL Errors CONTINUED */ + NZERROR_CIC_ERR_SSL_ALERT_CB_FAILURE = 29004, + NZERROR_CIC_ERR_SSL_BAD_CERTIFICATE = 29005, + NZERROR_CIC_ERR_SSL_BAD_CERTIFICATE_REQUEST = 29006, + NZERROR_CIC_ERR_SSL_BAD_CLEAR_KEY_LEN = 29007, + NZERROR_CIC_ERR_SSL_BAD_DHPARAM_KEY_LENGTH = 29008, + NZERROR_CIC_ERR_SSL_BAD_ENCRYPTED_KEY_LEN = 29009, + NZERROR_CIC_ERR_SSL_BAD_EXPORT_KEY_LENGTH = 29010, + NZERROR_CIC_ERR_SSL_BAD_FINISHED_MESSAGE = 29011, + NZERROR_CIC_ERR_SSL_BAD_KEY_ARG_LEN = 29012, + NZERROR_CIC_ERR_SSL_BAD_MAC = 29013, + NZERROR_CIC_ERR_SSL_BAD_MAX_FRAGMENT_LENGTH_EXTENSION = 29014, + NZERROR_CIC_ERR_SSL_BAD_MESSAGE_LENGTH = 29015, + NZERROR_CIC_ERR_SSL_BAD_PKCS1_PADDING = 29016, + NZERROR_CIC_ERR_SSL_BAD_PREMASTER_SECRET_LENGTH = 29017, + NZERROR_CIC_ERR_SSL_BAD_PREMASTER_SECRET_VERSION = 29018, + NZERROR_CIC_ERR_SSL_BAD_PROTOCOL_VERSION = 29019, + NZERROR_CIC_ERR_SSL_BAD_RECORD_LENGTH = 29020, + NZERROR_CIC_ERR_SSL_BAD_SECRET_KEY_LEN = 29021, + NZERROR_CIC_ERR_SSL_BAD_SIDE = 29022, + NZERROR_CIC_ERR_SSL_BUFFERS_NOT_EMPTY = 29023, + NZERROR_CIC_ERR_SSL_CERTIFICATE_VALIDATE_FAILED = 29024, + NZERROR_CIC_ERR_SSL_CERT_CHECK_CALLBACK = 29025, + NZERROR_CIC_ERR_SSL_DECRYPT_FAILED = 29026, + NZERROR_CIC_ERR_SSL_ENTROPY_COLLECTION = 29027, + NZERROR_CIC_ERR_SSL_FAIL_SERVER_VERIFY = 29028, + NZERROR_CIC_ERR_SSL_HANDSHAKE_ALREADY_COMPLETED = 29029, + NZERROR_CIC_ERR_SSL_HANDSHAKE_REQUESTED = 29030, + NZERROR_CIC_ERR_SSL_HANDSHAKE_REQUIRED = 29031, + NZERROR_CIC_ERR_SSL_INCOMPLETE_IDENTITY = 29032, + NZERROR_CIC_ERR_SSL_INVALID_PFX = 29033, + NZERROR_CIC_ERR_SSL_NEEDS_CIPHER_OR_CLIENTAUTH = 29034, + NZERROR_CIC_ERR_SSL_NEEDS_PRNG = 29035, + NZERROR_CIC_ERR_SSL_NOT_SUPPORTED = 29036, + NZERROR_CIC_ERR_SSL_NO_CERTIFICATE = 29037, + NZERROR_CIC_ERR_SSL_NO_MATCHING_CERTIFICATES = 29038, + NZERROR_CIC_ERR_SSL_NO_MATCHING_CIPHER_SUITES = 29039, + NZERROR_CIC_ERR_SSL_NO_SUPPORTED_CIPHER_SUITES = 29040, + NZERROR_CIC_ERR_SSL_NULL_CB = 29041, + NZERROR_CIC_ERR_SSL_READ_BUFFER_NOT_EMPTY = 29042, + NZERROR_CIC_ERR_SSL_READ_REQUIRED = 29043, + NZERROR_CIC_ERR_SSL_RENEGOTIATION_ALREADY_REQUESTED = 29044, + NZERROR_CIC_ERR_SSL_RENEGOTIATION_REFUSED = 29045, + NZERROR_CIC_ERR_SSL_RESUMABLE_SESSION = 29046, + NZERROR_CIC_ERR_SSL_TLS_EXTENSION_MISMATCH = 29047, + NZERROR_CIC_ERR_SSL_UNEXPECTED_MSG = 29048, + NZERROR_CIC_ERR_SSL_UNKNOWN_RECORD = 29049, + NZERROR_CIC_ERR_SSL_UNSUPPORTED_CLIENT_AUTH_MODE = 29050, + NZERROR_CIC_ERR_SSL_UNSUPPORTED_PUBKEY_TYPE = 29051, + NZERROR_CIC_ERR_SSL_WRITE_BUFFER_NOT_EMPTY = 29052, + NZERROR_CIC_ERR_PKCS12_MISSING_ALG = 29053, + NZERROR_CIC_ERR_PKCS_AUTH_FAILED = 29054, + NZERROR_CIC_ERR_PKCS_BAD_CONTENT_TYPE = 29055, + NZERROR_CIC_ERR_PKCS_BAD_INPUT = 29056, + NZERROR_CIC_ERR_PKCS_BAD_PADDING = 29057, + NZERROR_CIC_ERR_PKCS_BAD_SN = 29058, + NZERROR_CIC_ERR_PKCS_BAD_SN_LENGTH = 29059, + NZERROR_CIC_ERR_PKCS_BAD_VERSION = 29060, + NZERROR_CIC_ERR_PKCS_BASE = 29061, + NZERROR_CIC_ERR_PKCS_FIELD_NOT_PRESENT = 29062, + NZERROR_CIC_ERR_PKCS_NEED_CERTVAL = 29063, + NZERROR_CIC_ERR_PKCS_NEED_PASSWORD = 29064, + NZERROR_CIC_ERR_PKCS_NEED_PKC = 29065, + NZERROR_CIC_ERR_PKCS_NEED_PRV_KEY = 29066, + NZERROR_CIC_ERR_PKCS_NEED_TRUSTED = 29067, + NZERROR_CIC_ERR_PKCS_UNSUPPORTED_CERT_FORMAT = 29068, + NZERROR_CIC_ERR_PKCS_UNSUP_PRVKEY_TYPE = 29069, + NZERROR_CIC_ERR_CODING_BAD_PEM = 29070, + NZERROR_CIC_ERR_CODING_BASE = 29071, + NZERROR_CIC_ERR_DER_BAD_ENCODING = 29072, + NZERROR_CIC_ERR_DER_BAD_ENCODING_LENGTH = 29073, + NZERROR_CIC_ERR_DER_BASE = 29074, + NZERROR_CIC_ERR_DER_ELEMENT_TOO_LONG = 29075, + NZERROR_CIC_ERR_DER_INDEFINITE_LENGTH = 29076, + NZERROR_CIC_ERR_DER_NO_MORE_ELEMENTS = 29077, + NZERROR_CIC_ERR_DER_OBJECT_TOO_LONG = 29078, + NZERROR_CIC_ERR_DER_TAG_SIZE = 29079, + NZERROR_CIC_ERR_DER_TIME_OUT_OF_RANGE = 29080, + NZERROR_CIC_ERR_DER_UNUSED_BITS_IN_BIT_STR = 29081, + NZERROR_CIC_ERR_GENERAL_BASE = 29082, + NZERROR_CIC_ERR_HASH_BASE = 29083, + NZERROR_CIC_ERR_ILLEGAL_PARAM = 29084, + NZERROR_CIC_ERR_MEM_NOT_OURS = 29085, + NZERROR_CIC_ERR_MEM_OVERRUN = 29086, + NZERROR_CIC_ERR_MEM_UNDERRUN = 29087, + NZERROR_CIC_ERR_MEM_WAS_FREED = 29088, + NZERROR_CIC_ERR_NOT_FOUND = 29090, + NZERROR_CIC_ERR_NO_PTR = 29091, + NZERROR_CIC_ERR_TIMEOUT = 29092, + NZERROR_CIC_ERR_UNIT_MASK = 29093, + NZERROR_CIC_ERR_BAD_CTX = 29094, + NZERROR_CIC_ERR_BAD_INDEX = 29095, + NZERROR_CIC_ERR_BAD_LENGTH = 29096, + NZERROR_CIC_ERR_CODING_BAD_ENCODING = 29097, + NZERROR_CIC_ERR_SSL_NO_CLIENT_AUTH_MODES = 29098, + + /* ============>>> PKCS12 error 29100 - 29149 */ + + NZERROR_LOCKEYID_CREATE_FAILED = 29100, + NZERROR_P12_ADD_PVTKEY_FAILED = 29101, + NZERROR_P12_ADD_CERT_FAILED = 29102, + NZERROR_P12_WLT_CREATE_FAILED = 29103, + NZERROR_P12_ADD_CERTREQ_FAILED = 29104, + NZERROR_P12_WLT_EXP_FAILED = 29105, + NZERROR_P12_WLT_IMP_FAILED = 29106, + NZERROR_P12_CREATE_FAILED = 29107, + NZERROR_P12_DEST_FAILED = 29107, + NZERROR_P12_RAND_ERROR = 29108, + NZERROR_P12_PVTKEY_CRT_FAILED = 29109, + NZERROR_P12_INVALID_BAG = 29110, + NZERROR_P12_INVALID_INDEX = 29111, + NZERROR_P12_GET_CERT_FAILED = 29112, + NZERROR_P12_GET_PVTKEY_FAILED = 29113, + NZERROR_P12_IMP_PVTKEY_FAILED = 29114, + NZERROR_P12_EXP_PVTKEY_FAILED = 29115, + NZERROR_P12_GET_ATTRIB_FAILED = 29116, + NZERROR_P12_ADD_ATTRIB_FAILED = 29117, + NZERROR_P12_CRT_ATTRIB_FAILED = 29118, + NZERROR_P12_IMP_CERT_FAILED = 29119, + NZERROR_P12_EXP_CERT_FAILED = 29120, + NZERROR_P12_ADD_SECRET_FAILED = 29121, + NZERROR_P12_ADD_PKCS11INFO_FAILED = 29122, + NZERROR_P12_GET_PKCS11INFO_FAILED = 29123, + NZERROR_P12_MULTIPLE_PKCS11_LIBNAME = 29124, + NZERROR_P12_MULTIPLE_PKCS11_TOKENLABEL = 29125, + NZERROR_P12_MULTIPLE_PKCS11_TOKENPASSPHRASE = 29126, + NZERROR_P12_UNKNOWN_PKCS11INFO = 29127, + NZERROR_P12_PKCS11_LIBNAME_NOT_SET = 29128, + NZERROR_P12_PKCS11_TOKENLABEL_NOT_SET = 29129, + NZERROR_P12_PKCS11_TOKENPASSPHRASE_NOT_SET = 29130, + NZERROR_P12_MULTIPLE_PKCS11_CERTLABEL = 29131, + +/* ===========>>> SSL Errors CONTINUED 29135 - 29139 */ + NZERROR_CIC_ERR_RANDOM = 29135, + NZERROR_CIC_ERR_SMALL_BUFFER = 29136, + NZERROR_CIC_ERR_SSL_BAD_CONTEXT = 29137, + +/* ==========>>> Mutex Errors 29138 - 29139 */ + NZERROR_MUTEX_INITIALIZE_FAILED = 29138, + NZERROR_MUTEX_DESTROY_FAILED = 29139, + + +/* ============>>> EXTENSIONS Errors 29140 - 29149 */ + NZERROR_BS_CERTOBJ_CREAT_FAILED = 29140, + NZERROR_BS_DER_IMP_FAILED = 29141, + + +/* ============>>> FIPS ERRORS 29150 - 29175 */ + NZERROR_DES_SELF_TEST_FAILED = 29150, + NZERROR_3DES_SELF_TEST_FAILED = 29151, + NZERROR_SHA_SELF_TEST_FAILED = 29152, + NZERROR_RSA_SELF_TEST_FAILED = 29153, + NZERROR_DRNG_SELF_TEST_FAILED = 29154, + NZERROR_CKEYPAIR_SELF_TEST_FAILED = 29155, + NZERROR_CRNG_SELF_TEST_FAILED = 29156, + NZERROR_FIPS_PATHNAME_ERROR = 29157, + NZERROR_FIPS_LIB_OPEN_FAILED = 29158, + NZERROR_FIPS_LIB_READ_ERROR = 29159, + NZERROR_FIPS_LIB_DIFFERS = 29160, + NZERROR_DAC_SELF_TEST_FAILED = 29161, + NZERROR_NONFIPS_CIPHERSUITE = 29162, + NZERROR_VENDOR_NOT_SUPPORTED_FIPS_MODE = 29163, + NZERROR_EXTERNAL_PKCS12_NOT_SUPPORTED_FIPS_MODE = 29164, + NZERROR_AES_SELF_TEST_FAILED = 29165, + +/* ============>>> CRL ERRORS 29176 - 29200 */ + NZERROR_CRL_SIG_VERIFY_FAILED = 29176, /*CRL signature verification failed*/ + NZERROR_CERT_NOT_IN_CRL = 29177, + /*Cert is not in CRL - cert is not revoked*/ + NZERROR_CERT_IN_CRL = 29178, /*Cert is in CRL - cert is revoked*/ + NZERROR_CERT_IN_CRL_CHECK_FAILED = 29179, /*Cert revocation check failed */ + NZERROR_INVALID_CERT_STATUS_PROTOCOL = 29180, + NZERROR_LDAP_OPEN_FAILED = 29181, /* ldap_open failed */ + NZERROR_LDAP_BIND_FAILED = 29182, /* ldap_bind failed */ + NZERROR_LDAP_SEARCH_FAILED = 29183, /* ldap_search failed */ + NZERROR_LDAP_RESULT_FAILED = 29184, /* ldap_result failed */ + NZERROR_LDAP_FIRSTATTR_FAILED = 29185, /* ldap_first_attribute failed */ + NZERROR_LDAP_GETVALUESLEN_FAILED = 29186, /* ldap_get_values_len failed */ + NZERROR_LDAP_UNSUPPORTED_VALMEC = 29187, + /* unsupported validation mechanism */ + NZERROR_LDAP_COUNT_ENTRIES_FAILED = 29188,/* ldap_count_entries failed */ + NZERROR_LDAP_NO_ENTRY_FOUND = 29189, /* No entry found in OID */ + NZERROR_LDAP_MULTIPLE_ENTRIES_FOUND = 29190, /* Multiple entries in OID*/ + NZERROR_OID_INFO_NOT_SET = 29191, + NZERROR_LDAP_VALMEC_NOT_SET = 29192, + /* Validation mechanism not set in OID*/ + NZERROR_CRLDP_NO_CRL_FOUND = 29193, + /* No CRL found using CRLDP mechanism */ + NZERROR_CRL_NOT_IN_CACHE = 29194, /* No CRL found in the cache*/ + NZERROR_CRL_EXPIRED = 29195, /* CRL nextUpdate time is in the past */ + +/* ============>>> ADD ERRORS HERE -- NOTE DECREASING numbers */ + NZERROR_DN_MATCH = 29222, /* for nztCompareDN */ + NZERROR_CERT_CHAIN_CREATION = 29223, /* unable to create a cert chain + * with the existing TPs for the + * cert to be installed. + */ + NZERROR_NO_MATCHING_CERT_REQ = 29224, /* No matching cert_req was + * found the corresponding to + * the privatekey which + * matches the cert to be + * installed */ + NZERROR_CERT_ALREADY_INSTALLED = 29225, /* we are attempting to + * install a cert again into + * a persona which already + * has it installed. + */ + NZERROR_NO_MATCHING_PRIVATE_KEY = 29226, /* could not find a matching + * persona-private(privatekey) in + * the Persona, for the given + * cert(public key). + */ + NZERROR_VALIDITY_EXPIRED = 29227, /* certificate validity date expired */ + NZERROR_TK_BYTES_NEEDED = 29228, /* Couldn't determine # of bytes needed */ + NZERROR_TK_BAD_MAGIC_NUMBER = 29229, + /* Magic number found in header does not match expected */ + NZERROR_TK_BAD_HEADER_LENGTH = 29230, + /* Header length passed in not sufficient for message header */ + NZERROR_TK_CE_INIT = 29231, /* Crypto engine failed to initialize */ + NZERROR_TK_CE_KEYINIT = 29232, /* Crypto engine key initialization failed */ + NZERROR_TK_CE_ENCODE_KEY = 29233, /* Count not encode key object */ + NZERROR_TK_CE_DECODE_KEY = 29234, /* Could not decode key into object */ + NZERROR_TK_CE_GEYKEYINFO = 29235, /* Crypto engine failed to get key info */ + NZERROR_TK_SEED_RANDOM = 29236, /* Couldn't seed random number generator */ + NZERROR_TK_CE_ALGFINISH = 29237, /* Couldn't finish algorithm */ + NZERROR_TK_CE_ALGAPPLY = 29238, /* Couldn't apply algorithm to data */ + NZERROR_TK_CE_ALGINIT = 29239, /* Couldn't init CE for algorithm */ + NZERROR_TK_ALGORITHM = 29240, /* Have no idea what algorithm you want */ + NZERROR_TK_CANNOT_GROW = 29241, /* Cannot grow output buffer block */ + NZERROR_TK_KEYSIZE = 29242, /* Key not large enough for data */ + NZERROR_TK_KEYTYPE = 29243, /* Unknown key type. */ + + NZERROR_TK_PLSQL_NO_WRL = 29244, + /* Wallet resource locator not specified to PL/SQL function */ + + NZERROR_TK_CE_FUNC = 29245, /* Unknown crypto engine function */ + NZERROR_TK_TDU_FORMAT = 29246, /* Unknown TDU format */ + NZERROR_TK_NOTOPEN = 29247, /* Object must be open */ + NZERROR_TK_WRLTYPE = 29248, /* Bad WRL type */ + NZERROR_TK_CE_STATE = 29249, /* Bad state specified for the crypto engine */ + + /* After 29249, use error numbers in block 43000 - 43499 */ + NZERROR_PKCS11_LIBRARY_NOT_FOUND = 43000, /* PKCS #11 library not found */ + NZERROR_PKCS11_TOKEN_NOT_FOUND = 43001, + /* can't find token with given label*/ + NZERROR_PKCS11_BAD_PASSPHRASE = 43002, /* passphrase is incorrect/expired */ + NZERROR_PKCS11_GET_FUNC_LIST = 43003, /* C_GetFunctionList returned error */ + NZERROR_PKCS11_INITIALIZE = 43004, /* C_Initialize returned error */ + NZERROR_PKCS11_NO_TOKENS_PRESENT = 43005, /* No tokens present */ + NZERROR_PKCS11_GET_SLOT_LIST = 43006, /* C_GetSlotList returned error */ + + NZERROR_PKCS11_GET_TOKEN_INFO = 43008, /* C_GetTokenInfo returned error */ + NZERROR_PKCS11_SYMBOL_NOT_FOUND = 43009, /* Symbol not found in PKCS11 lib */ + + NZERROR_PKCS11_TOKEN_LOGIN_FAILED = 43011, /* Token login failed */ + + NZERROR_PKCS11_CHANGE_PROVIDERS_ERROR = 43013, /* Change providers error */ + NZERROR_PKCS11_GET_PRIVATE_KEY_ERROR = 43014, + /* Error trying to find private key on token */ + NZERROR_PKCS11_CREATE_KEYPAIR_ERROR = 43015, /* Key pair gen error */ + NZERROR_PKCS11_WALLET_CONTAINS_P11_INFO = 43016, /* Wallet already contains + pkcs11 info */ + NZERROR_PKCS11_NO_CERT_ON_TOKEN = 43017, /* No cert found on token */ + NZERROR_PKCS11_NO_USER_CERT_ON_TOKEN = 43018, /*No user cert found on token*/ + NZERROR_PKCS11_NO_CERT_ON_TOKEN_WITH_GIVEN_LABEL = 43019, /*No cert found on token with given certificate label.*/ + NZERROR_PKCS11_MULTIPLE_CERTS_ON_TOKEN_WITH_GIVEN_LABEL = 43020, /*Multiple certs found on token with given certificate label.*/ + NZERROR_PKCS11_CERT_WITH_LABEL_NOT_USER_CERT = 43021, /*Cert with given cert is not a user cert because no corresponding pvt key found on token */ + + /* RSA ERRORS 43050 - 43059 */ + NZERROR_BIND_SERVICE_ERROR = 43050, /* C_BindService returned error */ + NZERROR_CREATE_KEY_OBJ_ERROR = 43051, /* B_CreateKeyObject returned error */ + NZERROR_GET_CERT_FIELDS = 43052, /* C_GetCertFields returned error */ + NZERROR_CREATE_PKCS10_OBJECT = 43053, + /* C_CreatePKCS10Object returned error */ + NZERROR_SET_PKCS10_FIELDS = 43054, /* C_SetPKCS10Fields returned error */ + NZERROR_SIGN_CERT_REQUEST = 43055, /* C_SignCertRequest returned error */ + NZERROR_GET_PKCS10_DER = 43056, /* C_GetPKCS10DER returned error */ + NZERROR_INITIALIZE_CERTC = 43057, /* C_InitializeCertC returned error */ + NZERROR_INSERT_PRIVATE_KEY = 43058, /* C_InsertPrivateKey returned error */ + NZERROR_RSA_ERROR = 43059, /* RSA error. See trace output */ + + /* slts ERRORS 43060 - 43069 */ + NZERROR_SLTSCTX_INIT_FAILED = 43060, /* sltsini() returned error */ + NZERROR_SLTSKYC_FAILED = 43061, /* sltskyc() returned error */ + NZERROR_SLTSCTX_TERM_FAILED = 43062, /* sltster() returned error */ + NZERROR_SLTSKYS_FAILED = 43063, /* sltskys() returned error */ + + NZERROR_INVALID_HEADER_LENGTH = 43070, /* bad sso header length */ + NZERROR_WALLET_CONTAINS_USER_CREDENTIALS = 43071, /* wallet not empty */ + NZERROR_CANNOT_MODIFY_AL = 43072, /* Cannot modify AL wallet */ + NZERROR_FILE_LOCK_FAILED = 43073, /* Cannot lock wallet file */ + + NZERROR_CSF_ALIAS_INVALID = 43100, /* alias is invalid */ + NZERROR_CSF_KEY_INVALID = 43101, /* key invalid */ + NZERROR_CSF_CRED_NOT_SUPPORTED = 43102, /* only pwd cred supported */ + NZERROR_CSF_HOSTNAME = 43103, /* hostname error */ + NZERROR_CSF_XML = 43104, /* XmlCreate error. See trace */ + NZERROR_CSF_WALLET_NOT_SPECIFIED = 43105, /* no wallet specified */ + NZERROR_CSF_MAP_NOT_IN_STORE = 43106, /* map does not exist in store */ + NZERROR_CSF_KEY_NOT_IN_STORE = 43107, /* key does not exist in store */ + NZERROR_CSF_ENTRY_EXISTS = 43108, /* entry with map/key exists */ + + NZERROR_LX_ERROR = 43120, /* lx api returned error */ + + NZERROR_LAST_ERROR = 43499, /* Last available error */ + /* MAXIMUM ERROR NUMBER IS 43499 */ + + /* + * DO NOT JUST INSERT NEW ERRORS IN ANY OLD PLACE. New errors should be + * added such the current error retains their integer values. Duplicate + * values will cause compiler errors. + */ + NZERROR_THIS_MUST_BE_LAST + +} nzerror; + +/* + * Macro to convert SSL errors to Oracle errors. As SSL errors are negative + * and Oracle numbers are positive, the following needs to be done. + * 1. The base error number, which is the highest, is added to the + * SSL error to get the index into the number range. + * 2. The result is added to the base Oracle number to get the Oracle error. + */ +#define NZERROR_SSL_TO_ORACLE(ssl_error_) \ + ((ssl_error_ == SSLNoErr) \ + ? NZERROR_OK \ + : (nzerror) ((ssl_error_ - SSLMemoryErr) + (uword) NZERROR_SSLMemoryErr)) +#endif /* NZERROR_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/nzt.h b/libraries/SQLAPI/include/ora_win/nzt.h new file mode 100644 index 000000000..963639523 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/nzt.h @@ -0,0 +1,2387 @@ +/* DISABLE check_long_lines */ + +/* Copyright (c) 1996, 2007, Oracle. All rights reserved. */ +/* Copyright (c) 1996, 2007, Oracle. All rights reserved. */ + +/* + * + */ + +/* + * NAME + * nzt.h + * + * DESCRIPTION + * Toolkit public declarations. + * + * PUBLIC FUNCTIONS + * nztwOpenWallet - Open a wallet based on a WRL and pwd. + * nztwCloseWallet - Close a wallet. + * + nztwCreateWallet - Create a new wallet. + * + nztwDestroyWallet - Destroy an existing wallet. + * nztwRetrievePersonaCopy - Retieve a copy of a particular persona. + * + nzteStorePersona - Store a persona in the wallet. + * nzteOpenPersona - Open a persona. + * nzteClosePersona - Close a persona. + * + nzteRemovePersona - Remove a persona from a wallet. + * + nzteCreatePersona - Create a persona. + * nzteDestroyPersona - Destroy a persona. + * nztiStoreTrustedIdentity - Store an identity with associated trust. + * nzteRetrieveTrustedIdentCopy - Retrieves a trusted identity from persona + * + nzteSetProtection - Modify the protection set in a persona. + * + nzteGetProtection - Get the protection set in a persona + * nztePriKey - Get the Private Key (X509 Only) + * nzteMyCert - Get the Certificate (X509 only) + * nzteX509CreatePersona - Create a persona given an X509 Certificate. + * + nztiRemoveIdentity - Remove an identity from a persona. + * nztiCreateIdentity - Create an identity. + * nztiDuplicateIdentity - Create a complete copy of an identity. + * nztiAbortIdentity - Discard an unstored identity. + * nztidGetIdentityDesc - Gets Identity Description from Identity. + * nztidFreeIdentityDesc - Frees memory for Identity Desc object. + * nztSign - Generate an attached signature. + * + nztxSignExpansion - Determine size of signature. + * nztVerify - Verify an attached signature. + * nztValidate - Validate an identity. + * nztsd_SignDetached - Generate a detached signature. + * + nztxsd_SignDetachedExpansion - Determine size of detached signature. + * nztved_VerifyDetached - Verify a detached signature. + * + nztEncrypt - Symmetric key encryption. + * + nztxEncryptExpansion - Determine the tdu length for encryption. + * + nztDecrypt - Symmetric key decryption. + * + nztEnvelope - Sign then encrypt data for recipient(s). + * + nztDeEnvelope - Reverse nztEnvelope. + * + nztKeyedHash - Generate keyed hash. + * + nztxKeyedHashExpansion - Determine size of TDU for keyed hash. + * nztHash - Generate hash. + * + nztxHashExpansion - Determine the size of the TDU for a hash. + * nztSeedRandom - See the random number generator. + * nztrb_RandomBytes - Generate a series of random bytes. + * nztrn_RandomNumber - Generate a random number. + * nztbbInitBlock - Initialize a buffer block. + * nztbbReuseBlock - Reuse a buffer block. + * nztbbSizeBlock - Find the size of the buffer block. + * nztbbGrowBlock - Grow initialized buffer block by 'inc' bytes. + * nztbbPurgeBlock - Purge the memory used within a buffer block. + * nztbbSetBlock - Set block to known state. + * nztkec_PKEncrypt - Encrypt data then encrypt key for recipient. + * nztkdc_PKDecrypt - Decrypt PKEncrypt'ed data. + * nztific_FreeIdentityContent - Free the contents of an identity. + * nztifdn - Create an identity from a distinguished name + * nztcts_CipherSpecToStr - Converts the Cipher Spec Code To String + * nztiae_IsAuthEnabled - Checks to see if Authentication is Enabled + * in the current Cipher Spec. + * nztiae_IsEncrEnabled - Checks to see if Encryption is Enabled + * in the current Cipher Spec. + * nztiae_IsHashEnabled - Checks to see if Hashing is Enabled + * in the current Cipher Spec. + * nztwGetCertInfo - Get peer certificate info + * + * NOTE: the '+' indicates that these functions are UNSUPPORTED at this time. + * + * NOTES + * + * MODIFIED + * shiahuan 11/28/07 - + * skalyana 08/15/07 - + * pkale 09/28/06 - Bug 5565668: Removed __STDC__ + * tnallath 09/22/05 - + * rchahal 07/27/04 - add keyusage + * srtata 11/10/03 - fix nztSetAppDefaultLocation header + * rchahal 10/15/03 - bug 2513821 + * rchahal 11/11/02 - pkcs11 support + * akoyfman 07/05/02 - adding secret store to persona + * supriya 10/11/01 - Fix for bug # 2015732 + * ajacobs 04/04/01 - make NZT_REGISTRY_WRL always available + * ajacobs 03/06/01 - olint fix + * ajacobs 03/02/01 - Add GetCertInfo + * supriya 02/23/01 - Move nzttKPUsage from nzt0.h + * rchahal 01/26/01 - olint fixes + * supriya 12/07/00 - Change fn name + * supriya 12/01/00 - Certificate API's needed for iAS + * supriya 06/19/00 - Adding definitions for MCS and ENTR + * lkethana 05/31/00 - multiple cert support + * skanjila 06/25/99 - Remove nztcts_CipherSpecToStr() to NZOS. + * skanjila 06/23/99 - Change API of nztcts_CipherSpecToStr. + * lkethana 06/18/99 - rem nztIPrivateAlloc, etc + * lkethana 06/10/99 - changing size_t to ub4 + * lkethana 06/02/99 - add api for getting auth/encry/hash capability of c + * arswamin 12/28/98 - add NZT_MAX_MD5. + * arswamin 12/21/98 - change signature of compareDN + * qdinh 12/21/98 - change size_t to ub4. + * inetwork 11/22/98 - Removing NZDEPRECATED definition + * amthakur 09/14/98 - deprecating and updating the c-structures. + * arswamin 09/24/98 - adding NZTTWRL_NULL for SSO support. + * amthakur 07/30/98 - changing the prototype of nztGetCertChain. + * qdinh 05/01/98 - add NZTTIDENTTYPE_INVALID_TYPE + * qdinh 04/17/98 - add NZTTWRL_ORACLE. + * ascott 10/08/97 - implement nztiStoreTrustedIdentity + * ascott 10/07/97 - add nztiGetIdentityDesc + * ascott 09/28/97 - clarify prototype comments and error codes + * ascott 09/05/97 - update identity: create, destroy, duplicate + * ascott 08/21/97 - add GetCert and GetPriKey + * ascott 08/07/97 - add other WRL settings + * asriniva 03/25/97 - Add ANSI prototypes + * rwessman 03/19/97 - Added prototypes for nztific_FreeIdentityContent() + * asriniva 03/11/97 - Fix olint errors + * sdange 02/28/97 - Removed inclusion of nz0decl.h + * sdange 02/18/97 - Moved nzt specific declarations from nz0decl.h + * asriniva 01/21/97 - Remove prototypes. + * asriniva 10/31/96 - Include oratypes.h + * asriniva 10/15/96 - Declare buffer block helper functions + * asriniva 10/08/96 - First pass at wallet open/close + * asriniva 10/04/96 - Add random number seed function + * asriniva 10/03/96 - Reorder parameters in nztbbSetBlock + * asriniva 10/03/96 - Keep editing. + * asriniva 10/03/96 - Continued edits. + * asriniva 10/02/96 - Continue editing. + * asriniva 09/26/96 - + */ + +/* ENABLE check_long_lines */ + +#ifndef NZT_ORACLE +#define NZT_ORACLE + +#ifndef ORATYPES +# include +#endif /* ORATYPES */ + +#ifndef NZERROR_ORACLE +# include /* NZ error type */ +#endif /* NZERROR_ORACLE */ + + +#define NZT_MAX_SHA1 20 +#define NZT_MAX_MD5 16 + +/***************************************/ +/* PUBLIC CONSTANTS, MACROS, AND TYPES */ +/***************************************/ + +/* + * Wallet Resource Locator Type Strings + * + * WRL TYPE PARAMETERS BEHAVIOR + * ======== ========== ===================================== + * default: Uses directory defined by the parameter + * SNZD_DEFAULT_FILE_DIRECTORY which in + * unix is "$HOME/oracle/oss" + * + * file: file path Find the Oracle wallet in this directory. + * example: file: + * + * sqlnet: In this case, the directory path will be + * retrieved from the sqlnet.ora file under + * the oss.source.my_wallet parameter. + * + * mcs: Microsoft WRL. + * + * entr: dir path Entrust WRL. eg: ENTR: + * + */ +/* Note that there is no NZT_NULL_WRL. Instead look in snzd.h for DEFAULT_WRP + * which is used in our new defaulting mechanism. The NZT_DEFAULT_WRL + * should be deprecated. + */ +#define NZT_DEFAULT_WRL ((text *)"default:") +#define NZT_SQLNET_WRL ((text *)"sqlnet:") +#define NZT_FILE_WRL ((text *)"file:") +#define NZT_ENTR_WRL ((text *)"entr:") +#define NZT_MCS_WRL ((text *)"mcs:") +#define NZT_ORACLE_WRL ((text *)"oracle:") +#define NZT_REGISTRY_WRL ((text *)"reg:") + +enum nzttwrl +{ + NZTTWRL_DEFAULT = 1, /* Default, use SNZD_DEFAULT_FILE_DIRECTORY */ + NZTTWRL_SQLNET, /* Use oss.source.my_wallet in sqlnet.ora file */ + NZTTWRL_FILE, /* Find the oracle wallet in this directory */ + NZTTWRL_ENTR, /* Find the entrust profile in this directory */ + NZTTWRL_MCS, /* WRL for Microsoft */ + NZTTWRL_ORACLE, /* Get the wallet from OSS db */ + NZTTWRL_NULL, /* New SSO defaulting mechanism */ + NZTTWRL_REGISTRY /* Find the wallet in Windows Registry */ +}; +typedef enum nzttwrl nzttwrl; + +#ifndef NZ0DECL_ORACLE + /* + * With the elimination of nz0decl.h from public, we need this + * redundant typedef. + */ + typedef struct nzctx nzctx; + typedef struct nzstrc nzstrc; + typedef struct nzosContext nzosContext; +#endif /* NZ0DECL_ORACLE */ + +/* Moved from nz0decl.h */ + +typedef struct nzttIdentity nzttIdentity; +typedef struct nzttIdentityPrivate nzttIdentityPrivate; +typedef struct nzttPersona nzttPersona; +typedef struct nzttPersonaPrivate nzttPersonaPrivate; +typedef struct nzttWallet nzttWallet; +typedef struct nzttWalletPrivate nzttWalletPrivate; +typedef struct nzttWalletObj nzttWalletObj; /* For wallet object */ +typedef struct nzssEntry nzssEntry; /* For secretstore */ +typedef struct nzpkcs11_Info nzpkcs11_Info; + +/* + * Crypto Engine State + * + * Once the crypto engine (CE) has been initialized for a particular + * cipher, it is either at the initial state, or it is continuing to + * use the cipher. NZTCES_END is used to change the state back to + * initialized and flush any remaining output. NZTTCES_RESET can be + * used to change the state back to initialized and throw away any + * remaining output. + */ +enum nzttces +{ + NZTTCES_CONTINUE = 1, /* Continue processing input */ + NZTTCES_END, /* End processing input */ + NZTTCES_RESET /* Reset processing and skip generating output */ +}; +typedef enum nzttces nzttces; + +/* + * Crypto Engine Functions + * + * List of crypto engine categories; used to index into protection + * vector. + */ +enum nzttcef +{ + NZTTCEF_DETACHEDSIGNATURE = 1, /* Signature, detached from content */ + NZTTCEF_SIGNATURE, /* Signature combined with content */ + NZTTCEF_ENVELOPING, /* Signature and encryption with content */ + NZTTCEF_PKENCRYPTION, /* Encryption for one or more recipients */ + NZTTCEF_ENCRYPTION, /* Symmetric encryption */ + NZTTCEF_KEYEDHASH, /* Keyed hash/checkusm */ + NZTTCEF_HASH, /* Hash/checsum */ + NZTTCEF_RANDOM, /* Random byte generation */ + + NZTTCEF_LAST /* Used for array size */ +}; +typedef enum nzttcef nzttcef; + +/* + * State of the persona. + */ +enum nzttState +{ + NZTTSTATE_EMPTY = 0, /* is not in any state(senseless???) */ + NZTTSTATE_REQUESTED, /* cert-request */ + NZTTSTATE_READY, /* certificate */ + NZTTSTATE_INVALID, /* certificate */ + NZTTSTATE_RENEWAL /* renewal-requested */ +}; +typedef enum nzttState nzttState; + +/* + * Cert-version types + * + * This is used to quickly look-up the cert-type + */ +enum nzttVersion +{ + NZTTVERSION_X509v1 = 1, /* X.509v1 */ + NZTTVERSION_X509v3, /* X.509v3 */ +#ifdef NZDEPRECATED + NZTTVERSION_SYMMETRIC, /* Symmetric */ +#endif + NZTTVERSION_INVALID_TYPE /* For Initialization */ +}; +typedef enum nzttVersion nzttVersion; + +/* + * Cipher Types + * + * List of all cryptographic algorithms, some of which may not be + * available. + */ +enum nzttCipherType +{ + NZTTCIPHERTYPE_RSA = 1, /* RSA public key */ + NZTTCIPHERTYPE_DES, /* DES */ + NZTTCIPHERTYPE_RC4, /* RC4 */ + NZTTCIPHERTYPE_MD5DES, /* DES encrypted MD5 with salt (PBE) */ + NZTTCIPHERTYPE_MD5RC2, /* RC2 encrypted MD5 with salt (PBE) */ + NZTTCIPHERTYPE_MD5, /* MD5 */ + NZTTCIPHERTYPE_SHA /* SHA */ +}; +typedef enum nzttCipherType nzttCipherType; + +/* + * TDU Formats + * + * List of possible toolkit data unit (TDU) formats. Depending on the + * function and cipher used some may be not be available. + */ +enum nztttdufmt +{ + NZTTTDUFMT_PKCS7 = 1, /* PKCS7 format */ + NZTTTDUFMT_RSAPAD, /* RSA padded format */ + NZTTTDUFMT_ORACLEv1, /* Oracle v1 format */ + NZTTTDUFMT_LAST /* Used for array size */ +}; +typedef enum nztttdufmt nztttdufmt; + +/* + * Validate State + * + * Possible validation states an identity can be in. + */ +enum nzttValState +{ + NZTTVALSTATE_NONE = 1, /* Needs to be validated */ + NZTTVALSTATE_GOOD, /* Validated */ + NZTTVALSTATE_REVOKED /* Failed to validate */ +}; +typedef enum nzttValState nzttValState; + +/* + * Policy Fields <----NEW (09/14/98) + * + * Policies enforced + */ +enum nzttPolicy +{ + NZTTPOLICY_NONE = 0, + NZTTPOLICY_RETRY_1, /* number of retries for decryption = 1 */ + NZTTPOLICY_RETRY_2, /* number of retries for decryption = 2 */ + NZTTPOLICY_RETRY_3 /* number of retries for decryption = 3 */ +}; +typedef enum nzttPolicy nzttPolicy; + +/* + * Persona Usage <----NEW (09/14/98) + * + * what a persona will be used for? + */ + +#ifdef NZDEPRECATED_MULTIPLECERTS +enum nzttUsage +{ + NZTTUSAGE_NONE = 0, + NZTTUSAGE_SSL /* persona for SSL usage */ +}; +typedef enum nzttUsage nzttUsage; +#endif + +/* + * Personas and identities have unique id's that are represented with + * 128 bits. + */ +typedef ub1 nzttID[16]; + +/* + * Identity Types + * + * List of all Identity types.. + */ +enum nzttIdentType +{ + NZTTIDENTITYTYPE_INVALID_TYPE = 0, + NZTTIDENTITYTYPE_CERTIFICTAE, + NZTTIDENTITYTYPE_CERT_REQ, + NZTTIDENTITYTYPE_RENEW_CERT_REQ, + NZTTIDENTITYTYPE_CLEAR_ETP, + NZTTIDENTITYTYPE_CLEAR_UTP, + NZTTIDENTITYTYPE_CLEAR_PTP +}; +typedef enum nzttIdentType nzttIdentType; + +typedef ub4 nzttKPUsage; +/* IF new types are added nztiMUS should be changed */ +#define NZTTKPUSAGE_NONE 0 +#define NZTTKPUSAGE_SSL 1 /* SSL Server */ +#define NZTTKPUSAGE_SMIME_ENCR 2 +#define NZTTKPUSAGE_SMIME_SIGN 4 +#define NZTTKPUSAGE_CODE_SIGN 8 +#define NZTTKPUSAGE_CERT_SIGN 16 +#define NZTTKPUSAGE_SSL_CLIENT 32 /* SSL Client */ +#define NZTTKPUSAGE_INVALID_USE 0xffff + + +/* + * Timestamp as 32 bit quantity in UTC. + */ +typedef ub1 nzttTStamp[4]; + +/* + * Buffer Block + * + * A function that needs to fill (and possibly grow) an output buffer + * uses an output parameter block to describe each buffer. + * + * The flags_nzttBufferBlock member tells the function whether the + * buffer can be grown or not. If flags_nzttBufferBlock is 0, then + * the buffer will be realloc'ed automatically. + * + * The buflen_nzttBufferBLock member is set to the length of the + * buffer before the function is called and will be the length of the + * buffer when the function is finished. If buflen_nzttBufferBlock is + * 0, then the initial pointer stored in pobj_nzttBufferBlock is + * ignored. + * + * The objlen_nzttBufferBlock member is set to the length of the + * object stored in the buffer when the function is finished. If the + * initial buffer had a non-0 length, then it is possible that the + * object length is shorter than the buffer length. + * + * The pobj_nzttBufferBlock member is a pointer to the output object. + */ +struct nzttBufferBlock +{ +# define NZT_NO_AUTO_REALLOC 0x1 + + uword flags_nzttBufferBlock; /* Flags */ + ub4 buflen_nzttBufferBlock; /* Total length of buffer */ + ub4 usedlen_nzttBufferBlock; /* Length of used buffer part */ + ub1 *buffer_nzttBufferBlock; /* Pointer to buffer */ +}; +typedef struct nzttBufferBlock nzttBufferBlock; + +/* + * Wallet. + */ +struct nzttWallet +{ + ub1 *ldapName_nzttWallet; /* user's LDAP Name */ + ub4 ldapNamelen_nzttWallet; /* len of user's LDAP Name */ + nzttPolicy securePolicy_nzttWallet; /* secured-policy of the wallet */ + nzttPolicy openPolicy_nzttWallet; /* open-policy of the wallet */ + nzttPersona *persona_nzttWallet; /* List of personas in wallet */ + nzttWalletPrivate *private_nzttWallet; /* Private wallet information */ +#ifdef NZDEPRECATED + ub4 npersona_nzttWallet; /* Number of personas */ +#endif +}; + +/* + * The wallet contains, one or more personas. A persona always + * contains its private key and its identity. It may also contain + * other 3rd party identites. All identities qualified with trust + * where the qualifier can indicate anything from untrusted to trusted + * for specific operations. + */ + +/* + * Persona + * + * Structure containing information about a persona. + */ +struct nzttPersona +{ + ub1 *genericName_nzttPersona; /* user-friendly persona name */ + ub4 genericNamelen_nzttPersona; /* persona-name length */ + nzttPersonaPrivate *private_nzttPersona; /* Opaque part of persona */ + nzttIdentity *mycertreqs_nzttPersona; /* My cert-requests */ + nzttIdentity *mycerts_nzttPersona; /* My certificates */ + nzttIdentity *mytps_nzttPersona; /* List of trusted identities */ + nzssEntry *mystore_nzttPersona; /* List of secrets */ + nzpkcs11_Info *mypkcs11Info_nzttPersona; /* PKCS11 token info */ + struct nzttPersona *next_nzttPersona; /* Next persona */ +#ifdef NZDEPRECATED_MULTIPLECERTS + /* As Persona has multiple certs for different + usages, Persona Usage does not mean anything. Similarly + each key pair has its own state and Persona state itself + does not mean anything. - lk 5/31/00 + */ + nzttUsage usage_nzttPersona; /* persona usage; SSL/SET/.. */ + nzttState state_nzttPersona; /* persona state-requested/ready */ + ub4 ntps_nzttPersona; /* Num of trusted identities */ +#endif +}; + +/* + * Identity + * + * Structure containing information about an identity. + * + * NOTE + * -- the next_trustpoint field only applies to trusted identities and + * has no meaning (i.e. is NULL) for self identities. + */ +struct nzttIdentity +{ + text *dn_nzttIdentity; /* Alias */ + ub4 dnlen_nzttIdentity; /* Length of alias */ + text *comment_nzttIdentity; /* Comment */ + ub4 commentlen_nzttIdentity; /* Length of comment */ + nzttIdentityPrivate *private_nzttIdentity; /* Opaque part of identity */ + nzttIdentity *next_nzttIdentity; /* next identity in list */ +}; + +struct nzttB64Cert +{ + ub1 *b64Cert_nzttB64Cert; + ub4 b64Certlen_nzttB64Cert; + struct nzttB64Cert *next_nzttB64Cert; +}; +typedef struct nzttB64Cert nzttB64Cert; + + +struct nzttPKCS7ProtInfo +{ + nzttCipherType mictype_nzttPKCS7ProtInfo; /* Hash cipher */ + nzttCipherType symmtype_nzttPKCS7ProtInfo; /* Symmetric cipher */ + ub4 keylen_nzttPKCS7ProtInfo; /* Length of key to use */ +}; +typedef struct nzttPKCS7ProtInfo nzttPKCS7ProtInfo; + +/* + * Protection Information. + * + * Information specific to a type of protection. + */ +union nzttProtInfo +{ + nzttPKCS7ProtInfo pkcs7_nzttProtInfo; +}; +typedef union nzttProtInfo nzttProtInfo; + +/* + * A description of a persona so that the toolkit can create one. A + * persona can be symmetric or asymmetric and both contain an + * identity. The identity for an asymmetric persona will be the + * certificate and the identity for the symmetric persona will be + * descriptive information about the persona. In either case, an + * identity will have been created before the persona is created. + * + * A persona can be stored separately from the wallet that references + * it. By default, a persona is stored with the wallet (it inherits + * with WRL used to open the wallet). If a WRL is specified, then it + * is used to store the actuall persona and the wallet will have a + * reference to it. + */ +struct nzttPersonaDesc +{ + ub4 privlen_nzttPersonaDesc; /* Length of private info (key)*/ + ub1 *priv_nzttPersonaDesc; /* Private information */ + ub4 prllen_nzttPersonaDesc; /* Length of PRL */ + text *prl_nzttPersonaDesc; /* PRL for storage */ + ub4 aliaslen_nzttPersonaDesc; /* Length of alias */ + text *alias_nzttPersonaDesc; /* Alias */ + ub4 longlen_nzttPersonaDesc; /* Length of longer description*/ + text *long_nzttPersonaDesc; /* Longer persona description */ +}; +typedef struct nzttPersonaDesc nzttPersonaDesc; + +/* + * A description of an identity so that the toolkit can create one. + * Since an identity can be symmetric or asymmetric, the asymmetric + * identity information will not be used when a symmetric identity is + * created. This means the publen_nzttIdentityDesc and + * pub_nzttIdentityDesc members will not be used when creating a + * symmetric identity. + */ +struct nzttIdentityDesc +{ + ub4 publen_nzttIdentityDesc; /* Length of identity */ + ub1 *pub_nzttIdentityDesc; /* Type specific identity */ + ub4 dnlen_nzttIdentityDesc; /* Length of alias */ + text *dn_nzttIdentityDesc; /* Alias */ + ub4 longlen_nzttIdentityDesc; /* Length of longer description */ + text *long_nzttIdentityDesc; /* Longer description */ + ub4 quallen_nzttIdentityDesc; /* Length of trust qualifier */ + text *trustqual_nzttIdentityDesc; /* Trust qualifier */ +}; +typedef struct nzttIdentityDesc nzttIdentityDesc; + +/********************************/ +/* PUBLIC FUNCTION DECLARATIONS */ +/********************************/ + +/*---------------------- nztwOpenWallet ----------------------*/ + +/* + * NAME + * nztwOpenWallet - Open a wallet based on a wallet Resource Locator (WRL). + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wrllen {IN} Length of WRL. + * wrl {IN} WRL. + * pwdlen {IN} Length of password. + * pwd {IN} Password. + * wallet {IN/OUT} Initialized wallet structure. + * + * NOTES + * The syntax for a WRL is :. + * + * Wallet Type Wallet Type Parameters. + * ----------- ---------------------- + * File Pathname (e.g. "file:/home/asriniva") + * Oracle Connect string (e.g. "oracle:scott/tiger@oss") + * + * There are also defaults. If the WRL is NZT_DEFAULT_WRL, then + * the platform specific WRL default is used. If only the wallet + * type is specified, then the WRL type specific default is used + * (e.g. "oracle:") + * + * There is an implication with Oracle that should be stated: An + * Oracle based wallet can be implemented in a user's private space + * or in world readable space. + * + * When the wallet is opened, the password is verified by hashing + * it and comparing against the password hash stored with the + * wallet. The list of personas (and their associated identities) + * is built and stored into the wallet structure. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_RIO_OPEN RIO could not open wallet (see network trace file). + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_TK_WRLTYPE WRL type is not known. + * NZERROR_TK_WRLPARM WRL parm does not match type. + */ +nzerror nztwOpenWallet( nzctx *, ub4, text *, ub4, text *, + nzttWallet * ); + + +/*---------------------- nztwCloseWallet ----------------------*/ + +/* + * NAME + * nztwCloseWallet - Close a wallet + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wallet {IN/OUT} Wallet. + * + * NOTES + * Closing a wallet also closes all personas associated with that + * wallet. It does not cause a persona to automatically be saved + * if it has changed. The implication is that a persona can be + * modified by an application but if it is not explicitly saved it + * reverts back to what was in the wallet. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_RIO_CLOSE RIO could not close wallet (see network trace file). + */ +nzerror nztwCloseWallet( nzctx *, nzttWallet * ); + +/*--------------------nztwGetCertInfo----------------------------*/ +/****NOTE: This function is a temporary hack.****/ +/****DO NOT CALL. It will soon disappear.****/ +nzerror nztwGetCertInfo( nzctx *nz_context, + nzosContext *nzosCtx, + nzttWallet *walletRef, + void *peerCert ); + + +/*------------------------ nztwConstructWallet -----------------------*/ +/* + * + * nzerror nztwConstructWallet( nzctx *oss_context, + * nzttPolicy openPolicy, + * nzttPolicy securePolicy, + * ub1 *ldapName, + * ub4 ldapNamelen, + * nzstrc *wrl, + * nzttPersona *personas, + * nzttWallet **wallet ); + */ + +/*---------------------- nztwRetrievePersonaCopy ----------------------*/ + +/* + * NAME + * nztwRetrievePersonaCopy - Retrieves a persona based from wallet + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wallet {IN} Wallet. + * index {IN} Which wallet index to remove (first persona is zero). + * persona {OUT} Persona found. + * + * NOTES + * Retrieves a persona from the wallet based on the index number passed + * in. This persona is a COPY of the one stored in the wallet, therefore + * it is perfectly fine for the wallet to be closed after this call is + * made. + * + * The caller is responsible for disposing of the persona when completed. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztwRetrievePersonaCopy( nzctx *, nzttWallet *, ub4, + nzttPersona ** ); + + +/*---------------------- nztwRetrievePersonaCopyByName ----------------------*/ + +/* + * NAME + * nztwRetrievePersonaCopyByName - Retrieves a persona based on its name. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wallet {IN} Wallet. + * name {IN} Name of the persona + * persona {OUT} Persona found. + * + * NOTES + * Retrieves a persona from the wallet based on the name of the persona. + * This persona is a COPY of the one stored in the wallet, therefore + * it is perfectly fine for the wallet to be closed after this call is + * made. + * + * The caller is responsible for disposing of the persona when completed. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztwRetrievePersonaCopyByName( nzctx *, nzttWallet *, char *, + nzttPersona ** ); + +/*---------------------- nzteOpenPersona ----------------------*/ + +/* + * NAME + * nzteOpenPersona - Open a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password failed to decrypt persona. + * NZERROR_TK_BADPRL Persona resource locator did not work. + * NZERROR_RIO_OPEN Could not open persona (see network trace file). + */ +nzerror nzteOpenPersona( nzctx *, nzttPersona * ); + +/*--------------------- nzteClosePersona ---------------------*/ + +/* + * NAME + * nzteClosePersona - Close a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * Closing a persona does not store the persona, it simply releases + * the memory associated with the crypto engine. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nzteClosePersona( nzctx *, nzttPersona * ); + +/*--------------------- nzteDestroyPersona ---------------------*/ + +/* + * NAME + * nzteDestroyPersona - Destroy a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * The persona is destroyd in the open state, but it will + * not be associated with a wallet. + * + * The persona parameter is doubly indirect so that at the + * conclusion of the function, the pointer can be set to NULL. + * + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_TYPE Unsupported itype/ctype combination. + * NZERROR_TK_PARMS Error in persona description. + */ +nzerror nzteDestroyPersona( nzctx *, nzttPersona ** ); + +/*---------------------- nzteRetrieveTrustedIdentCopy ----------------------*/ + +/* + * NAME + * nzteRetrieveTrustedIdentCopy - Retrieves a trusted identity from persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * index {IN} Which wallet index to remove (first element is zero). + * identity {OUT} Trusted Identity from this persona. + * + * NOTES + * Retrieves a trusted identity from the persona based on the index + * number passed in. This identity is a COPY of the one stored in + * the persona, therefore it is perfectly fine to close the persona + * after this call is made. + * + * The caller is responsible for freeing the memory of this object + * by calling nztiAbortIdentity it is no longer needed + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nzteRetrieveTrustedIdentCopy( nzctx *, nzttPersona *, ub4, + nzttIdentity ** ); + +/*--------------------- nztePriKey ---------------------*/ + +/* + * NAME + * nztePriKey - Get the decrypted Private Key for the Persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * vkey {OUT} Private Key [B_KEY_OBJ] + * vkey_len {OUT} Private Key Length + * + * NOTES + * This funiction will only work for X.509 based persona which contain + * a private key. + * A copy of the private key is returned to the caller so that they do not + * have to worry about the key changeing "underneath them". + * Memory will be allocated for the vkey and therefore, the CALLER + * will be responsible for freeing this memory. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_NO_MEMORY ossctx is null. + * NZERROR_TK_BADPRL Persona resource locator did not work. + */ +nzerror nztePriKey( nzctx *, nzttPersona *, ub1 **, ub4 * ); + +/*--------------------- nzteMyCert ---------------------*/ + +/* + * NAME + * nzteMyCert - Get the X.509 Certificate for a persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * cert {OUT} X.509 Certificate [BER encoded] + * cert_len {OUT} Certificate length + * + * NOTES + * This funiction will only work for X.509 based persona which contain + * a certificate for the self identity. + * A copy of the certificate is returned to the caller so that they do not + * have to worry about the certificate changeing "underneath them". + * Memory will be allocated for the cert and therefore, the CALLER + * will be responsible for freeing this memory. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_NO_MEMORY ossctx is null. + */ +nzerror nzteMyCert( nzctx *, nzttPersona *, ub1 **, ub4 * ); + +/*--------------------- nzteX509CreatePersona ---------------------*/ + +/* + * NAME + * nzteX509CreatePersona - Given a BER X.509 cert, create a persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * cert {IN} X.509 Certificate [BER encoded] + * cert_len {IN} Certificate length + * persona {OUT} Persona. + * + * NOTES + * Memory will be allocated for the persona and therefore, the CALLER + * will be responsible for freeing this memory. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_NO_MEMORY ossctx is null. + */ +nzerror nzteX509CreatePersona( nzctx *, ub1 *, ub4, nzttPersona ** ); + +/*-------------------- nztiCreateIdentity --------------------*/ + +/* + * NAME + * nztiCreateIdentity - Create an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * itype {IN} Identity type. + * desc {IN} Description of identity. + * identity {IN/OUT} Identity. + * + * NOTES + * Memory is only allocated for the identity structure. The elements in + * the description struct are not copied. Rather their pointers are copied + * into the identity structure. Therefore, the caller should not free + * the elements referenced by the desc. These elements will be freed + * when the nztiDestroyIdentity is called. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_PARMS Error in description. + */ +nzerror nztiCreateIdentity( nzctx *, nzttVersion, nzttIdentityDesc *, + nzttIdentity ** ); + +#ifdef NZ_OLD_TOOLS +/*-------------------- nztiDuplicateIdentity --------------------*/ + +/* + * NAME + * nztiDuplicateIdentity - Duplicate an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN} Target Identity. + * new_identity {IN} New Identity. + * + * NOTES + * Memory for the identity is allocated inside the function, and all + * internal identity elements as well. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTFOUND Identity not found. + * NZERROR_PARMS Error in description. + */ +nzerror nztiDuplicateIdentity( nzctx *, nzttIdentity *, + nzttIdentity ** ); +#endif /* NZ_OLD_TOOLS */ + +/*--------------------- nztiAbortIdentity ---------------------*/ + +/* + * NAME + * nztiAbortIdentity - Abort an unassociated identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN/OUT} Identity. + * + * NOTES + * It is an error to try to abort an identity that can be + * referenced through a persona. + * + * The identity pointer is set to NULL at the conclusion. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_CANTABORT Identity is associated with persona. + */ +nzerror nztiAbortIdentity( nzctx *, nzttIdentity ** ); + +#ifdef NZ_OLD_TOOLS +/*----------------- nztidGetIdentityDesc -----------------*/ + +/* + * NAME + * nztidGetIdentityDesc - Gets an Identity Description from the identity + * + * PARAMETERS + * osscntxt {IN} Success. + * identity {IN} Identity. + * description {IN/OUT} Identity Description. + * + * NOTES + * Memory is allocated for the Identity Description. It + * is the callers responsibility to free this memory by calling + * nztiFreeIdentityDesc. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztidGetIdentityDesc( nzctx *, nzttIdentity *, + nzttIdentityDesc ** ); + +/*----------------- nztidFreeIdentityDesc -----------------*/ + +/* + * NAME + * nztidFreeIdentityDesc - Frees memory for Identity Desc object. + * + * PARAMETERS + * osscntxt {IN} oss context. + * description {IN/OUT} Identity Description. + * + * NOTES + * Memory is freed for all Identity description elements. Pointer is + * then set to null. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztidFreeIdentityDesc( nzctx *, nzttIdentityDesc ** ); +#endif /* NZ_OLD_TOOLS */ + +/*---------------- nztific_FreeIdentityContent ----------------*/ + +/* + * NAME + * nztific_FreeIdentityContent - free the contents of an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN/OUT} freed identity + * + * NOTES + * Free a created identity. + * + * RETURNS + * NZERROR_OK Success. + */ +/* + * Free the identity content. + */ +nzerror nztific_FreeIdentityContent( nzctx *ossctx, + nzttIdentity *identity ); + + +/*-------------------------- nztSign --------------------------*/ + +/* + * NAME + * nztSign - Create an attached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Open persona acting as signer. + * state {IN} State of signature. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztSign( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------------- nztVerify -------------------------*/ + +/* + * NAME + * nztVerify - Verify an attached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of verification. + * intdulen {IN} TDU length. + * intdu {IN} TDU. + * out {IN/OUT} Extracted message. + * verified {OUT} TRUE if signature verified. + * validated{OUT} TRUE if signing identity validated. + * identity {OUT} Identity of signing party. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow outptu buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztVerify( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock *, boolean *, boolean *, + nzttIdentity ** ); + +/*------------------------ nztValidate ------------------------*/ + +/* + * NAME + * nztValidate - Validate an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * identity {IN} Identity. + * validated{OUT} TRUE if identity was validated. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztValidate( nzctx *, nzttPersona *, nzttIdentity *, boolean * ); + +/*-------------------- nztsd_SignDetached --------------------*/ + +/* + * NAME + * nztsd_SignDetached - Generate a detached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of signature. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztsd_SignDetached( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------- nztved_VerifyDetached -------------------*/ + +/* + * NAME + * nztved_VerifyDetached - Verify a detached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of verification. + * inlen {IN} Length of data. + * in {IN} Data. + * intdulen {IN} Input TDU length. + * tdu {IN} Input TDU. + * verified {OUT} TRUE if signature verified. + * validated{OUT} TRUE if signing identity validated. + * identity {OUT} Identity of signing party. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztved_VerifyDetached( nzctx *, nzttPersona *, nzttces, ub4, + ub1 *, ub4, ub1 *, boolean *, boolean *, + nzttIdentity ** ); + +/*--------------------- nztkec_PKEncrypt ---------------------*/ + +/* + * NAME + * nztkec_PKEncrypt - Encrypt data symmetrically, encrypt key asymmetrically + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nrecipients {IN} Number of recipients for this encryption. + * recipients {IN} List of recipients. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * There is a limitation of 1 recipient (nrecipients = 1) at this + * time. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztkec_PKEncrypt( nzctx *, nzttPersona *, ub4, nzttIdentity *, + nzttces, ub4, ub1 *, nzttBufferBlock * ); + +/*---------------- nztxkec_PKEncryptExpansion ----------------*/ + +/* + * NAME + * nztxkec_PKEncryptExpansion - Determine the buffer needed for PKEncrypt + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nrecipients {IN} Number of recipients. + * inlen {IN} Length of input. + * tdulen {out} Length of buffer need. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxkec_PKEncryptExpansion( nzctx *, nzttPersona *, ub4, ub4, + ub4 * ); + +/*--------------------- nztkdc_PKDecrypt ---------------------*/ + +/* + * NAME + * nztkdc_PKDecrypt - Decrypt a PKEncrypted message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztkdc_PKDecrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*-------------------------- nztHash --------------------------*/ + +/* + * NAME + * nztHash - Generate a hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of hash. + * inlen {IN} Length of this input. + * in {IN} This input. + * tdu {IN/OUT} Output tdu. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztHash( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*----------------------- nztSeedRandom -----------------------*/ + +/* + * NAME + * nztSeedRandom - Seed the random function + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * seedlen {IN} Length of seed. + * seed {IN} Seed. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztSeedRandom( nzctx *, nzttPersona *, ub4, ub1 * ); + +/*--------------------- nztrb_RandomBytes ---------------------*/ + +/* + * NAME + * nztrb_RandomBytes - Generate a buffer random bytes. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nbytes {IN} Number of bytes desired. + * out {IN/OUT} Buffer block for bytes. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztrb_RandomBytes( nzctx *, nzttPersona *, ub4, + nzttBufferBlock * ); + +/*-------------------- nztrn_RandomNumber --------------------*/ + +/* + * NAME + * nztrn_RandomNumber - Generate a random number + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * num {OUT} Number. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztrn_RandomNumber( nzctx *, nzttPersona *, uword * ); + +/*---------------------- nztbbInitBlock ----------------------*/ + +/* + * NAME + * nztbbInitBlock - Initialize a buffer block. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * block {IN/OUT} Buffer block. + * + * NOTES + * The buffer block is initialized to be empty (all members are set + * to 0/NULL). Such a block will be allocated memory as needed. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbInitBlock( nzctx *, nzttBufferBlock * ); + +/*---------------------- nztbbReuseBlock ----------------------*/ + +/* + * NAME + * nztbbReuseBlock - Reuse an already initialized and possibly used block. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * block {IN/OUT} Buffer block. + * + * NOTES + * This function simply sets the used length member of the buffer + * block to 0. If the block already has memory allocated to it, + * this will cause it to be reused. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbReuseBlock( nzctx *, nzttBufferBlock * ); + +/*---------------------- nztbbSizeBlock ----------------------*/ + +/* + * NAME + * nztbbSizeBlock - Size an initialized block to a particular size. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * len {IN} Minimum number of unused bytes desired. + * block {IN/OUT} Buffer block. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbSizeBlock( nzctx *, ub4, nzttBufferBlock * ); + +/*----------------------- nztbbGrowBlock -----------------------*/ + +/* + * NAME + * nzbbGrowBlock - Increase the size of the buffer block. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * inc {IN} Number of bytes to increase. + * block {IN/OUT} Buffer block. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbGrowBlock( nzctx *, ub4, nzttBufferBlock * ); + +/*---------------------- nztbbPurgeBlock ----------------------*/ + +/* + * NAME + * nztbbPurgeBlock - Purge a buffer block of its memory. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * block {IN/OUT} Buffer block. + * + * NOTES + * The memory used by the buffer block as the buffer is released. + * The buffer block itself is not affected. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbPurgeBlock( nzctx *, nzttBufferBlock * ); + +/*----------------------- nztbbSetBlock -----------------------*/ + +/* + * NAME + * nztbbSetBlock - Set a buffer block to a known state. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * flags {IN} Flags to set. + * buflen {IN} Length of buffer. + * usedlen {IN} Used length. + * buffer {IN} Buffer. + * block {IN/OUT} Buffer block + * + * NOTES + * If buflen > 0, objlen == 0, and obj == NULL, then buflen bytes + * of memory is allocated and a pointer is stored in the buffer + * block. + * + * The buffer parameter remains unchanged. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbSetBlock( nzctx *, uword, ub4, ub4, ub1 *, + nzttBufferBlock * ); + + +/*--------------------- nztiGetSecInfo ---------------------*/ + +/* + * NAME + * nztiGetSecInfo - Get some security information for SSL + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * persona {IN} persona + * dname {OUT} distinguished name of the certificate + * dnamelen {OUT} length of the distinguished name + * issuername {OUT} issuer name of the certificate + * certhash {OUT} SHA1 hash of the certificate + * certhashlen{OUT} length of the hash + * NOTES + * This function allocate memories for issuername, certhash, and dname. + * To deallocate memory for those params, you should call nztdbuf_DestroyBuf. + * RETURNS + * + */ +nzerror nztiGetSecInfo( nzctx *, nzttPersona *, text **, ub4 *, + text **, ub4 *, ub1 **, ub4 * ); + + +/*---------------------- nztiGetDName ----------------------*/ + +/* + * NAME + * nztiGetDName - Get the distinguished name for the given identity + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity need to get dname from + * dn {OUT} distinguished name + * dnlen {OUT} length of the dname + * + * NOTES + * + * RETURNS + * + */ + +nzerror nztiGetDName( nzctx *, nzttIdentity *, + text **, ub4 * ); + +/*------------------- nztiGetIssuerName -------------------*/ + +/* + * NAME + * nztiGetIssuerName - Get IssuerName for the given identity + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity need to get issuername from + * issuername {OUT} issuer's name + * issuernamelen {OUT} length of the issuer's name + * + * NOTES + * + * RETURNS + * + */ +nzerror nztiGetIssuerName( nzctx *, nzttIdentity *, + text **, ub4 * ); + + +/*-------------------- nztgch_GetCertHash --------------------*/ + +/* + * NAME + * nztgch_GetCertHash - Get SHA1 hash for the certificate of the identity + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity need to get issuername from + * certHash {OUT} certHash buffer + * hashLen {OUT} length of the certHash + * + * NOTES + * Need to call nztdbuf_DestroyBuf to deallocate memory for certHash. + * RETURNS + * + */ +nzerror nztgch_GetCertHash( nzctx *, nzttIdentity *, + ub1 **, ub4 * ); + +/*-------------------- nztdbuf_DestroyBuf --------------------*/ + +/* + * NAME + * nztdbuf_DestroyBuf - Deallocation funtions for ub1 and text buffer + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * buf {IN} Allocated buffer to be destroyed. + * + * NOTES + * + * RETURNS + * + */ +nzerror nztdbuf_DestroyBuf( nzctx *, void ** ); + + +/*----------------------- nztGetCertChain -----------------------*/ + +/* + * NAME + * nztGetCertChain - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * + * NOTES + * + * RETURNS + * + */ +nzerror nztGetCertChain( nzctx *, nzttWallet * ); + +/*----------------------- nztCompareDN -----------------------*/ + +/* + * NAME + * nztCompareDN - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * dn1 {IN} distinguished name 1 + * dn2 {IN} distinguished name 2 + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztCompareDN( nzctx *, ub1 *,ub4 , ub1 *, ub4, boolean * ); + + +#ifdef NZ_OLD_TOOLS +/*--------------------- nztIdentityAlloc ---------------------*/ + +/* + * NAME + * nztIdentityAlloc - Allocate memory for nzttIdentity context + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {OUT} nzttIdentity context + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztIdentityAlloc( nzctx *, nzttIdentity ** ); + +/*--------------------- nztIPrivateAlloc ---------------------*/ + +/* + * NAME + * nztIPrivateAlloc - Allocate memory for nzttIdentityPrivate + * + * PARAMETERS + * Name {IN/OUT} Description + * + * osscntxt {IN} OSS context. + * ipriv {OUT} identityPrivate structure + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ + +nzerror nztIPrivateAlloc( nzctx *, nzttIdentityPrivate **); + + +/*---------------------- nztIDupContent ----------------------*/ + +/* + * NAME + * nztIDupContent - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * targetIdentity{OUT} target identity + * sourceIdentity {IN} source identity + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ + +nzerror nztIDupContent( nzctx *, nzttIdentity *, nzttIdentity * ); +/*---------------------- nztIPDuplicate ----------------------*/ + +/* + * NAME + * nztIPDuplicate - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * target_ipriv {OUT} target identityPrivate + * source_ipriv {IN} source identityPrivate + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztIPDuplicate( nzctx *, nzttIdentityPrivate **, + nzttIdentityPrivate * ); + +/*--------------------- nztiDupIdentList ---------------------*/ + +/* + * NAME + * nztiDupIdentList - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * source_identities {IN} source identity list + * numIdent {OUT} number of identity in the list + * ppidentity {OUT} Target of identity + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztiDupIdentList( nzctx *, nzttIdentity *, ub4 *, + nzttIdentity ** ); + +/*--------------------- nztFreeIdentList ---------------------*/ + +/* + * NAME + * nztFreeIdentList - Free memory for a list of Identities + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity context + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztFreeIdentList( nzctx *, nzttIdentity ** ); +#endif /* NZ_OLD_TOOLS */ + +/*--------------------- nztCheckVaLidity ---------------------*/ + +/* + * NAME + * nztCheckVaLidity - Check the validity of certificate + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * start_time Start time of the certificate + * end_time End time of the certificate + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztCheckValidity( nzctx *, ub4 , ub4 ); + +/*--------------------- nztwCreateWallet ---------------------*/ + +/* + * NAME + * nztwCreateWallet - Create a new wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wrllen {IN} Length of wallet resource locator. + * wrl {IN} WRL. + * pwdlen {IN} Length of password (see notes below). + * pwd {IN} Password. + * wallet {IN/OUT} Wallet. + * + * NOTES + * It is an error to try to create a wallet that already exists. + * The previously existing wallet must be destroyed first. + * + * The wallet itself is not encrypted. Rather, all the personas in + * the wallet are encrypted under the same password. A hash of the + * password is stored in the wallet. + * + * Upon success, an empty open wallet is stored in the wallet + * parameter. + * + * RETURNS + * NZERROR_OK Sucess. + * NZERROR_TK_WALLET_EXISTS Wallet already exists. + * NZERROR_RIO_OPEN RIO could not create wallet (see trace file). + */ +nzerror nztwCreateWallet( nzctx *, ub4, text *, ub4, text *, + nzttWallet * ); + + +/*--------------------- nztwDestroyWallet ---------------------*/ + +/* + * NAME + * nztwDestroyWallet - Destroy an existing wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wrllen {IN} Length of wallet resource locator. + * wrl {IN} WRL. + * pwdlen {IN} Length of password. + * pwd {IN} Password. + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_RIO_OPEN RIO could not open wallet (see trace file). + * NZERROR_RIO_DELETE Delete failed (see trace file). + */ +nzerror nztwDestroyWallet( nzctx *, ub4, text *, ub4, text * ); + +/*--------------------- nzteStorePersona ---------------------*/ + +/* + * NAME + * nzteStorePersona - Store an open persona in a wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * wallet {IN/OUT} Wallet. + * + * NOTES + * If the open persona is not associated with any wallet (it was + * created via the nzteClosePersona function), then storing the + * persona creates that association. The wallet will also have an + * updated persona list that reflects this association. + * + * If the open persona was associated with wallet 'A' (it was + * opened via the nztwOpenWallet function), and is stored back into + * wallet 'A', then then the old persona is overwritten by the new + * persona if the password can be verified. Recall that all + * personas have a unique identity id. If that id changes then + * storing the persona will put a new persona in the wallet. + * + * If the open persona was associated with wallet 'A' and is stored + * into wallet 'B', and if wallet 'B' does not contain a persona + * with that unique identity id, then the persona will be copied + * into wallet 'B', wallet 'B''s persona list will be updated, and + * the persona structure will be updated to be associated with + * wallet 'B'. If wallet 'B' already contained the persona, it + * would be overwritten by the new persona. + * + * The persona parameter is doubly indirect so that at the + * conclusion of the function call, the pointer can be directed to + * the persona in the wallet. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_RIO_STORE Store failed (see network trace file). + */ +nzerror nzteStorePersona( nzctx *, nzttPersona **, nzttWallet * ); + +/*--------------------- nzteRemovePersona ---------------------*/ + +/* + * NAME + * nzteRemovePersona - Remove a persona from the wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * The password is verified before trying to remove the persona. + * + * If the persona is open, it is closed. The persona is removed + * from the wallet list and the persona pointer is set to NULL. + * + * A double indirect pointer to the persona is required so that the + * persona pointer can be set to NULL upon completion. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_RIO_DELETE Delete failed. + */ +nzerror nzteRemovePersona( nzctx *, nzttPersona ** ); + +/*--------------------- nzteCreatePersona ---------------------*/ + +/* + * NAME + * nzteCreatePersona - Create a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * itype {IN} Identity type. + * ctype {IN} Cipher type. + * desc {IN} Persona description. + * persona {OUT} Persona. + * + * NOTES + * The resulting persona is created in the open state, but it will + * not be associated with a wallet. + * + * The memory for the persona is allocated by the function. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_TYPE Unsupported itype/ctype combination. + * NZERROR_TK_PARMS Error in persona description. + */ +nzerror nzteCreatePersona( nzctx *, nzttVersion, nzttCipherType, + nzttPersonaDesc *, nzttPersona ** ); + + +/*----------------- nztiStoreTrustedIdentity -----------------*/ + +/* + * NAME + * nztiStoreTrustedIdentity - Store an identity into a persona. + * + * PARAMETERS + * osscntxt {IN} Success. + * identity {IN/OUT} Trusted Identity. + * persona {IN/OUT} Persona. + * + * NOTES + * The identity is not saved with the persona in the wallet until + * the persona is stored. + * + * The identity parameter is double indirect so that it can point + * into the persona at the conclusion of the call. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztiStoreTrustedIdentity( nzctx *, nzttIdentity **, + nzttPersona * ); + +/*--------------------- nzteSetProtection ---------------------*/ + +/* + * NAME + * nzteSetProtection - Set the protection type for a CE function. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * func {IN} CE function. + * tdufmt {IN} TDU Format. + * protinfo {IN} Protection information specific to this format. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PROTECTION Unsupported protection. + * NZERROR_TK_PARMS Error in protection info. + */ +nzerror nzteSetProtection( nzctx *, nzttPersona *, nzttcef, nztttdufmt, + nzttProtInfo * ); + +/*--------------------- nzteGetProtection ---------------------*/ + +/* + * NAME + * nzteGetProtection - Get the protection type for a CE function. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * func {IN} CE function. + * tdufmt {OUT} TDU format. + * protinfo {OUT} Protection information. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nzteGetProtection( nzctx *, nzttPersona *, nzttcef, nztttdufmt *, + nzttProtInfo * ); + +/*-------------------- nztiRemoveIdentity --------------------*/ + +/* + * NAME + * nztiRemoveIdentity - Remove an identity from an open persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN/OUT} Identity. + * + * NOTES + * If the persona is not stored, this identity will still be in the + * persona stored in the wallet. + * + * The identity parameter is doubly indirect so that at the + * conclusion of the function, the pointer can be set to NULL. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTFOUND Identity not found. + * NZERROR_TK_NOTOPEN Persona is not open. + */ +nzerror nztiRemoveIdentity( nzctx *, nzttIdentity ** ); + +/*----------------- nztifdn -----------------*/ + +/* + * NAME + * nztifdn - create an Identity From a Distinguished Name + * + * PARAMETERS + * osscntxt {IN} OSS context. + * length {IN} Length of the distinguished name + * distinguished_name {IN} distinguished name string + * ppidentity {OUT} created identity + * + * NOTES + * Given a distinguished name, return the identity that corresponds to it. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztifdn( nzctx *ossctx, + ub4 length, + text *distinguished_name, + nzttIdentity **ppidentity ); + +/*--------------------- nztxSignExpansion ---------------------*/ + +/* + * NAME + * nztxSignExpansion - Determine the size of the attached signature buffer. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of input. + * tdulen {OUT} Buffer needed for signature. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxSignExpansion( nzctx *, nzttPersona *, ub4, ub4 * ); + +/*--------------- nztxsd_SignDetachedExpansion ---------------*/ + +/* + * NAME + * nztxsd_SignDetachedExpansion - Determine the size of buffer needed. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of input. + * tdulen {OUT} Buffer needed for signature. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxsd_SignDetachedExpansion( nzctx *, nzttPersona *, ub4, + ub4 * ); + +/*------------------------ nztEncrypt ------------------------*/ + +/* + * NAME + * nztEncrypt - Symmetrically encrypt + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztEncrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------- nztxEncryptExpansion -------------------*/ + +/* + * NAME + * nztxEncryptExpansion - Determine the size of the TDU to encrypt. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input part. + * tdulen {OUT} Length of TDU. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxEncryptExpansion( nzctx *, nzttPersona *, ub4, ub4 * ); + +/*------------------------ nztDecrypt ------------------------*/ + +/* + * NAME + * nztDecrypt - Decrypt an Encrypted message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of decryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * out {IN/OUT} Cleartext message. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztDecrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------------ nztEnvelope ------------------------*/ + +/* + * NAME + * nztEnvelope - Sign and PKEncrypt a message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nrecipients {IN} Number of recipients for this encryption. + * recipients {IN} List of recipients. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztEnvelope( nzctx *, nzttPersona *, ub4, nzttIdentity *, + nzttces, ub4, ub1 *, nzttBufferBlock * ); + +/*----------------------- nztDeEnvelope -----------------------*/ + +/* + * NAME + * nztDeEnvelope - PKDecrypt and verify a message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * out {OUT} Message from TDU. + * verified {OUT} TRUE if verified. + * validated {OUT} TRUE if validated. + * sender {OUT} Identity of sender. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztDeEnvelope( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock *, boolean *, boolean *, + nzttIdentity ** ); + +/*----------------------- nztKeyedHash -----------------------*/ + +/* + * NAME + * nztKeyedHash - Generate a keyed hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of hash. + * inlen {IN} Length of this input. + * in {IN} This input. + * tdu {IN/OUT} Output tdu. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztKeyedHash( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------ nztxKeyedHashExpansion ------------------*/ + +/* + * NAME + * nztxKeyedHashExpansion - Determine the space needed for a keyed hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input. + * tdulen {OUT} TDU length. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxKeyedHashExpansion( nzctx *, nzttPersona *, ub4, + ub4 * ); + +/*--------------------- nztxHashExpansion ---------------------*/ + +/* + * NAME + * nztxHashExpansion - Determine the size of the TDU for a hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input. + * tdulen {OUT} TDU length. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxHashExpansion( nzctx *, nzttPersona *, ub4, ub4 * ); + +/*---------------- nztiae_IsAuthEnabled ----------------*/ + +/* + * NAME + * nztiae_IsAuthEnabled - Checks to see if Authentication is Enabled + * in the current Cipher Spec. + * + * PARAMETERS + * ctx {IN} Oracle SSL Context + * ncipher {IN} CipherSuite + * authEnabled {OUT} Boolean for is Auth Enabled? + * + * NOTES + * + * RETURNS + * NZERROR_OK on success. + * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized. + */ + +nzerror nztiae_IsAuthEnabled( nzctx *ctx, + ub2 ncipher, + boolean *authEnabled ); + +/*---------------- nztiee_IsEncrEnabled ----------------*/ +/* + * NAME + * nztiee_IsEncrEnabled - Checks to see if Encryption is Enabled + * in the current Cipher Spec. + * + * PARAMETERS + * ctx {IN} Oracle SSL Context + * ncipher {IN} CipherSuite + * EncrEnabled {OUT} Boolean for is Auth Enabled? + * + * NOTES + * + * RETURNS + * NZERROR_OK on success. + * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized. + */ + +nzerror nztiee_IsEncrEnabled( nzctx *ctx, + ub2 ncipher, + boolean *EncrEnabled ); + +/*---------------- nztihe_IsHashEnabled ----------------*/ +/* + * NAME + * nztihe_IsHashEnabled - Checks to see if HAshing is Enabled + * in the current Cipher Spec. + * + * PARAMETERS + * ctx {IN} Oracle SSL Context + * ncipher {IN} CipherSuite + * hashEnabled {OUT} Boolean for is Auth Enabled? + * + * NOTES + * + * RETURNS + * NZERROR_OK on success. + * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized. + */ + +nzerror nztihe_IsHashEnabled( nzctx *ctx, + ub2 ncipher, + boolean *hashEnabled ); + +/* + * + */ + +nzerror nztGetIssuerName( nzctx *ctx, + nzttIdentity *identity, + ub1 **issuername, + ub4 *issuernamelen ); + +nzerror nztGetSubjectName( nzctx *ctx, + nzttIdentity *identity, + ub1 **subjectname, + ub4 *subjectnamelen ); + +nzerror nztGetBase64Cert( nzctx *ctx, + nzttIdentity *identity, + ub1 **b64cert, + ub4 *b64certlen ); + +nzerror nztGetSerialNumber( nzctx *ctx, + nzttIdentity *identity, + ub1 **serialnum, + ub4 *serialnumlen ); + +nzerror nztGetValidDate( nzctx *ctx, + nzttIdentity *identity, + ub4 *startdate, + ub4 *enddate ); + +nzerror nztGetVersion( nzctx *ctx, + nzttIdentity *identity, + nzstrc *pVerStr ); + +nzerror nztGetPublicKey( nzctx *ctx, + nzttIdentity *identity, + ub1 **pubKey, + ub4 *pubKeylen ); + +nzerror nztGenericDestroy( nzctx *ctx, + ub1 **var ); + +nzerror nztSetAppDefaultLocation( nzctx *ctx, + text *, + size_t ); + +nzerror nztSearchNZDefault( nzctx *ctx, + boolean *search ); + +nzerror nztSetLightWeight(nzctx *ctx, + boolean flag); + +#endif /* NZT_ORACLE */ + diff --git a/libraries/SQLAPI/include/ora_win/oci.h b/libraries/SQLAPI/include/ora_win/oci.h new file mode 100644 index 000000000..379b11b3b --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/oci.h @@ -0,0 +1,3045 @@ +/* Copyright (c) 1995, 2009, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + oci.h - V8 Oracle Call Interface public definitions + + DESCRIPTION + This file defines all the constants and structures required by a V8 + OCI programmer. + + RELATED DOCUMENTS + V8 OCI Functional Specification + Oracle Call Interface Programmer's Guide Vol 1 and 2 + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + None + + PRIVATE FUNCTION(S) + None + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + ssahu 04/15/09 - Add user handle as an attribute to session pool + handle + dalpern 03/17/09 - bug 7646876: applying_crossedition_trigger + kneel 11/21/08 - bump OCI version to 11.2 + thoang 09/24/08 - include ocixstream.h + asohi 08/25/08 - Bug 7320582 : AQ dequeue navigation flags fix + thoang 08/04/08 - Add XStream attributes + msowdaga 07/23/08 - Add flag OCI_SESSGET_SYSDBA + rphillip 03/21/08 - Add partition memory attribute + nikeda 04/15/08 - Support OCIP_ATTR_CONTYPE + mbastawa 12/24/07 - add server, envhp attributes + slynn 03/18/08 - + amullick 02/11/08 - add support for OCILobGet/SetContentType + tbhosle 01/07/08 - add OCI_ATTR_SUBSCR_IPADDR + nikeda 12/19/07 - Add OCI_SUBSCR_QOS_HAREG + rphillip 10/22/07 - Add OCI_ATTR_DIRPATH_NO_INDEX_ERRORS + debanerj 12/14/07 - Added OCI_ATTR_RESERVED_38 and OCI_ATTR_RESERVED_39 + umabhat 09/20/07 - bug6119750 added OCI_FNCODE_APPCTXSET & + OCI_FNCODE_APPCTXCLEARALL + debanerj 04/10/07 - XDS Attributes + msakayed 05/24/07 - Bug #5095734: add OCI_ATTR_DIRPATH_RESERVED_19 + schoi 03/02/07 - Get/SetOptions API change + ebatbout 03/30/07 - 5598333: Add OCI_ATTR_DIRPATH_RESERVED_18 + nikeda 03/21/07 - Add OCI_ATTR_RESERVED_37 + abande 03/06/07 - Remove attributes for global stmt cache and + metadata cache + rphillip 02/20/07 - Add OCI_ATTR_DIRPATH_RESERVED_17 + shan 11/16/06 - bug 5595911. + msakayed 12/04/06 - Bug #5660845: add OCI_DIRPATH_INPUT_OCI + gviswana 10/26/06 - Remove OCI_ATTR_CURRENT_EDITION + maramali 09/29/06 - bug 5568492, added OCI_NLS_LOCALE_A2_ISO_2_ORA + gviswana 09/29/06 - CURRENT_EDITION -> EDITION + aramappa 09/20/06 - Update major and minor version information + slynn 07/28/06 - Migrate to new 11g LOB terminiology + debanerj 07/20/06 - Add OCI_ATTR_LOBPREFETCH_LENGTH + mbastawa 06/25/06 - add OCI_ATTR_RESERVED_36 + hqian 05/22/06 - 11gR1 proj-18303: add OCI_SYSASM + dkogan 04/06/06 - disable charset validation by default + jhealy 05/15/06 - Add TimesTen OCI adapter. + slynn 06/20/06 - GetSharedRegions + rthammai 06/13/06 - add reserved attribute + msakayed 06/15/06 - Project 20586: interval partitioning support + debanerj 10/25/05 - LOB prefetch + slynn 05/25/06 - New NG Lob Functionality. + yujwang 05/16/06 - Add OCI_ATTR_RESERVED_33, OCI_ATTR_RESERVED_34 + abande 04/25/06 - 18297: Add attributes for global stmt cache and + metadata cache + ssvemuri 04/26/06 - Constants for Query Notification support + jgiloni 05/05/06 - Add OCI_ATCH_RESERVED_7 + mxyang 02/01/06 - Added OCI_ATTR_CURRENT_EDITION attribute + hqian 05/04/06 - new runtime capability attribute for asm volume + nikeda 06/06/06 - OCI_TT: Add new OCIP attributes + aramappa 04/17/06 - Added OCI_FNCODE_ARRAYDESCRIPTORALLOC and + OCI_FNCODE_ARRAYDESCRIPTORFREE + debanerj 05/04/06 - 18313: OCI Net Fusion + rupsingh 05/26/06 - + jacao 05/11/06 - + absaxena 04/17/06 - add notification grouping attributes + rpingte 02/02/06 - add OCI_ATCH_RESERVED_6 + rpingte 04/27/06 - Add OCI_ATTR_DRIVER_NAME + jawilson 02/14/06 - add OCI_FNCODE_AQENQSTREAM + kneel 04/03/06 - Adding support in kjhn for critical severity + rphillip 03/31/06 - Add OCI_ATTR_DIRPATH_RESERVED_14 + mxyang 02/01/06 - Added OCI_ATTR_APPLICATION_EDITION attribute + rphillip 01/30/06 - Add new DPAPI attrs + ebatbout 11/03/05 - Add direct path support for multiple subtypes + porangas 02/22/06 - 5055398: Define OCI_STMT_CALL + mbastawa 01/31/06 - add OCI_ATTR_RESERVED_26 + yohu 01/27/06 - align Execution Modes macros + sjanardh 01/25/06 - add OCI_EXEC_RESERVED_6 + sichandr 01/18/06 - add OCI_ATTR_XMLTYPE_BINARY_XML + yohu 12/22/05 - add OCI_TRANS_PROMOTE + srseshad 09/12/05 - stmtcache: callback + krajan 10/25/05 - Added ENABLE_BEQUEATH attach flag + mbastawa 09/16/05 - dbhygiene + porangas 07/20/04 - 1175350: adding attribute for ognfd + chliang 06/30/05 - add OCI_SUPPRESS_NLS_VALIDATION mode + aahluwal 03/15/05 - [Bug 4235014]:add ASM, Preconnect events + ssappara 08/12/04 - Bug3669429 add OCI_ATTR_DESC_SYNBAS + absaxena 03/24/05 - remove OCI_AQ_RESERVED_5 + mbastawa 03/01/05 - add OCI_EXEC_RESERVED_5 + msakayed 02/15/05 - Bug #3147299: Add OCI_ATTR_CURRENT_ERRCOL + aahluwal 01/11/05 - [Bug 3944589]: add OCI_AUTH_RESERVED_5 + nikeda 11/15/04 - Add OCIP_IIO + rvissapr 11/10/04 - bug 3843644 - isencrypted + hohung 11/22/04 - add OCI_BIND_RESERVED_3 + cchui 10/25/04 - add OCI_ATTR_PROXY_CLIENT + aahluwal 09/27/04 - add incarnation, reason, cardinality to event handle + msakayed 09/14/04 - column encryption support (project id 5578) + jacao 08/17/04 - Add OCI_ATTR_DB_CHARSET_ID + mhho 08/29/04 - resolve conflicting mode declaration + sgollapu 05/28/04 - Add OCI_AUTH_RESERVED_3 + mbastawa 08/05/04 - add OCI_ATTR_RESERVED_21 + ebatbout 07/27/04 - add OCI_ATTR_DIRPATH_RESERVED_9 and move all direct + path attributes into a separate area in this file. + clei 06/29/04 - add OCI_ATTR_ENCC_SIZE + weiwang 05/06/04 - add OCIAQListenOpts and OCIAQLisMsgProps + weiwang 04/30/04 - add OCI_AQ_RESERVED_5 + nbhatt 04/27/04 - add new attribute + ssvemuri 06/19/04 - change notification descriptors and attributes + ksurlake 06/01/04 - grabtrans 'ksurlake_txn_skmishra_clone' + ksurlake 05/13/04 - add subscriber handle attributes + mbastawa 06/01/04 - add 3 more OCI_FETCH_RESERVED modes + chliang 05/28/04 - add nchar literal replacement modes + nikeda 05/14/04 - [OLS on RAC] new authentication mode + debanerj 05/17/04 - 13064: add fncodes for LOB array Read and Write + nikeda 05/20/04 - [OCI Events] Add incarnation, cardinality,reason + nikeda 05/18/04 - [OCI Events] Add OCI_ATTR_SERVICENAME + nikeda 05/17/04 - Add event handle + nikeda 05/13/04 - [OCI Events] Rename HACBK->EVTCBK, HACTX->EVTCTX + nikeda 05/10/04 - [OCI Events] code review changes + nikeda 04/15/04 - [OCI Events] OCI_SESSRLS_DROPSESS_FORCE + nikeda 04/12/04 - [OCI Events] Add OCI_ATTR_USER_MEMORY + aahluwal 04/12/04 - add OCI_HNDLFR_RESERVED5 + vraja 04/28/04 - add options for redo sync on commit + aahluwal 05/29/04 - [OCI Events]: add support for svc, svc member events + nikeda 05/28/04 - grabtrans 'nikeda_oci_events_copy' + nikeda 05/18/04 - [OCI Events] Add OCI_ATTR_SERVICENAME + nikeda 05/17/04 - Add event handle + nikeda 05/13/04 - [OCI Events] Rename HACBK->EVTCBK, HACTX->EVTCTX + nikeda 05/10/04 - [OCI Events] code review changes + nikeda 04/15/04 - [OCI Events] OCI_SESSRLS_DROPSESS_FORCE + nikeda 04/12/04 - [OCI Events] Add OCI_ATTR_USER_MEMORY + aahluwal 04/12/04 - add OCI_HNDLFR_RESERVED5 + jciminsk 04/28/04 - merge from RDBMS_MAIN_SOLARIS_040426 + jacao 03/06/04 - add OCI_ATTR_CURRENT_SCHEMA + aahluwal 01/20/04 - remove OCI_KEEP_FETCH_STATE + aahluwal 03/25/04 - [OCI Events] add OCI_HTYPE_HAEVENT and related attrs + nikeda 03/19/04 - [OCI Events] Add OCI_ATTR_HACBK and OCI_ATTR_HACTX + dfrumkin 12/04/03 - Add database startup/shutdown + chliang 12/22/03 - grid/main merge: add OCI_ATTR_RESERVED_20 + jciminsk 12/12/03 - merge from RDBMS_MAIN_SOLARIS_031209 + sgollapu 09/19/03 - Add fetch modes + sgollapu 07/30/03 - Add TSM attributes + sgollapu 06/26/03 - Add OCI_MUTEX_TRY + aime 06/23/03 - sync grid with main + sgollapu 06/07/03 - Add reserved attribute + sgollapu 06/05/03 - Add reserved auth flag + rpingte 05/22/03 - Add OCI_ATCH_RESERVED_5 + sgollapu 05/06/03 - Add TSM attributes + sgollapu 04/10/03 - Session migration Flags/interfaces + dfrumkin 04/23/04 - add OCI_PREP2_RESERVED_1 + rpingte 05/06/04 - add major and minor version information + bsinha 04/06/04 - add new OCI_TRANS flag + chliang 11/26/03 - add OCI_ATTR_RESERVED_19 + preilly 10/23/03 - Make OCI_ATTR_DIRPATH_METADATA_BUF private + chliang 08/07/03 - add OCI_ATTR_SKIP_BUFFER + srseshad 03/12/03 - convert public oci api to ansi + weiwang 05/14/03 - remove iot creation for rule sets + rkoti 04/15/03 - [2746515] add fntcodes for Unlimited size LOB 6003 + tcruanes 05/13/03 - add slave SQL OCI execution mode + rkoti 02/21/03 - [2761455] add OCI_FNCODE_AQENQARRAY, + OCI_FNCODE_AQDEQARRAY and update OCI_FNCODE_MAXFCN + tkeefe 01/29/03 - bug-2773794: Add new interface for setting Kerb attrs + aahluwal 02/06/03 - add OCI_ATTR_TRANSFORMATION_NO + weiwang 12/05/02 - add OCI_ATTR_USER_PROPERTY + ataracha 01/03/03 - include ocixmldb.h + preilly 12/05/02 - Add wait attribute for locking when using dir path + tkeefe 01/03/03 - bug-2623771: Added OCI_ATTR_KERBEROS_KEY + lchidamb 12/13/02 - end-to-end tracing attributes + msakayed 10/28/02 - Bug #2643907: add OCI_ATTR_DIRPATH_SKIPINDEX_METHOD + rphillip 11/13/02 - Add OCIP_ATTR_DIRPATH_INDEX + sagrawal 10/13/02 - liniting + sagrawal 10/03/02 - PL/SQL Compiler warnings + jstenois 11/07/02 - remove ocixad.h + chliang 10/21/02 - add OCI_ATTR_RESERVED_16,17 + hsbedi 10/30/02 - grabtrans 'jstenois_fix_xt_convert' + aahluwal 10/12/02 - add OCI_ATTR_AQ_NUM_E_ERRORS/OCI_ATTR_AQ_ERROR_INDEX + bdagevil 10/21/02 - add SQL analyze internal exec mode + csteinba 10/11/02 - add OCI_ATTR_RESERVED_16 + chliang 10/12/02 - add bind row callback attributes + preilly 10/25/02 - Add new reserved parameters + tkeefe 10/31/02 - bug-2623771: Added OCI_ATTR_AUDIT_SESSION_ID + csteinba 10/04/02 - Add OCI_ATTR_RESERVED_15 + mhho 10/11/02 - add new credential constant + thoang 09/25/02 - Add OCI_XMLTYPE_CREATE_CLOB + skaluska 10/07/02 - describe rules objects + csteinba 09/16/02 - Remove OCI_CACHE + gtarora 10/03/02 - OCI_ATTR_COL_SUBS => OCI_ATTR_OBJ_SUBS + msakayed 09/09/02 - Bug #2482469: add OCI_ATTR_DIRPATH_RESERVED_[3-6] + aahluwal 08/30/02 - adding dequeue across txn group + srseshad 04/24/02 - Add attribute OCI_ATTR_SPOOL_STMTCACHESIZE. + ebatbout 07/22/02 - Remove OCI_ATTR_RESERVED_11. + abande 01/17/02 - Bug 1788921; Add external attribute. + aahluwal 06/04/02 - bug 2360115 + pbagal 05/24/02 - Incorporate review comments + pbagal 05/22/02 - Introduce instance type attribute. + whe 07/01/02 - add OCI_BIND_DEFINE_SOFT flags + gtarora 07/01/02 - Add OCI_ATTR_COL_SUBS + tkeefe 05/30/02 - Add support for new proxy authentication credentials + dgprice 12/18/01 - bug 2102779 add reserved force describe + schandir 11/19/01 - add/modify modes. + schandir 11/15/01 - add OCI_SPC_STMTCACHE. + schandir 12/06/01 - change mode value of OCI_SPOOL. + msakayed 11/02/01 - Bug #2094292: add OCI_ATTR_DIRPATH_INPUT + dsaha 11/09/01 - add OCI_DTYPE_RESERVED1 + skabraha 11/05/01 - new method flag + skabraha 10/25/01 - another flag for XML + skabraha 10/11/01 - describe flags for subtypes + nbhatt 09/18/01 - new reserved AQ flags + celsbern 10/19/01 - merge LOG to MAIN + ksurlake 10/12/01 - add OCI_ATTR_RESERVED_13 + ksurlake 08/13/01 - add OCI_ATTR_RESERVED_12 + schandir 09/24/01 - Adding stmt caching + abande 09/04/01 - Adding session pooling + sagrawal 10/23/01 - add new bit for OCIPHandleFree + preilly 10/25/01 - Add support for specifying metadata on DirPathCtx + skabraha 09/24/01 - describe flags for XML type + schandir 09/24/01 - Adding stmt caching + abande 09/04/01 - Adding session pooling + stakeda 09/17/01 - add OCI_NLS_CHARSET_ID + whe 09/19/01 - add OCIXMLType create options + rpingte 09/11/01 - add OCI_MUTEX_ENV_ONLY and OCI_NO_MUTEX_STMT + cmlim 08/28/01 - mod datecache attrs to use same naming as dpapi attrs + wzhang 08/24/01 - Add new keywords for OCINlsNameMap. + rphillip 05/02/01 - Add date cache attributes + rphillip 08/22/01 - Add new stream version + ebatbout 04/13/01 - add definition, OCI_ATTR_RESERVED_11 + chliang 04/12/01 - add shortnames for newer oci funcation + wzhang 04/11/01 - Add new OCI NLS constants. + cmlim 04/13/01 - remove attrs not used by dpapi (151 & 152 avail) + rkambo 03/23/01 - bugfix 1421793 + cmlim 04/02/01 - remove OCI_ATTR_DIRPATH_{NESTED_TBL, SUBST_OBJ_TBL} + - note: attribute #s 186 & 205 available + whe 03/28/01 - add OCI_AFC_PAD_ON/OFF mode + preilly 03/05/01 - Add stream versioning support to DirPath context + schandir 12/18/00 - remove attr CONN_INCR_DELAY. + schandir 12/12/00 - change mode from OCI_POOL to OCI_CPOOL. + cbarclay 01/12/01 - add atribute for OCIP_ATTR_TMZ + whe 01/07/01 - add attributes related to UTF16 env mode + slari 12/29/00 - add blank line + slari 12/28/00 - OCI_ATTR_RESERVED_10 + whe 12/19/00 - add OCI_ENVCR_RESERVED3 + rpang 11/29/00 - Added OCI_ATTR_ORA_DEBUG_JDWP attribute + cmlim 11/28/00 - support substitutable object tables in dpapi + akatti 10/09/00 - [198379]:add OCIRowidToChar + sgollapu 10/11/00 - Add OCI_PREP_RESERVED_1 + sgollapu 08/27/00 - add attribute to get erroneous column + sgollapu 07/29/00 - Add snapshot attributes + kmohan 09/18/00 - add OCI_FNCODE_LOGON2 + abrumm 10/08/00 - include ocixad.h + mbastawa 10/04/00 - add OCI_ATTR_ROWS_FETCHED + nbhatt 08/24/00 - add transformation attribute + dmwong 08/22/00 - OCI_ATTR_CID_VALUE -> OCI_ATTR_CLIENT_IDENTIFIER. + cmlim 08/30/00 - add OCI_ATTR_DIRPATH_SID + dsaha 08/18/00 - add OCI_ATTR_RESERVED_5 + amangal 08/17/00 - Merge into 8.2 : 1194361 + slari 08/03/00 - add OCI_ATTR_HANDLE_POSITION + dsaha 07/20/00 - 2rt exec + sgollapu 07/04/00 - Add virtual session flag + cmlim 07/07/00 - add OCI_ATTR_DIRPATH_OID, OCI_ATTR_DIRPATH_NESTED_TBL + etucker 07/28/00 - add OCIIntervalFromTZ + rwessman 06/26/00 - N-tier: added new credential attributes + whe 07/27/00 - add OCI_UTF16 mode + vjayaram 07/18/00 - add connection pooling changes + etucker 07/12/00 - add dls apis + cmlim 07/07/00 - add OCI_ATTR_DIRPATH_OID, OCI_ATTR_DIRPATH_NESTED_TBL + sgollapu 07/04/00 - Add virtual session flag + najain 05/01/00 - AQ Signature support + sgollapu 06/14/00 - Add reserved OCI mode + rkambo 06/08/00 - notification presentation support + sagrawal 06/04/00 - ref cursor to c + ksurlake 06/07/00 - define OCI_POOL + mbastawa 06/05/00 - added scrollable cursor attributes + weiwang 03/31/00 - add LDAP support + whe 05/30/00 - add OCI_ATTR_MAXCHAR_SIZE + whe 05/23/00 - validate OCI_NO_CACHE mode + dsaha 02/02/00 - Add no-cache attr in statement handle + whe 05/23/00 - add OCIP_ICACHE + allee 05/17/00 - describe support for JAVA implmented TYPE + preilly 05/30/00 - Continue adding support for objects in direct path lo + cmlim 05/16/00 - 8.2 dpapi support of ADTs + rxgovind 05/04/00 - OCIAnyDataSet changes + rkasamse 05/25/00 - add OCIAnyDataCtx + rmurthy 04/26/00 - describe support for inheritance + ksurlake 04/18/00 - Add credential type + whe 05/24/00 - add OCI_ATTR_CHAR_ attrs + rkambo 04/19/00 - subscription enhancement + rmurthy 04/26/00 - describe support for inheritance + delson 03/28/00 - add OCI_ATTR_RESERVED_2 + abrumm 03/31/00 - external table support + rkasamse 03/13/00 - add declarations for OCIAnyData + najain 02/24/00 - support for dequeue as select + dsaha 03/10/00 - Add OCI_ALWAYS_BLOCKING + esoyleme 04/25/00 - separated transactions + sgollapu 12/23/99 - OCIServerAttach extensions + slari 08/23/99 - add OCI_DTYPE_UCB + slari 08/20/99 - add OCI_UCBTYPE_REPLACE + hsbedi 08/31/99 - Memory Stats . + sgollapu 08/02/99 - oci sql routing + slari 08/06/99 - rename values for OCI_SERVER_STATUS + slari 08/02/99 - add OCI_ATTR_SERVER_STATUS + tnbui 07/28/99 - Remove OCI_DTYPE_TIMESTAMP_ITZ + amangal 07/19/99 - Merge into 8.1.6 : bug 785797 + tnbui 07/07/99 - Change ADJUSTMENT modes + dsaha 07/07/99 - OCI_SAHRED_EXT + dmwong 06/08/99 - add OCI_ATTR_APPCTX_* + vyanaman 06/23/99 - + vyanaman 06/21/99 - Add new OCI Datetime and Interval descriptors + esoyleme 06/29/99 - expose MTS performance enhancements + rshaikh 04/23/99 - add OCI_SQL_VERSION_* + tnbui 05/24/99 - Remove OCIAdjStr + dsaha 05/21/99 - Add OCI_ADJUST_UNK + mluong 05/17/99 - fix merge + tnbui 04/05/99 - ADJUSTMENT values + abrumm 04/16/99 - dpapi: more attributes + dsaha 02/24/99 - Add OCI_SHOW_DML_WARNINGS + jiyang 12/07/98 - Add OCI_NLS_DUAL_CURRENCY + slari 12/07/98 - change OCI_NOMUTEX to OCI_NO_MUTEX + aroy 11/30/98 - change OCI_NOCALLBACK to OCI_NO_UCB + aroy 11/13/98 - add env modes to process modes + slari 09/08/98 - add OCI_FNCODE_SVC2HST and _SVCRH + aroy 09/04/98 - Add OCI_ATTR_MIGSESSION + skray 08/14/98 - server groups for session switching + mluong 08/11/98 - add back OCI_HTYPE_LAST. + aroy 05/25/98 - add process handle type + aroy 04/06/98 - add shared mode + slari 07/13/98 - merge forward to 8.1.4 + slari 07/09/98 - add OCI_BIND_RESERVED_2 + slari 07/08/98 - add OCI_EXACT_FETCH_RESERVED_1 + dsaha 07/07/98 - Add OCI_PARSE_ONLY + dsaha 06/29/98 - Add OCI_PARSE_ONLY + slari 07/01/98 - add OCI_BIND_RESERVED_2 + sgollapu 06/25/98 - Fix bug 683565 + slari 06/17/98 - remove OC_FETCH_RESERVED_2 + slari 06/11/98 - add OCI_FETCH_RESERVED_1 and 2 + jhasenbe 05/27/98 - Remove definitions for U-Calls (Unicode) + jiyang 05/18/98 - remove OCI_ATTR_CARTLANG + nbhatt 05/20/98 - OCI_DEQ_REMOVE_NODATA + nbhatt 05/19/98 - correct AQ opcode + skmishra 05/06/98 - Add precision attribute to Attributes list + aroy 04/20/98 - merge forward 8.0.5 -> 8.1.3 + schandra 05/01/98 - OCI sender id + sgollapu 02/19/98 - enhanced array DML + nbhatt 05/15/98 - AQ listen call + sgollapu 04/27/98 - more attributes + skaluska 04/06/98 - Add OCI_PTYPE_SCHEMA, OCI_PTYPE_DATABASE + slari 04/28/98 - add OCI_ATTR_PDPRC + lchidamb 05/05/98 - change OCI_NAMESPACE_AQ to 1 + nbhatt 04/27/98 - AQ Notification Descriptor + abrumm 06/24/98 - more direct path attributes + abrumm 05/27/98 - OCI direct path interface support + abrumm 05/08/98 - OCI direct path interface support + lchidamb 03/02/98 - client notification additions + kkarun 04/17/98 - Add more Interval functions + vyanaman 04/16/98 - Add get/set TZ + kkarun 04/14/98 - Add OCI Datetime shortnames + vyanaman 04/13/98 - Add OCI DateTime and Interval check error codes + kkarun 04/07/98 - Add OCI_DTYPE_DATETIME and OCI_DTYPE_INTERVAL + esoyleme 12/15/97 - support failover callback retry + esoyleme 04/22/98 - merge support for failover callback retry + mluong 04/16/98 - add OCI_FNCODE_LOBLOCATORASSIGN + rkasamse 04/17/98 - add short names for OCIPickler(Memory/Ctx) cart servi + slari 04/10/98 - add OCI_FNCODE_SVCCTXTOLDA + slari 04/09/98 - add OCI_FNCODE_RESET + slari 04/07/98 - add OCI_FNCODE_LOBFILEISOPEN + slari 04/06/98 - add OCI_FNCODE_LOBOPEN + slari 03/20/98 - change OCI_CBTYPE_xxx to OCI_UCBTYPE_xxx + slari 03/18/98 - add OCI_FNCODE_MAXFCN + slari 02/12/98 - add OCI_ENV_NO_USRCB + skabraha 04/09/98 - adding shortnames for OCIFile + rhwu 04/03/98 - Add short names for the OCIThread package + tanguyen 04/03/98 - add OCI_ATTR_xxxx for type inheritance + rkasamse 04/02/98 - add OCI_ATTR_UCI_REFRESH + nramakri 04/01/98 - Add short names for the OCIExtract package + ewaugh 03/31/98 - Add short names for the OCIFormat package. + jhasenbe 04/06/98 - Add definitions for U-Calls (Unicode) + (OCI_TEXT, OCI_UTEXT, OCI_UTEXT4) + skmishra 03/03/98 - Add OCI_ATTR_PARSE_ERROR_OFFSET + rwessman 03/11/98 - Added OCI_CRED_PROXY for proxy authentication + abrumm 03/31/98 - OCI direct path interface support + nmallava 03/03/98 - add constants for temp lob apis + skotsovo 03/05/98 - resolve merge conflicts + skotsovo 02/24/98 - add OCI_DTYPE_LOC + skaluska 01/21/98 - Add OCI_ATTR_LTYPE + rkasamse 01/06/98 - add OCI_ATTR* for obj cache enhancements + dchatter 01/08/98 - more comments + skabraha 12/02/97 - moved oci1.h to the front of include files. + jiyang 12/18/97 - Add OCI_NLS_MAX_BUFSZ + rhwu 12/02/97 - move oci1.h up + ewaugh 12/15/97 - Add short names for the OCIFormat package. + rkasamse 12/02/97 - Add a constant for memory cartridge services -- OCI_M + nmallava 12/31/97 - open/close for internal lobs + khnguyen 11/27/97 - add OCI_ATTR_LFPRECISION, OCI_ATTR_FSPRECISION + rkasamse 11/03/97 - add types for pickler cartridge services + mluong 11/20/97 - changed ubig_ora to ub4 per skotsovo + ssamu 11/14/97 - add oci1.h + jiyang 11/13/97 - Add NLS service for cartridge + esoyleme 12/15/97 - support failover callback retry + jwijaya 10/21/97 - change OCILobOffset/Length from ubig_ora to ub4 + cxcheng 07/28/97 - fix compile with SLSHORTNAME + schandra 06/25/97 - AQ OCI interface + sgollapu 07/25/97 - Add OCI_ATTR_DESC_PUBLIC + cxcheng 06/16/97 - add OCI_ATTR_TDO + skotsovo 06/05/97 - add fntcodes for lob buffering subsystem + esoyleme 05/13/97 - move failover callback prototype + skmishra 05/06/97 - stdc compiler fixes + skmishra 04/22/97 - Provide C++ compatibility + lchidamb 04/19/97 - add OCI_ATTR_SESSLANG + ramkrish 04/15/97 - Add OCI_LOB_BUFFER_(NO)FREE + sgollapu 04/18/97 - Add OCI_ATTR_TABLESPACE + skaluska 04/17/97 - Add OCI_ATTR_SUB_NAME + schandra 04/10/97 - Use long OCI names + aroy 03/27/97 - add OCI_DTYPE_FILE + sgollapu 03/26/97 - Add OCI_OTYPEs + skmishra 04/09/97 - Added constant OCI_ROWID_LEN + dchatter 03/21/97 - add attr OCI_ATTR_IN_V8_MODE + lchidamb 03/21/97 - add OCI_COMMIT_ON_SUCCESS execution mode + skmishra 03/20/97 - Added OCI_ATTR_LOBEMPTY + sgollapu 03/19/97 - Add OCI_ATTR_OVRLD_ID + aroy 03/17/97 - add postprocessing callback + sgollapu 03/15/97 - Add OCI_ATTR_PARAM + cxcheng 02/07/97 - change OCI_PTYPE codes for type method for consistenc + cxcheng 02/05/97 - add OCI_PTYPE_TYPE_RESULT + cxcheng 02/04/97 - rename OCI_PTYPE constants to be more consistent + cxcheng 02/03/97 - add OCI_ATTR, OCI_PTYPE contants for describe type + esoyleme 01/23/97 - merge neerja callback + sgollapu 12/30/96 - Remove OCI_DTYPE_SECURITY + asurpur 12/26/96 - CHanging OCI_NO_AUTH to OCI_AUTH + sgollapu 12/23/96 - Add more attrs to COL, ARG, and SEQ + sgollapu 12/12/96 - Add OCI_DESCRIBE_ONLY + slari 12/11/96 - change prototype of OCICallbackInBind + nbhatt 12/05/96 - "callback" + lchidamb 11/19/96 - handle subclassing + sgollapu 11/09/96 - OCI_PATTR_* + dchatter 11/04/96 - add attr OCI_ATTR_CHRCNT + mluong 11/01/96 - test + cxcheng 10/31/96 - add #defines for OCILobLength etc + dchatter 10/31/96 - add lob read write call back fp defs + dchatter 10/30/96 - more changes + rhari 10/30/96 - Include ociextp.h at the very end + lchidamb 10/22/96 - add fdo attribute for bind/server handle + dchatter 10/22/96 - change attr defn for prefetch parameters & lobs/file + calls + slari 10/21/96 - add OCI_ENV_NO_MUTEX + rhari 10/25/96 - Include ociextp.h + rxgovind 10/25/96 - add OCI_LOBMAXSIZE, remove OCI_FILE_READWRITE + sgollapu 10/24/96 - Correct OCILogon and OCILogoff + sgollapu 10/24/96 - Correct to OCILogon and OCILogoff + sgollapu 10/21/96 - Add ocilon and ociloff + skaluska 10/31/96 - Add OCI_PTYPE values + sgollapu 10/17/96 - correct OCI_ATTR_SVCCTX to OCI_ATTR_SERVER + rwessman 10/16/96 - Added security functions and fixed olint errors. + sthakur 10/14/96 - add more COR attributes + cxcheng 10/14/96 - re-enable LOB functions + sgollapu 10/10/96 - Add ocibdp and ocibdn + slari 10/07/96 - add back OCIRowid + aroy 10/08/96 - add typedef ocibfill for PRO*C + mluong 10/11/96 - replace OCI_ATTR_CHARSET* with OCI_ATTR_CHARSET_* + cxcheng 10/10/96 - temporarily take out #define for lob functions + sgollapu 10/02/96 - Rename OCI functions and datatypes + skotsovo 10/01/96 - move orl lob fnts to oci + aroy 09/10/96 - fix merge errors + aroy 08/19/96 - NCHAR support + jboonleu 09/05/96 - add OCI attributes for object cache + dchatter 08/20/96 - HTYPE ranges from 1-50; DTYPE from 50-255 + slari 08/06/96 - define OCI_DTYPE_ROWID + sthakur 08/14/96 - complex object support + schandra 06/17/96 - Convert XA to use new OCI + abrik 08/15/96 - OCI_ATTR_HEAPALLOC added + aroy 07/17/96 - terminology change: ocilobd => ocilobl + aroy 07/03/96 - add lob typedefs for Pro*C + slari 06/28/96 - add OCI_ATTR_STMT_TYPE + lchidamb 06/26/96 - reorg #ifndef + schandra 05/31/96 - attribute types for internal and external client name + asurpur 05/30/96 - Changing the value of mode + schandra 05/18/96 - OCI_TRANS_TWOPHASE -> 0x00000001 to 0x00100000 + slari 05/30/96 - add callback function prototypes + jbellemo 05/23/96 - remove ociisc + schandra 04/23/96 - loosely-coupled branches + asurpur 05/15/96 - New mode for ocicpw + aroy 04/24/96 - making ocihandles opaque + slari 04/18/96 - add missing defines + schandra 03/27/96 - V8OCI - add transaction related calls + dchatter 04/01/96 - add OCI_FILE options + dchatter 03/21/96 - add oci2lda conversion routines + dchatter 03/07/96 - add OCI piece definition + slari 03/12/96 - add describe attributes + slari 03/12/96 - add OCI_OTYPE_QUERY + aroy 02/28/96 - Add column attributes + slari 02/09/96 - add OCI_OBJECT + slari 02/07/96 - add OCI_HYTPE_DSC + aroy 01/10/96 - adding function code defines... + dchatter 01/03/96 - define OCI_NON_BLOCKING + dchatter 01/02/96 - Add Any descriptor + dchatter 01/02/96 - Add Select List descriptor + dchatter 12/29/95 - V8 OCI definitions + dchatter 12/29/95 - Creation + +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN +#include +#endif + +#ifndef OCI_ORACLE +# define OCI_ORACLE + + +/*--------------------------------------------------------------------------- + Short names provided for platforms which do not allow extended symbolic names + ---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME +/* Translation of the long function/type names to short names for IBM only */ +/* maybe lint will use this too */ +#define OCISessionEnd ocitac +#define OCIResultSetToStmt ocirs2sh +#define OCISessionBegin ociauth +#define OCIServerAttach ociatch +#define OCIDescriptorAlloc ocigdesc +#define OCIServerDetach ocidtch +#define OCIDescriptorFree ocifdesc +#define OCIServerVersion ocivers +#define OCIDescribeAny ocidsca +#define OCIBindDynamic ocibda +#define OCIBindByName ocibdn +#define OCIBindByPos ocibdp +#define OCIErrorGet ocigdr +#define OCIBindArrayOfStruct ocibsa +#define OCIEnvInit ociinit +#define OCIBindObject ocibndt +#define OCIHandleAlloc ocighndl +#define OCIHandleFree ocifhndl +#define OCIRowidToChar ociri2c +#ifdef NEVER +#define OCIStmtBindByPos ocibndp +#define OCIStmtBindByName ocibndn +#endif +#define OCIAttrGet ocigattr +#define OCIDefineByPos ocidfne +#define OCIAttrSet ocisattr +#define OCIDefineDynamic ociddf +#define OCILdaToSvcCtx ocild2sv +#define OCIDefineArrayOfStruct ocidarr +#define OCIInitialize ocipi +#define OCIDefineObject ocidndt +#define OCIStmtExecute ociexec +#define OCILobAppend ocilfap +#define OCILobOpenFile ocifopn +#define OCILobCloseFile ocifcls +#define OCILobLocator ocilobd +#define OCILobGetDeduplicateRegions ocilgshr +#define OCILobRegion ocilregd +#define OCILobCopy ocilfcp +#define OCILobFileCreate ocifcrt +#define OCILobFileDelete ocifdel +#define OCILobGetLength ocilfln +#define OCILobWrite ocilfwr +#define OCILobRead ocilfrd +#define OCILobErase ocilfer +#define OCILobTrim ocilftr +#define OCILobSetOptions ocinglso +#define OCILobGetOptions ocinglgo +#define OCILobFragmentInsert ocinglfi +#define OCILobFragmentDelete ocinglfd +#define OCILobFragmentMove ocinglfm +#define OCILobFragmentReplace ocinglfr +#define OCILobSetContentType ocinglsct +#define OCILobGetContentType ocinglgct + +#define OCIStmtFetch ocifch +#define OCIStmtGetBindInfo ocigbp +#define OCIStmtGetPieceInfo ocigpi +#define OCIStmtPrepare ocireq +#define OCIStmtSetPieceInfo ocispi +#define OCISvcCtxToLda ocisv2ld +#define OCITransCommit ocitxcm +#define OCITransDetach ocitxdt +#define OCITransForget ocitxfgt +#define OCITransPrepare ocitxpre +#define OCITransRollback ocitxrl +#define OCIPasswordChange ocicpw +#define OCITransStart ocitxst +#define OCITransMultiPrepare ocitxmp + +#define OCIBreak ocibreak +#define OCIParamGet ocigparm +#define OCIParamSet ocisparm + +#define OCISecurityOpenWallet ocizwOpenWallet +#define OCISecurityCloseWallet ocizwCloseWallet +#define OCISecurityCreateWallet ocizwCreateWallet +#define OCISecurityDestroyWallet ocizwDestroyWallet +#define OCISecurityStorePersona ocizeStorePersona +#define OCISecurityOpenPersona ocizeOpenPersona +#define OCISecurityClosePersona ocizeClosePersona +#define OCISecurityRemovePersona ocizeRemovePersona +#define OCISecurityCreatePersona ocizeCreatePersona +#define OCISecuritySetProtection ocizeSetProtection +#define OCISecurityGetProtection ocizeGetProtection +#define OCISecurityRemoveIdentity ociziRemoveIdentity +#define OCISecurityCreateIdentity ociziCreateIdentity +#define OCISecurityAbortIdentity ociziAbortIdentity +#define OCISecurityFreeIdentity ociziFreeIdentity +#define OCISecurityStoreTrustedIdentity ociziStoreTrustedIdentity +#define OCISecuritySign ocizSign +#define OCISecuritySignExpansion ocizxSignExpansion +#define OCISecurityVerify ocizVerify +#define OCISecurityValidate ocizValidate +#define OCISecuritySignDetached ocizsd_SignDetached +#define OCISecuritySignDetExpansion ocizxsd_SignDetachedExpansion +#define OCISecurityVerifyDetached ocizved_VerifyDetached +#define OCISecurity_PKEncrypt ocizkec_PKEncrypt +#define OCISecurityPKEncryptExpansion ocizxkec_PKEncryptExpansion +#define OCISecurityPKDecrypt ocizkdc_PKDecrypt +#define OCISecurityEncrypt ocizEncrypt +#define OCISecurityEncryptExpansion ocizxEncryptExpansion +#define OCISecurityDecrypt ocizDecrypt +#define OCISecurityEnvelope ocizEnvelope +#define OCISecurityDeEnvelope ocizDeEnvelope +#define OCISecurityKeyedHash ocizKeyedHash +#define OCISecurityKeyedHashExpansion ocizxKeyedHashExpansion +#define OCISecurityHash ocizHash +#define OCISecurityHashExpansion ocizxHashExpansion +#define OCISecuritySeedRandom ocizSeedRandom +#define OCISecurityRandomBytes ocizrb_RandomBytes +#define OCISecurityRandomNumber ocizrn_RandomNumber +#define OCISecurityInitBlock ocizibInitBlock +#define OCISecurityReuseBlock ocizrbReuseBlock +#define OCISecurityPurgeBlock ocizpbPurgeBlock +#define OCISecuritySetBlock ocizsbSetBlock +#define OCISecurityGetIdentity ocizgi_GetIdentity + +#define OCIExtractInit ocixeini +#define OCIExtractTerm ocixetrm +#define OCIExtractReset ocixerst +#define OCIExtractSetNumKeys ocixesnk +#define OCIExtractSetKey ocixesk +#define OCIExtractFromFile ocixeff +#define OCIExtractFromStr ocixefs +#define OCIExtractToInt ocixeti +#define OCIExtractToBool ocixetb +#define OCIExtractToStr ocixets +#define OCIExtractToOCINum ocixeton +#define OCIExtractToList ocixetl +#define OCIExtractFromList ocixefl + +#define OCIDateTimeGetTime ocidt01_GetTime +#define OCIDateTimeGetDate ocidt02_GetDate +#define OCIDateTimeGetTimeZoneOffset ocidt03_GetTZ +#define OCIDateTimeSysTimeStamp ocidt07_SysTS +#define OCIDateTimeAssign ocidt08_Assign +#define OCIDateTimeToText ocidt09_ToText +#define OCIDateTimeFromText ocidt10_FromText +#define OCIDateTimeCompare ocidt11_Compare +#define OCIDateTimeCheck ocidt12_Check +#define OCIDateTimeConvert ocidt13_Convert +#define OCIDateTimeSubtract ocidt14_Subtract +#define OCIDateTimeIntervalAdd ocidt15_IntervalAdd +#define OCIDateTimeIntervalSub ocidt16_IntervalSub +#define OCIDateTimeGetTimeZoneName ocidt17_Gettzname +#define OCIDateTimeToArray ocidt18_ToArray +#define OCIDateTimeFromArray ocidt19_FromArray + +#define OCIIntervalSubtract ociint01_Subtract +#define OCIIntervalAdd ociint02_Add +#define OCIIntervalMultiply ociint03_Multiply +#define OCIIntervalDivide ociint04_Divide +#define OCIIntervalCompare ociint05_Compare +#define OCIIntervalFromText ociint06_FromText +#define OCIIntervalToText ociint07_ToText +#define OCIIntervalToNumber ociint08_ToNumber +#define OCIIntervalCheck ociint09_Check +#define OCIIntervalAssign ociint10_Assign +#define OCIIntervalGetYearMonth ociint11_GetYearMonth +#define OCIIntervalSetYearMonth ociint12_SetYearMonth +#define OCIIntervalGetDaySecond ociint13_GetDaySecond +#define OCIIntervalSetDaySecond ociint14_SetDaySecond +#define OCIIntervalFromNumber ociint15_FromNumber +#define OCIIntervalFromTZ ociint16_FromTZ + +#define OCIFormatInit ocixs01_Init +#define OCIFormatString ocixs02_Format +#define OCIFormatTerm ocixs03_Term +#define OCIFormatTUb1 ocixs04_TUb1 +#define OCIFormatTUb2 ocixs05_TUb2 +#define OCIFormatTUb4 ocixs06_TUb4 +#define OCIFormatTUword ocixs07_TUword +#define OCIFormatTUbig_ora ocixs08_TUbig_ora +#define OCIFormatTSb1 ocixs09_TSb1 +#define OCIFormatTSb2 ocixs10_TSb2 +#define OCIFormatTSb4 ocixs11_TSb4 +#define OCIFormatTSword ocixs12_TSword +#define OCIFormatTSbig_ora ocixs13_TSbig_ora +#define OCIFormatTEb1 ocixs14_TEb1 +#define OCIFormatTEb2 ocixs15_TEb2 +#define OCIFormatTEb4 ocixs16_TEb4 +#define OCIFormatTEword ocixs17_TEword +#define OCIFormatTChar ocixs18_TChar +#define OCIFormatTText ocixs19_TText +#define OCIFormatTDouble ocixs20_TDouble +#define OCIFormatTDvoid ocixs21_TDvoid +#define OCIFormatTEnd ocixs22_TEnd + +#define OCIFileInit ocifinit +#define OCIFileTerm ocifterm +#define OCIFileOpen ocifopen +#define OCIFileClose ocifclose +#define OCIFileRead ocifread +#define OCIFileWrite ocifwrite +#define OCIFileSeek ocifseek +#define OCIFileExists ocifexists +#define OCIFileGetLength ocifglen +#define OCIFileFlush ocifflush + + +/* OCIThread short name */ +#define OCIThreadProcessInit ocitt01_ProcessInit +#define OCIThreadInit ocitt02_Init +#define OCIThreadTerm ocitt03_Term +#define OCIThreadIsMulti ocitt04_IsMulti +#define OCIThreadMutexInit ocitt05_MutexInit +#define OCIThreadMutexDestroy ocitt06_MutexDestroy +#define OCIThreadMutexAcquire ocitt07_MutexAcquire +#define OCIThreadMutexRelease ocitt08_MutexRelease +#define OCIThreadKeyInit ocitt09_KeyInit +#define OCIThreadKeyDestroy ocitt10_KeyDestroy +#define OCIThreadKeyGet ocitt11_KeyGet +#define OCIThreadKeySet ocitt12_KeySet +#define OCIThreadIdInit ocitt13_IdInit +#define OCIThreadIdDestroy ocitt14_IdDestroy +#define OCIThreadIdSet ocitt15_IdSet +#define OCIThreadIdSetNull ocitt16_IdSetNull +#define OCIThreadIdGet ocitt17_IdGet +#define OCIThreadIdSame ocitt18_IdSame +#define OCIThreadIdNull ocitt19_IdNull +#define OCIThreadHndInit ocitt20_HndInit +#define OCIThreadHndDestroy ocitt21_HndDestroy +#define OCIThreadCreate ocitt22_Create +#define OCIThreadJoin ocitt23_Join +#define OCIThreadClose ocitt24_Close +#define OCIThreadHandleGet ocitt25_HandleGet + +/* Translation between the old and new datatypes */ + +#define OCISession ociusrh +#define OCIBind ocibndh +#define OCIDescribe ocidsch +#define OCIDefine ocidfnh +#define OCIEnv ocienvh +#define OCIError ocierrh + +#define OCICPool ocicpool + +#define OCISPool ocispool +#define OCIAuthInfo ociauthinfo + + +#define OCILob ocilobd +#define OCILobLength ocillen +#define OCILobMode ocilmo +#define OCILobOffset ociloff + +#define OCILobLocator ocilobd +#define OCIBlobLocator ociblobl +#define OCIClobLocator ociclobl +#define OCILobRegion ocilregd +#define OCIBFileLocator ocibfilel + +#define OCIParam ocipard +#define OCIResult ocirstd +#define OCISnapshot ocisnad +#define OCIServer ocisrvh +#define OCIStmt ocistmh +#define OCISvcCtx ocisvch +#define OCITrans ocitxnh +#define OCICallbackInBind ocibicfp +#define OCICallbackOutBind ocibocfp +#define OCICallbackDefine ocidcfp +#define OCICallbackLobRead ocilrfp +#define OCICallbackLobWrite ocilwfp +#define OCICallbackLobGetDededuplicateRegions ocilgshr +#define OCISecurity ociossh +#define OCIComplexObject ocicorh +#define OCIComplexObjectComp ocicord +#define OCIRowid ociridd + +#define OCIAQDeq ociaqdeq +#define OCIAQEnq ociaqenq +#define OCIConnectionPoolCreate ociconpc +#define OCIConnectionPoolDestroy ociconpd +#define OCIEnvCreate ocienvct +#define OCILobAssign ociloass +#define OCILobCharSetForm ocilocfm +#define OCILobCharSetId ocilocid +#define OCILobDisableBuffering ocilodbf +#define OCILobEnableBuffering ociloebf +#define OCILobFileClose ocilofcl +#define OCILobFileCloseAll ocilofca +#define OCILobFileExists ocilofex +#define OCILobFileGetName ocilofgn +#define OCILobFileIsOpen ocifiopn +#define OCILobFileOpen ocilofop +#define OCILobFileSetName ocilofsn +#define OCILobFlushBuffer ocilofbf +#define OCILobIsEqual ociloieq +#define OCILobLoadFromFile ocilolff +#define OCILobLocatorIsInit ocilolii +#define OCILobLocatorAssign ocilolas +#define OCILogon ocilogon +#define OCILogon2 ocilgon2 +#define OCILogoff ocilgoff +#endif /* ifdef SLSHORTNAME */ + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/*-----------------------------Handle Types----------------------------------*/ + /* handle types range from 1 - 49 */ +#define OCI_HTYPE_FIRST 1 /* start value of handle type */ +#define OCI_HTYPE_ENV 1 /* environment handle */ +#define OCI_HTYPE_ERROR 2 /* error handle */ +#define OCI_HTYPE_SVCCTX 3 /* service handle */ +#define OCI_HTYPE_STMT 4 /* statement handle */ +#define OCI_HTYPE_BIND 5 /* bind handle */ +#define OCI_HTYPE_DEFINE 6 /* define handle */ +#define OCI_HTYPE_DESCRIBE 7 /* describe handle */ +#define OCI_HTYPE_SERVER 8 /* server handle */ +#define OCI_HTYPE_SESSION 9 /* authentication handle */ +#define OCI_HTYPE_AUTHINFO OCI_HTYPE_SESSION /* SessionGet auth handle */ +#define OCI_HTYPE_TRANS 10 /* transaction handle */ +#define OCI_HTYPE_COMPLEXOBJECT 11 /* complex object retrieval handle */ +#define OCI_HTYPE_SECURITY 12 /* security handle */ +#define OCI_HTYPE_SUBSCRIPTION 13 /* subscription handle */ +#define OCI_HTYPE_DIRPATH_CTX 14 /* direct path context */ +#define OCI_HTYPE_DIRPATH_COLUMN_ARRAY 15 /* direct path column array */ +#define OCI_HTYPE_DIRPATH_STREAM 16 /* direct path stream */ +#define OCI_HTYPE_PROC 17 /* process handle */ +#define OCI_HTYPE_DIRPATH_FN_CTX 18 /* direct path function context */ +#define OCI_HTYPE_DIRPATH_FN_COL_ARRAY 19 /* dp object column array */ +#define OCI_HTYPE_XADSESSION 20 /* access driver session */ +#define OCI_HTYPE_XADTABLE 21 /* access driver table */ +#define OCI_HTYPE_XADFIELD 22 /* access driver field */ +#define OCI_HTYPE_XADGRANULE 23 /* access driver granule */ +#define OCI_HTYPE_XADRECORD 24 /* access driver record */ +#define OCI_HTYPE_XADIO 25 /* access driver I/O */ +#define OCI_HTYPE_CPOOL 26 /* connection pool handle */ +#define OCI_HTYPE_SPOOL 27 /* session pool handle */ +#define OCI_HTYPE_ADMIN 28 /* admin handle */ +#define OCI_HTYPE_EVENT 29 /* HA event handle */ + +#define OCI_HTYPE_LAST 29 /* last value of a handle type */ + +/*---------------------------------------------------------------------------*/ + + +/*-------------------------Descriptor Types----------------------------------*/ + /* descriptor values range from 50 - 255 */ +#define OCI_DTYPE_FIRST 50 /* start value of descriptor type */ +#define OCI_DTYPE_LOB 50 /* lob locator */ +#define OCI_DTYPE_SNAP 51 /* snapshot descriptor */ +#define OCI_DTYPE_RSET 52 /* result set descriptor */ +#define OCI_DTYPE_PARAM 53 /* a parameter descriptor obtained from ocigparm */ +#define OCI_DTYPE_ROWID 54 /* rowid descriptor */ +#define OCI_DTYPE_COMPLEXOBJECTCOMP 55 + /* complex object retrieval descriptor */ +#define OCI_DTYPE_FILE 56 /* File Lob locator */ +#define OCI_DTYPE_AQENQ_OPTIONS 57 /* enqueue options */ +#define OCI_DTYPE_AQDEQ_OPTIONS 58 /* dequeue options */ +#define OCI_DTYPE_AQMSG_PROPERTIES 59 /* message properties */ +#define OCI_DTYPE_AQAGENT 60 /* aq agent */ +#define OCI_DTYPE_LOCATOR 61 /* LOB locator */ +#define OCI_DTYPE_INTERVAL_YM 62 /* Interval year month */ +#define OCI_DTYPE_INTERVAL_DS 63 /* Interval day second */ +#define OCI_DTYPE_AQNFY_DESCRIPTOR 64 /* AQ notify descriptor */ +#define OCI_DTYPE_DATE 65 /* Date */ +#define OCI_DTYPE_TIME 66 /* Time */ +#define OCI_DTYPE_TIME_TZ 67 /* Time with timezone */ +#define OCI_DTYPE_TIMESTAMP 68 /* Timestamp */ +#define OCI_DTYPE_TIMESTAMP_TZ 69 /* Timestamp with timezone */ +#define OCI_DTYPE_TIMESTAMP_LTZ 70 /* Timestamp with local tz */ +#define OCI_DTYPE_UCB 71 /* user callback descriptor */ +#define OCI_DTYPE_SRVDN 72 /* server DN list descriptor */ +#define OCI_DTYPE_SIGNATURE 73 /* signature */ +#define OCI_DTYPE_RESERVED_1 74 /* reserved for internal use */ +#define OCI_DTYPE_AQLIS_OPTIONS 75 /* AQ listen options */ +#define OCI_DTYPE_AQLIS_MSG_PROPERTIES 76 /* AQ listen msg props */ +#define OCI_DTYPE_CHDES 77 /* Top level change notification desc */ +#define OCI_DTYPE_TABLE_CHDES 78 /* Table change descriptor */ +#define OCI_DTYPE_ROW_CHDES 79 /* Row change descriptor */ +#define OCI_DTYPE_CQDES 80 /* Query change descriptor */ +#define OCI_DTYPE_LOB_REGION 81 /* LOB Share region descriptor */ +#define OCI_DTYPE_LAST 81 /* last value of a descriptor type */ + +/*---------------------------------------------------------------------------*/ + +/*--------------------------------LOB types ---------------------------------*/ +#define OCI_TEMP_BLOB 1 /* LOB type - BLOB ------------------ */ +#define OCI_TEMP_CLOB 2 /* LOB type - CLOB ------------------ */ +/*---------------------------------------------------------------------------*/ + +/*-------------------------Object Ptr Types----------------------------------*/ +#define OCI_OTYPE_NAME 1 /* object name */ +#define OCI_OTYPE_REF 2 /* REF to TDO */ +#define OCI_OTYPE_PTR 3 /* PTR to TDO */ +/*---------------------------------------------------------------------------*/ + +/*=============================Attribute Types===============================*/ +/* + Note: All attributes are global. New attibutes should be added to the end + of the list. Before you add an attribute see if an existing one can be + used for your handle. + + If you see any holes please use the holes first. + +*/ +/*===========================================================================*/ + + +#define OCI_ATTR_FNCODE 1 /* the OCI function code */ +#define OCI_ATTR_OBJECT 2 /* is the environment initialized in object mode */ +#define OCI_ATTR_NONBLOCKING_MODE 3 /* non blocking mode */ +#define OCI_ATTR_SQLCODE 4 /* the SQL verb */ +#define OCI_ATTR_ENV 5 /* the environment handle */ +#define OCI_ATTR_SERVER 6 /* the server handle */ +#define OCI_ATTR_SESSION 7 /* the user session handle */ +#define OCI_ATTR_TRANS 8 /* the transaction handle */ +#define OCI_ATTR_ROW_COUNT 9 /* the rows processed so far */ +#define OCI_ATTR_SQLFNCODE 10 /* the SQL verb of the statement */ +#define OCI_ATTR_PREFETCH_ROWS 11 /* sets the number of rows to prefetch */ +#define OCI_ATTR_NESTED_PREFETCH_ROWS 12 /* the prefetch rows of nested table*/ +#define OCI_ATTR_PREFETCH_MEMORY 13 /* memory limit for rows fetched */ +#define OCI_ATTR_NESTED_PREFETCH_MEMORY 14 /* memory limit for nested rows */ +#define OCI_ATTR_CHAR_COUNT 15 + /* this specifies the bind and define size in characters */ +#define OCI_ATTR_PDSCL 16 /* packed decimal scale */ +#define OCI_ATTR_FSPRECISION OCI_ATTR_PDSCL + /* fs prec for datetime data types */ +#define OCI_ATTR_PDPRC 17 /* packed decimal format */ +#define OCI_ATTR_LFPRECISION OCI_ATTR_PDPRC + /* fs prec for datetime data types */ +#define OCI_ATTR_PARAM_COUNT 18 /* number of column in the select list */ +#define OCI_ATTR_ROWID 19 /* the rowid */ +#define OCI_ATTR_CHARSET 20 /* the character set value */ +#define OCI_ATTR_NCHAR 21 /* NCHAR type */ +#define OCI_ATTR_USERNAME 22 /* username attribute */ +#define OCI_ATTR_PASSWORD 23 /* password attribute */ +#define OCI_ATTR_STMT_TYPE 24 /* statement type */ +#define OCI_ATTR_INTERNAL_NAME 25 /* user friendly global name */ +#define OCI_ATTR_EXTERNAL_NAME 26 /* the internal name for global txn */ +#define OCI_ATTR_XID 27 /* XOPEN defined global transaction id */ +#define OCI_ATTR_TRANS_LOCK 28 /* */ +#define OCI_ATTR_TRANS_NAME 29 /* string to identify a global transaction */ +#define OCI_ATTR_HEAPALLOC 30 /* memory allocated on the heap */ +#define OCI_ATTR_CHARSET_ID 31 /* Character Set ID */ +#define OCI_ATTR_CHARSET_FORM 32 /* Character Set Form */ +#define OCI_ATTR_MAXDATA_SIZE 33 /* Maximumsize of data on the server */ +#define OCI_ATTR_CACHE_OPT_SIZE 34 /* object cache optimal size */ +#define OCI_ATTR_CACHE_MAX_SIZE 35 /* object cache maximum size percentage */ +#define OCI_ATTR_PINOPTION 36 /* object cache default pin option */ +#define OCI_ATTR_ALLOC_DURATION 37 + /* object cache default allocation duration */ +#define OCI_ATTR_PIN_DURATION 38 /* object cache default pin duration */ +#define OCI_ATTR_FDO 39 /* Format Descriptor object attribute */ +#define OCI_ATTR_POSTPROCESSING_CALLBACK 40 + /* Callback to process outbind data */ +#define OCI_ATTR_POSTPROCESSING_CONTEXT 41 + /* Callback context to process outbind data */ +#define OCI_ATTR_ROWS_RETURNED 42 + /* Number of rows returned in current iter - for Bind handles */ +#define OCI_ATTR_FOCBK 43 /* Failover Callback attribute */ +#define OCI_ATTR_IN_V8_MODE 44 /* is the server/service context in V8 mode */ +#define OCI_ATTR_LOBEMPTY 45 /* empty lob ? */ +#define OCI_ATTR_SESSLANG 46 /* session language handle */ + +#define OCI_ATTR_VISIBILITY 47 /* visibility */ +#define OCI_ATTR_RELATIVE_MSGID 48 /* relative message id */ +#define OCI_ATTR_SEQUENCE_DEVIATION 49 /* sequence deviation */ + +#define OCI_ATTR_CONSUMER_NAME 50 /* consumer name */ +#define OCI_ATTR_DEQ_MODE 51 /* dequeue mode */ +#define OCI_ATTR_NAVIGATION 52 /* navigation */ +#define OCI_ATTR_WAIT 53 /* wait */ +#define OCI_ATTR_DEQ_MSGID 54 /* dequeue message id */ + +#define OCI_ATTR_PRIORITY 55 /* priority */ +#define OCI_ATTR_DELAY 56 /* delay */ +#define OCI_ATTR_EXPIRATION 57 /* expiration */ +#define OCI_ATTR_CORRELATION 58 /* correlation id */ +#define OCI_ATTR_ATTEMPTS 59 /* # of attempts */ +#define OCI_ATTR_RECIPIENT_LIST 60 /* recipient list */ +#define OCI_ATTR_EXCEPTION_QUEUE 61 /* exception queue name */ +#define OCI_ATTR_ENQ_TIME 62 /* enqueue time (only OCIAttrGet) */ +#define OCI_ATTR_MSG_STATE 63/* message state (only OCIAttrGet) */ + /* NOTE: 64-66 used below */ +#define OCI_ATTR_AGENT_NAME 64 /* agent name */ +#define OCI_ATTR_AGENT_ADDRESS 65 /* agent address */ +#define OCI_ATTR_AGENT_PROTOCOL 66 /* agent protocol */ +#define OCI_ATTR_USER_PROPERTY 67 /* user property */ +#define OCI_ATTR_SENDER_ID 68 /* sender id */ +#define OCI_ATTR_ORIGINAL_MSGID 69 /* original message id */ + +#define OCI_ATTR_QUEUE_NAME 70 /* queue name */ +#define OCI_ATTR_NFY_MSGID 71 /* message id */ +#define OCI_ATTR_MSG_PROP 72 /* message properties */ + +#define OCI_ATTR_NUM_DML_ERRORS 73 /* num of errs in array DML */ +#define OCI_ATTR_DML_ROW_OFFSET 74 /* row offset in the array */ + + /* AQ array error handling uses DML method of accessing errors */ +#define OCI_ATTR_AQ_NUM_ERRORS OCI_ATTR_NUM_DML_ERRORS +#define OCI_ATTR_AQ_ERROR_INDEX OCI_ATTR_DML_ROW_OFFSET + +#define OCI_ATTR_DATEFORMAT 75 /* default date format string */ +#define OCI_ATTR_BUF_ADDR 76 /* buffer address */ +#define OCI_ATTR_BUF_SIZE 77 /* buffer size */ + +/* For values 78 - 80, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_NUM_ROWS 81 /* number of rows in column array */ + /* NOTE that OCI_ATTR_NUM_COLS is a column + * array attribute too. + */ +#define OCI_ATTR_COL_COUNT 82 /* columns of column array + processed so far. */ +#define OCI_ATTR_STREAM_OFFSET 83 /* str off of last row processed */ +#define OCI_ATTR_SHARED_HEAPALLOC 84 /* Shared Heap Allocation Size */ + +#define OCI_ATTR_SERVER_GROUP 85 /* server group name */ + +#define OCI_ATTR_MIGSESSION 86 /* migratable session attribute */ + +#define OCI_ATTR_NOCACHE 87 /* Temporary LOBs */ + +#define OCI_ATTR_MEMPOOL_SIZE 88 /* Pool Size */ +#define OCI_ATTR_MEMPOOL_INSTNAME 89 /* Instance name */ +#define OCI_ATTR_MEMPOOL_APPNAME 90 /* Application name */ +#define OCI_ATTR_MEMPOOL_HOMENAME 91 /* Home Directory name */ +#define OCI_ATTR_MEMPOOL_MODEL 92 /* Pool Model (proc,thrd,both)*/ +#define OCI_ATTR_MODES 93 /* Modes */ + +#define OCI_ATTR_SUBSCR_NAME 94 /* name of subscription */ +#define OCI_ATTR_SUBSCR_CALLBACK 95 /* associated callback */ +#define OCI_ATTR_SUBSCR_CTX 96 /* associated callback context */ +#define OCI_ATTR_SUBSCR_PAYLOAD 97 /* associated payload */ +#define OCI_ATTR_SUBSCR_NAMESPACE 98 /* associated namespace */ + +#define OCI_ATTR_PROXY_CREDENTIALS 99 /* Proxy user credentials */ +#define OCI_ATTR_INITIAL_CLIENT_ROLES 100 /* Initial client role list */ + +#define OCI_ATTR_UNK 101 /* unknown attribute */ +#define OCI_ATTR_NUM_COLS 102 /* number of columns */ +#define OCI_ATTR_LIST_COLUMNS 103 /* parameter of the column list */ +#define OCI_ATTR_RDBA 104 /* DBA of the segment header */ +#define OCI_ATTR_CLUSTERED 105 /* whether the table is clustered */ +#define OCI_ATTR_PARTITIONED 106 /* whether the table is partitioned */ +#define OCI_ATTR_INDEX_ONLY 107 /* whether the table is index only */ +#define OCI_ATTR_LIST_ARGUMENTS 108 /* parameter of the argument list */ +#define OCI_ATTR_LIST_SUBPROGRAMS 109 /* parameter of the subprogram list */ +#define OCI_ATTR_REF_TDO 110 /* REF to the type descriptor */ +#define OCI_ATTR_LINK 111 /* the database link name */ +#define OCI_ATTR_MIN 112 /* minimum value */ +#define OCI_ATTR_MAX 113 /* maximum value */ +#define OCI_ATTR_INCR 114 /* increment value */ +#define OCI_ATTR_CACHE 115 /* number of sequence numbers cached */ +#define OCI_ATTR_ORDER 116 /* whether the sequence is ordered */ +#define OCI_ATTR_HW_MARK 117 /* high-water mark */ +#define OCI_ATTR_TYPE_SCHEMA 118 /* type's schema name */ +#define OCI_ATTR_TIMESTAMP 119 /* timestamp of the object */ +#define OCI_ATTR_NUM_ATTRS 120 /* number of sttributes */ +#define OCI_ATTR_NUM_PARAMS 121 /* number of parameters */ +#define OCI_ATTR_OBJID 122 /* object id for a table or view */ +#define OCI_ATTR_PTYPE 123 /* type of info described by */ +#define OCI_ATTR_PARAM 124 /* parameter descriptor */ +#define OCI_ATTR_OVERLOAD_ID 125 /* overload ID for funcs and procs */ +#define OCI_ATTR_TABLESPACE 126 /* table name space */ +#define OCI_ATTR_TDO 127 /* TDO of a type */ +#define OCI_ATTR_LTYPE 128 /* list type */ +#define OCI_ATTR_PARSE_ERROR_OFFSET 129 /* Parse Error offset */ +#define OCI_ATTR_IS_TEMPORARY 130 /* whether table is temporary */ +#define OCI_ATTR_IS_TYPED 131 /* whether table is typed */ +#define OCI_ATTR_DURATION 132 /* duration of temporary table */ +#define OCI_ATTR_IS_INVOKER_RIGHTS 133 /* is invoker rights */ +#define OCI_ATTR_OBJ_NAME 134 /* top level schema obj name */ +#define OCI_ATTR_OBJ_SCHEMA 135 /* schema name */ +#define OCI_ATTR_OBJ_ID 136 /* top level schema object id */ + +/* For values 137 - 141, see DirPathAPI attribute section in this file */ + + +#define OCI_ATTR_TRANS_TIMEOUT 142 /* transaction timeout */ +#define OCI_ATTR_SERVER_STATUS 143/* state of the server handle */ +#define OCI_ATTR_STATEMENT 144 /* statement txt in stmt hdl */ + +/* For value 145, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_DEQCOND 146 /* dequeue condition */ +#define OCI_ATTR_RESERVED_2 147 /* reserved */ + + +#define OCI_ATTR_SUBSCR_RECPT 148 /* recepient of subscription */ +#define OCI_ATTR_SUBSCR_RECPTPROTO 149 /* protocol for recepient */ + +/* For values 150 - 151, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_LDAP_HOST 153 /* LDAP host to connect to */ +#define OCI_ATTR_LDAP_PORT 154 /* LDAP port to connect to */ +#define OCI_ATTR_BIND_DN 155 /* bind DN */ +#define OCI_ATTR_LDAP_CRED 156 /* credentials to connect to LDAP */ +#define OCI_ATTR_WALL_LOC 157 /* client wallet location */ +#define OCI_ATTR_LDAP_AUTH 158 /* LDAP authentication method */ +#define OCI_ATTR_LDAP_CTX 159 /* LDAP adminstration context DN */ +#define OCI_ATTR_SERVER_DNS 160 /* list of registration server DNs */ + +#define OCI_ATTR_DN_COUNT 161 /* the number of server DNs */ +#define OCI_ATTR_SERVER_DN 162 /* server DN attribute */ + +#define OCI_ATTR_MAXCHAR_SIZE 163 /* max char size of data */ + +#define OCI_ATTR_CURRENT_POSITION 164 /* for scrollable result sets*/ + +/* Added to get attributes for ref cursor to statement handle */ +#define OCI_ATTR_RESERVED_3 165 /* reserved */ +#define OCI_ATTR_RESERVED_4 166 /* reserved */ + +/* For value 167, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_DIGEST_ALGO 168 /* digest algorithm */ +#define OCI_ATTR_CERTIFICATE 169 /* certificate */ +#define OCI_ATTR_SIGNATURE_ALGO 170 /* signature algorithm */ +#define OCI_ATTR_CANONICAL_ALGO 171 /* canonicalization algo. */ +#define OCI_ATTR_PRIVATE_KEY 172 /* private key */ +#define OCI_ATTR_DIGEST_VALUE 173 /* digest value */ +#define OCI_ATTR_SIGNATURE_VAL 174 /* signature value */ +#define OCI_ATTR_SIGNATURE 175 /* signature */ + +/* attributes for setting OCI stmt caching specifics in svchp */ +#define OCI_ATTR_STMTCACHESIZE 176 /* size of the stm cache */ + +/* --------------------------- Connection Pool Attributes ------------------ */ +#define OCI_ATTR_CONN_NOWAIT 178 +#define OCI_ATTR_CONN_BUSY_COUNT 179 +#define OCI_ATTR_CONN_OPEN_COUNT 180 +#define OCI_ATTR_CONN_TIMEOUT 181 +#define OCI_ATTR_STMT_STATE 182 +#define OCI_ATTR_CONN_MIN 183 +#define OCI_ATTR_CONN_MAX 184 +#define OCI_ATTR_CONN_INCR 185 + +/* For value 187, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_NUM_OPEN_STMTS 188 /* open stmts in session */ +#define OCI_ATTR_DESCRIBE_NATIVE 189 /* get native info via desc */ + +#define OCI_ATTR_BIND_COUNT 190 /* number of bind postions */ +#define OCI_ATTR_HANDLE_POSITION 191 /* pos of bind/define handle */ +#define OCI_ATTR_RESERVED_5 192 /* reserverd */ +#define OCI_ATTR_SERVER_BUSY 193 /* call in progress on server*/ + +/* For value 194, see DirPathAPI attribute section in this file */ + +/* notification presentation for recipient */ +#define OCI_ATTR_SUBSCR_RECPTPRES 195 +#define OCI_ATTR_TRANSFORMATION 196 /* AQ message transformation */ + +#define OCI_ATTR_ROWS_FETCHED 197 /* rows fetched in last call */ + +/* --------------------------- Snapshot attributes ------------------------- */ +#define OCI_ATTR_SCN_BASE 198 /* snapshot base */ +#define OCI_ATTR_SCN_WRAP 199 /* snapshot wrap */ + +/* --------------------------- Miscellanous attributes --------------------- */ +#define OCI_ATTR_RESERVED_6 200 /* reserved */ +#define OCI_ATTR_READONLY_TXN 201 /* txn is readonly */ +#define OCI_ATTR_RESERVED_7 202 /* reserved */ +#define OCI_ATTR_ERRONEOUS_COLUMN 203 /* position of erroneous col */ +#define OCI_ATTR_RESERVED_8 204 /* reserved */ +#define OCI_ATTR_ASM_VOL_SPRT 205 /* ASM volume supported? */ + +/* For value 206, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_INST_TYPE 207 /* oracle instance type */ +/******USED attribute 208 for OCI_ATTR_SPOOL_STMTCACHESIZE*******************/ + +#define OCI_ATTR_ENV_UTF16 209 /* is env in utf16 mode? */ +#define OCI_ATTR_RESERVED_9 210 /* reserved */ +#define OCI_ATTR_RESERVED_10 211 /* reserved */ + +/* For values 212 and 213, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_RESERVED_12 214 /* reserved */ +#define OCI_ATTR_RESERVED_13 215 /* reserved */ +#define OCI_ATTR_IS_EXTERNAL 216 /* whether table is external */ + + +/* -------------------------- Statement Handle Attributes ------------------ */ + +#define OCI_ATTR_RESERVED_15 217 /* reserved */ +#define OCI_ATTR_STMT_IS_RETURNING 218 /* stmt has returning clause */ +#define OCI_ATTR_RESERVED_16 219 /* reserved */ +#define OCI_ATTR_RESERVED_17 220 /* reserved */ +#define OCI_ATTR_RESERVED_18 221 /* reserved */ + +/* --------------------------- session attributes ---------------------------*/ +#define OCI_ATTR_RESERVED_19 222 /* reserved */ +#define OCI_ATTR_RESERVED_20 223 /* reserved */ +#define OCI_ATTR_CURRENT_SCHEMA 224 /* Current Schema */ +#define OCI_ATTR_RESERVED_21 415 /* reserved */ + +/* ------------------------- notification subscription ----------------------*/ +#define OCI_ATTR_SUBSCR_QOSFLAGS 225 /* QOS flags */ +#define OCI_ATTR_SUBSCR_PAYLOADCBK 226 /* Payload callback */ +#define OCI_ATTR_SUBSCR_TIMEOUT 227 /* Timeout */ +#define OCI_ATTR_SUBSCR_NAMESPACE_CTX 228 /* Namespace context */ +#define OCI_ATTR_SUBSCR_CQ_QOSFLAGS 229 + /* change notification (CQ) specific QOS flags */ +#define OCI_ATTR_SUBSCR_CQ_REGID 230 + /* change notification registration id */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_CLASS 231/* ntfn grouping class */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_VALUE 232/* ntfn grouping value */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_TYPE 233 /* ntfn grouping type */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_START_TIME 234/* ntfn grp start time */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_REPEAT_COUNT 235 /* ntfn grp rep count */ +#define OCI_ATTR_AQ_NTFN_GROUPING_MSGID_ARRAY 236 /* aq grp msgid array */ +#define OCI_ATTR_AQ_NTFN_GROUPING_COUNT 237 /* ntfns recd in grp */ + +/* ----------------------- row callback attributes ------------------------- */ +#define OCI_ATTR_BIND_ROWCBK 301 /* bind row callback */ +#define OCI_ATTR_BIND_ROWCTX 302 /* ctx for bind row callback */ +#define OCI_ATTR_SKIP_BUFFER 303 /* skip buffer in array ops */ + +/* ----------------------- XStream API attributes -------------------------- */ +#define OCI_ATTR_XSTREAM_ACK_INTERVAL 350 /* XStream ack interval */ +#define OCI_ATTR_XSTREAM_IDLE_TIMEOUT 351 /* XStream idle timeout */ + +/*----- Db Change Notification (CQ) statement handle attributes------------ */ +#define OCI_ATTR_CQ_QUERYID 304 +/* ------------- DB Change Notification reg handle attributes ---------------*/ +#define OCI_ATTR_CHNF_TABLENAMES 401 /* out: array of table names */ +#define OCI_ATTR_CHNF_ROWIDS 402 /* in: rowids needed */ +#define OCI_ATTR_CHNF_OPERATIONS 403 + /* in: notification operation filter*/ +#define OCI_ATTR_CHNF_CHANGELAG 404 + /* txn lag between notifications */ + +/* DB Change: Notification Descriptor attributes -----------------------*/ +#define OCI_ATTR_CHDES_DBNAME 405 /* source database */ +#define OCI_ATTR_CHDES_NFYTYPE 406 /* notification type flags */ +#define OCI_ATTR_CHDES_XID 407 /* XID of the transaction */ +#define OCI_ATTR_CHDES_TABLE_CHANGES 408/* array of table chg descriptors*/ + +#define OCI_ATTR_CHDES_TABLE_NAME 409 /* table name */ +#define OCI_ATTR_CHDES_TABLE_OPFLAGS 410 /* table operation flags */ +#define OCI_ATTR_CHDES_TABLE_ROW_CHANGES 411 /* array of changed rows */ +#define OCI_ATTR_CHDES_ROW_ROWID 412 /* rowid of changed row */ +#define OCI_ATTR_CHDES_ROW_OPFLAGS 413 /* row operation flags */ + +/* Statement handle attribute for db change notification */ +#define OCI_ATTR_CHNF_REGHANDLE 414 /* IN: subscription handle */ +#define OCI_ATTR_NETWORK_FILE_DESC 415 /* network file descriptor */ + +/* client name for single session proxy */ +#define OCI_ATTR_PROXY_CLIENT 416 + +/* 415 is already taken - see OCI_ATTR_RESERVED_21 */ + +/* TDE attributes on the Table */ +#define OCI_ATTR_TABLE_ENC 417/* does table have any encrypt columns */ +#define OCI_ATTR_TABLE_ENC_ALG 418 /* Table encryption Algorithm */ +#define OCI_ATTR_TABLE_ENC_ALG_ID 419 /* Internal Id of encryption Algorithm*/ + +/* -------- Attributes related to Statement cache callback ----------------- */ +#define OCI_ATTR_STMTCACHE_CBKCTX 420 /* opaque context on stmt */ +#define OCI_ATTR_STMTCACHE_CBK 421 /* callback fn for stmtcache */ + +/*---------------- Query change descriptor attributes -----------------------*/ +#define OCI_ATTR_CQDES_OPERATION 422 +#define OCI_ATTR_CQDES_TABLE_CHANGES 423 +#define OCI_ATTR_CQDES_QUERYID 424 + + +#define OCI_ATTR_CHDES_QUERIES 425 /* Top level change desc array of queries */ + +/* Please use from 143 */ + +/* -------- Internal statement attributes ------- */ +#define OCI_ATTR_RESERVED_26 422 + +/* 424 is used by OCI_ATTR_DRIVER_NAME */ +/* --------- Attributes added to support server side session pool ---------- */ +#define OCI_ATTR_CONNECTION_CLASS 425 +#define OCI_ATTR_PURITY 426 + +#define OCI_ATTR_PURITY_DEFAULT 0x00 +#define OCI_ATTR_PURITY_NEW 0x01 +#define OCI_ATTR_PURITY_SELF 0x02 + +/* -------- Attributes for Times Ten --------------------------*/ +#define OCI_ATTR_RESERVED_28 426 /* reserved */ +#define OCI_ATTR_RESERVED_29 427 /* reserved */ +#define OCI_ATTR_RESERVED_30 428 /* reserved */ +#define OCI_ATTR_RESERVED_31 429 /* reserved */ +#define OCI_ATTR_RESERVED_32 430 /* reserved */ +#define OCI_ATTR_RESERVED_41 454 /* reserved */ + + +/* ----------- Reserve internal attributes for workload replay ------------ */ +#define OCI_ATTR_RESERVED_33 433 +#define OCI_ATTR_RESERVED_34 434 + +/* statement attribute */ +#define OCI_ATTR_RESERVED_36 444 + +/* -------- Attributes for Network Session Time Out--------------------------*/ +#define OCI_ATTR_SEND_TIMEOUT 435 /* NS send timeout */ +#define OCI_ATTR_RECEIVE_TIMEOUT 436 /* NS receive timeout */ + +/*--------- Attributes related to LOB prefetch------------------------------ */ +#define OCI_ATTR_DEFAULT_LOBPREFETCH_SIZE 438 /* default prefetch size */ +#define OCI_ATTR_LOBPREFETCH_SIZE 439 /* prefetch size */ +#define OCI_ATTR_LOBPREFETCH_LENGTH 440 /* prefetch length & chunk */ + +/*--------- Attributes related to LOB Deduplicate Regions ------------------ */ +#define OCI_ATTR_LOB_REGION_PRIMARY 442 /* Primary LOB Locator */ +#define OCI_ATTR_LOB_REGION_PRIMOFF 443 /* Offset into Primary LOB */ +#define OCI_ATTR_LOB_REGION_OFFSET 445 /* Region Offset */ +#define OCI_ATTR_LOB_REGION_LENGTH 446 /* Region Length Bytes/Chars */ +#define OCI_ATTR_LOB_REGION_MIME 447 /* Region mime type */ + +/*--------------------Attribute to fetch ROWID ------------------------------*/ +#define OCI_ATTR_FETCH_ROWID 448 + +/* server attribute */ +#define OCI_ATTR_RESERVED_37 449 + +/*------------------- Client Internal Attributes -----------------------*/ +#define OCI_ATTR_RESERVED_38 450 +#define OCI_ATTR_RESERVED_39 451 + +/* --------------- ip address attribute in environment handle -------------- */ +#define OCI_ATTR_SUBSCR_IPADDR 452 /* ip address to listen on */ + +/* server attribute */ +#define OCI_ATTR_RESERVED_40 453 + +/* DB Change: Event types ---------------*/ +#define OCI_EVENT_NONE 0x0 /* None */ +#define OCI_EVENT_STARTUP 0x1 /* Startup database */ +#define OCI_EVENT_SHUTDOWN 0x2 /* Shutdown database */ +#define OCI_EVENT_SHUTDOWN_ANY 0x3 /* Startup instance */ +#define OCI_EVENT_DROP_DB 0x4 /* Drop database */ +#define OCI_EVENT_DEREG 0x5 /* Subscription deregistered */ +#define OCI_EVENT_OBJCHANGE 0x6 /* Object change notification */ +#define OCI_EVENT_QUERYCHANGE 0x7 /* query result change */ + +/* DB Change: Operation types -----------*/ +#define OCI_OPCODE_ALLROWS 0x1 /* all rows invalidated */ +#define OCI_OPCODE_ALLOPS 0x0 /* interested in all operations */ +#define OCI_OPCODE_INSERT 0x2 /* INSERT */ +#define OCI_OPCODE_UPDATE 0x4 /* UPDATE */ +#define OCI_OPCODE_DELETE 0x8 /* DELETE */ +#define OCI_OPCODE_ALTER 0x10 /* ALTER */ +#define OCI_OPCODE_DROP 0x20 /* DROP TABLE */ +#define OCI_OPCODE_UNKNOWN 0x40 /* GENERIC/ UNKNOWN*/ + +/* -------- client side character and national character set ids ----------- */ +#define OCI_ATTR_ENV_CHARSET_ID OCI_ATTR_CHARSET_ID /* charset id in env */ +#define OCI_ATTR_ENV_NCHARSET_ID OCI_ATTR_NCHARSET_ID /* ncharset id in env */ + +/* ----------------------- ha event callback attributes -------------------- */ +#define OCI_ATTR_EVTCBK 304 /* ha callback */ +#define OCI_ATTR_EVTCTX 305 /* ctx for ha callback */ + +/* ------------------ User memory attributes (all handles) ----------------- */ +#define OCI_ATTR_USER_MEMORY 306 /* pointer to user memory */ + +/* ------- unauthorised access and user action auditing banners ------------ */ +#define OCI_ATTR_ACCESS_BANNER 307 /* access banner */ +#define OCI_ATTR_AUDIT_BANNER 308 /* audit banner */ + +/* ----------------- port no attribute in environment handle ------------- */ +#define OCI_ATTR_SUBSCR_PORTNO 390 /* port no to listen */ + +#define OCI_ATTR_RESERVED_35 437 + +/*------------- Supported Values for protocol for recepient -----------------*/ +#define OCI_SUBSCR_PROTO_OCI 0 /* oci */ +#define OCI_SUBSCR_PROTO_MAIL 1 /* mail */ +#define OCI_SUBSCR_PROTO_SERVER 2 /* server */ +#define OCI_SUBSCR_PROTO_HTTP 3 /* http */ +#define OCI_SUBSCR_PROTO_MAX 4 /* max current protocols */ + +/*------------- Supported Values for presentation for recepient -------------*/ +#define OCI_SUBSCR_PRES_DEFAULT 0 /* default */ +#define OCI_SUBSCR_PRES_XML 1 /* xml */ +#define OCI_SUBSCR_PRES_MAX 2 /* max current presentations */ + +/*------------- Supported QOS values for notification registrations ---------*/ +#define OCI_SUBSCR_QOS_RELIABLE 0x01 /* reliable */ +#define OCI_SUBSCR_QOS_PAYLOAD 0x02 /* payload delivery */ +#define OCI_SUBSCR_QOS_REPLICATE 0x04 /* replicate to director */ +#define OCI_SUBSCR_QOS_SECURE 0x08 /* secure payload delivery */ +#define OCI_SUBSCR_QOS_PURGE_ON_NTFN 0x10 /* purge on first ntfn */ +#define OCI_SUBSCR_QOS_MULTICBK 0x20 /* multi instance callback */ + /* 0x40 is used for a internal flag */ +#define OCI_SUBSCR_QOS_HAREG 0x80 /* HA reg */ + +/* ----QOS flags specific to change notification/ continuous queries CQ -----*/ +#define OCI_SUBSCR_CQ_QOS_QUERY 0x01 /* query level notification */ +#define OCI_SUBSCR_CQ_QOS_BEST_EFFORT 0x02 /* best effort notification */ +#define OCI_SUBSCR_CQ_QOS_CLQRYCACHE 0x04 /* client query caching */ + +/*------------- Supported Values for notification grouping class ------------*/ +#define OCI_SUBSCR_NTFN_GROUPING_CLASS_TIME 1 /* time */ + +/*------------- Supported Values for notification grouping type -------------*/ +#define OCI_SUBSCR_NTFN_GROUPING_TYPE_SUMMARY 1 /* summary */ +#define OCI_SUBSCR_NTFN_GROUPING_TYPE_LAST 2 /* last */ + +/* ----- Temporary attribute value for UCS2/UTF16 character set ID -------- */ +#define OCI_UCS2ID 1000 /* UCS2 charset ID */ +#define OCI_UTF16ID 1000 /* UTF16 charset ID */ + +/*============================== End OCI Attribute Types ====================*/ + +/*---------------- Server Handle Attribute Values ---------------------------*/ + +/* OCI_ATTR_SERVER_STATUS */ +#define OCI_SERVER_NOT_CONNECTED 0x0 +#define OCI_SERVER_NORMAL 0x1 + +/*---------------------------------------------------------------------------*/ + +/*------------------------- Supported Namespaces ---------------------------*/ +#define OCI_SUBSCR_NAMESPACE_ANONYMOUS 0 /* Anonymous Namespace */ +#define OCI_SUBSCR_NAMESPACE_AQ 1 /* Advanced Queues */ +#define OCI_SUBSCR_NAMESPACE_DBCHANGE 2 /* change notification */ +#define OCI_SUBSCR_NAMESPACE_MAX 3 /* Max Name Space Number */ + + +/*-------------------------Credential Types----------------------------------*/ +#define OCI_CRED_RDBMS 1 /* database username/password */ +#define OCI_CRED_EXT 2 /* externally provided credentials */ +#define OCI_CRED_PROXY 3 /* proxy authentication */ +#define OCI_CRED_RESERVED_1 4 /* reserved */ +#define OCI_CRED_RESERVED_2 5 /* reserved */ +/*---------------------------------------------------------------------------*/ + +/*------------------------Error Return Values--------------------------------*/ +#define OCI_SUCCESS 0 /* maps to SQL_SUCCESS of SAG CLI */ +#define OCI_SUCCESS_WITH_INFO 1 /* maps to SQL_SUCCESS_WITH_INFO */ +#define OCI_RESERVED_FOR_INT_USE 200 /* reserved */ +#define OCI_NO_DATA 100 /* maps to SQL_NO_DATA */ +#define OCI_ERROR -1 /* maps to SQL_ERROR */ +#define OCI_INVALID_HANDLE -2 /* maps to SQL_INVALID_HANDLE */ +#define OCI_NEED_DATA 99 /* maps to SQL_NEED_DATA */ +#define OCI_STILL_EXECUTING -3123 /* OCI would block error */ +/*---------------------------------------------------------------------------*/ + +/*--------------------- User Callback Return Values -------------------------*/ +#define OCI_CONTINUE -24200 /* Continue with the body of the OCI function */ +#define OCI_ROWCBK_DONE -24201 /* done with user row callback */ +/*---------------------------------------------------------------------------*/ + +/*------------------DateTime and Interval check Error codes------------------*/ + +/* DateTime Error Codes used by OCIDateTimeCheck() */ +#define OCI_DT_INVALID_DAY 0x1 /* Bad day */ +#define OCI_DT_DAY_BELOW_VALID 0x2 /* Bad DAy Low/high bit (1=low)*/ +#define OCI_DT_INVALID_MONTH 0x4 /* Bad MOnth */ +#define OCI_DT_MONTH_BELOW_VALID 0x8 /* Bad MOnth Low/high bit (1=low) */ +#define OCI_DT_INVALID_YEAR 0x10 /* Bad YeaR */ +#define OCI_DT_YEAR_BELOW_VALID 0x20 /* Bad YeaR Low/high bit (1=low) */ +#define OCI_DT_INVALID_HOUR 0x40 /* Bad HouR */ +#define OCI_DT_HOUR_BELOW_VALID 0x80 /* Bad HouR Low/high bit (1=low) */ +#define OCI_DT_INVALID_MINUTE 0x100 /* Bad MiNute */ +#define OCI_DT_MINUTE_BELOW_VALID 0x200 /*Bad MiNute Low/high bit (1=low) */ +#define OCI_DT_INVALID_SECOND 0x400 /* Bad SeCond */ +#define OCI_DT_SECOND_BELOW_VALID 0x800 /*bad second Low/high bit (1=low)*/ +#define OCI_DT_DAY_MISSING_FROM_1582 0x1000 + /* Day is one of those "missing" from 1582 */ +#define OCI_DT_YEAR_ZERO 0x2000 /* Year may not equal zero */ +#define OCI_DT_INVALID_TIMEZONE 0x4000 /* Bad Timezone */ +#define OCI_DT_INVALID_FORMAT 0x8000 /* Bad date format input */ + + +/* Interval Error Codes used by OCIInterCheck() */ +#define OCI_INTER_INVALID_DAY 0x1 /* Bad day */ +#define OCI_INTER_DAY_BELOW_VALID 0x2 /* Bad DAy Low/high bit (1=low) */ +#define OCI_INTER_INVALID_MONTH 0x4 /* Bad MOnth */ +#define OCI_INTER_MONTH_BELOW_VALID 0x8 /*Bad MOnth Low/high bit (1=low) */ +#define OCI_INTER_INVALID_YEAR 0x10 /* Bad YeaR */ +#define OCI_INTER_YEAR_BELOW_VALID 0x20 /*Bad YeaR Low/high bit (1=low) */ +#define OCI_INTER_INVALID_HOUR 0x40 /* Bad HouR */ +#define OCI_INTER_HOUR_BELOW_VALID 0x80 /*Bad HouR Low/high bit (1=low) */ +#define OCI_INTER_INVALID_MINUTE 0x100 /* Bad MiNute */ +#define OCI_INTER_MINUTE_BELOW_VALID 0x200 + /*Bad MiNute Low/high bit(1=low) */ +#define OCI_INTER_INVALID_SECOND 0x400 /* Bad SeCond */ +#define OCI_INTER_SECOND_BELOW_VALID 0x800 + /*bad second Low/high bit(1=low) */ +#define OCI_INTER_INVALID_FRACSEC 0x1000 /* Bad Fractional second */ +#define OCI_INTER_FRACSEC_BELOW_VALID 0x2000 + /* Bad fractional second Low/High */ + + +/*------------------------Parsing Syntax Types-------------------------------*/ +#define OCI_V7_SYNTAX 2 /* V815 language - for backwards compatibility */ +#define OCI_V8_SYNTAX 3 /* V815 language - for backwards compatibility */ +#define OCI_NTV_SYNTAX 1 /* Use what so ever is the native lang of server */ + /* these values must match the values defined in kpul.h */ +/*---------------------------------------------------------------------------*/ + +/*------------------------(Scrollable Cursor) Fetch Options------------------- + * For non-scrollable cursor, the only valid (and default) orientation is + * OCI_FETCH_NEXT + */ +#define OCI_FETCH_CURRENT 0x00000001 /* refetching current position */ +#define OCI_FETCH_NEXT 0x00000002 /* next row */ +#define OCI_FETCH_FIRST 0x00000004 /* first row of the result set */ +#define OCI_FETCH_LAST 0x00000008 /* the last row of the result set */ +#define OCI_FETCH_PRIOR 0x00000010 /* previous row relative to current */ +#define OCI_FETCH_ABSOLUTE 0x00000020 /* absolute offset from first */ +#define OCI_FETCH_RELATIVE 0x00000040 /* offset relative to current */ +#define OCI_FETCH_RESERVED_1 0x00000080 /* reserved */ +#define OCI_FETCH_RESERVED_2 0x00000100 /* reserved */ +#define OCI_FETCH_RESERVED_3 0x00000200 /* reserved */ +#define OCI_FETCH_RESERVED_4 0x00000400 /* reserved */ +#define OCI_FETCH_RESERVED_5 0x00000800 /* reserved */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------Bind and Define Options----------------------------*/ +#define OCI_SB2_IND_PTR 0x00000001 /* unused */ +#define OCI_DATA_AT_EXEC 0x00000002 /* data at execute time */ +#define OCI_DYNAMIC_FETCH 0x00000002 /* fetch dynamically */ +#define OCI_PIECEWISE 0x00000004 /* piecewise DMLs or fetch */ +#define OCI_DEFINE_RESERVED_1 0x00000008 /* reserved */ +#define OCI_BIND_RESERVED_2 0x00000010 /* reserved */ +#define OCI_DEFINE_RESERVED_2 0x00000020 /* reserved */ +#define OCI_BIND_SOFT 0x00000040 /* soft bind or define */ +#define OCI_DEFINE_SOFT 0x00000080 /* soft bind or define */ +#define OCI_BIND_RESERVED_3 0x00000100 /* reserved */ +#define OCI_IOV 0x00000200 /* For scatter gather bind/define */ +/*---------------------------------------------------------------------------*/ + +/*----------------------------- Various Modes ------------------------------*/ +#define OCI_DEFAULT 0x00000000 + /* the default value for parameters and attributes */ +/*-------------OCIInitialize Modes / OCICreateEnvironment Modes -------------*/ +#define OCI_THREADED 0x00000001 /* appl. in threaded environment */ +#define OCI_OBJECT 0x00000002 /* application in object environment */ +#define OCI_EVENTS 0x00000004 /* application is enabled for events */ +#define OCI_RESERVED1 0x00000008 /* reserved */ +#define OCI_SHARED 0x00000010 /* the application is in shared mode */ +#define OCI_RESERVED2 0x00000020 /* reserved */ +/* The following *TWO* are only valid for OCICreateEnvironment call */ +#define OCI_NO_UCB 0x00000040 /* No user callback called during ini */ +#define OCI_NO_MUTEX 0x00000080 /* the environment handle will not be */ + /* protected by a mutex internally */ +#define OCI_SHARED_EXT 0x00000100 /* Used for shared forms */ +/************************** 0x00000200 free **********************************/ +#define OCI_ALWAYS_BLOCKING 0x00000400 /* all connections always blocking */ +/************************** 0x00000800 free **********************************/ +#define OCI_USE_LDAP 0x00001000 /* allow LDAP connections */ +#define OCI_REG_LDAPONLY 0x00002000 /* only register to LDAP */ +#define OCI_UTF16 0x00004000 /* mode for all UTF16 metadata */ +#define OCI_AFC_PAD_ON 0x00008000 + /* turn on AFC blank padding when rlenp present */ +#define OCI_ENVCR_RESERVED3 0x00010000 /* reserved */ +#define OCI_NEW_LENGTH_SEMANTICS 0x00020000 /* adopt new length semantics */ + /* the new length semantics, always bytes, is used by OCIEnvNlsCreate */ +#define OCI_NO_MUTEX_STMT 0x00040000 /* Do not mutex stmt handle */ +#define OCI_MUTEX_ENV_ONLY 0x00080000 /* Mutex only the environment handle */ +#define OCI_SUPPRESS_NLS_VALIDATION 0x00100000 /* suppress nls validation */ + /* nls validation suppression is on by default; + use OCI_ENABLE_NLS_VALIDATION to disable it */ +#define OCI_MUTEX_TRY 0x00200000 /* try and acquire mutex */ +#define OCI_NCHAR_LITERAL_REPLACE_ON 0x00400000 /* nchar literal replace on */ +#define OCI_NCHAR_LITERAL_REPLACE_OFF 0x00800000 /* nchar literal replace off*/ +#define OCI_ENABLE_NLS_VALIDATION 0x01000000 /* enable nls validation */ +#define OCI_ENVCR_RESERVED4 0x02000000 /* reserved */ + +/*---------------------------------------------------------------------------*/ +/*------------------------OCIConnectionpoolCreate Modes----------------------*/ + +#define OCI_CPOOL_REINITIALIZE 0x111 + +/*---------------------------------------------------------------------------*/ +/*--------------------------------- OCILogon2 Modes -------------------------*/ + +#define OCI_LOGON2_SPOOL 0x0001 /* Use session pool */ +#define OCI_LOGON2_CPOOL OCI_CPOOL /* Use connection pool */ +#define OCI_LOGON2_STMTCACHE 0x0004 /* Use Stmt Caching */ +#define OCI_LOGON2_PROXY 0x0008 /* Proxy authentiaction */ + +/*---------------------------------------------------------------------------*/ +/*------------------------- OCISessionPoolCreate Modes ----------------------*/ + +#define OCI_SPC_REINITIALIZE 0x0001 /* Reinitialize the session pool */ +#define OCI_SPC_HOMOGENEOUS 0x0002 /* Session pool is homogeneneous */ +#define OCI_SPC_STMTCACHE 0x0004 /* Session pool has stmt cache */ +#define OCI_SPC_NO_RLB 0x0008 /* Do not enable Runtime load balancing. */ + +/*---------------------------------------------------------------------------*/ +/*--------------------------- OCISessionGet Modes ---------------------------*/ + +#define OCI_SESSGET_SPOOL 0x0001 /* SessionGet called in SPOOL mode */ +#define OCI_SESSGET_CPOOL OCI_CPOOL /* SessionGet called in CPOOL mode */ +#define OCI_SESSGET_STMTCACHE 0x0004 /* Use statement cache */ +#define OCI_SESSGET_CREDPROXY 0x0008 /* SessionGet called in proxy mode */ +#define OCI_SESSGET_CREDEXT 0x0010 +#define OCI_SESSGET_SPOOL_MATCHANY 0x0020 +#define OCI_SESSGET_PURITY_NEW 0x0040 +#define OCI_SESSGET_PURITY_SELF 0x0080 +#define OCI_SESSGET_SYSDBA 0x0100 /* SessionGet with SYSDBA privileges */ + +/*---------------------------------------------------------------------------*/ +/*------------------------ATTR Values for Session Pool-----------------------*/ +/* Attribute values for OCI_ATTR_SPOOL_GETMODE */ +#define OCI_SPOOL_ATTRVAL_WAIT 0 /* block till you get a session */ +#define OCI_SPOOL_ATTRVAL_NOWAIT 1 /* error out if no session avaliable */ +#define OCI_SPOOL_ATTRVAL_FORCEGET 2 /* get session even if max is exceeded */ + +/*---------------------------------------------------------------------------*/ +/*--------------------------- OCISessionRelease Modes -----------------------*/ + +#define OCI_SESSRLS_DROPSESS 0x0001 /* Drop the Session */ +#define OCI_SESSRLS_RETAG 0x0002 /* Retag the session */ + +/*---------------------------------------------------------------------------*/ +/*----------------------- OCISessionPoolDestroy Modes -----------------------*/ + +#define OCI_SPD_FORCE 0x0001 /* Force the sessions to terminate. + Even if there are some busy + sessions close them */ + +/*---------------------------------------------------------------------------*/ +/*----------------------------- Statement States ----------------------------*/ + +#define OCI_STMT_STATE_INITIALIZED 0x0001 +#define OCI_STMT_STATE_EXECUTED 0x0002 +#define OCI_STMT_STATE_END_OF_FETCH 0x0003 + +/*---------------------------------------------------------------------------*/ + +/*----------------------------- OCIMemStats Modes ---------------------------*/ +#define OCI_MEM_INIT 0x01 +#define OCI_MEM_CLN 0x02 +#define OCI_MEM_FLUSH 0x04 +#define OCI_DUMP_HEAP 0x80 + +#define OCI_CLIENT_STATS 0x10 +#define OCI_SERVER_STATS 0x20 + +/*----------------------------- OCIEnvInit Modes ----------------------------*/ +/* NOTE: NO NEW MODES SHOULD BE ADDED HERE BECAUSE THE RECOMMENDED METHOD + * IS TO USE THE NEW OCICreateEnvironment MODES. + */ +#define OCI_ENV_NO_UCB 0x01 /* A user callback will not be called in + OCIEnvInit() */ +#define OCI_ENV_NO_MUTEX 0x08 /* the environment handle will not be protected + by a mutex internally */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------ Prepare Modes ------------------------------------*/ +#define OCI_NO_SHARING 0x01 /* turn off statement handle sharing */ +#define OCI_PREP_RESERVED_1 0x02 /* reserved */ +#define OCI_PREP_AFC_PAD_ON 0x04 /* turn on blank padding for AFC */ +#define OCI_PREP_AFC_PAD_OFF 0x08 /* turn off blank padding for AFC */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +/*----------------------- Execution Modes -----------------------------------*/ +#define OCI_BATCH_MODE 0x00000001 /* batch the oci stmt for exec */ +#define OCI_EXACT_FETCH 0x00000002 /* fetch exact rows specified */ +/* #define 0x00000004 available */ +#define OCI_STMT_SCROLLABLE_READONLY \ + 0x00000008 /* if result set is scrollable */ +#define OCI_DESCRIBE_ONLY 0x00000010 /* only describe the statement */ +#define OCI_COMMIT_ON_SUCCESS 0x00000020 /* commit, if successful exec */ +#define OCI_NON_BLOCKING 0x00000040 /* non-blocking */ +#define OCI_BATCH_ERRORS 0x00000080 /* batch errors in array dmls */ +#define OCI_PARSE_ONLY 0x00000100 /* only parse the statement */ +#define OCI_EXACT_FETCH_RESERVED_1 0x00000200 /* reserved */ +#define OCI_SHOW_DML_WARNINGS 0x00000400 + /* return OCI_SUCCESS_WITH_INFO for delete/update w/no where clause */ +#define OCI_EXEC_RESERVED_2 0x00000800 /* reserved */ +#define OCI_DESC_RESERVED_1 0x00001000 /* reserved */ +#define OCI_EXEC_RESERVED_3 0x00002000 /* reserved */ +#define OCI_EXEC_RESERVED_4 0x00004000 /* reserved */ +#define OCI_EXEC_RESERVED_5 0x00008000 /* reserved */ +#define OCI_EXEC_RESERVED_6 0x00010000 /* reserved */ +#define OCI_RESULT_CACHE 0x00020000 /* hint to use query caching */ +#define OCI_NO_RESULT_CACHE 0x00040000 /*hint to bypass query caching*/ +#define OCI_EXEC_RESERVED_7 0x00080000 /* reserved */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------Authentication Modes-------------------------------*/ +#define OCI_MIGRATE 0x00000001 /* migratable auth context */ +#define OCI_SYSDBA 0x00000002 /* for SYSDBA authorization */ +#define OCI_SYSOPER 0x00000004 /* for SYSOPER authorization */ +#define OCI_PRELIM_AUTH 0x00000008 /* for preliminary authorization */ +#define OCIP_ICACHE 0x00000010 /* Private OCI cache mode */ +#define OCI_AUTH_RESERVED_1 0x00000020 /* reserved */ +#define OCI_STMT_CACHE 0x00000040 /* enable OCI Stmt Caching */ +#define OCI_STATELESS_CALL 0x00000080 /* stateless at call boundary */ +#define OCI_STATELESS_TXN 0x00000100 /* stateless at txn boundary */ +#define OCI_STATELESS_APP 0x00000200 /* stateless at user-specified pts */ +#define OCI_AUTH_RESERVED_2 0x00000400 /* reserved */ +#define OCI_AUTH_RESERVED_3 0x00000800 /* reserved */ +#define OCI_AUTH_RESERVED_4 0x00001000 /* reserved */ +#define OCI_AUTH_RESERVED_5 0x00002000 /* reserved */ +#define OCI_SYSASM 0x00008000 /* for SYSASM authorization */ +#define OCI_AUTH_RESERVED_6 0x00010000 /* reserved */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------Session End Modes----------------------------------*/ +#define OCI_SESSEND_RESERVED_1 0x0001 /* reserved */ +#define OCI_SESSEND_RESERVED_2 0x0002 /* reserved */ +/*---------------------------------------------------------------------------*/ + +/*------------------------Attach Modes---------------------------------------*/ + +/* The following attach modes are the same as the UPI modes defined in + * UPIDEF.H. Do not use these values externally. + */ + +#define OCI_FASTPATH 0x0010 /* Attach in fast path mode */ +#define OCI_ATCH_RESERVED_1 0x0020 /* reserved */ +#define OCI_ATCH_RESERVED_2 0x0080 /* reserved */ +#define OCI_ATCH_RESERVED_3 0x0100 /* reserved */ +#define OCI_CPOOL 0x0200 /* Attach using server handle from pool */ +#define OCI_ATCH_RESERVED_4 0x0400 /* reserved */ +#define OCI_ATCH_RESERVED_5 0x2000 /* reserved */ +#define OCI_ATCH_ENABLE_BEQ 0x4000 /* Allow bequeath connect strings */ +#define OCI_ATCH_RESERVED_6 0x8000 /* reserved */ +#define OCI_ATCH_RESERVED_7 0x10000 /* reserved */ +#define OCI_ATCH_RESERVED_8 0x20000 /* reserved */ + +#define OCI_SRVATCH_RESERVED5 0x01000000 /* reserved */ +#define OCI_SRVATCH_RESERVED6 0x02000000 /* reserved */ + +/*---------------------OCIStmtPrepare2 Modes---------------------------------*/ +#define OCI_PREP2_CACHE_SEARCHONLY 0x0010 /* ONly Search */ +#define OCI_PREP2_GET_PLSQL_WARNINGS 0x0020 /* Get PL/SQL warnings */ +#define OCI_PREP2_RESERVED_1 0x0040 /* reserved */ + +/*---------------------OCIStmtRelease Modes----------------------------------*/ +#define OCI_STRLS_CACHE_DELETE 0x0010 /* Delete from Cache */ + +/*---------------------OCIHanlde Mgmt Misc Modes-----------------------------*/ +#define OCI_STM_RESERVED4 0x00100000 /* reserved */ + +/*-----------------------------End Various Modes ----------------------------*/ + +/*------------------------Piece Information----------------------------------*/ +#define OCI_PARAM_IN 0x01 /* in parameter */ +#define OCI_PARAM_OUT 0x02 /* out parameter */ +/*---------------------------------------------------------------------------*/ + +/*------------------------ Transaction Start Flags --------------------------*/ +/* NOTE: OCI_TRANS_JOIN and OCI_TRANS_NOMIGRATE not supported in 8.0.X */ +#define OCI_TRANS_NEW 0x00000001 /* start a new local or global txn */ +#define OCI_TRANS_JOIN 0x00000002 /* join an existing global txn */ +#define OCI_TRANS_RESUME 0x00000004 /* resume the global txn branch */ +#define OCI_TRANS_PROMOTE 0x00000008 /* promote the local txn to global */ +#define OCI_TRANS_STARTMASK 0x000000ff /* mask for start operation flags */ + +#define OCI_TRANS_READONLY 0x00000100 /* start a readonly txn */ +#define OCI_TRANS_READWRITE 0x00000200 /* start a read-write txn */ +#define OCI_TRANS_SERIALIZABLE 0x00000400 /* start a serializable txn */ +#define OCI_TRANS_ISOLMASK 0x0000ff00 /* mask for start isolation flags */ + +#define OCI_TRANS_LOOSE 0x00010000 /* a loosely coupled branch */ +#define OCI_TRANS_TIGHT 0x00020000 /* a tightly coupled branch */ +#define OCI_TRANS_TYPEMASK 0x000f0000 /* mask for branch type flags */ + +#define OCI_TRANS_NOMIGRATE 0x00100000 /* non migratable transaction */ +#define OCI_TRANS_SEPARABLE 0x00200000 /* separable transaction (8.1.6+) */ +#define OCI_TRANS_OTSRESUME 0x00400000 /* OTS resuming a transaction */ +#define OCI_TRANS_OTHRMASK 0xfff00000 /* mask for other start flags */ + + +/*---------------------------------------------------------------------------*/ + +/*------------------------ Transaction End Flags ----------------------------*/ +#define OCI_TRANS_TWOPHASE 0x01000000 /* use two phase commit */ +#define OCI_TRANS_WRITEBATCH 0x00000001 /* force cmt-redo for local txns */ +#define OCI_TRANS_WRITEIMMED 0x00000002 /* no force cmt-redo */ +#define OCI_TRANS_WRITEWAIT 0x00000004 /* no sync cmt-redo */ +#define OCI_TRANS_WRITENOWAIT 0x00000008 /* sync cmt-redo for local txns */ +/*---------------------------------------------------------------------------*/ + +/*------------------------- AQ Constants ------------------------------------ + * NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE + * The following constants must match the PL/SQL dbms_aq constants + * NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE + */ +/* ------------------------- Visibility flags -------------------------------*/ +#define OCI_ENQ_IMMEDIATE 1 /* enqueue is an independent transaction */ +#define OCI_ENQ_ON_COMMIT 2 /* enqueue is part of current transaction */ + +/* ----------------------- Dequeue mode flags -------------------------------*/ +#define OCI_DEQ_BROWSE 1 /* read message without acquiring a lock */ +#define OCI_DEQ_LOCKED 2 /* read and obtain write lock on message */ +#define OCI_DEQ_REMOVE 3 /* read the message and delete it */ +#define OCI_DEQ_REMOVE_NODATA 4 /* delete message w'o returning payload */ +#define OCI_DEQ_GETSIG 5 /* get signature only */ + +/* ----------------- Dequeue navigation flags -------------------------------*/ +#define OCI_DEQ_FIRST_MSG 1 /* get first message at head of queue */ +#define OCI_DEQ_NEXT_MSG 3 /* next message that is available */ +#define OCI_DEQ_NEXT_TRANSACTION 2 /* get first message of next txn group */ +#define OCI_DEQ_FIRST_MSG_MULTI_GROUP 4 + /* start from first message and array deq across txn groups */ +#define OCI_DEQ_MULT_TRANSACTION 5 /* array dequeue across txn groups */ +#define OCI_DEQ_NEXT_MSG_MULTI_GROUP OCI_DEQ_MULT_TRANSACTION + /* array dequeue across txn groups */ + +/* ----------------- Dequeue Option Reserved flags ------------------------- */ +#define OCI_DEQ_RESERVED_1 0x000001 + +/* --------------------- Message states -------------------------------------*/ +#define OCI_MSG_WAITING 1 /* the message delay has not yet completed */ +#define OCI_MSG_READY 0 /* the message is ready to be processed */ +#define OCI_MSG_PROCESSED 2 /* the message has been processed */ +#define OCI_MSG_EXPIRED 3 /* message has moved to exception queue */ + +/* --------------------- Sequence deviation ---------------------------------*/ +#define OCI_ENQ_BEFORE 2 /* enqueue message before another message */ +#define OCI_ENQ_TOP 3 /* enqueue message before all messages */ + +/* ------------------------- Visibility flags -------------------------------*/ +#define OCI_DEQ_IMMEDIATE 1 /* dequeue is an independent transaction */ +#define OCI_DEQ_ON_COMMIT 2 /* dequeue is part of current transaction */ + +/* ------------------------ Wait --------------------------------------------*/ +#define OCI_DEQ_WAIT_FOREVER -1 /* wait forever if no message available */ +#define OCI_NTFN_GROUPING_FOREVER -1 /* send grouping notifications forever */ +#define OCI_DEQ_NO_WAIT 0 /* do not wait if no message is available */ + +#define OCI_FLOW_CONTROL_NO_TIMEOUT -1 + /* streaming enqueue: no timeout for flow control */ + +/* ------------------------ Delay -------------------------------------------*/ +#define OCI_MSG_NO_DELAY 0 /* message is available immediately */ + +/* ------------------------- Expiration -------------------------------------*/ +#define OCI_MSG_NO_EXPIRATION -1 /* message will never expire */ + +#define OCI_MSG_PERSISTENT_OR_BUFFERED 3 +#define OCI_MSG_BUFFERED 2 +#define OCI_MSG_PERSISTENT 1 + +/* ----------------------- Reserved/AQE pisdef flags ------------------------*/ +/* see aqeflg defines in kwqp.h */ +#define OCI_AQ_RESERVED_1 0x0002 +#define OCI_AQ_RESERVED_2 0x0004 +#define OCI_AQ_RESERVED_3 0x0008 +#define OCI_AQ_RESERVED_4 0x0010 + +#define OCI_AQ_STREAMING_FLAG 0x02000000 + +/* ------------------------------ Replay Info -------------------------------*/ +#define OCI_AQ_LAST_ENQUEUED 0 +#define OCI_AQ_LAST_ACKNOWLEDGED 1 + +/* -------------------------- END AQ Constants ----------------------------- */ + +/* --------------------END DateTime and Interval Constants ------------------*/ + +/*-----------------------Object Types----------------------------------------*/ +/*-----------Object Types **** Not to be Used **** --------------------------*/ +/* Deprecated */ +#define OCI_OTYPE_UNK 0 +#define OCI_OTYPE_TABLE 1 +#define OCI_OTYPE_VIEW 2 +#define OCI_OTYPE_SYN 3 +#define OCI_OTYPE_PROC 4 +#define OCI_OTYPE_FUNC 5 +#define OCI_OTYPE_PKG 6 +#define OCI_OTYPE_STMT 7 +/*---------------------------------------------------------------------------*/ + +/*=======================Describe Handle Parameter Attributes ===============*/ +/* + These attributes are orthogonal to the other set of attributes defined + above. These attrubutes are to be used only for the describe handle. +*/ +/*===========================================================================*/ +/* Attributes common to Columns and Stored Procs */ +#define OCI_ATTR_DATA_SIZE 1 /* maximum size of the data */ +#define OCI_ATTR_DATA_TYPE 2 /* the SQL type of the column/argument */ +#define OCI_ATTR_DISP_SIZE 3 /* the display size */ +#define OCI_ATTR_NAME 4 /* the name of the column/argument */ +#define OCI_ATTR_PRECISION 5 /* precision if number type */ +#define OCI_ATTR_SCALE 6 /* scale if number type */ +#define OCI_ATTR_IS_NULL 7 /* is it null ? */ +#define OCI_ATTR_TYPE_NAME 8 + /* name of the named data type or a package name for package private types */ +#define OCI_ATTR_SCHEMA_NAME 9 /* the schema name */ +#define OCI_ATTR_SUB_NAME 10 /* type name if package private type */ +#define OCI_ATTR_POSITION 11 + /* relative position of col/arg in the list of cols/args */ +/* complex object retrieval parameter attributes */ +#define OCI_ATTR_COMPLEXOBJECTCOMP_TYPE 50 +#define OCI_ATTR_COMPLEXOBJECTCOMP_TYPE_LEVEL 51 +#define OCI_ATTR_COMPLEXOBJECT_LEVEL 52 +#define OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE 53 + +/* Only Columns */ +#define OCI_ATTR_DISP_NAME 100 /* the display name */ +#define OCI_ATTR_ENCC_SIZE 101 /* encrypted data size */ +#define OCI_ATTR_COL_ENC 102 /* column is encrypted ? */ +#define OCI_ATTR_COL_ENC_SALT 103 /* is encrypted column salted ? */ + +/*Only Stored Procs */ +#define OCI_ATTR_OVERLOAD 210 /* is this position overloaded */ +#define OCI_ATTR_LEVEL 211 /* level for structured types */ +#define OCI_ATTR_HAS_DEFAULT 212 /* has a default value */ +#define OCI_ATTR_IOMODE 213 /* in, out inout */ +#define OCI_ATTR_RADIX 214 /* returns a radix */ +#define OCI_ATTR_NUM_ARGS 215 /* total number of arguments */ + +/* only named type attributes */ +#define OCI_ATTR_TYPECODE 216 /* object or collection */ +#define OCI_ATTR_COLLECTION_TYPECODE 217 /* varray or nested table */ +#define OCI_ATTR_VERSION 218 /* user assigned version */ +#define OCI_ATTR_IS_INCOMPLETE_TYPE 219 /* is this an incomplete type */ +#define OCI_ATTR_IS_SYSTEM_TYPE 220 /* a system type */ +#define OCI_ATTR_IS_PREDEFINED_TYPE 221 /* a predefined type */ +#define OCI_ATTR_IS_TRANSIENT_TYPE 222 /* a transient type */ +#define OCI_ATTR_IS_SYSTEM_GENERATED_TYPE 223 /* system generated type */ +#define OCI_ATTR_HAS_NESTED_TABLE 224 /* contains nested table attr */ +#define OCI_ATTR_HAS_LOB 225 /* has a lob attribute */ +#define OCI_ATTR_HAS_FILE 226 /* has a file attribute */ +#define OCI_ATTR_COLLECTION_ELEMENT 227 /* has a collection attribute */ +#define OCI_ATTR_NUM_TYPE_ATTRS 228 /* number of attribute types */ +#define OCI_ATTR_LIST_TYPE_ATTRS 229 /* list of type attributes */ +#define OCI_ATTR_NUM_TYPE_METHODS 230 /* number of type methods */ +#define OCI_ATTR_LIST_TYPE_METHODS 231 /* list of type methods */ +#define OCI_ATTR_MAP_METHOD 232 /* map method of type */ +#define OCI_ATTR_ORDER_METHOD 233 /* order method of type */ + +/* only collection element */ +#define OCI_ATTR_NUM_ELEMS 234 /* number of elements */ + +/* only type methods */ +#define OCI_ATTR_ENCAPSULATION 235 /* encapsulation level */ +#define OCI_ATTR_IS_SELFISH 236 /* method selfish */ +#define OCI_ATTR_IS_VIRTUAL 237 /* virtual */ +#define OCI_ATTR_IS_INLINE 238 /* inline */ +#define OCI_ATTR_IS_CONSTANT 239 /* constant */ +#define OCI_ATTR_HAS_RESULT 240 /* has result */ +#define OCI_ATTR_IS_CONSTRUCTOR 241 /* constructor */ +#define OCI_ATTR_IS_DESTRUCTOR 242 /* destructor */ +#define OCI_ATTR_IS_OPERATOR 243 /* operator */ +#define OCI_ATTR_IS_MAP 244 /* a map method */ +#define OCI_ATTR_IS_ORDER 245 /* order method */ +#define OCI_ATTR_IS_RNDS 246 /* read no data state method */ +#define OCI_ATTR_IS_RNPS 247 /* read no process state */ +#define OCI_ATTR_IS_WNDS 248 /* write no data state method */ +#define OCI_ATTR_IS_WNPS 249 /* write no process state */ + +#define OCI_ATTR_DESC_PUBLIC 250 /* public object */ + +/* Object Cache Enhancements : attributes for User Constructed Instances */ +#define OCI_ATTR_CACHE_CLIENT_CONTEXT 251 +#define OCI_ATTR_UCI_CONSTRUCT 252 +#define OCI_ATTR_UCI_DESTRUCT 253 +#define OCI_ATTR_UCI_COPY 254 +#define OCI_ATTR_UCI_PICKLE 255 +#define OCI_ATTR_UCI_UNPICKLE 256 +#define OCI_ATTR_UCI_REFRESH 257 + +/* for type inheritance */ +#define OCI_ATTR_IS_SUBTYPE 258 +#define OCI_ATTR_SUPERTYPE_SCHEMA_NAME 259 +#define OCI_ATTR_SUPERTYPE_NAME 260 + +/* for schemas */ +#define OCI_ATTR_LIST_OBJECTS 261 /* list of objects in schema */ + +/* for database */ +#define OCI_ATTR_NCHARSET_ID 262 /* char set id */ +#define OCI_ATTR_LIST_SCHEMAS 263 /* list of schemas */ +#define OCI_ATTR_MAX_PROC_LEN 264 /* max procedure length */ +#define OCI_ATTR_MAX_COLUMN_LEN 265 /* max column name length */ +#define OCI_ATTR_CURSOR_COMMIT_BEHAVIOR 266 /* cursor commit behavior */ +#define OCI_ATTR_MAX_CATALOG_NAMELEN 267 /* catalog namelength */ +#define OCI_ATTR_CATALOG_LOCATION 268 /* catalog location */ +#define OCI_ATTR_SAVEPOINT_SUPPORT 269 /* savepoint support */ +#define OCI_ATTR_NOWAIT_SUPPORT 270 /* nowait support */ +#define OCI_ATTR_AUTOCOMMIT_DDL 271 /* autocommit DDL */ +#define OCI_ATTR_LOCKING_MODE 272 /* locking mode */ + +/* for externally initialized context */ +#define OCI_ATTR_APPCTX_SIZE 273 /* count of context to be init*/ +#define OCI_ATTR_APPCTX_LIST 274 /* count of context to be init*/ +#define OCI_ATTR_APPCTX_NAME 275 /* name of context to be init*/ +#define OCI_ATTR_APPCTX_ATTR 276 /* attr of context to be init*/ +#define OCI_ATTR_APPCTX_VALUE 277 /* value of context to be init*/ + +/* for client id propagation */ +#define OCI_ATTR_CLIENT_IDENTIFIER 278 /* value of client id to set*/ + +/* for inheritance - part 2 */ +#define OCI_ATTR_IS_FINAL_TYPE 279 /* is final type ? */ +#define OCI_ATTR_IS_INSTANTIABLE_TYPE 280 /* is instantiable type ? */ +#define OCI_ATTR_IS_FINAL_METHOD 281 /* is final method ? */ +#define OCI_ATTR_IS_INSTANTIABLE_METHOD 282 /* is instantiable method ? */ +#define OCI_ATTR_IS_OVERRIDING_METHOD 283 /* is overriding method ? */ + +#define OCI_ATTR_DESC_SYNBASE 284 /* Describe the base object */ + + +#define OCI_ATTR_CHAR_USED 285 /* char length semantics */ +#define OCI_ATTR_CHAR_SIZE 286 /* char length */ + +/* SQLJ support */ +#define OCI_ATTR_IS_JAVA_TYPE 287 /* is java implemented type ? */ + +/* N-Tier support */ +#define OCI_ATTR_DISTINGUISHED_NAME 300 /* use DN as user name */ +#define OCI_ATTR_KERBEROS_TICKET 301 /* Kerberos ticket as cred. */ + +/* for multilanguage debugging */ +#define OCI_ATTR_ORA_DEBUG_JDWP 302 /* ORA_DEBUG_JDWP attribute */ + +#define OCI_ATTR_EDITION 288 /* ORA_EDITION */ + +#define OCI_ATTR_RESERVED_14 303 /* reserved */ + + +/*---------------------------End Describe Handle Attributes -----------------*/ + +/* For values 303 - 307, see DirPathAPI attribute section in this file */ + +/* ----------------------- Session Pool Attributes ------------------------- */ +#define OCI_ATTR_SPOOL_TIMEOUT 308 /* session timeout */ +#define OCI_ATTR_SPOOL_GETMODE 309 /* session get mode */ +#define OCI_ATTR_SPOOL_BUSY_COUNT 310 /* busy session count */ +#define OCI_ATTR_SPOOL_OPEN_COUNT 311 /* open session count */ +#define OCI_ATTR_SPOOL_MIN 312 /* min session count */ +#define OCI_ATTR_SPOOL_MAX 313 /* max session count */ +#define OCI_ATTR_SPOOL_INCR 314 /* session increment count */ +#define OCI_ATTR_SPOOL_STMTCACHESIZE 208 /*Stmt cache size of pool */ +#define OCI_ATTR_SPOOL_AUTH 460 /* Auth handle on pool handle*/ +/*------------------------------End Session Pool Attributes -----------------*/ +/*---------------------------- For XML Types ------------------------------- */ +/* For table, view and column */ +#define OCI_ATTR_IS_XMLTYPE 315 /* Is the type an XML type? */ +#define OCI_ATTR_XMLSCHEMA_NAME 316 /* Name of XML Schema */ +#define OCI_ATTR_XMLELEMENT_NAME 317 /* Name of XML Element */ +#define OCI_ATTR_XMLSQLTYPSCH_NAME 318 /* SQL type's schema for XML Ele */ +#define OCI_ATTR_XMLSQLTYPE_NAME 319 /* Name of SQL type for XML Ele */ +#define OCI_ATTR_XMLTYPE_STORED_OBJ 320 /* XML type stored as object? */ +#define OCI_ATTR_XMLTYPE_BINARY_XML 422 /* XML type stored as binary? */ + +/*---------------------------- For Subtypes ------------------------------- */ +/* For type */ +#define OCI_ATTR_HAS_SUBTYPES 321 /* Has subtypes? */ +#define OCI_ATTR_NUM_SUBTYPES 322 /* Number of subtypes */ +#define OCI_ATTR_LIST_SUBTYPES 323 /* List of subtypes */ + +/* XML flag */ +#define OCI_ATTR_XML_HRCHY_ENABLED 324 /* hierarchy enabled? */ + +/* Method flag */ +#define OCI_ATTR_IS_OVERRIDDEN_METHOD 325 /* Method is overridden? */ + +/* For values 326 - 335, see DirPathAPI attribute section in this file */ + +/*------------- Attributes for 10i Distributed Objects ----------------------*/ +#define OCI_ATTR_OBJ_SUBS 336 /* obj col/tab substitutable */ + +/* For values 337 - 338, see DirPathAPI attribute section in this file */ + +/*---------- Attributes for 10i XADFIELD (NLS language, territory -----------*/ +#define OCI_ATTR_XADFIELD_RESERVED_1 339 /* reserved */ +#define OCI_ATTR_XADFIELD_RESERVED_2 340 /* reserved */ +/*------------- Kerberos Secure Client Identifier ---------------------------*/ +#define OCI_ATTR_KERBEROS_CID 341 /* Kerberos db service ticket*/ + + +/*------------------------ Attributes for Rules objects ---------------------*/ +#define OCI_ATTR_CONDITION 342 /* rule condition */ +#define OCI_ATTR_COMMENT 343 /* comment */ +#define OCI_ATTR_VALUE 344 /* Anydata value */ +#define OCI_ATTR_EVAL_CONTEXT_OWNER 345 /* eval context owner */ +#define OCI_ATTR_EVAL_CONTEXT_NAME 346 /* eval context name */ +#define OCI_ATTR_EVALUATION_FUNCTION 347 /* eval function name */ +#define OCI_ATTR_VAR_TYPE 348 /* variable type */ +#define OCI_ATTR_VAR_VALUE_FUNCTION 349 /* variable value function */ +#define OCI_ATTR_VAR_METHOD_FUNCTION 350 /* variable method function */ +#define OCI_ATTR_ACTION_CONTEXT 351 /* action context */ +#define OCI_ATTR_LIST_TABLE_ALIASES 352 /* list of table aliases */ +#define OCI_ATTR_LIST_VARIABLE_TYPES 353 /* list of variable types */ +#define OCI_ATTR_TABLE_NAME 356 /* table name */ + +/* For values 357 - 359, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_MESSAGE_CSCN 360 /* message cscn */ +#define OCI_ATTR_MESSAGE_DSCN 361 /* message dscn */ + +/*--------------------- Audit Session ID ------------------------------------*/ +#define OCI_ATTR_AUDIT_SESSION_ID 362 /* Audit session ID */ + +/*--------------------- Kerberos TGT Keys -----------------------------------*/ +#define OCI_ATTR_KERBEROS_KEY 363 /* n-tier Kerberos cred key */ +#define OCI_ATTR_KERBEROS_CID_KEY 364 /* SCID Kerberos cred key */ + + +#define OCI_ATTR_TRANSACTION_NO 365 /* AQ enq txn number */ + +/*----------------------- Attributes for End To End Tracing -----------------*/ +#define OCI_ATTR_MODULE 366 /* module for tracing */ +#define OCI_ATTR_ACTION 367 /* action for tracing */ +#define OCI_ATTR_CLIENT_INFO 368 /* client info */ +#define OCI_ATTR_COLLECT_CALL_TIME 369 /* collect call time */ +#define OCI_ATTR_CALL_TIME 370 /* extract call time */ +#define OCI_ATTR_ECONTEXT_ID 371 /* execution-id context */ +#define OCI_ATTR_ECONTEXT_SEQ 372 /*execution-id sequence num */ + + +/*------------------------------ Session attributes -------------------------*/ +#define OCI_ATTR_SESSION_STATE 373 /* session state */ +#define OCI_SESSION_STATELESS 1 /* valid states */ +#define OCI_SESSION_STATEFUL 2 + +#define OCI_ATTR_SESSION_STATETYPE 374 /* session state type */ +#define OCI_SESSION_STATELESS_DEF 0 /* valid state types */ +#define OCI_SESSION_STATELESS_CAL 1 +#define OCI_SESSION_STATELESS_TXN 2 +#define OCI_SESSION_STATELESS_APP 3 + +#define OCI_ATTR_SESSION_STATE_CLEARED 376 /* session state cleared */ +#define OCI_ATTR_SESSION_MIGRATED 377 /* did session migrate */ +#define OCI_ATTR_SESSION_PRESERVE_STATE 388 /* preserve session state */ +#define OCI_ATTR_DRIVER_NAME 424 /* Driver Name */ + +/* -------------------------- Admin Handle Attributes ---------------------- */ + +#define OCI_ATTR_ADMIN_PFILE 389 /* client-side param file */ + +/*----------------------- Attributes for End To End Tracing -----------------*/ +/* -------------------------- HA Event Handle Attributes ------------------- */ + +#define OCI_ATTR_HOSTNAME 390 /* SYS_CONTEXT hostname */ +#define OCI_ATTR_DBNAME 391 /* SYS_CONTEXT dbname */ +#define OCI_ATTR_INSTNAME 392 /* SYS_CONTEXT instance name */ +#define OCI_ATTR_SERVICENAME 393 /* SYS_CONTEXT service name */ +#define OCI_ATTR_INSTSTARTTIME 394 /* v$instance instance start time */ +#define OCI_ATTR_HA_TIMESTAMP 395 /* event time */ +#define OCI_ATTR_RESERVED_22 396 /* reserved */ +#define OCI_ATTR_RESERVED_23 397 /* reserved */ +#define OCI_ATTR_RESERVED_24 398 /* reserved */ +#define OCI_ATTR_DBDOMAIN 399 /* db domain */ +#define OCI_ATTR_RESERVED_27 425 /* reserved */ + +#define OCI_ATTR_EVENTTYPE 400 /* event type */ +#define OCI_EVENTTYPE_HA 0 /* valid value for OCI_ATTR_EVENTTYPE */ + +#define OCI_ATTR_HA_SOURCE 401 +/* valid values for OCI_ATTR_HA_SOURCE */ +#define OCI_HA_SOURCE_INSTANCE 0 +#define OCI_HA_SOURCE_DATABASE 1 +#define OCI_HA_SOURCE_NODE 2 +#define OCI_HA_SOURCE_SERVICE 3 +#define OCI_HA_SOURCE_SERVICE_MEMBER 4 +#define OCI_HA_SOURCE_ASM_INSTANCE 5 +#define OCI_HA_SOURCE_SERVICE_PRECONNECT 6 + +#define OCI_ATTR_HA_STATUS 402 +#define OCI_HA_STATUS_DOWN 0 /* valid values for OCI_ATTR_HA_STATUS */ +#define OCI_HA_STATUS_UP 1 + +#define OCI_ATTR_HA_SRVFIRST 403 + +#define OCI_ATTR_HA_SRVNEXT 404 +/* ------------------------- Server Handle Attributes -----------------------*/ + +#define OCI_ATTR_TAF_ENABLED 405 + +/* Extra notification attributes */ +#define OCI_ATTR_NFY_FLAGS 406 + +#define OCI_ATTR_MSG_DELIVERY_MODE 407 /* msg delivery mode */ +#define OCI_ATTR_DB_CHARSET_ID 416 /* database charset ID */ +#define OCI_ATTR_DB_NCHARSET_ID 417 /* database ncharset ID */ +#define OCI_ATTR_RESERVED_25 418 /* reserved */ + +#define OCI_ATTR_FLOW_CONTROL_TIMEOUT 423 /* AQ: flow control timeout */ +/*---------------------------------------------------------------------------*/ +/* ------------------DirPathAPI attribute Section----------------------------*/ +/* All DirPathAPI attributes are in this section of the file. Existing */ +/* attributes prior to this section being created are assigned values < 2000 */ +/* Add new DirPathAPI attributes to this section and their assigned value */ +/* should be whatever the last entry is + 1. */ + +/*------------- Supported Values for Direct Path Stream Version -------------*/ +#define OCI_DIRPATH_STREAM_VERSION_1 100 +#define OCI_DIRPATH_STREAM_VERSION_2 200 +#define OCI_DIRPATH_STREAM_VERSION_3 300 /* default */ + + +#define OCI_ATTR_DIRPATH_MODE 78 /* mode of direct path operation */ +#define OCI_ATTR_DIRPATH_NOLOG 79 /* nologging option */ +#define OCI_ATTR_DIRPATH_PARALLEL 80 /* parallel (temp seg) option */ + +#define OCI_ATTR_DIRPATH_SORTED_INDEX 137 /* index that data is sorted on */ + + /* direct path index maint method (see oci8dp.h) */ +#define OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD 138 + + /* parallel load: db file, initial and next extent sizes */ + +#define OCI_ATTR_DIRPATH_FILE 139 /* DB file to load into */ +#define OCI_ATTR_DIRPATH_STORAGE_INITIAL 140 /* initial extent size */ +#define OCI_ATTR_DIRPATH_STORAGE_NEXT 141 /* next extent size */ + /* direct path index maint method (see oci8dp.h) */ +#define OCI_ATTR_DIRPATH_SKIPINDEX_METHOD 145 + + /* 8.2 dpapi support of ADTs */ +#define OCI_ATTR_DIRPATH_EXPR_TYPE 150 /* expr type of OCI_ATTR_NAME */ + +/* For the direct path API there are three data formats: + * TEXT - used mainly by SQL*Loader, data is in textual form + * STREAM - used by datapump, data is in stream loadable form + * OCI - used by OCI programs utilizing the DpApi, data is in binary form + */ +#define OCI_ATTR_DIRPATH_INPUT 151 +#define OCI_DIRPATH_INPUT_TEXT 0x01 /* text */ +#define OCI_DIRPATH_INPUT_STREAM 0x02 /* stream (datapump) */ +#define OCI_DIRPATH_INPUT_OCI 0x04 /* binary (oci) */ +#define OCI_DIRPATH_INPUT_UNKNOWN 0x08 + +#define OCI_ATTR_DIRPATH_FN_CTX 167 /* fn ctx ADT attrs or args */ + +#define OCI_ATTR_DIRPATH_OID 187 /* loading into an OID col */ +#define OCI_ATTR_DIRPATH_SID 194 /* loading into an SID col */ +#define OCI_ATTR_DIRPATH_OBJ_CONSTR 206 /* obj type of subst obj tbl */ + +/* Attr to allow setting of the stream version PRIOR to calling Prepare */ +#define OCI_ATTR_DIRPATH_STREAM_VERSION 212 /* version of the stream*/ + +#define OCIP_ATTR_DIRPATH_VARRAY_INDEX 213 /* varray index column */ + +/*------------- Supported Values for Direct Path Date cache -----------------*/ +#define OCI_ATTR_DIRPATH_DCACHE_NUM 303 /* date cache entries */ +#define OCI_ATTR_DIRPATH_DCACHE_SIZE 304 /* date cache limit */ +#define OCI_ATTR_DIRPATH_DCACHE_MISSES 305 /* date cache misses */ +#define OCI_ATTR_DIRPATH_DCACHE_HITS 306 /* date cache hits */ +#define OCI_ATTR_DIRPATH_DCACHE_DISABLE 307 /* on set: disable datecache + * on overflow. + * on get: datecache disabled? + * could be due to overflow + * or others */ + +/*------------- Attributes for 10i Updates to the DirPath API ---------------*/ +#define OCI_ATTR_DIRPATH_RESERVED_7 326 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_8 327 /* reserved */ +#define OCI_ATTR_DIRPATH_CONVERT 328 /* stream conversion needed? */ +#define OCI_ATTR_DIRPATH_BADROW 329 /* info about bad row */ +#define OCI_ATTR_DIRPATH_BADROW_LENGTH 330 /* length of bad row info */ +#define OCI_ATTR_DIRPATH_WRITE_ORDER 331 /* column fill order */ +#define OCI_ATTR_DIRPATH_GRANULE_SIZE 332 /* granule size for unload */ +#define OCI_ATTR_DIRPATH_GRANULE_OFFSET 333 /* offset to last granule */ +#define OCI_ATTR_DIRPATH_RESERVED_1 334 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_2 335 /* reserved */ + +/*------ Attributes for 10i DirPathAPI conversion (NLS lang, terr, cs) ------*/ +#define OCI_ATTR_DIRPATH_RESERVED_3 337 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_4 338 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_5 357 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_6 358 /* reserved */ + +#define OCI_ATTR_DIRPATH_LOCK_WAIT 359 /* wait for lock in dpapi */ + +#define OCI_ATTR_DIRPATH_RESERVED_9 2000 /* reserved */ + +/*------ Attribute for 10iR2 for column encryption for Direct Path API ------*/ +#define OCI_ATTR_DIRPATH_RESERVED_10 2001 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_11 2002 /* reserved */ + +/*------ Attribute to determine last column successfully converted ----------*/ +#define OCI_ATTR_CURRENT_ERRCOL 2003 /* current error column */ + + /*--Attributes for 11gR1 for multiple subtype support in Direct Path API - */ +#define OCI_ATTR_DIRPATH_SUBTYPE_INDEX 2004 /* sbtyp indx for attribute */ + +#define OCI_ATTR_DIRPATH_RESERVED_12 2005 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_13 2006 /* reserver */ + + /*--Attribute for partitioning constraint optimization in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_14 2007 /* reserved */ + + /*--Attribute for interval partitioning in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_15 2008 /* reserved */ + + /*--Attribute for interval partitioning in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_16 2009 /* reserved */ + +/*--Attribute for allowing parallel lob loads in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_17 2010 /* reserved */ + +/*--Attribute for process order number of table being loaded/unloaded */ +#define OCI_ATTR_DIRPATH_RESERVED_18 2011 /* reserved */ + +#define OCI_ATTR_DIRPATH_RESERVED_19 2012 /* reserved */ + +#define OCI_ATTR_DIRPATH_NO_INDEX_ERRORS 2013 /* reserved */ + +/*--Attribute for private sqlldr no index errors */ +#define OCI_ATTR_DIRPATH_RESERVED_20 2014 /* reserved */ + +/*--Attribute for private sqlldr partition memory limit */ +#define OCI_ATTR_DIRPATH_RESERVED_21 2015 /* reserved */ + +/* Add DirPathAPI attributes above. Next value to be assigned is 2016 */ + + +/* ------------------End of DirPathAPI attribute Section --------------------*/ +/*---------------------------------------------------------------------------*/ + + +/*---------------- Describe Handle Parameter Attribute Values ---------------*/ + +/* OCI_ATTR_CURSOR_COMMIT_BEHAVIOR */ +#define OCI_CURSOR_OPEN 0 +#define OCI_CURSOR_CLOSED 1 + +/* OCI_ATTR_CATALOG_LOCATION */ +#define OCI_CL_START 0 +#define OCI_CL_END 1 + +/* OCI_ATTR_SAVEPOINT_SUPPORT */ +#define OCI_SP_SUPPORTED 0 +#define OCI_SP_UNSUPPORTED 1 + +/* OCI_ATTR_NOWAIT_SUPPORT */ +#define OCI_NW_SUPPORTED 0 +#define OCI_NW_UNSUPPORTED 1 + +/* OCI_ATTR_AUTOCOMMIT_DDL */ +#define OCI_AC_DDL 0 +#define OCI_NO_AC_DDL 1 + +/* OCI_ATTR_LOCKING_MODE */ +#define OCI_LOCK_IMMEDIATE 0 +#define OCI_LOCK_DELAYED 1 + +/* ------------------- Instance type attribute values -----------------------*/ +#define OCI_INSTANCE_TYPE_UNKNOWN 0 +#define OCI_INSTANCE_TYPE_RDBMS 1 +#define OCI_INSTANCE_TYPE_OSM 2 + +/* ---------------- ASM Volume Device Support attribute values --------------*/ +#define OCI_ASM_VOLUME_UNSUPPORTED 0 +#define OCI_ASM_VOLUME_SUPPORTED 1 + +/*---------------------------------------------------------------------------*/ + +/*---------------------------OCIPasswordChange-------------------------------*/ +#define OCI_AUTH 0x08 /* Change the password but do not login */ + + +/*------------------------Other Constants------------------------------------*/ +#define OCI_MAX_FNS 100 /* max number of OCI Functions */ +#define OCI_SQLSTATE_SIZE 5 +#define OCI_ERROR_MAXMSG_SIZE 1024 /* max size of an error message */ +#define OCI_LOBMAXSIZE MINUB4MAXVAL /* maximum lob data size */ +#define OCI_ROWID_LEN 23 +#define OCI_LOB_CONTENTTYPE_MAXSIZE 128 /* max size of securefile contenttype */ +#define OCI_LOB_CONTENTTYPE_MAXBYTESIZE OCI_LOB_CONTENTTYPE_MAXSIZE +/*---------------------------------------------------------------------------*/ + +/*------------------------ Fail Over Events ---------------------------------*/ +#define OCI_FO_END 0x00000001 +#define OCI_FO_ABORT 0x00000002 +#define OCI_FO_REAUTH 0x00000004 +#define OCI_FO_BEGIN 0x00000008 +#define OCI_FO_ERROR 0x00000010 +/*---------------------------------------------------------------------------*/ + +/*------------------------ Fail Over Callback Return Codes ------------------*/ +#define OCI_FO_RETRY 25410 +/*---------------------------------------------------------------------------*/ + +/*------------------------- Fail Over Types ---------------------------------*/ +#define OCI_FO_NONE 0x00000001 +#define OCI_FO_SESSION 0x00000002 +#define OCI_FO_SELECT 0x00000004 +#define OCI_FO_TXNAL 0x00000008 +/*---------------------------------------------------------------------------*/ + +/*-----------------------Function Codes--------------------------------------*/ +#define OCI_FNCODE_INITIALIZE 1 /* OCIInitialize */ +#define OCI_FNCODE_HANDLEALLOC 2 /* OCIHandleAlloc */ +#define OCI_FNCODE_HANDLEFREE 3 /* OCIHandleFree */ +#define OCI_FNCODE_DESCRIPTORALLOC 4 /* OCIDescriptorAlloc */ +#define OCI_FNCODE_DESCRIPTORFREE 5 /* OCIDescriptorFree */ +#define OCI_FNCODE_ENVINIT 6 /* OCIEnvInit */ +#define OCI_FNCODE_SERVERATTACH 7 /* OCIServerAttach */ +#define OCI_FNCODE_SERVERDETACH 8 /* OCIServerDetach */ +/* unused 9 */ +#define OCI_FNCODE_SESSIONBEGIN 10 /* OCISessionBegin */ +#define OCI_FNCODE_SESSIONEND 11 /* OCISessionEnd */ +#define OCI_FNCODE_PASSWORDCHANGE 12 /* OCIPasswordChange */ +#define OCI_FNCODE_STMTPREPARE 13 /* OCIStmtPrepare */ + /* unused 14- 16 */ +#define OCI_FNCODE_BINDDYNAMIC 17 /* OCIBindDynamic */ +#define OCI_FNCODE_BINDOBJECT 18 /* OCIBindObject */ + /* 19 unused */ +#define OCI_FNCODE_BINDARRAYOFSTRUCT 20 /* OCIBindArrayOfStruct */ +#define OCI_FNCODE_STMTEXECUTE 21 /* OCIStmtExecute */ + /* unused 22-24 */ +#define OCI_FNCODE_DEFINEOBJECT 25 /* OCIDefineObject */ +#define OCI_FNCODE_DEFINEDYNAMIC 26 /* OCIDefineDynamic */ +#define OCI_FNCODE_DEFINEARRAYOFSTRUCT 27 /* OCIDefineArrayOfStruct */ +#define OCI_FNCODE_STMTFETCH 28 /* OCIStmtFetch */ +#define OCI_FNCODE_STMTGETBIND 29 /* OCIStmtGetBindInfo */ + /* 30, 31 unused */ +#define OCI_FNCODE_DESCRIBEANY 32 /* OCIDescribeAny */ +#define OCI_FNCODE_TRANSSTART 33 /* OCITransStart */ +#define OCI_FNCODE_TRANSDETACH 34 /* OCITransDetach */ +#define OCI_FNCODE_TRANSCOMMIT 35 /* OCITransCommit */ + /* 36 unused */ +#define OCI_FNCODE_ERRORGET 37 /* OCIErrorGet */ +#define OCI_FNCODE_LOBOPENFILE 38 /* OCILobFileOpen */ +#define OCI_FNCODE_LOBCLOSEFILE 39 /* OCILobFileClose */ + /* 40 was LOBCREATEFILE, unused */ + /* 41 was OCILobFileDelete, unused */ +#define OCI_FNCODE_LOBCOPY 42 /* OCILobCopy */ +#define OCI_FNCODE_LOBAPPEND 43 /* OCILobAppend */ +#define OCI_FNCODE_LOBERASE 44 /* OCILobErase */ +#define OCI_FNCODE_LOBLENGTH 45 /* OCILobGetLength */ +#define OCI_FNCODE_LOBTRIM 46 /* OCILobTrim */ +#define OCI_FNCODE_LOBREAD 47 /* OCILobRead */ +#define OCI_FNCODE_LOBWRITE 48 /* OCILobWrite */ + /* 49 unused */ +#define OCI_FNCODE_SVCCTXBREAK 50 /* OCIBreak */ +#define OCI_FNCODE_SERVERVERSION 51 /* OCIServerVersion */ + +#define OCI_FNCODE_KERBATTRSET 52 /* OCIKerbAttrSet */ + +/* unused 53 */ + +#define OCI_FNCODE_ATTRGET 54 /* OCIAttrGet */ +#define OCI_FNCODE_ATTRSET 55 /* OCIAttrSet */ +#define OCI_FNCODE_PARAMSET 56 /* OCIParamSet */ +#define OCI_FNCODE_PARAMGET 57 /* OCIParamGet */ +#define OCI_FNCODE_STMTGETPIECEINFO 58 /* OCIStmtGetPieceInfo */ +#define OCI_FNCODE_LDATOSVCCTX 59 /* OCILdaToSvcCtx */ + /* 60 unused */ +#define OCI_FNCODE_STMTSETPIECEINFO 61 /* OCIStmtSetPieceInfo */ +#define OCI_FNCODE_TRANSFORGET 62 /* OCITransForget */ +#define OCI_FNCODE_TRANSPREPARE 63 /* OCITransPrepare */ +#define OCI_FNCODE_TRANSROLLBACK 64 /* OCITransRollback */ +#define OCI_FNCODE_DEFINEBYPOS 65 /* OCIDefineByPos */ +#define OCI_FNCODE_BINDBYPOS 66 /* OCIBindByPos */ +#define OCI_FNCODE_BINDBYNAME 67 /* OCIBindByName */ +#define OCI_FNCODE_LOBASSIGN 68 /* OCILobAssign */ +#define OCI_FNCODE_LOBISEQUAL 69 /* OCILobIsEqual */ +#define OCI_FNCODE_LOBISINIT 70 /* OCILobLocatorIsInit */ + +#define OCI_FNCODE_LOBENABLEBUFFERING 71 /* OCILobEnableBuffering */ +#define OCI_FNCODE_LOBCHARSETID 72 /* OCILobCharSetID */ +#define OCI_FNCODE_LOBCHARSETFORM 73 /* OCILobCharSetForm */ +#define OCI_FNCODE_LOBFILESETNAME 74 /* OCILobFileSetName */ +#define OCI_FNCODE_LOBFILEGETNAME 75 /* OCILobFileGetName */ +#define OCI_FNCODE_LOGON 76 /* OCILogon */ +#define OCI_FNCODE_LOGOFF 77 /* OCILogoff */ +#define OCI_FNCODE_LOBDISABLEBUFFERING 78 /* OCILobDisableBuffering */ +#define OCI_FNCODE_LOBFLUSHBUFFER 79 /* OCILobFlushBuffer */ +#define OCI_FNCODE_LOBLOADFROMFILE 80 /* OCILobLoadFromFile */ + +#define OCI_FNCODE_LOBOPEN 81 /* OCILobOpen */ +#define OCI_FNCODE_LOBCLOSE 82 /* OCILobClose */ +#define OCI_FNCODE_LOBISOPEN 83 /* OCILobIsOpen */ +#define OCI_FNCODE_LOBFILEISOPEN 84 /* OCILobFileIsOpen */ +#define OCI_FNCODE_LOBFILEEXISTS 85 /* OCILobFileExists */ +#define OCI_FNCODE_LOBFILECLOSEALL 86 /* OCILobFileCloseAll */ +#define OCI_FNCODE_LOBCREATETEMP 87 /* OCILobCreateTemporary */ +#define OCI_FNCODE_LOBFREETEMP 88 /* OCILobFreeTemporary */ +#define OCI_FNCODE_LOBISTEMP 89 /* OCILobIsTemporary */ + +#define OCI_FNCODE_AQENQ 90 /* OCIAQEnq */ +#define OCI_FNCODE_AQDEQ 91 /* OCIAQDeq */ +#define OCI_FNCODE_RESET 92 /* OCIReset */ +#define OCI_FNCODE_SVCCTXTOLDA 93 /* OCISvcCtxToLda */ +#define OCI_FNCODE_LOBLOCATORASSIGN 94 /* OCILobLocatorAssign */ + +#define OCI_FNCODE_UBINDBYNAME 95 + +#define OCI_FNCODE_AQLISTEN 96 /* OCIAQListen */ + +#define OCI_FNCODE_SVC2HST 97 /* reserved */ +#define OCI_FNCODE_SVCRH 98 /* reserved */ + /* 97 and 98 are reserved for Oracle internal use */ + +#define OCI_FNCODE_TRANSMULTIPREPARE 99 /* OCITransMultiPrepare */ + +#define OCI_FNCODE_CPOOLCREATE 100 /* OCIConnectionPoolCreate */ +#define OCI_FNCODE_CPOOLDESTROY 101 /* OCIConnectionPoolDestroy */ +#define OCI_FNCODE_LOGON2 102 /* OCILogon2 */ +#define OCI_FNCODE_ROWIDTOCHAR 103 /* OCIRowidToChar */ + +#define OCI_FNCODE_SPOOLCREATE 104 /* OCISessionPoolCreate */ +#define OCI_FNCODE_SPOOLDESTROY 105 /* OCISessionPoolDestroy */ +#define OCI_FNCODE_SESSIONGET 106 /* OCISessionGet */ +#define OCI_FNCODE_SESSIONRELEASE 107 /* OCISessionRelease */ +#define OCI_FNCODE_STMTPREPARE2 108 /* OCIStmtPrepare2 */ +#define OCI_FNCODE_STMTRELEASE 109 /* OCIStmtRelease */ +#define OCI_FNCODE_AQENQARRAY 110 /* OCIAQEnqArray */ +#define OCI_FNCODE_AQDEQARRAY 111 /* OCIAQDeqArray */ +#define OCI_FNCODE_LOBCOPY2 112 /* OCILobCopy2 */ +#define OCI_FNCODE_LOBERASE2 113 /* OCILobErase2 */ +#define OCI_FNCODE_LOBLENGTH2 114 /* OCILobGetLength2 */ +#define OCI_FNCODE_LOBLOADFROMFILE2 115 /* OCILobLoadFromFile2 */ +#define OCI_FNCODE_LOBREAD2 116 /* OCILobRead2 */ +#define OCI_FNCODE_LOBTRIM2 117 /* OCILobTrim2 */ +#define OCI_FNCODE_LOBWRITE2 118 /* OCILobWrite2 */ +#define OCI_FNCODE_LOBGETSTORAGELIMIT 119 /* OCILobGetStorageLimit */ +#define OCI_FNCODE_DBSTARTUP 120 /* OCIDBStartup */ +#define OCI_FNCODE_DBSHUTDOWN 121 /* OCIDBShutdown */ +#define OCI_FNCODE_LOBARRAYREAD 122 /* OCILobArrayRead */ +#define OCI_FNCODE_LOBARRAYWRITE 123 /* OCILobArrayWrite */ +#define OCI_FNCODE_AQENQSTREAM 124 /* OCIAQEnqStreaming */ +#define OCI_FNCODE_AQGETREPLAY 125 /* OCIAQGetReplayInfo */ +#define OCI_FNCODE_AQRESETREPLAY 126 /* OCIAQResetReplayInfo */ +#define OCI_FNCODE_ARRAYDESCRIPTORALLOC 127 /*OCIArrayDescriptorAlloc */ +#define OCI_FNCODE_ARRAYDESCRIPTORFREE 128 /* OCIArrayDescriptorFree */ +#define OCI_FNCODE_LOBGETOPT 129 /* OCILobGetCptions */ +#define OCI_FNCODE_LOBSETOPT 130 /* OCILobSetCptions */ +#define OCI_FNCODE_LOBFRAGINS 131 /* OCILobFragementInsert */ +#define OCI_FNCODE_LOBFRAGDEL 132 /* OCILobFragementDelete */ +#define OCI_FNCODE_LOBFRAGMOV 133 /* OCILobFragementMove */ +#define OCI_FNCODE_LOBFRAGREP 134 /* OCILobFragementReplace */ +#define OCI_FNCODE_LOBGETDEDUPLICATEREGIONS 135/* OCILobGetDeduplicateRegions */ +#define OCI_FNCODE_APPCTXSET 136 /* OCIAppCtxSet */ +#define OCI_FNCODE_APPCTXCLEARALL 137 /* OCIAppCtxClearAll */ + +#define OCI_FNCODE_LOBGETCONTENTTYPE 138 /* OCILobGetContentType */ +#define OCI_FNCODE_LOBSETCONTENTTYPE 139 /* OCILobSetContentType */ +#define OCI_FNCODE_MAXFCN 139 /* maximum OCI function code */ + +/*---------------Statement Cache callback modes-----------------------------*/ +#define OCI_CBK_STMTCACHE_STMTPURGE 0x01 + +/*---------------------------------------------------------------------------*/ + +/*-----------------------Handle Definitions----------------------------------*/ +typedef struct OCIEnv OCIEnv; /* OCI environment handle */ +typedef struct OCIError OCIError; /* OCI error handle */ +typedef struct OCISvcCtx OCISvcCtx; /* OCI service handle */ +typedef struct OCIStmt OCIStmt; /* OCI statement handle */ +typedef struct OCIBind OCIBind; /* OCI bind handle */ +typedef struct OCIDefine OCIDefine; /* OCI Define handle */ +typedef struct OCIDescribe OCIDescribe; /* OCI Describe handle */ +typedef struct OCIServer OCIServer; /* OCI Server handle */ +typedef struct OCISession OCISession; /* OCI Authentication handle */ +typedef struct OCIComplexObject OCIComplexObject; /* OCI COR handle */ +typedef struct OCITrans OCITrans; /* OCI Transaction handle */ +typedef struct OCISecurity OCISecurity; /* OCI Security handle */ +typedef struct OCISubscription OCISubscription; /* subscription handle */ + +typedef struct OCICPool OCICPool; /* connection pool handle */ +typedef struct OCISPool OCISPool; /* session pool handle */ +typedef struct OCIAuthInfo OCIAuthInfo; /* auth handle */ +typedef struct OCIAdmin OCIAdmin; /* admin handle */ +typedef struct OCIEvent OCIEvent; /* HA event handle */ + +/*-----------------------Descriptor Definitions------------------------------*/ +typedef struct OCISnapshot OCISnapshot; /* OCI snapshot descriptor */ +typedef struct OCIResult OCIResult; /* OCI Result Set Descriptor */ +typedef struct OCILobLocator OCILobLocator; /* OCI Lob Locator descriptor */ +typedef struct OCILobRegion OCILobRegion; /* OCI Lob Regions descriptor */ +typedef struct OCIParam OCIParam; /* OCI PARameter descriptor */ +typedef struct OCIComplexObjectComp OCIComplexObjectComp; + /* OCI COR descriptor */ +typedef struct OCIRowid OCIRowid; /* OCI ROWID descriptor */ + +typedef struct OCIDateTime OCIDateTime; /* OCI DateTime descriptor */ +typedef struct OCIInterval OCIInterval; /* OCI Interval descriptor */ + +typedef struct OCIUcb OCIUcb; /* OCI User Callback descriptor */ +typedef struct OCIServerDNs OCIServerDNs; /* OCI server DN descriptor */ + +/*-------------------------- AQ Descriptors ---------------------------------*/ +typedef struct OCIAQEnqOptions OCIAQEnqOptions; /* AQ Enqueue Options hdl */ +typedef struct OCIAQDeqOptions OCIAQDeqOptions; /* AQ Dequeue Options hdl */ +typedef struct OCIAQMsgProperties OCIAQMsgProperties; /* AQ Mesg Properties */ +typedef struct OCIAQAgent OCIAQAgent; /* AQ Agent descriptor */ +typedef struct OCIAQNfyDescriptor OCIAQNfyDescriptor; /* AQ Nfy descriptor */ +typedef struct OCIAQSignature OCIAQSignature; /* AQ Siganture */ +typedef struct OCIAQListenOpts OCIAQListenOpts; /* AQ listen options */ +typedef struct OCIAQLisMsgProps OCIAQLisMsgProps; /* AQ listen msg props */ + +/*---------------------------------------------------------------------------*/ + +/* Lob typedefs for Pro*C */ +typedef struct OCILobLocator OCIClobLocator; /* OCI Character LOB Locator */ +typedef struct OCILobLocator OCIBlobLocator; /* OCI Binary LOB Locator */ +typedef struct OCILobLocator OCIBFileLocator; /* OCI Binary LOB File Locator */ +/*---------------------------------------------------------------------------*/ + +/* Undefined value for tz in interval types*/ +#define OCI_INTHR_UNK 24 + + /* These defined adjustment values */ +#define OCI_ADJUST_UNK 10 +#define OCI_ORACLE_DATE 0 +#define OCI_ANSI_DATE 1 + +/*------------------------ Lob-specific Definitions -------------------------*/ + +/* + * ociloff - OCI Lob OFFset + * + * The offset in the lob data. The offset is specified in terms of bytes for + * BLOBs and BFILes. Character offsets are used for CLOBs, NCLOBs. + * The maximum size of internal lob data is 4 gigabytes. FILE LOB + * size is limited by the operating system. + */ +typedef ub4 OCILobOffset; + +/* + * ocillen - OCI Lob LENgth (of lob data) + * + * Specifies the length of lob data in bytes for BLOBs and BFILes and in + * characters for CLOBs, NCLOBs. The maximum length of internal lob + * data is 4 gigabytes. The length of FILE LOBs is limited only by the + * operating system. + */ +typedef ub4 OCILobLength; +/* + * ocilmo - OCI Lob open MOdes + * + * The mode specifies the planned operations that will be performed on the + * FILE lob data. The FILE lob can be opened in read-only mode only. + * + * In the future, we may include read/write, append and truncate modes. Append + * is equivalent to read/write mode except that the FILE is positioned for + * writing to the end. Truncate is equivalent to read/write mode except that + * the FILE LOB data is first truncated to a length of 0 before use. + */ +enum OCILobMode +{ + OCI_LOBMODE_READONLY = 1, /* read-only */ + OCI_LOBMODE_READWRITE = 2 /* read_write for internal lobs only */ +}; +typedef enum OCILobMode OCILobMode; + +/*---------------------------------------------------------------------------*/ + + +/*----------------------------Piece Definitions------------------------------*/ + +/* if ocidef.h is being included in the app, ocidef.h should precede oci.h */ + +/* + * since clients may use oci.h, ocidef.h and ocidfn.h the following defines + * need to be guarded, usually internal clients + */ + +#ifndef OCI_FLAGS +#define OCI_FLAGS +#define OCI_ONE_PIECE 0 /* one piece */ +#define OCI_FIRST_PIECE 1 /* the first piece */ +#define OCI_NEXT_PIECE 2 /* the next of many pieces */ +#define OCI_LAST_PIECE 3 /* the last piece */ +#endif +/*---------------------------------------------------------------------------*/ + +/*--------------------------- FILE open modes -------------------------------*/ +#define OCI_FILE_READONLY 1 /* readonly mode open for FILE types */ +/*---------------------------------------------------------------------------*/ +/*--------------------------- LOB open modes --------------------------------*/ +#define OCI_LOB_READONLY 1 /* readonly mode open for ILOB types */ +#define OCI_LOB_READWRITE 2 /* read write mode open for ILOBs */ +#define OCI_LOB_WRITEONLY 3 /* Writeonly mode open for ILOB types*/ +#define OCI_LOB_APPENDONLY 4 /* Appendonly mode open for ILOB types */ +#define OCI_LOB_FULLOVERWRITE 5 /* Completely overwrite ILOB */ +#define OCI_LOB_FULLREAD 6 /* Doing a Full Read of ILOB */ + +/*----------------------- LOB Buffering Flush Flags -------------------------*/ +#define OCI_LOB_BUFFER_FREE 1 +#define OCI_LOB_BUFFER_NOFREE 2 +/*---------------------------------------------------------------------------*/ + +/*---------------------------LOB Option Types -------------------------------*/ +#define OCI_LOB_OPT_COMPRESS 1 /* SECUREFILE Compress */ +#define OCI_LOB_OPT_ENCRYPT 2 /* SECUREFILE Encrypt */ +#define OCI_LOB_OPT_DEDUPLICATE 4 /* SECUREFILE Deduplicate */ +#define OCI_LOB_OPT_ALLOCSIZE 8 /* SECUREFILE Allocation Size */ +#define OCI_LOB_OPT_CONTENTTYPE 16 /* SECUREFILE Content Type */ +#define OCI_LOB_OPT_MODTIME 32 /* SECUREFILE Modification Time */ + +/*------------------------ LOB Option Values ------------------------------*/ +/* Compression */ +#define OCI_LOB_COMPRESS_OFF 0 /* Compression off */ +#define OCI_LOB_COMPRESS_ON 1 /* Compression on */ +/* Encryption */ +#define OCI_LOB_ENCRYPT_OFF 0 /* Encryption Off */ +#define OCI_LOB_ENCRYPT_ON 2 /* Encryption On */ +/* Deduplciate */ +#define OCI_LOB_DEDUPLICATE_OFF 0 /* Deduplicate Off */ +#define OCI_LOB_DEDUPLICATE_ON 4 /* Deduplicate Lobs */ + +/*--------------------------- OCI Statement Types ---------------------------*/ + +#define OCI_STMT_UNKNOWN 0 /* Unknown statement */ +#define OCI_STMT_SELECT 1 /* select statement */ +#define OCI_STMT_UPDATE 2 /* update statement */ +#define OCI_STMT_DELETE 3 /* delete statement */ +#define OCI_STMT_INSERT 4 /* Insert Statement */ +#define OCI_STMT_CREATE 5 /* create statement */ +#define OCI_STMT_DROP 6 /* drop statement */ +#define OCI_STMT_ALTER 7 /* alter statement */ +#define OCI_STMT_BEGIN 8 /* begin ... (pl/sql statement)*/ +#define OCI_STMT_DECLARE 9 /* declare .. (pl/sql statement ) */ +#define OCI_STMT_CALL 10 /* corresponds to kpu call */ +/*---------------------------------------------------------------------------*/ + +/*--------------------------- OCI Parameter Types ---------------------------*/ +#define OCI_PTYPE_UNK 0 /* unknown */ +#define OCI_PTYPE_TABLE 1 /* table */ +#define OCI_PTYPE_VIEW 2 /* view */ +#define OCI_PTYPE_PROC 3 /* procedure */ +#define OCI_PTYPE_FUNC 4 /* function */ +#define OCI_PTYPE_PKG 5 /* package */ +#define OCI_PTYPE_TYPE 6 /* user-defined type */ +#define OCI_PTYPE_SYN 7 /* synonym */ +#define OCI_PTYPE_SEQ 8 /* sequence */ +#define OCI_PTYPE_COL 9 /* column */ +#define OCI_PTYPE_ARG 10 /* argument */ +#define OCI_PTYPE_LIST 11 /* list */ +#define OCI_PTYPE_TYPE_ATTR 12 /* user-defined type's attribute */ +#define OCI_PTYPE_TYPE_COLL 13 /* collection type's element */ +#define OCI_PTYPE_TYPE_METHOD 14 /* user-defined type's method */ +#define OCI_PTYPE_TYPE_ARG 15 /* user-defined type method's arg */ +#define OCI_PTYPE_TYPE_RESULT 16/* user-defined type method's result */ +#define OCI_PTYPE_SCHEMA 17 /* schema */ +#define OCI_PTYPE_DATABASE 18 /* database */ +#define OCI_PTYPE_RULE 19 /* rule */ +#define OCI_PTYPE_RULE_SET 20 /* rule set */ +#define OCI_PTYPE_EVALUATION_CONTEXT 21 /* evaluation context */ +#define OCI_PTYPE_TABLE_ALIAS 22 /* table alias */ +#define OCI_PTYPE_VARIABLE_TYPE 23 /* variable type */ +#define OCI_PTYPE_NAME_VALUE 24 /* name value pair */ + +/*---------------------------------------------------------------------------*/ + +/*----------------------------- OCI List Types ------------------------------*/ +#define OCI_LTYPE_UNK 0 /* unknown */ +#define OCI_LTYPE_COLUMN 1 /* column list */ +#define OCI_LTYPE_ARG_PROC 2 /* procedure argument list */ +#define OCI_LTYPE_ARG_FUNC 3 /* function argument list */ +#define OCI_LTYPE_SUBPRG 4 /* subprogram list */ +#define OCI_LTYPE_TYPE_ATTR 5 /* type attribute */ +#define OCI_LTYPE_TYPE_METHOD 6 /* type method */ +#define OCI_LTYPE_TYPE_ARG_PROC 7 /* type method w/o result argument list */ +#define OCI_LTYPE_TYPE_ARG_FUNC 8 /* type method w/result argument list */ +#define OCI_LTYPE_SCH_OBJ 9 /* schema object list */ +#define OCI_LTYPE_DB_SCH 10 /* database schema list */ +#define OCI_LTYPE_TYPE_SUBTYPE 11 /* subtype list */ +#define OCI_LTYPE_TABLE_ALIAS 12 /* table alias list */ +#define OCI_LTYPE_VARIABLE_TYPE 13 /* variable type list */ +#define OCI_LTYPE_NAME_VALUE 14 /* name value list */ + +/*---------------------------------------------------------------------------*/ + +/*-------------------------- Memory Cartridge Services ---------------------*/ +#define OCI_MEMORY_CLEARED 1 + +/*-------------------------- Pickler Cartridge Services ---------------------*/ +typedef struct OCIPicklerTdsCtx OCIPicklerTdsCtx; +typedef struct OCIPicklerTds OCIPicklerTds; +typedef struct OCIPicklerImage OCIPicklerImage; +typedef struct OCIPicklerFdo OCIPicklerFdo; +typedef ub4 OCIPicklerTdsElement; + +typedef struct OCIAnyData OCIAnyData; + +typedef struct OCIAnyDataSet OCIAnyDataSet; +typedef struct OCIAnyDataCtx OCIAnyDataCtx; + +/*---------------------------------------------------------------------------*/ + +/*--------------------------- User Callback Constants -----------------------*/ +#define OCI_UCBTYPE_ENTRY 1 /* entry callback */ +#define OCI_UCBTYPE_EXIT 2 /* exit callback */ +#define OCI_UCBTYPE_REPLACE 3 /* replacement callback */ + +/*---------------------------------------------------------------------------*/ + +/*--------------------- NLS service type and constance ----------------------*/ +#define OCI_NLS_DAYNAME1 1 /* Native name for Monday */ +#define OCI_NLS_DAYNAME2 2 /* Native name for Tuesday */ +#define OCI_NLS_DAYNAME3 3 /* Native name for Wednesday */ +#define OCI_NLS_DAYNAME4 4 /* Native name for Thursday */ +#define OCI_NLS_DAYNAME5 5 /* Native name for Friday */ +#define OCI_NLS_DAYNAME6 6 /* Native name for for Saturday */ +#define OCI_NLS_DAYNAME7 7 /* Native name for for Sunday */ +#define OCI_NLS_ABDAYNAME1 8 /* Native abbreviated name for Monday */ +#define OCI_NLS_ABDAYNAME2 9 /* Native abbreviated name for Tuesday */ +#define OCI_NLS_ABDAYNAME3 10 /* Native abbreviated name for Wednesday */ +#define OCI_NLS_ABDAYNAME4 11 /* Native abbreviated name for Thursday */ +#define OCI_NLS_ABDAYNAME5 12 /* Native abbreviated name for Friday */ +#define OCI_NLS_ABDAYNAME6 13 /* Native abbreviated name for for Saturday */ +#define OCI_NLS_ABDAYNAME7 14 /* Native abbreviated name for for Sunday */ +#define OCI_NLS_MONTHNAME1 15 /* Native name for January */ +#define OCI_NLS_MONTHNAME2 16 /* Native name for February */ +#define OCI_NLS_MONTHNAME3 17 /* Native name for March */ +#define OCI_NLS_MONTHNAME4 18 /* Native name for April */ +#define OCI_NLS_MONTHNAME5 19 /* Native name for May */ +#define OCI_NLS_MONTHNAME6 20 /* Native name for June */ +#define OCI_NLS_MONTHNAME7 21 /* Native name for July */ +#define OCI_NLS_MONTHNAME8 22 /* Native name for August */ +#define OCI_NLS_MONTHNAME9 23 /* Native name for September */ +#define OCI_NLS_MONTHNAME10 24 /* Native name for October */ +#define OCI_NLS_MONTHNAME11 25 /* Native name for November */ +#define OCI_NLS_MONTHNAME12 26 /* Native name for December */ +#define OCI_NLS_ABMONTHNAME1 27 /* Native abbreviated name for January */ +#define OCI_NLS_ABMONTHNAME2 28 /* Native abbreviated name for February */ +#define OCI_NLS_ABMONTHNAME3 29 /* Native abbreviated name for March */ +#define OCI_NLS_ABMONTHNAME4 30 /* Native abbreviated name for April */ +#define OCI_NLS_ABMONTHNAME5 31 /* Native abbreviated name for May */ +#define OCI_NLS_ABMONTHNAME6 32 /* Native abbreviated name for June */ +#define OCI_NLS_ABMONTHNAME7 33 /* Native abbreviated name for July */ +#define OCI_NLS_ABMONTHNAME8 34 /* Native abbreviated name for August */ +#define OCI_NLS_ABMONTHNAME9 35 /* Native abbreviated name for September */ +#define OCI_NLS_ABMONTHNAME10 36 /* Native abbreviated name for October */ +#define OCI_NLS_ABMONTHNAME11 37 /* Native abbreviated name for November */ +#define OCI_NLS_ABMONTHNAME12 38 /* Native abbreviated name for December */ +#define OCI_NLS_YES 39 /* Native string for affirmative response */ +#define OCI_NLS_NO 40 /* Native negative response */ +#define OCI_NLS_AM 41 /* Native equivalent string of AM */ +#define OCI_NLS_PM 42 /* Native equivalent string of PM */ +#define OCI_NLS_AD 43 /* Native equivalent string of AD */ +#define OCI_NLS_BC 44 /* Native equivalent string of BC */ +#define OCI_NLS_DECIMAL 45 /* decimal character */ +#define OCI_NLS_GROUP 46 /* group separator */ +#define OCI_NLS_DEBIT 47 /* Native symbol of debit */ +#define OCI_NLS_CREDIT 48 /* Native sumbol of credit */ +#define OCI_NLS_DATEFORMAT 49 /* Oracle date format */ +#define OCI_NLS_INT_CURRENCY 50 /* International currency symbol */ +#define OCI_NLS_LOC_CURRENCY 51 /* Locale currency symbol */ +#define OCI_NLS_LANGUAGE 52 /* Language name */ +#define OCI_NLS_ABLANGUAGE 53 /* Abbreviation for language name */ +#define OCI_NLS_TERRITORY 54 /* Territory name */ +#define OCI_NLS_CHARACTER_SET 55 /* Character set name */ +#define OCI_NLS_LINGUISTIC_NAME 56 /* Linguistic name */ +#define OCI_NLS_CALENDAR 57 /* Calendar name */ +#define OCI_NLS_DUAL_CURRENCY 78 /* Dual currency symbol */ +#define OCI_NLS_WRITINGDIR 79 /* Language writing direction */ +#define OCI_NLS_ABTERRITORY 80 /* Territory Abbreviation */ +#define OCI_NLS_DDATEFORMAT 81 /* Oracle default date format */ +#define OCI_NLS_DTIMEFORMAT 82 /* Oracle default time format */ +#define OCI_NLS_SFDATEFORMAT 83 /* Local string formatted date format */ +#define OCI_NLS_SFTIMEFORMAT 84 /* Local string formatted time format */ +#define OCI_NLS_NUMGROUPING 85 /* Number grouping fields */ +#define OCI_NLS_LISTSEP 86 /* List separator */ +#define OCI_NLS_MONDECIMAL 87 /* Monetary decimal character */ +#define OCI_NLS_MONGROUP 88 /* Monetary group separator */ +#define OCI_NLS_MONGROUPING 89 /* Monetary grouping fields */ +#define OCI_NLS_INT_CURRENCYSEP 90 /* International currency separator */ +#define OCI_NLS_CHARSET_MAXBYTESZ 91 /* Maximum character byte size */ +#define OCI_NLS_CHARSET_FIXEDWIDTH 92 /* Fixed-width charset byte size */ +#define OCI_NLS_CHARSET_ID 93 /* Character set id */ +#define OCI_NLS_NCHARSET_ID 94 /* NCharacter set id */ + +#define OCI_NLS_MAXBUFSZ 100 /* Max buffer size may need for OCINlsGetInfo */ + +#define OCI_NLS_BINARY 0x1 /* for the binary comparison */ +#define OCI_NLS_LINGUISTIC 0x2 /* for linguistic comparison */ +#define OCI_NLS_CASE_INSENSITIVE 0x10 /* for case-insensitive comparison */ + +#define OCI_NLS_UPPERCASE 0x20 /* convert to uppercase */ +#define OCI_NLS_LOWERCASE 0x40 /* convert to lowercase */ + +#define OCI_NLS_CS_IANA_TO_ORA 0 /* Map charset name from IANA to Oracle */ +#define OCI_NLS_CS_ORA_TO_IANA 1 /* Map charset name from Oracle to IANA */ +#define OCI_NLS_LANG_ISO_TO_ORA 2 /* Map language name from ISO to Oracle */ +#define OCI_NLS_LANG_ORA_TO_ISO 3 /* Map language name from Oracle to ISO */ +#define OCI_NLS_TERR_ISO_TO_ORA 4 /* Map territory name from ISO to Oracle*/ +#define OCI_NLS_TERR_ORA_TO_ISO 5 /* Map territory name from Oracle to ISO*/ +#define OCI_NLS_TERR_ISO3_TO_ORA 6 /* Map territory name from 3-letter ISO */ + /* abbreviation to Oracle */ +#define OCI_NLS_TERR_ORA_TO_ISO3 7 /* Map territory name from Oracle to */ + /* 3-letter ISO abbreviation */ +#define OCI_NLS_LOCALE_A2_ISO_TO_ORA 8 + /*Map locale name from A2 ISO to oracle*/ +#define OCI_NLS_LOCALE_A2_ORA_TO_ISO 9 + /*Map locale name from oracle to A2 ISO*/ + +typedef struct OCIMsg OCIMsg; +typedef ub4 OCIWchar; + +#define OCI_XMLTYPE_CREATE_OCISTRING 1 +#define OCI_XMLTYPE_CREATE_CLOB 2 +#define OCI_XMLTYPE_CREATE_BLOB 3 + +/*------------------------- Kerber Authentication Modes ---------------------*/ +#define OCI_KERBCRED_PROXY 1 /* Apply Kerberos Creds for Proxy */ +#define OCI_KERBCRED_CLIENT_IDENTIFIER 2/*Apply Creds for Secure Client ID */ + +/*------------------------- Database Startup Flags --------------------------*/ +#define OCI_DBSTARTUPFLAG_FORCE 0x00000001 /* Abort running instance, start */ +#define OCI_DBSTARTUPFLAG_RESTRICT 0x00000002 /* Restrict access to DBA */ + +/*------------------------- Database Shutdown Modes -------------------------*/ +#define OCI_DBSHUTDOWN_TRANSACTIONAL 1 /* Wait for all the transactions */ +#define OCI_DBSHUTDOWN_TRANSACTIONAL_LOCAL 2 /* Wait for local transactions */ +#define OCI_DBSHUTDOWN_IMMEDIATE 3 /* Terminate and roll back */ +#define OCI_DBSHUTDOWN_ABORT 4 /* Terminate and don't roll back */ +#define OCI_DBSHUTDOWN_FINAL 5 /* Orderly shutdown */ + +/*------------------------- Version information -----------------------------*/ +#define OCI_MAJOR_VERSION 11 /* Major release version */ +#define OCI_MINOR_VERSION 2 /* Minor release version */ + +/*---------------------- OCIIOV structure definitions -----------------------*/ +struct OCIIOV +{ + void *bfp; /* The Pointer to the data buffer */ + ub4 bfl; /* Length of the Data Buffer */ +}; +typedef struct OCIIOV OCIIOV; + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/* None */ + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + +/* see ociap.h or ocikp.h */ + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + +/* None */ + + +#endif /* OCI_ORACLE */ + + +/* more includes */ + +#ifndef OCI1_ORACLE +#include +#endif + +#ifndef ORO_ORACLE +#include +#endif + +#ifndef ORI_ORACLE +#include +#endif + +#ifndef ORL_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#include +#endif + +#ifndef OCIEXTP_ORACLE +#include +#endif + +#include +#include + +#ifndef OCIXMLDB_ORACLE +#include +#endif + +#ifndef OCI8DP_ORACLE +#include /* interface definitions for the direct path api */ +#endif + +#ifndef OCIEXTP_ORACLE +#include +#endif + +#ifndef OCIXSTREAM_ORACLE +#include +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + diff --git a/libraries/SQLAPI/include/ora_win/oci1.h b/libraries/SQLAPI/include/ora_win/oci1.h new file mode 100644 index 000000000..7f8d6c0a3 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/oci1.h @@ -0,0 +1,182 @@ + +/* Copyright (c) 1997, 2005, Oracle. All rights reserved. */ + +/* NOTE: See 'header_template.doc' in the 'doc' dve under the 'forms' + directory for the header file template that includes instructions. +*/ + +/* + NAME + oci1.h - Cartridge Service definitions + + DESCRIPTION + + + RELATED DOCUMENTS + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + + + PRIVATE FUNCTION(S) + + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + nramakri 01/16/98 - remove #ifdef NEVER clause + ewaugh 12/18/97 - Turn type wrappers into functions. + skabraha 12/02/97 - Adding data structures & constants for OCIFile + rhwu 12/02/97 - OCI Thread + nramakri 12/15/97 - move to core4 + ewaugh 12/11/97 - add OCIFormat package constants + ssamu 12/10/97 - do not include s.h + nramakri 11/19/97 - add OCIExtract definitions + ssamu 11/14/97 - creation + +*/ + + +#ifndef OCI1_ORACLE +# define OCI1_ORACLE + +# ifndef ORATYPES +# include +# endif + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/* Constants required by the OCIFormat package. */ + +#define OCIFormatUb1(variable) OCIFormatTUb1(), &(variable) +#define OCIFormatUb2(variable) OCIFormatTUb2(), &(variable) +#define OCIFormatUb4(variable) OCIFormatTUb4(), &(variable) +#define OCIFormatUword(variable) OCIFormatTUword(), &(variable) +#define OCIFormatUbig_ora(variable) OCIFormatTUbig_ora(), &(variable) +#define OCIFormatSb1(variable) OCIFormatTSb1(), &(variable) +#define OCIFormatSb2(variable) OCIFormatTSb2(), &(variable) +#define OCIFormatSb4(variable) OCIFormatTSb4(), &(variable) +#define OCIFormatSword(variable) OCIFormatTSword(), &(variable) +#define OCIFormatSbig_ora(variable) OCIFormatTSbig_ora(), &(variable) +#define OCIFormatEb1(variable) OCIFormatTEb1(), &(variable) +#define OCIFormatEb2(variable) OCIFormatTEb2(), &(variable) +#define OCIFormatEb4(variable) OCIFormatTEb4(), &(variable) +#define OCIFormatEword(variable) OCIFormatTEword(), &(variable) +#define OCIFormatChar(variable) OCIFormatTChar(), &(variable) +#define OCIFormatText(variable) OCIFormatTText(), (variable) +#define OCIFormatDouble(variable) OCIFormatTDouble(), &(variable) +#define OCIFormatDvoid(variable) OCIFormatTDvoid(), (variable) +#define OCIFormatEnd OCIFormatTEnd() + +#define OCIFormatDP 6 + + +/*----------------- Public Constants for OCIFile -------------------------*/ + +/* flags for open.*/ +/* flags for mode */ +#define OCI_FILE_READ_ONLY 1 /* open for read only */ +#define OCI_FILE_WRITE_ONLY 2 /* open for write only */ +#define OCI_FILE_READ_WRITE 3 /* open for read & write */ +/* flags for create */ +#define OCI_FILE_EXIST 0 /* the file should exist */ +#define OCI_FILE_CREATE 1 /* create if the file doesn't exist */ +#define OCI_FILE_EXCL 2 /* the file should not exist */ +#define OCI_FILE_TRUNCATE 4 /* create if the file doesn't exist, + else truncate file the file to 0 */ +#define OCI_FILE_APPEND 8 /* open the file in append mode */ + +/* flags for seek */ +#define OCI_FILE_SEEK_BEGINNING 1 /* seek from the beginning of the file */ +#define OCI_FILE_SEEK_CURRENT 2 /* seek from the current position */ +#define OCI_FILE_SEEK_END 3 /* seek from the end of the file */ + +#define OCI_FILE_FORWARD 1 /* seek forward */ +#define OCI_FILE_BACKWARD 2 /* seek backward */ + +/* file type */ +#define OCI_FILE_BIN 0 /* binary file */ +#define OCI_FILE_TEXT 1 /* text file */ +#define OCI_FILE_STDIN 2 /* standard i/p */ +#define OCI_FILE_STDOUT 3 /* standard o/p */ +#define OCI_FILE_STDERR 4 /* standard error */ + +/* Represents an open file */ +typedef struct OCIFileObject OCIFileObject; + + +/*--------------------- OCI Thread Object Definitions------------------------*/ + +/* OCIThread Context */ +typedef struct OCIThreadContext OCIThreadContext; + +/* OCIThread Mutual Exclusion Lock */ +typedef struct OCIThreadMutex OCIThreadMutex; + +/* OCIThread Key for Thread-Specific Data */ +typedef struct OCIThreadKey OCIThreadKey; + +/* OCIThread Thread ID */ +typedef struct OCIThreadId OCIThreadId; + +/* OCIThread Thread Handle */ +typedef struct OCIThreadHandle OCIThreadHandle; + + +/*-------------------- OCI Thread Callback Function Pointers ----------------*/ + +/* OCIThread Key Destructor Function Type */ +typedef void (*OCIThreadKeyDestFunc)( void * ); + + +/* Flags passed into OCIExtractFromXXX routines to direct processing */ +#define OCI_EXTRACT_CASE_SENSITIVE 0x1 /* matching is case sensitive */ +#define OCI_EXTRACT_UNIQUE_ABBREVS 0x2 /* unique abbreviations for keys + are allowed */ +#define OCI_EXTRACT_APPEND_VALUES 0x4 /* if multiple values for a key + exist, this determines if the + new value should be appended + to (or replace) the current + list of values */ + +/* Constants passed into OCIExtractSetKey routine */ +#define OCI_EXTRACT_MULTIPLE 0x8 /* key can accept multiple values */ +#define OCI_EXTRACT_TYPE_BOOLEAN 1 /* key type is boolean */ +#define OCI_EXTRACT_TYPE_STRING 2 /* key type is string */ +#define OCI_EXTRACT_TYPE_INTEGER 3 /* key type is integer */ +#define OCI_EXTRACT_TYPE_OCINUM 4 /* key type is ocinum */ + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#endif /* OCI1_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/oci8dp.h b/libraries/SQLAPI/include/ora_win/oci8dp.h new file mode 100644 index 000000000..070651081 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/oci8dp.h @@ -0,0 +1,317 @@ +/* + * + */ + +/* Copyright (c) 1998, 2005, Oracle. All rights reserved. */ + +/* + NAME + oci8dp.h - OCI: Direct Path API interface prototypes. + + DESCRIPTION + Public types, constants, and interfaces to the direct path API. + + RELATED DOCUMENTS + + NOTES + This file is not directly included by the application, this file + is included by "oci.h", which the application should include. + + MODIFIED (MM/DD/YY) + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + rphillip 02/27/04 - Add OCI_DIRPATH_COL_ERROR + srseshad 03/12/03 - convert oci public api to ansi + msakayed 10/28/02 - Bug #2643907: add OCI_ATTR_DIRPATH_SKIPINDEX_METHOD + cmlim 04/13/01 - remove OCIDirPathStreamToStream - not used by dpapi + cmlim 04/02/01 - OCI_DIRPATH_EXPR_OPQ_SQL_FN to OCI_DIRPATH_EXPR_SQL + ebatbout 01/22/01 - PARTIAL value for OCIDirPathDataSave action parameter + cmlim 07/20/00 - support opaques/sql strings in 8.2 dpapi + cmlim 08/14/00 - support refs in 8.2 dpapi + cmlim 04/17/00 - add defines for OCIDirPathFuncCtx handle & OCI_ATTR_D + whe 09/01/99 - 976457:check __cplusplus for C++ code + abrumm 04/16/99 - dpapi: more attributes + abrumm 02/26/99 - add defines for DataSave action + abrumm 10/04/98 - clen must be a ub4 + abrumm 05/27/98 - add column array flag values + abrumm 05/12/98 - direct path api support + abrumm 03/31/98 - OCI direct path interface support + abrumm 03/18/98 - Creation + +*/ + +#ifndef OCI8DP_ORACLE +# define OCI8DP_ORACLE + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN +#include +#endif + +#ifndef OCI_ORACLE +#include +#endif + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/*----- Handles and descriptors for direct path operations (OCIDirPath*) ----*/ + +typedef struct OCIDirPathCtx OCIDirPathCtx; /* context */ +typedef struct OCIDirPathFuncCtx OCIDirPathFuncCtx; /* function context */ +typedef struct OCIDirPathColArray OCIDirPathColArray; /* column array */ +typedef struct OCIDirPathStream OCIDirPathStream; /* stream */ +typedef struct OCIDirPathDesc OCIDirPathDesc; /* direct path descriptor */ + + /*----- Defines for Direct Path Options -----*/ + + /* values for OCI_ATTR_DIRPATH_MODE attribute */ +#define OCI_DIRPATH_LOAD 1 /* direct path load operation */ +#define OCI_DIRPATH_UNLOAD 2 /* direct path unload operation */ +#define OCI_DIRPATH_CONVERT 3 /* direct path convert only operation */ + + /*----- values for OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD attribute -----*/ +#define OCI_DIRPATH_INDEX_MAINT_SINGLE_ROW 1 + +/* Note that there are two attributes dealing with index maintenance - + * OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD and OCI_ATTR_DIRPATH_SKIPINDEX_METHOD. + * OCI_ATTR_DIRPATH_SKIPINDEX_METHOD exists to isolate the behavior for + * skipping index maintenance since maintenance of unusable indexes is + * orthogonal to that of single row insertion. + * For backwards compatibility we still allow users to specify skip + * methods in OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD so make sure the + * enumerations for the two attributes are distinct. + */ + /*----- values for OCI_ATTR_DIRPATH_SKIPINDEX_METHOD attribute -----*/ +#define OCI_DIRPATH_INDEX_MAINT_SKIP_UNUSABLE 2 +#define OCI_DIRPATH_INDEX_MAINT_DONT_SKIP_UNUSABLE 3 +#define OCI_DIRPATH_INDEX_MAINT_SKIP_ALL 4 + + /* values for OCI_ATTR_STATE attribute of OCIDirPathCtx */ +#define OCI_DIRPATH_NORMAL 1 /* can accept rows, last row complete */ +#define OCI_DIRPATH_PARTIAL 2 /* last row was partial */ +#define OCI_DIRPATH_NOT_PREPARED 3 /* direct path context is not prepared */ + + /*----- values for cflg argument to OCIDirpathColArrayEntrySet -----*/ +#define OCI_DIRPATH_COL_COMPLETE 0 /* column data is complete */ +#define OCI_DIRPATH_COL_NULL 1 /* column is null */ +#define OCI_DIRPATH_COL_PARTIAL 2 /* column data is partial */ +#define OCI_DIRPATH_COL_ERROR 3 /* column error, ignore row */ + /*----- values for action parameter to OCIDirPathDataSave -----*/ +#define OCI_DIRPATH_DATASAVE_SAVEONLY 0 /* data save point only */ +#define OCI_DIRPATH_DATASAVE_FINISH 1 /* execute finishing logic */ +/* save portion of input data (before space error occurred) and finish */ +#define OCI_DIRPATH_DATASAVE_PARTIAL 2 + + /*- OCI_ATTR_DIRPATH_EXPR_TYPE values (describes OCI_ATTR_NAME expr type) -*/ +#define OCI_DIRPATH_EXPR_OBJ_CONSTR 1 /* NAME is an object constructor */ +#define OCI_DIRPATH_EXPR_SQL 2 /* NAME is an opaque or sql function */ +#define OCI_DIRPATH_EXPR_REF_TBLNAME 3 /* NAME is table name if ref is scoped*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------------ OCIDirPathCtx Operations -------------------------*/ + +/* + NAME + OCIDirPathAbort - OCI: Abort a direct path operation. + + DESCRIPTION + Aborts a direct path operation. Upon successful completion + the direct path context is no longer valid. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathAbort( OCIDirPathCtx *dpctx, OCIError *errhp ); + +/* + NAME + OCIDirPathDataSave - OCI: Execute a data save point. + + DESCRIPTION + Successful return of this function indicates that a data save + point has been executed. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathDataSave( OCIDirPathCtx *dpctx, OCIError *errhp, ub4 action ); + +/* + NAME + OCIDirPathFinish - OCI: Finish a direct path operation. + + DESCRIPTION + Finishes a direct path operation. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathFinish( OCIDirPathCtx *dpctx, OCIError *errhp ); + +/* + NAME + OCIDirPathFlushRow - OCI: Flush a partial row from the server. + + DESCRIPTION + Flushes a partially loaded row from the server. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathFlushRow( OCIDirPathCtx *dpctx, OCIError *errhp ); + +/* + NAME + OCIDirPathPrepare - OCI: Prepare a direct path operation. + + DESCRIPTION + Prepares a table/partition for a direct path operation. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathPrepare( OCIDirPathCtx *dpctx, OCISvcCtx *svchp, + OCIError *errhp ); + +/* + NAME + OCIDirPathLoadStream - OCI: Load a direct path stream. + + DESCRIPTION + Load a direct path stream to the object associated with + the direct path context. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathLoadStream( OCIDirPathCtx *dpctx, OCIDirPathStream *dpstr, + OCIError *errhp ); + + +/*---------------------- OCIDirPathColArray Operations ----------------------*/ + +/* + NAME + OCIDirPathColArrayEntryGet - OCI: Get column array entry. + + DESCRIPTION + Column array function which is used to get a specified entry in + a column array. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayEntryGet( OCIDirPathColArray *dpca, OCIError *errhp, + ub4 rownum, ub2 colIdx, ub1 **cvalpp, ub4 *clenp, + ub1 *cflgp ); + +/* + NAME + OCIDirPathColArrayEntrySet - OCI: Set column array entry. + + DESCRIPTION + Column array function which is used to set a specified entry in + a column array. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayEntrySet( OCIDirPathColArray *dpca, OCIError *errhp, + ub4 rownum, ub2 colIdx, ub1 *cvalp, ub4 clen, + ub1 cflg ); + +/* + NAME + OCIDirPathColArrayRowGet - OCI: Get column array row pointers. + + DESCRIPTION + Column array function which is used to get the base row pointers + for a specified row in a column array. + To be used in lieu of OCIDirPathColArrayEntryGet() and + OCIDirPathColArrayEntrySet(). + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayRowGet( OCIDirPathColArray *dpca, OCIError *errhp, + ub4 rownum, ub1 ***cvalppp, ub4 **clenpp, + ub1 **cflgpp ); + +/* + NAME + OCIDirPathColArrayReset - OCI: Reset Column Array State + + DESCRIPTION + Function which resets the column array state. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + Resetting the column array state is necessary when piecing in a large + column and an error occurs in the middle of loading the column. + */ +sword +OCIDirPathColArrayReset( OCIDirPathColArray *dpca, OCIError *errhp ); + +/* + NAME + OCIDirPathColArrayToStream - OCI: Convert Column Array to Stream Format. + + DESCRIPTION + Convert from column array format to stream format which is suitable + for loading via OCIDirPathLoadStream(). + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayToStream( OCIDirPathColArray *dpca, OCIDirPathCtx *dpctx, + OCIDirPathStream *dpstr, OCIError *errhp, + ub4 rowcnt, ub4 rowoff ); + + + +/*----------------------- OCIDirPathStream Operations -----------------------*/ + +/* + NAME + OCIDirPathStreamReset - OCI: + + DESCRIPTION + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathStreamReset( OCIDirPathStream *dpstr, OCIError *errhp ); + +#endif /* OCI8DP_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/ociap.h b/libraries/SQLAPI/include/ora_win/ociap.h new file mode 100644 index 000000000..6f57c4b97 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ociap.h @@ -0,0 +1,11122 @@ +/* Copyright (c) 1996, 2008, Oracle. All rights reserved. */ + +/* + NAME + ociap.h + + DESCRIPTION + Oracle Call Interface - Ansi Prototypes + + RELATED DOCUMENTS + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + OCIAttrGet + OCIAttrSet + OCIBindArrayOfStruct + OCIBindByName + OCIBindByPos + OCIBindDynamic + OCIBindObject + OCIBreak + OCIConnectionPoolCreate + OCISessionPoolCreate + OCISessionGet + OCISessionRelease + OCIDateTimeAssign + OCIDateTimeCheck + OCIDateTimeCompare + OCIDateTimeConvert + OCIDateTimeFromText + OCIDateTimeGetDate + OCIDateTimeGetTime + OCIDateTimeGetTime + OCIDateTimeGetTimeZoneOffset + OCIDateTimeSysTimeStamp + OCIDateTimeIntervalAdd + OCIDateTimeIntervalSub + OCIDateTimeConstruct + OCIDateTimeSubtract + OCIDateTimeToText + OCIDateTimeGetTimeZoneName + OCIDateTimeToArray + OCIDateTimeFromArray + OCIRowidToChar + OCIDefineArrayOfStruct + OCIDefineByPos + OCIDefineDynamic + OCIDefineObject + OCIDescAlloc + OCIDescFree + OCIDescribeAny + OCIEnvCreate + OCIEnvNlsCreate + OCIEnvInit + OCIErrorGet + OCIExtractSetKey + OCIExtractFromFile + OCIIntervalSubtract + OCIIntervalMultiply + OCIIntervalToNumber + OCIIntervalToText + OCIIntervalFromTZ + OCIKerbAttrSet + OCILdaToSvcCtx + OCILobAppend + OCILobAssign + OCILobCharSetForm + OCILobCharSetId + OCILobCopy + OCILobCreateTemporary + OCILobDisableBuffering + OCILobEnableBuffering + OCILobErase + OCILobOpen + OCILobClose + OCILobFileClose + OCILobFileCLoseAll + OCILobFileExists + OCILobFileGetName + OCILobFileIsOpen + OCILobFileOpen + OCILobFileSetName + OCILobFlushBuffer + OCILobFreeTemporary + OCILobGetChunkSize + OCILobGetLength + OCILobIsEqual + OCILobIsTemporary + OCILobLoadFromFile + OCILobLocatorAssign + OCILobLocatorIsInit + OCILobRead + OCILobTrim + OCILobWrite + OCILobWriteAppend + OCILobGetStorageLimit + OCILobGetOptions + OCILobSetOptions + OCILobGetContentType + OCILobSetContentType + OCILogoff + OCILogon + OCILogon2 + OCIMemoryFree + OCIParamGet + OCIParamGet + OCIPasswordChange + OCIReset + OCIResultSetToStmt + OCIServerAttach + OCIServerDetach + OCIServerVersion + OCISessionBegin + OCISessionEnd + OCIStmtExecute + OCIStmtFetch + OCIStmtFetch2 + OCIStmtGetPieceInfo + OCIStmtPrepare + OCIStmtPrepare2 + OCIStmtRelease + OCIStmtSetPieceInfo + OCIFormatString + OCISvcCtxToLda + OCITransCommit + OCITransDetach + OCITransForget + OCITransMultiPrepare + OCITransPrepare + OCITransRollback + OCITransStart + OCIInitialize + OCIEnvCreate + OCIEnvNlsCreate + OCIFEnvCreate + OCIHandleAlloc + OCIDescriptorAlloc + OCIDescriptorFree + OCIArrayDescriptorAlloc + OCIArrayDescriptorFree + OCIEnvInit + OCIServerAttach + OCISessionBegin + OCISessionEnd + OCILogon + OCILogon2 + OCIPasswordChange + OCIStmtPrepare + OCIStmtPrepare2 + OCIStmtRelease + OCIBindByPos + OCIBindByName + OCIBindObject + OCIBindDynamic + OCIBindArrayOfStruct + OCIStmtGetPieceInfo + OCIStmtSetPieceInfo + OCIStmtExecute + OCIDefineByPos + OCIDefineObject + OCIDefineDynamic + OCIRowidToChar + OCIDefineArrayOfStruct + OCIStmtFetch + OCIStmtFetch2 + OCIStmtGetBindInfo + OCIDescribeAny + OCIParamGet + OCIParamSet + OCITransStart + OCITransMultiPrepare + OCIErrorGet + OCILobAppend + OCILobAssign + OCILobCharSetForm + OCILobCharSetId + OCILobCopy + OCILobCreateTemporary + OCILobClose + OCILobDisableBuffering + OCILobEnableBuffering + OCILobErase + OCILobFileClose + OCILobFileExists + OCILobFileGetName + OCILobFileIsOpen + OCILobFileOpen + OCILobFileSetName + OCILobFlushBuffer + OCILobFreeTemporary + OCILobGetChunkSize + OCILobGetLength + OCILobIsEqual + OCILobIsOpen + OCILobIsTemporary + OCILobLoadFromFile + OCILobLocatorAssign + OCILobLocatorIsInit + OCILobOpen + OCILobRead + OCILobTrim + OCILobWrite + OCILobWriteAppend + OCIServerVersion + OCIServerRelease + OCIAttrGet + OCIAttrSet + OCIUserCallbackRegister + OCIUserCallbackGet + OCISharedLibInit + OCIFileExists + OCIFileGetLength + OCIFileOpen + OCIFileRead + OCIFileSeek + OCIFileWrite + OCILobCopy2 + OCILobErase2 + OCILobGetLength2 + OCILobLoadFromFile2 + OCILobRead2 + OCILobArrayRead + OCILobTrim2 + OCILobWrite2 + OCILobArrayWrite + OCILobWriteAppend2 + OCILobGetStorageLimit + OCISecurityOpenWallet + OCISecurityCloseWallet + OCISecurityCreateWallet + OCISecurityDestroyWallet + OCISecurityStorePersona + OCISecurityOpenPersona + OCISecurityClosePersona + OCISecurityRemovePersona + OCISecurityCreatePersona + OCISecuritySetProtection + OCISecurityGetProtection + OCISecurityRemoveIdentity + OCISecurityCreateIdentity + OCISecurityAbortIdentity + OCISecurityFreeIdentity + OCISecurityStoreTrustedIdentity + OCISecuritySign + OCISecuritySignExpansion + OCISecurityVerify + OCISecurityValidate + OCISecuritySignDetached + OCISecuritySignDetExpansion + OCISecurityVerifyDetached + OCISecurity_PKEncrypt + OCISecurityPKEncryptExpansion + OCISecurityPKDecrypt + OCISecurityEncrypt + OCISecurityEncryptExpansion + OCISecurityDecrypt + OCISecurityEnvelope + OCISecurityDeEnvelope + OCISecurityKeyedHash + OCISecurityKeyedHashExpansion + OCISecurityHash + OCISecurityHashExpansion + OCISecuritySeedRandom + OCISecurityRandomBytes + OCISecurityRandomNumber + OCISecurityInitBlock + OCISecurityReuseBlock + OCISecurityPurgeBlock + OCISecuritySetBlock + OCISecurityGetIdentity + OCIAQEnq + OCIAQDeq + OCIAQEnqArray + OCIAQEnqStreaming + OCIAQDeqArray + OCIAQListen + OCIAQListen2 + OCIExtractSetKey + OCIExtractFromFile + OCIExtractToInt + OCIExtractToBool + OCIExtractToStr + OCIExtractToOCINum + OCIExtractFromList + OCIMemoryAlloc + OCIMemoryResize + OCIContextSetValue + OCIContextGetValue + OCIContextClearValue + OCIMemorySetCurrentIDs + OCIPicklerTdsCtxInit + OCIPicklerTdsInit + OCIPicklerTdsCreateElementNumber + OCIPicklerTdsCreateElementChar + OCIPicklerTdsCreateElementVarchar + OCIPicklerTdsCreateElementRaw + OCIPicklerTdsCreateElement + OCIPicklerTdsAddAttr + OCIPicklerTdsGenerate + OCIPicklerTdsGetAttr + OCIPicklerFdoInit + OCIPicklerFdoFree + OCIPicklerImageInit + OCIPicklerImageFree + OCIPicklerImageAddScalar + OCIPicklerImageAddNullScalar + OCIPicklerImageGenerate + OCIPicklerImageGetScalarSize + OCIPicklerImageGetScalar + OCIPicklerImageCollBegin + OCIPicklerImageCollAddScalar + OCIPicklerImageCollEnd + OCIPicklerImageCollBeginScan + OCIPicklerImageCollGetScalarSize + OCIPicklerImageCollGetScalar + OCIAnyDataGetType + OCIAnyDataIsNull + OCIAnyDataConvert + OCIAnyDataBeginCreate + OCIAnyDataAttrSet + OCIAnyDataCollAddElem + OCIAnyDataEndCreate + OCIAnyDataAccess + OCIAnyDataGetCurrAttrNum + OCIAnyDataAttrGet + OCIAnyDataCollGetElem + OCIPicklerTdsCtxInit + OCIPicklerTdsInit + OCIPicklerTdsCreateElementNumber + OCIPicklerTdsCreateElementChar + OCIPicklerTdsCreateElementVarchar + OCIPicklerTdsCreateElementRaw + OCIPicklerTdsCreateElement + OCIPicklerTdsAddAttr + OCIPicklerTdsGenerate + OCIPicklerTdsGetAttr + OCIPicklerFdoInit + OCIPicklerFdoFree + OCIPicklerImageInit + OCIPicklerImageFree + OCIPicklerImageAddScalar + OCIPicklerImageAddNullScalar + OCIPicklerImageGenerate + OCIPicklerImageGetScalarSize + OCIPicklerImageGetScalar + OCIPicklerImageCollBegin + OCIPicklerImageCollAddScalar + OCIPicklerImageCollEnd + OCIPicklerImageCollBeginScan + OCIPicklerImageCollGetScalarSize + OCIPicklerImageCollGetScalar + OCIAnyDataGetType + OCIAnyDataIsNull + OCIAnyDataConvert + OCIAnyDataBeginCreate + OCIAnyDataAttrSet + OCIAnyDataCollAddElem + OCIAnyDataEndCreate + OCIAnyDataAccess + OCIAnyDataGetCurrAttrNum + OCIAnyDataAttrGet + OCIAnyDataCollGetElem + OCIPicklerTdsCtxInit + OCIPicklerTdsInit + OCIPicklerTdsCreateElementNumber + OCIPicklerTdsCreateElementChar + OCIPicklerTdsCreateElementVarchar + OCIPicklerTdsCreateElementRaw + OCIPicklerTdsCreateElement + OCIPicklerTdsAddAttr + OCIPicklerTdsGenerate + OCIPicklerTdsGetAttr + OCIPicklerFdoInit + OCIPicklerFdoFree + OCIPicklerImageInit + OCIPicklerImageFree + OCIPicklerImageAddScalar + OCIPicklerImageAddNullScalar + OCIPicklerImageGenerate + OCIPicklerImageGetScalarSize + OCIPicklerImageGetScalar + OCIPicklerImageCollBegin + OCIPicklerImageCollAddScalar + OCIPicklerImageCollEnd + OCIPicklerImageCollBeginScan + OCIPicklerImageCollGetScalarSize + OCIPicklerImageCollGetScalar + OCIAnyDataGetType + OCIAnyDataIsNull + OCIAnyDataConvert + OCIAnyDataBeginCreate + OCIAnyDataAttrSet + OCIAnyDataCollAddElem + OCIAnyDataEndCreate + OCIAnyDataAccess + OCIAnyDataGetCurrAttrNum + OCIAnyDataAttrGet + OCIAnyDataCollGetElem + OCIAnyDataSetBeginCreate + OCIAnyDataSetDestroy + OCIAnyDataSetAddInstance + OCIAnyDataSetEndCreate + OCIAnyDataSetGetType + OCIAnyDataSetGetCount + OCIAnyDataSetGetInstance + OCIFormatString + OCINlsGetInfo + OCINlsNameMap + OCIMultiByteToWideChar + OCIMultiByteInSizeToWideChar + OCIWideCharToMultiByte + OCIWideCharInSizeToMultiByte + OCIWideCharStrcmp + OCIWideCharStrncmp + OCIWideCharStrcat + *OCIWideCharStrchr + OCIWideCharStrcpy + OCIWideCharStrncat + OCIWideCharStrncpy + *OCIWideCharStrrchr + OCIWideCharStrCaseConversion + OCIMultiByteStrcmp + OCIMultiByteStrncmp + OCIMultiByteStrcat + OCIMultiByteStrcpy + OCIMultiByteStrncat + OCIMultiByteStrncpy + OCIMultiByteStrnDisplayLength + OCIMultiByteStrCaseConversion + OCICharSetToUnicode + OCIUnicodeToCharSet + OCINlsCharSetConvert + OCINlsEnvironmentVariableGet + OCIMessageOpen + OCIMessageGet + OCIThreadMutexInit + OCIThreadMutexDestroy + OCIThreadMutexAcquire + OCIThreadMutexRelease + OCIThreadKeyInit + OCIThreadKeyDestroy + OCIThreadKeyGet + OCIThreadKeySet + OCIThreadIdSet + OCIThreadIdSetNull + OCIThreadIdGet + OCIThreadIdSame + OCIThreadIdNull + OCIThreadHndInit + OCIThreadHndDestroy + OCIThreadCreate + OCIThreadHandleGet + OCIThreadMutexInit + OCIThreadMutexDestroy + OCIThreadMutexAcquire + OCIThreadMutexRelease + OCIThreadKeyInit + OCIThreadKeyDestroy + OCIThreadKeyGet + OCIThreadKeySet + OCIThreadIdSet + OCIThreadIdSame + OCIThreadIdNull + OCIThreadCreate + OCISubscriptionRegister + OCISubscriptionPost + OCISubscriptionUnRegister + OCISubscriptionDisable + OCISubscriptionEnable + OCIDateTimeGetTime + OCIDateTimeGetDate + OCIDateTimeGetTimeZoneOffset + OCIDateTimeConstruct + OCIDateTimeSysTimeStamp + OCIDateTimeAssign + OCIDateTimeToText + OCIDateTimeFromText + OCIDateTimeCompare + OCIDateTimeCheck + OCIDateTimeConvert + OCIDateTimeSubtract + OCIDateTimeIntervalAdd + OCIDateTimeIntervalSub + OCIIntervalSubtract + OCIIntervalAdd + OCIIntervalMultiply + OCIIntervalDivide + OCIIntervalCompare + OCIIntervalFromNumber + OCIIntervalFromText + OCIIntervalToText + OCIIntervalToNumber + OCIIntervalCheck + OCIIntervalAssign + OCIIntervalSetYearMonth + OCIIntervalGetYearMonth + OCIIntervalSetDaySecond + OCIIntervalGetDaySecond + OCIDateTimeToArray + OCIDateTimeFromArray + OCIDateTimeGetTimeZoneName + OCIIntervalFromTZ + OCIConnectionPoolCreate + OCIConnectionPoolDestroy + OCISessionPoolCreate + OCISessionPoolDestroy + OCISessionGet + OCISessionRelease + OCIAppCtxSet + OCIAppCtxClearAll + OCIMemStats + OCIKerbAttrSet + OCIDBStartup + OCIDBShutdown + OCIClientVersion + OCIInitEventHandle + OCIStmtBindByPos + OCIStmtBindByName + + PRIVATE FUNCTION(S) + + EXAMPLES + + NOTES + + MODIFIED (MM/DD/YY) + slynn 03/18/08 - OCILobSet/SetContenttype->OCILobGet/SetContentType + amullick 02/11/08 - add OCILobGet/SetContenttype APIs + schoi 02/27/07 - OCILobGet/SetOptions API change + slynn 07/28/06 - Migrate to new 11g LOB terminology + hqian 05/22/06 - add OCI_SYSASM + slynn 06/21/06 - Add Lob Get Shared Regions Functionality + slynn 05/25/06 - New NG Lob Functionality. + jawilson 05/22/06 - add TDO out parameter for streaming enq callback + aramappa 01/19/06 - Added OCIArrayDescriptorAlloc, + OCIArrayDescriptorFree + jawilson 02/09/06 - add OCIAQEnqStreaming + mxu 03/08/06 - Fix bug 5037807 + srseshad 09/12/05 - stmtcache: callback + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + nbhatt 06/17/04 - merge conflicts + nbhatt 05/24/04 - merge conflicts + weiwang 05/06/04 - add OCIAQListen2 + rvissapr 06/21/04 - add OCIAppCtx API + debanerj 05/17/04 - 13064: LOB array Read and Write + aahluwal 06/02/04 - [OCI Events]: add OCIInitEventHandle + nikeda 05/28/04 - grabtrans 'nikeda_oci_events_copy' + nikeda 05/13/04 - [OCI Events] Rename HACBK->EVTCBK, HACTX->EVTCTX + nikeda 05/10/04 - [OCI Events] code review changes + aahluwal 04/09/04 - [OCI Events]: add OCIHAServerHandleGet + nikeda 03/18/04 - [OCI Events] New Server Handle Callback + dfrumkin 12/04/03 - Add OCIDBStartup, OCIDBShutdown + jciminsk 12/12/03 - merge from RDBMS_MAIN_SOLARIS_031209 + sgollapu 06/26/03 - Change OCIPing prototype + sgollapu 05/05/03 - Add OCIPing + debanerj 01/16/03 - Bug 2753018: Lob Locator parameter for + OCILobGetStorageLimit + rpingte 05/06/04 - add OCIClientVersion + debanerj 08/26/03 - 6003: Lob interface changes + sgollapu 06/23/03 - Add OCIPing + debanerj 01/16/03 - Bug 2753018: Lob Locator parameter for + OCILobGetStorageLimit + tkeefe 02/17/03 - bug-2773794: Add new interface for setting Kerb attrs + ataracha 01/03/03 - Move OCIXMLType functions to ocixml.h + akatti 11/28/02 - [2521361]:add OCIRowidToChar prototype + chliang 10/23/02 - add OCIFetchRowCallback + cparampa 10/13/02 - Fix the prototype of OCIAQListen(ansi prototype) + chliang 10/12/02 - add OCIBindRowCallback + debanerj 09/30/02 - Unlimited size LOB 6003 + thoang 09/25/02 - Add csid to XMLType create functions + thoang 04/19/02 - Add OCIXMLTypeGetNS + aahluwal 08/09/02 - adding OCIAQDeqArray + aahluwal 06/03/02 - bug 2360115 + skabraha 04/16/02 - fix compiler warnings + sichandr 02/12/02 - fix OCIXMLTypeExists + gayyappa 02/01/02 - fix 2210776 : change Dom to DOM + sichandr 10/24/01 - OCISvcCtx for XMLType create routines + schandir 09/14/01 - Add prototypes for Stmt Caching + abande 09/04/01 - Add Prototypes for Session Pooling Methods + stakeda 09/12/01 - add OCINlsCharSetConvert + whe 08/28/01 - add OCIEnvNlsCreate + wzhang 08/22/01 - Add OCINlsCharSetNameToId. + whe 10/05/01 - add prototype for OCIXMLType functions + mdmehta 04/06/01 - Bug 1683763, OCIDateTimeToText: buf_size to ub4* + schandir 12/12/00 - modify the ociconnectionpoolcreate() interface. + porangas 12/04/00 - Forward merge bug#974710 to 9i + rpingte 11/29/00 - Fix bug# 1485795. + gtarora 11/30/00 - fix comment for OCILobIsTemporary + akatti 11/07/00 - [1198379]:add OCIRowidToChar + bpalaval 10/15/00 - Forward merge 892654. + kmohan 09/18/00 - add OCILogon2 + etucker 07/28/00 - add OCIIntervalFromTZ + vjayaram 07/18/00 - add connection pooling changes + etucker 07/13/00 - add dls apis for oci + hmasaki 07/05/00 - fix 1230846: forward merge into 8.2 + mbastawa 06/05/00 - add OCIStmtFetch2 + rxgovind 06/07/00 - update OCIAnyData interfaces + rxgovind 05/04/00 - add OCIAnyDataSet interfaces + rkasamse 05/01/00 - remove attrno from OCIAnyDataAttrGet + rkasamse 03/13/00 - add prototype s for OCCIAnyData + slari 09/01/99 - remove OCIEnvCallback + slari 08/23/99 - add OCIUcb in user callback functions + dsaha 07/07/99 - Add OCIFEnvCreate for forms + vyanaman 06/21/99 - Change OCI DateTime/Interval APIs. + esoyleme 07/01/99 - expose MTS performance enhancements + whe 06/14/99 - bug727872:add CONST to match definitions + kkarun 02/23/99 - Fix OCIDateTime APIs + jiyang 12/07/98 - Add comments for OCI_NLS_DUAL_CURRENCY + aroy 12/01/98 - add OCIEnvCreate + slari 11/23/98 - use ORASTDARG + slari 11/21/98 - replace ellipsis by arglist in OCIUserCallback + thchang 10/20/98 - correct comment on OCILobCreateTemporary + slari 09/08/98 - allow envh to receive error info also in CallbackReg/ + kkarun 09/02/98 - Change const to CONST + aroy 08/04/98 - add OCITerminate calls + nramakri 06/25/98 - remove CONST from some OCIPickler APIs + jiyang 06/22/98 - Fix a lint error + nmallava 06/08/98 - ociistemporary -> envhp + jhasenbe 05/27/98 - Remove definitions for U-Calls (Unicode) + nmallava 05/18/98 - add comments + sgollapu 05/19/98 - Change text to OraText + aroy 04/20/98 - merge forward 8.0.5 -> 8.1.3 + nbhatt 05/14/98 - aq listen call + lchidamb 03/02/98 - Client Notification prototypes + vyanaman 04/19/98 - System Timestamp + kkarun 04/17/98 - Add more Interval functions + vyanaman 04/17/98 - Fix min (proc error) + vyanaman 04/16/98 - Add get/set TZ + kkarun 04/13/98 - Add Datetime prototypes + rkasamse 04/13/98 - change OCIEnv* to dvoid* for context/memory cart serv + rkasamse 04/15/98 - chage pickler cart interface + slari 03/20/98 - change proto of OCIUserCallback + slari 02/17/98 - add OCIUserCallback + jiyang 04/02/98 - Accept both env and user handles for NLS + rkasamse 03/20/98 - remove prototypes for OCIMemoryDuration* functions. + tsaulys 03/20/98 - use environment or session handle + nmallava 04/09/98 - OCILobLocatorAssign + nmallava 04/07/98 - lobgetchunksize and writeappend apis + jhasenbe 04/06/98 - Add new interfaces for Unicode support + nmallava 03/17/98 - add interfaces + nmallava 03/16/98 - add open/close apis + nmallava 03/10/98 - add temporary lobs apis + sgollapu 07/10/97 - Add OCIReset + sgollapu 02/09/98 - OCI non-blocking + nramakri 01/16/98 - remove #ifdef NEVER clause for OCIExtract + rmurthy 01/08/98 - OCIContextGenerateKey: change ub1 to ub4 + ewaugh 12/18/97 - Turn type wrappers into functions. + skabraha 12/02/97 - adding OCIFile functions + rhwu 12/02/97 - add OCI Thread + nramakri 12/15/97 - move to core4 + nramakri 12/11/97 - modify OCIExtract prototype + ewaugh 12/10/97 - add OCIFormat prototypes + nmallava 12/17/97 - Add ilob open and close apis + rkasamse 12/03/97 - Change some of the function names for pickler cartrid + nramakri 11/12/97 - add OCIExtract prototypes + rkasamse 11/21/97 - add prototypes for memory cartridge services and cont + rkasamse 11/03/97 - Add pickler cartridge interfaces. + jiyang 11/11/97 - Add NLS service for cartridge + tanguyen 08/19/97 - + cxcheng 07/30/97 - replace OCISvcCtx with OCISvcCtx + schandra 06/25/97 - AQ OCI interface + bnainani 07/21/97 - add prototypes for Oracle XA extensions + esoyleme 05/13/97 - move failover callback prototype + skmishra 05/06/97 - stdc compiler fixes + skmishra 04/24/97 - C++ Compatibility changes + skotsovo 04/21/97 - make lob parameter names consistent + rwhitman 04/16/97 - Fix LOB prototypes - Olint OCI 8.0.3 + ramkrish 04/15/97 - Add free flag to OCILobFlushBuffer + dchatter 04/10/97 - add nzt.h inclusion + cxcheng 04/09/97 - change objnamp from CONST text* to dvoid* + cxcheng 04/08/97 - fix prototype of OCIDescribeAny() + skotsovo 03/31/97 - remove OCILobLocatorSize + skotsovo 03/27/97 - add OCILobLoadFromFile + bcchang 02/18/97 - Fix syntax error + dchatter 01/13/97 - fix comments on LOB calls + aroy 01/10/97 - remove ocilobfilecreate delete + sgollapu 12/27/96 - Correct OCILogon prototype + dchatter 01/04/97 - comments to describe the functions + sgollapu 11/25/96 - Change OCILobFileIsExistent + schandra 11/18/96 - Remove xa.h include + sgollapu 11/09/96 - Change prototype of OCIDescribeAny + dchatter 10/31/96 - delete CONST from lob write cb fn + dchatter 10/30/96 - more changes + dchatter 10/26/96 - lob/file long name corrections + slari 10/16/96 - delete unused calls + rwessman 10/29/96 - Fixed OCISecurityGetIdentity prototype + bcchang 10/25/96 - Fix syntax error + sgollapu 10/22/96 - Add OCILogon and OCILogoff + rwessman 10/16/96 - Added cryptographic and digital signature functions + sgollapu 10/10/96 - Add ocibdp and ocibdn + rxgovind 10/07/96 - add oci file calls + skotsovo 10/01/96 - move orl lob fnts to oci + skotsovo 09/20/96 - in OCILobGetLength(), remove the 'isnull' parameter. + aroy 08/29/96 - change prototype for Nchar Lob support + dchatter 08/21/96 - OCIResultSetToStmt prototype change + sthakur 08/14/96 - add OCIParamSet + schandra 07/26/96 - TX OCI return values - sb4->sword + aroy 07/17/96 - terminology change: OCILobLocator => OCILobLocator + dchatter 07/01/96 - create ANSI prototypes + dchatter 07/01/96 - Creation + +*/ + + +#ifndef OCIAP_ORACLE +# define OCIAP_ORACLE + +# ifndef ORATYPES +# include +# endif + +#ifndef ORASTDARG +#include +#define ORASTDARG +#endif + +#ifndef OCIDFN +#include +#endif + +#ifndef NZT_ORACLE +#include +#endif /* NZT_ORACLE */ + +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#include +#endif + + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + +/***************************************************************************** + DESCRIPTION +****************************************************************************** +Note: the descriptions of the functions are alphabetically arranged. Please +maintain the arrangement when adding a new function description. The actual +prototypes are below this comment section and donot follow any alphabetical +ordering. + + +--------------------------------OCIAttrGet------------------------------------ + +OCIAttrGet() +Name +OCI Attribute Get +Purpose +This call is used to get a particular attribute of a handle. +Syntax +sword OCIAttrGet ( const void *trgthndlp, + ub4 trghndltyp, + void *attributep, + ub4 *sizep, + ub4 attrtype, + OCIError *errhp ); +Comments +This call is used to get a particular attribute of a handle. +See Appendix B, "Handle Attributes", for a list of handle types and their +readable attributes. +Parameters +trgthndlp (IN) - is the pointer to a handle type. +trghndltyp (IN) - is the handle type. +attributep (OUT) - is a pointer to the storage for an attribute value. The +attribute value is filled in. +sizep (OUT) - is the size of the attribute value. +This can be passed in as NULL for most parameters as the size is well known. +For text* parameters, a pointer to a ub4 must be passed in to get the length +of the string. +attrtype (IN) - is the type of attribute. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions +OCIAttrSet() + +--------------------------------OCIAttrSet------------------------------------ + + +OCIAttrSet() +Name +OCI Attribute Set +Purpose +This call is used to set a particular attribute of a handle or a descriptor. +Syntax +sword OCIAttrSet ( void *trgthndlp, + ub4 trghndltyp, + void *attributep, + ub4 size, + ub4 attrtype, + OCIError *errhp ); +Comments +This call is used to set a particular attribute of a handle or a descriptor. +See Appendix B for a list of handle types and their writeable attributes. +Parameters +trghndlp (IN/OUT) - the pointer to a handle type whose attribute gets +modified. +trghndltyp (IN/OUT) - is the handle type. +attributep (IN) - a pointer to an attribute value. +The attribute value is copied into the target handle. If the attribute value +is a pointer, then only the pointer is copied, not the contents of the pointer. +size (IN) - is the size of an attribute value. This can be passed in as 0 for +most attributes as the size is already known by the OCI library. For text* +attributes, a ub4 must be passed in set to the length of the string. +attrtype (IN) - the type of attribute being set. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions +OCIAttrGet() + + + +--------------------------------OCIBindArrayOfStruct-------------------------- + + + +OCIBindArrayOfStruct() +Name +OCI Bind for Array of Structures +Purpose +This call sets up the skip parameters for a static array bind. +Syntax +sword OCIBindArrayOfStruct ( OCIBind *bindp, + OCIError *errhp, + ub4 pvskip, + ub4 indskip, + ub4 alskip, + ub4 rcskip ); +Comments +This call sets up the skip parameters necessary for a static array bind. +This call follows a call to OCIBindByName() or OCIBindByPos(). The bind +handle returned by that initial bind call is used as a parameter for the +OCIBindArrayOfStruct() call. +For information about skip parameters, see the section "Arrays of Structures" +on page 4-16. +Parameters +bindp (IN) - the handle to a bind structure. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +pvskip (IN) - skip parameter for the next data value. +indskip (IN) - skip parameter for the next indicator value or structure. +alskip (IN) - skip parameter for the next actual length value. +rcskip (IN) - skip parameter for the next column-level return code value. +Related Functions +OCIAttrGet() + + +--------------------------------OCIBindByName--------------------------------- + +OCIBindByName() +Name +OCI Bind by Name +Purpose +Creates an association between a program variable and a placeholder in a SQL +statement or PL/SQL block. +Syntax +sword OCIBindByName ( + OCIStmt *stmtp, + OCIBind **bindp, + OCIError *errhp, + const OraText *placeholder, + sb4 placeh_len, + void *valuep, + sb4 value_sz, + ub2 dty, + void *indp, + ub2 *alenp, + ub2 *rcodep, + ub4 maxarr_len, + ub4 *curelep, + ub4 mode ); +Description +This call is used to perform a basic bind operation. The bind creates an +association between the address of a program variable and a placeholder in a +SQL statement or PL/SQL block. The bind call also specifies the type of data +which is being bound, and may also indicate the method by which data will be +provided at runtime. +This function also implicitly allocates the bind handle indicated by the bindp +parameter. +Data in an OCI application can be bound to placeholders statically or +dynamically. Binding is static when all the IN bind data and the OUT bind +buffers are well-defined just before the execute. Binding is dynamic when the +IN bind data and the OUT bind buffers are provided by the application on +demand at execute time to the client library. Dynamic binding is indicated by +setting the mode parameter of this call to OCI_DATA_AT_EXEC. +Related Functions: For more information about dynamic binding, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16. +Both OCIBindByName() and OCIBindByPos() take as a parameter a bind handle, +which is implicitly allocated by the bind call A separate bind handle is +allocated for each placeholder the application is binding. +Additional bind calls may be required to specify particular attributes +necessary when binding certain data types or handling input data in certain +ways: +If arrays of structures are being utilized, OCIBindArrayOfStruct() must +be called to set up the necessary skip parameters. +If data is being provided dynamically at runtime, and the application +will be using user-defined callback functions, OCIBindDynamic() must +be called to register the callbacks. +If a named data type is being bound, OCIBindObject() must be called to +specify additional necessary information. +Parameters +stmth (IN/OUT) - the statement handle to the SQL or PL/SQL statement +being processed. +bindp (IN/OUT) - a pointer to a pointer to a bind handle which is implicitly +allocated by this call. The bind handle maintains all the bind information +for this particular input value. The handle is feed implicitly when the +statement handle is deallocated. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +placeholder (IN) - the placeholder attributes are specified by name if +ocibindn() is being called. +placeh_len (IN) - the length of the placeholder name specified in placeholder. +valuep (IN/OUT) - a pointer to a data value or an array of data values of the +type specified in the dty parameter. An array of data values can be specified +for mapping into a PL/SQL table or for providing data for SQL multiple-row +operations. When an array of bind values is provided, this is called an array +bind in OCI terms. Additional attributes of the array bind (not bind to a +column of ARRAY type) are set up in OCIBindArrayOfStruct() call. +For a REF, named data type bind, the valuep parameter is used only for IN +bind data. The pointers to OUT buffers are set in the pgvpp parameter +initialized by OCIBindObject(). For named data type and REF binds, the bind +values are unpickled into the Object Cache. The OCI object navigational calls +can then be used to navigate the objects and the refs in the Object Cache. +If the OCI_DATA_AT_EXEC mode is specified in the mode parameter, valuep +is ignored for all data types. OCIBindArrayOfStruct() cannot be used and +OCIBindDynamic() must be invoked to provide callback functions if desired. +value_sz (IN) - the size of a data value. In the case of an array bind, this is +the maximum size of any element possible with the actual sizes being specified +in the alenp parameter. +If the OCI_DATA_AT_EXEC mode is specified, valuesz defines the maximum +size of the data that can be ever provided at runtime for data types other than +named data types or REFs. +dty (IN) - the data type of the value(s) being bound. Named data types +(SQLT_NTY) and REFs (SQLT_REF) are valid only if the application has been +initialized in object mode. For named data types, or REFs, additional calls +must be made with the bind handle to set up the datatype-specific attributes. +indp (IN/OUT) - pointer to an indicator variable or array. For scalar data +types, this is a pointer to sb2 or an array of sb2s. For named data types, +this pointer is ignored and the actual pointer to the indicator structure or +an array of indicator structures is initialized by OCIBindObject(). +Ignored for dynamic binds. +See the section "Indicator Variables" on page 2-43 for more information about +indicator variables. +alenp (IN/OUT) - pointer to array of actual lengths of array elements. Each +element in alenp is the length of the data in the corresponding element in the +bind value array before and after the execute. This parameter is ignored for +dynamic binds. +rcodep (OUT) - pointer to array of column level return codes. This parameter +is ignored for dynamic binds. +maxarr_len (IN) - the maximum possible number of elements of type dty in a +PL/SQL binds. This parameter is not required for non-PL/SQL binds. If +maxarr_len is non-zero, then either OCIBindDynamic() or +OCIBindArrayOfStruct() can be invoked to set up additional bind attributes. +curelep(IN/OUT) - a pointer to the actual number of elements. This parameter +is only required for PL/SQL binds. +mode (IN) - the valid modes for this parameter are: +OCI_DEFAULT. This is default mode. +OCI_DATA_AT_EXEC. When this mode is selected, the value_sz +parameter defines the maximum size of the data that can be ever +provided at runtime. The application must be ready to provide the OCI +library runtime IN data buffers at any time and any number of times. +Runtime data is provided in one of the two ways: +callbacks using a user-defined function which must be registered +with a subsequent call to OCIBindDynamic(). +a polling mechanism using calls supplied by the OCI. This mode +is assumed if no callbacks are defined. +For more information about using the OCI_DATA_AT_EXEC mode, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16. +When the allocated buffers are not required any more, they should be +freed by the client. +Related Functions +OCIBindDynamic(), OCIBindObject(), OCIBindArrayOfStruct(), OCIAttrGet() + + + +-------------------------------OCIBindByPos----------------------------------- + + +OCIBindByPos() +Name +OCI Bind by Position +Purpose +Creates an association between a program variable and a placeholder in a SQL +statement or PL/SQL block. +Syntax +sword OCIBindByPos ( + OCIStmt *stmtp, + OCIBind **bindp, + OCIError *errhp, + ub4 position, + void *valuep, + sb4 value_sz, + ub2 dty, + void *indp, + ub2 *alenp, + ub2 *rcodep, + ub4 maxarr_len, + ub4 *curelep, + ub4 mode); + +Description +This call is used to perform a basic bind operation. The bind creates an +association between the address of a program variable and a placeholder in a +SQL statement or PL/SQL block. The bind call also specifies the type of data +which is being bound, and may also indicate the method by which data will be +provided at runtime. +This function also implicitly allocates the bind handle indicated by the bindp +parameter. +Data in an OCI application can be bound to placeholders statically or +dynamically. Binding is static when all the IN bind data and the OUT bind +buffers are well-defined just before the execute. Binding is dynamic when the +IN bind data and the OUT bind buffers are provided by the application on +demand at execute time to the client library. Dynamic binding is indicated by +setting the mode parameter of this call to OCI_DATA_AT_EXEC. +Related Functions: For more information about dynamic binding, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16 +Both OCIBindByName() and OCIBindByPos() take as a parameter a bind handle, +which is implicitly allocated by the bind call A separate bind handle is +allocated for each placeholder the application is binding. +Additional bind calls may be required to specify particular attributes +necessary when binding certain data types or handling input data in certain +ways: +If arrays of structures are being utilized, OCIBindArrayOfStruct() must +be called to set up the necessary skip parameters. +If data is being provided dynamically at runtime, and the application +will be using user-defined callback functions, OCIBindDynamic() must +be called to register the callbacks. +If a named data type is being bound, OCIBindObject() must be called to +specify additional necessary information. +Parameters +stmth (IN/OUT) - the statement handle to the SQL or PL/SQL statement +being processed. +bindp (IN/OUT) - a pointer to a pointer to a bind handle which is implicitly +allocated by this call. The bind handle maintains all the bind information +for this particular input value. The handle is feed implicitly when the +statement handle is deallocated. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +position (IN) - the placeholder attributes are specified by position if +ocibindp() is being called. +valuep (IN/OUT) - a pointer to a data value or an array of data values of the +type specified in the dty parameter. An array of data values can be specified +for mapping into a PL/SQL table or for providing data for SQL multiple-row +operations. When an array of bind values is provided, this is called an array +bind in OCI terms. Additional attributes of the array bind (not bind to a +column of ARRAY type) are set up in OCIBindArrayOfStruct() call. +For a REF, named data type bind, the valuep parameter is used only for IN +bind data. The pointers to OUT buffers are set in the pgvpp parameter +initialized by OCIBindObject(). For named data type and REF binds, the bind +values are unpickled into the Object Cache. The OCI object navigational calls +can then be used to navigate the objects and the refs in the Object Cache. +If the OCI_DATA_AT_EXEC mode is specified in the mode parameter, valuep +is ignored for all data types. OCIBindArrayOfStruct() cannot be used and +OCIBindDynamic() must be invoked to provide callback functions if desired. +value_sz (IN) - the size of a data value. In the case of an array bind, this is +the maximum size of any element possible with the actual sizes being specified +in the alenp parameter. +If the OCI_DATA_AT_EXEC mode is specified, valuesz defines the maximum +size of the data that can be ever provided at runtime for data types other than +named data types or REFs. +dty (IN) - the data type of the value(s) being bound. Named data types +(SQLT_NTY) and REFs (SQLT_REF) are valid only if the application has been +initialized in object mode. For named data types, or REFs, additional calls +must be made with the bind handle to set up the datatype-specific attributes. +indp (IN/OUT) - pointer to an indicator variable or array. For scalar data +types, this is a pointer to sb2 or an array of sb2s. For named data types, +this pointer is ignored and the actual pointer to the indicator structure or +an array of indicator structures is initialized by OCIBindObject(). Ignored +for dynamic binds. +See the section "Indicator Variables" on page 2-43 for more information about +indicator variables. +alenp (IN/OUT) - pointer to array of actual lengths of array elements. Each +element in alenp is the length of the data in the corresponding element in the +bind value array before and after the execute. This parameter is ignored for +dynamic binds. +rcodep (OUT) - pointer to array of column level return codes. This parameter +is ignored for dynamic binds. +maxarr_len (IN) - the maximum possible number of elements of type dty in a +PL/SQL binds. This parameter is not required for non-PL/SQL binds. If +maxarr_len is non-zero, then either OCIBindDynamic() or +OCIBindArrayOfStruct() can be invoked to set up additional bind attributes. +curelep(IN/OUT) - a pointer to the actual number of elements. This parameter +is only required for PL/SQL binds. +mode (IN) - the valid modes for this parameter are: +OCI_DEFAULT. This is default mode. +OCI_DATA_AT_EXEC. When this mode is selected, the value_sz +parameter defines the maximum size of the data that can be ever +provided at runtime. The application must be ready to provide the OCI +library runtime IN data buffers at any time and any number of times. +Runtime data is provided in one of the two ways: +callbacks using a user-defined function which must be registered +with a subsequent call to OCIBindDynamic() . +a polling mechanism using calls supplied by the OCI. This mode +is assumed if no callbacks are defined. +For more information about using the OCI_DATA_AT_EXEC mode, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16. +When the allocated buffers are not required any more, they should be +freed by the client. +Related Functions +OCIBindDynamic(), OCIBindObject(), OCIBindArrayOfStruct(), OCIAttrGet() + + + +-------------------------------OCIBindDynamic--------------------------------- + +OCIBindDynamic() +Name +OCI Bind Dynamic Attributes +Purpose +This call is used to register user callbacks for dynamic data allocation. +Syntax +sword OCIBindDynamic( OCIBind *bindp, + OCIError *errhp, + void *ictxp, + OCICallbackInBind (icbfp)( + void *ictxp, + OCIBind *bindp, + ub4 iter, + ub4 index, + void **bufpp, + ub4 *alenp, + ub1 *piecep, + void **indp ), + void *octxp, + OCICallbackOutBind (ocbfp)( + void *octxp, + OCIBind *bindp, + ub4 iter, + ub4 index, + void **bufp, + ub4 **alenpp, + ub1 *piecep, + void **indpp, + ub2 **rcodepp) ); +Comments +This call is used to register user-defined callback functions for providing +data for an UPDATE or INSERT if OCI_DATA_AT_EXEC mode was specified in a +previous call to OCIBindByName() or OCIBindByPos(). +The callback function pointers must return OCI_CONTINUE if it the call is +successful. Any return code other than OCI_CONTINUE signals that the client +wishes to abort processing immediately. +For more information about the OCI_DATA_AT_EXEC mode, see the section +"Runtime Data Allocation and Piecewise Operations" on page 5-16. +Parameters +bindp (IN/OUT) - a bind handle returned by a call to OCIBindByName() or +OCIBindByPos(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +ictxp (IN) - the context pointer required by the call back function icbfp. +icbfp (IN) - the callback function which returns a pointer to the IN bind +value or piece at run time. The callback takes in the following parameters. +ictxp (IN/OUT) - the context pointer for this callback function. +bindp (IN) - the bind handle passed in to uniquely identify this bind +variable. +iter (IN) - 1-based execute iteration value. +index (IN) - index of the current array, for an array bind. 1 based not +greater than curele parameter of the bind call. +index (IN) - index of the current array, for an array bind. This parameter +is 1-based, and may not be greater than curele parameter of the bind call. +bufpp (OUT) - the pointer to the buffer. +piecep (OUT) - which piece of the bind value. This can be one of the +following values - OCI_ONE_PIECE, OCI_FIRST_PIECE, +OCI_NEXT_PIECE and OCI_LAST_PIECE. +indp (OUT) - contains the indicator value. This is apointer to either an +sb2 value or a pointer to an indicator structure for binding named data +types. +indszp (OUT) - contains the indicator value size. A pointer containing +the size of either an sb2 or an indicator structure pointer. +octxp (IN) - the context pointer required by the callback function ocbfp. +ocbfp (IN) - the callback function which returns a pointer to the OUT bind +value or piece at run time. The callback takes in the following parameters. +octxp (IN/OUT) - the context pointer for this call back function. +bindp (IN) - the bind handle passed in to uniquely identify this bind +variable. +iter (IN) - 1-based execute iteration value. +index (IN) - index of the current array, for an array bind. This parameter +is 1-based, and must not be greater than curele parameter of the bind call. +bufpp (OUT) - a pointer to a buffer to write the bind value/piece. +buflp (OUT) - returns the buffer size. +alenpp (OUT) - a pointer to a storage for OCI to fill in the size of the bind +value/piece after it has been read. +piecep (IN/OUT) - which piece of the bind value. It will be set by the +library to be one of the following values - OCI_ONE_PIECE or +OCI_NEXT_PIECE. The callback function can leave it unchanged or set +it to OCI_FIRST_PIECE or OCI_LAST_PIECE. By default - +OCI_ONE_PIECE. +indpp (OUT) - returns a pointer to contain the indicator value which +either an sb2 value or a pointer to an indicator structure for named data +types. +indszpp (OUT) - returns a pointer to return the size of the indicator +value which is either size of an sb2 or size of an indicator structure. +rcodepp (OUT) - returns a pointer to contains the return code. +Related Functions +OCIAttrGet() + + +---------------------------------OCIBindObject-------------------------------- + + +OCIBindObject() +Name +OCI Bind Object +Purpose +This function sets up additional attributes which are required for a named +data type (object) bind. +Syntax +sword OCIBindObject ( OCIBind *bindp, + OCIError *errhp, + const OCIType *type, + void **pgvpp, + ub4 *pvszsp, + void **indpp, + ub4 *indszp, ); +Comments +This function sets up additional attributes which binding a named data type +or a REF. An error will be returned if this function is called when the OCI +environment has been initialized in non-object mode. +This call takes as a paramter a type descriptor object (TDO) of datatype +OCIType for the named data type being defined. The TDO can be retrieved +with a call to OCITypeByName(). +If the OCI_DATA_AT_EXEC mode was specified in ocibindn() or ocibindp(), the +pointers to the IN buffers are obtained either using the callback icbfp +registered in the OCIBindDynamic() call or by the OCIStmtSetPieceInfo() call. +The buffers are dynamically allocated for the OUT data and the pointers to +these buffers are returned either by calling ocbfp() registered by the +OCIBindDynamic() or by setting the pointer to the buffer in the buffer passed +in by OCIStmtSetPieceInfo() called when OCIStmtExecute() returned +OCI_NEED_DATA. The memory of these client library- allocated buffers must be +freed when not in use anymore by using the OCIObjectFreee() call. +Parameters +bindp ( IN/OUT) - the bind handle returned by the call to OCIBindByName() +or OCIBindByPos(). +errhp ( IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +type ( IN) - points to the TDO which describes the type of the program +variable being bound. Retrieved by calling OCITypeByName(). +pgvpp ( IN/OUT) - points to a pointer to the program variable buffer. For an +array, pgvpp points to an array of pointers. When the bind variable is also an +OUT variable, the OUT Named Data Type value or REF is allocated +(unpickled) in the Object Cache, and a pointer to the value or REF is returned, +At the end of execute, when all OUT values have been received, pgvpp points +to an array of pointer(s) to these newly allocated named data types in the +object cache. +pgvpp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the Named +Data Type buffers are requested at runtime. For static array binds, skip +factors may be specified using the OCIBindArrayOfStruct() call. The skip +factors are used to compute the address of the next pointer to the value, the +indicator structure and their sizes. +pvszsp ( IN/OUT) - points to the size of the program variable. The size of the +named data type is not required on input. For an array, pvszsp is an array of +ub4s. On return, for OUT bind variables, this points to size(s) of the Named +Data Types and REFs received. pvszsp is ignored if the OCI_DATA_AT_EXEC +mode is set. Then the size of the buffer is taken at runtime. +indpp ( IN/OUT) - points to a pointer to the program variable buffer +containing the parallel indicator structure. For an array, points to an array +of pointers. When the bind variable is also an OUT bind variable, memory is +allocated in the object cache, to store the unpickled OUT indicator values. At +the end of the execute when all OUT values have been received, indpp points +to the pointer(s) to these newly allocated indicator structure(s). +indpp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the indicator +is requested at runtime. +indszp ( IN/OUT) - points to the size of the IN indicator structure program +variable. For an array, it is an array of sb2s. On return for OUT bind +variables, this points to size(s) of the received OUT indicator structures. +indszp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the indicator +size is requested at runtime. +Related Functions +OCIAttrGet() + + + +----------------------------------OCIBreak------------------------------------ + + +OCIBreak() +Name +OCI Break +Purpose +This call performs an immediate (asynchronous) abort of any currently +executing OCI function that is associated with a server . +Syntax +sword OCIBreak ( void *hndlp, + OCIError *errhp); +Comments +This call performs an immediate (asynchronous) abort of any currently +executing OCI function that is associated with a server. It is normally used +to stop a long-running OCI call being processed on the server. +This call can take either the service context handle or the server context +handle as a parameter to identify the function to be aborted. +Parameters +hndlp (IN) - the service context handle or the server context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions + +-----------------------------OCIConnectionPoolCreate -------------------------- +Name: +OCIConnectionPoolCreate + +Purpose: +Creates the connections in the pool + +Syntax: +OCIConnectionPoolCreate (OCIEnv *envhp, OCIError *errhp, OCICPool *poolhp, + OraText **poolName, sb4 *poolNameLen, + const Oratext *dblink, sb4 dblinkLen, + ub4 connMin, ub4 connMax, ub4 connIncr, + const OraText *poolUsername, sb4 poolUserLen, + const OraText *poolPassword, sb4 poolPassLen, + ub4 mode) +Comments: +This call is used to create a connection pool. conn_min connections +to the database are started on calling OCIConnectionPoolCreate. + +Parameters: +envhp (IN/OUT) - A pointer to the environment where the Conencton Pool + is to be created +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +poolhp (IN/OUT) - An uninitialiazed pool handle. +poolName (OUT) - The connection pool name. +poolNameLen (OUT) - The length of the connection pool name +dblink (IN/OUT) - Specifies the database(server) to connect. This will also + be used as the default pool name. +dblinkLen (IN) - The length of the string pointed to by dblink. +connMin (IN) - Specifies the minimum number of connections in the + Connection Pool at any instant. + connMin number of connections are started when + OCIConnectionPoolCreate() is called. +connMax (IN) - Specifies the maximum number of connections that can be + opened to the database. Once this value is reached, no + more connections are opened. +connIncr (IN) - Allows application to set the next increment for + connections to be opened to the database if the current + number of connections are less than conn_max. +poolUsername (IN/OUT) - Connection pooling requires an implicit proxy + session and this attribute provides a username + for that session. +poolUserLen (IN) - This represents the length of pool_username. +poolPassword (IN/OUT) - The password for the parameter pool_username passed + above. +poolPassLen (IN) - This represents the length of pool_password. + +mode (IN) - The modes supported are OCI_DEFAULT and +OCI_CPOOL_REINITIALIZE + +Related Functions +OCIConnectionPoolDestroy() + +--------------------------------------------------------------------------- + +----------------------------OCIConnectionPoolDestroy------------------------- +Name: +OCIConnectionPoolDestroy + +Purpose: +Terminates the connections in the pool + +Syntax: +OCIConnectionPoolDestroy (OCICPool *poolhp, OCIError *errhp, ub4 mode) + +Comments: +On calling OCIConnectionPoolDestroy, all the open connections in the pool +are closed and the pool is destroyed. + +Parameters: +poolhp (IN/OUT) - An initialiazed pool handle. +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +mode (IN) - Currently, OCIConnectionPoolDestroy() will support only + the OCI_DEFAULT mode. + +Related Functions: +OCIConnectionPoolCreate() + +----------------------------------------------------------------------------- +----------------------------OCISessionPoolCreate----------------------------- +Name: +OCISessionPoolCreate + +Purpose: +Creates the sessions in the session pool. + +Syntax: +sword OCISessionPoolCreate (OCIEnv *envhp, OCIError *errhp, OCISpool *spoolhp, + OraText **poolName, ub4 *poolNameLen, + const OraText *connStr, ub4 connStrLen, + ub4 sessMin, ub4 sessMax, ub4 sessIncr, + OraText *userid, ub4 useridLen, + OraText *password, ub4 passwordLen, + ub4 mode) + +Comments: +When OCISessionPoolCreate is called, a session pool is initialized for +the associated environment and the database specified by the +connStr parameter. This pool is named uniquely and the name +is returned to the user in the poolname parameter. + +Parameters: +envhp (IN/OUT) - A pointer to the environment handle in which the session + pool needs to be created. +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +spoolhp (IN/OUT) - A pointer to the session pool handle that is created. +poolName (OUT) - Session pool name returned to the user. +poolNameLen (OUT) - Length of the PoolName +connStr (IN) - The TNS alias of the database to connect to. +connStrLen (IN) - Length of the connStr. +sessMin (IN) - Specifies the minimum number of sessions in the Session Pool. + These are the number of sessions opened in the beginning, if + in Homogeneous mode. Else, the parameter is ignored. +sessMax (IN) - Specifies the maximum number of sessions in the Session Pool. + Once this value is reached, no more sessions are opened, + unless the OCI_ATTR_SPOOL_FORCEGET is set. +userid (IN) - Specifies the userid with which to start up the sessions. +useridLen (IN) - Length of userid. +password (IN) - Specifies the password for the corresponding userid. +passwordLen (IN) - Specifies the length of the password +mode(IN) - May be OCI_DEFAULT, OCI_SPC_SPOOL_REINITIALIZE, or + OCI_SPC_SPOOL_HOMOGENEOUS. + +Returns: +SUCCESS - If pool could be allocated and created successfully. +ERROR - If above conditions could not be met. + +Related Functions: +OCISessionPoolDestroy() +----------------------------------------------------------------------------- +-----------------------------OCISessionPoolDestroy--------------------------- +Name: +OCISessionPoolDestroy + +Purpose: +Terminates all the sessions in the session pool. + +Syntax: +sword OCISessionPoolDestroy (OCISPool *spoolhp, OCIError *errhp, ub4 mode) + +Comments: +spoolhp (IN/OUT) - The pool handle of the session pool to be destroyed. +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +mode (IN) - Currently only OCI_DEFAULT mode is supported. + +Returns: +SUCCESS - All the sessions could be closed. +ERROR - If the above condition is not met. + +Related Functions: +OCISessionPoolCreate() +----------------------------------------------------------------------------- +-------------------------------OCISessionGet--------------------------------- +Name: +OCISessionGet + +Purpose: +Get a session. This could be from a session pool, connection pool or +a new standalone session. + +Syntax: +sword OCISessionGet(OCIenv *envhp, OCIError *errhp, OCISvcCtx **svchp, + OCIAuthInfo *authhp, + OraText *poolName, ub4 poolName_len, + const OraText *tagInfo, ub4 tagInfo_len, + OraText **retTagInfo, ub4 *retTagInfo_len, + boolean *found, + ub4 mode) + +Comments: +envhp (IN/OUT) - OCI environment handle. +errhp (IN/OUT) - OCI error handle to be passed to OCIErrorGet(). +svchp (IN/OUT) - Address of an OCI service context pointer. This will be + filled with a server and session handle, attached to the + pool. +authhp (IN/OUT) - OCI Authentication Information handle. +poolName (IN) - This indicates the session/connection pool to get the + session/connection from in the OCI_SPOOL/OCI_CPOOL mode. + In the OCI_DEFAULT mode it refers to the connect string. +poolName_len (IN) - length of poolName. +tagInfo (IN) - indicates the tag of the session that the user wants. If the + user wants a default session, he must specify a NULL here. + Only used for Session Pooling. +tagInfo_len (IN) - the length of tagInfo. +retTagInfo (OUT) - This indicates the type of session that is returned to + the user. Only used for Session Pooling. +retTagInfo_len (OUT) - the length of retTagInfo. +found (OUT) - set to true if the user gets a session he had requested, else + set to false. Only used for Session Pooling. +mode (IN) - The supported modes are OCI_DEFAULT, OCI_CRED_PROXY and + OCI_GET_SPOOL_MATCHANY, OCI_SPOOL and OCI_CPOOL. OCI_SPOOL and + OCI_CPOOL are mutually exclusive. + +Returns: +SUCCESS - if a session was successfully returned into svchp. +SUCCESS_WITH_INFO - if a session was successfully returned into svchp and the + total number of sessions > maxsessions. Only valid for + Session Pooling. +ERROR - If a session could not be retrieved. + +Related Functions: +OCISessionRelease() +----------------------------------------------------------------------------- +---------------------------OCISessionRelease--------------------------------- +Name: +OCISessionRelease + +Purpose: +Release the session. + +Syntax: +sword OCISessionRelease ( OCISvcCtx *svchp, OCIError *errhp, + OraText *tag, ub4 tag_len, + ub4 mode); + +Comments: +svchp (IN/OUT) - The service context associated with the session/connection. +errhp (IN/OUT) - OCI error handle to be passed to OCIErrorGet(). +tag (IN) - Only used for Session Pooling. + This parameter will be ignored unless mode OCI_RLS_SPOOL_RETAG is + specified. In this case, the session is labelled with this tag and + returned to the pool. If this is NULL, then the session is untagged. +tag_len (IN) - Length of the tag. This is ignored unless mode + OCI_RLS_SPOOL_RETAG is set. +mode (IN) - The supported modes are OCI_DEFAULT, OCI_RLS_SPOOL_DROPSESS, + OCI_RLS_SPOOL_RETAG. The last 2 are only valid for Session Pooling. + When OCI_RLS_SPOOL_DROPSESS is specified, the session + will be removed from the session pool. If OCI_RLS_SPOOL_RETAG + is set, the tag on the session will be altered. If this mode is + not set, the tag and tag_len parameters will be ignored. + +Returns: +ERROR - If the session could not be released successfully. +SUCCESS - In all other cases. + +Related Functions: +OCISessionGet(). +----------------------------------------------------------------------------- +------------------------------OCIDateTimeAssign -------------------------- +sword OCIDateTimeAssign(void *hndl, OCIError *err, const OCIDateTime *from, + OCIDateTime *to); +NAME: OCIDateTimeAssign - OCIDateTime Assignment +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +from (IN) - datetime to be assigned +to (OUT) - lhs of assignment +DESCRIPTION: + Performs date assignment. The type of the output will be same as that + of input + +------------------------------OCIDateTimeCheck---------------------------- +sword OCIDateTimeCheck(void *hndl, OCIError *err, const OCIDateTime *date, + ub4 *valid ); +NAME: OCIDateTimeCheck - OCIDateTime CHecK if the given date is valid +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date (IN) - date to be checked +valid (OUT) - returns zero for a valid date, otherwise + the ORed combination of all error bits specified below: + Macro name Bit number Error + ---------- ---------- ----- + OCI_DATE_INVALID_DAY 0x1 Bad day + OCI_DATE_DAY_BELOW_VALID 0x2 Bad DAy Low/high bit (1=low) + OCI_DATE_INVALID_MONTH 0x4 Bad MOnth + OCI_DATE_MONTH_BELOW_VALID 0x8 Bad MOnth Low/high bit (1=low) + OCI_DATE_INVALID_YEAR 0x10 Bad YeaR + OCI_DATE_YEAR_BELOW_VALID 0x20 Bad YeaR Low/high bit (1=low) + OCI_DATE_INVALID_HOUR 0x40 Bad HouR + OCI_DATE_HOUR_BELOW_VALID 0x80 Bad HouR Low/high bit (1=low) + OCI_DATE_INVALID_MINUTE 0x100 Bad MiNute + OCI_DATE_MINUTE_BELOW_VALID 0x200 Bad MiNute Low/high bit (1=low) + OCI_DATE_INVALID_SECOND 0x400 Bad SeCond + OCI_DATE_SECOND_BELOW_VALID 0x800 bad second Low/high bit (1=low) + OCI_DATE_DAY_MISSING_FROM_1582 0x1000 Day is one of those "missing" + from 1582 + OCI_DATE_YEAR_ZERO 0x2000 Year may not equal zero + OCI_DATE_INVALID_TIMEZONE 0x4000 Bad Timezone + OCI_DATE_INVALID_FORMAT 0x8000 Bad date format input + + So, for example, if the date passed in was 2/0/1990 25:61:10 in + (month/day/year hours:minutes:seconds format), the error returned + would be OCI_DATE_INVALID_DAY | OCI_DATE_DAY_BELOW_VALID | + OCI_DATE_INVALID_HOUR | OCI_DATE_INVALID_MINUTE + +DESCRIPTION: + Check if the given date is valid. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'date' and 'valid' pointers are NULL pointers + +------------------------------- OCIDateTimeCompare---------------------------- +sword OCIDateTimeCompare(void *hndl, OCIError *err, const OCIDateTime *date1, + const OCIDateTime *date2, sword *result ); +NAME: OCIDateTimeCompare - OCIDateTime CoMPare dates +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date1, date2 (IN) - dates to be compared +result (OUT) - comparison result, 0 if equal, -1 if date1 < date2, + 1 if date1 > date2 +DESCRIPTION: +The function OCIDateCompare compares two dates. It returns -1 if +date1 is smaller than date2, 0 if they are equal, and 1 if date1 is +greater than date2. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + input dates are not mutually comparable + +------------------------------OCIDateTimeConvert---------------------- +sword OCIDateTimeConvert(void *hndl, OCIError *err, OCIDateTime *indate, + OCIDateTime *outdate); +NAME: OCIDateTimeConvert - Conversion between different DATETIME types +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +indate (IN) - pointer to input date +outdate (OUT) - pointer to output datetime +DESCRIPTION: Converts one datetime type to another. The result type is + the type of the 'outdate' descriptor. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + conversion not possible. + +---------------------------- OCIDateTimeFromText----------------------- +sword OCIDateTimeFromText(void *hndl, OCIError *err, const OraText *date_str, + size_t d_str_length, const OraText *fmt, ub1 fmt_length, + const OraText *lang_name, size_t lang_length, OCIDateTime *date ); +NAME: OCIDateTimeFromText - OCIDateTime convert String FROM Date +PARAMETERS: +hndl (IN) - Session/Env handle. If Session Handle is passed, the + conversion takes place in session NLS_LANGUAGE and + session NLS_CALENDAR, otherwise the default is used. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date_str (IN) - input string to be converted to Oracle date +d_str_length (IN) - size of the input string, if the length is -1 + then 'date_str' is treated as a null terminated string +fmt (IN) - conversion format; if 'fmt' is a null pointer, then + the string is expected to be in the default format for + the datetime type. +fmt_length (IN) - length of the 'fmt' parameter +lang_name (IN) - language in which the names and abbreviations of + days and months are specified, if null i.e. (OraText *)0, + the default language of session is used, +lang_length (IN) - length of the 'lang_name' parameter +date (OUT) - given string converted to date +DESCRIPTION: + Converts the given string to Oracle datetime type set in the + OCIDateTime descriptor according to the specified format. Refer to + "TO_DATE" conversion function described in "Oracle SQL Language + Reference Manual" for a description of format. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid format + unknown language + invalid input string + +--------------------------- OCIDateTimeGetDate------------------------- +sword OCIDateTimeGetDate(void *hndl, OCIError *err, const OCIDateTime *date, + sb2 *year, ub1 *month, ub1 *day ); +NAME: OCIDateTimeGetDate - OCIDateTime Get Date (year, month, day) + portion of DATETIME. +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime +year (OUT) - year value +month (OUT) - month value +day (OUT) - day value + +--------------------------- OCIDateTimeGetTime ------------------------ +sword OCIDateTimeGetTime(void *hndl, OCIError *err, OCIDateTime *datetime, + ub1 *hour, ub1 *minute, ub1 *sec, ub4 *fsec); +NAME: OCIDateTimeGetTime - OCIDateTime Get Time (hour, min, second, + fractional second) of DATETIME. +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime +hour (OUT) - hour value +minute (OUT) - minute value +sec (OUT) - second value +fsec (OUT) - Fractional Second value + +--------------------------- OCIDateTimeGetTimeZoneOffset ---------------------- +sword OCIDateTimeGetTimeZoneOffset(void *hndl,OCIError *err,const + OCIDateTime *datetime,sb1 *hour,sb1 *minute); + +NAME: OCIDateTimeGetTimeZoneOffset - OCIDateTime Get TimeZone (hour, minute) + portion of DATETIME. +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime +hour (OUT) - TimeZone Hour value +minute (OUT) - TimeZone Minute value + +--------------------------- OCIDateTimeSysTimeStamp--------------------- +sword OCIDateTimeSysTimeStamp(void *hndl, OCIError *err, + OCIDateTime *sys_date ); + +NAME: OCIDateTimeSysTimeStamp - Returns system date/time as a TimeStamp with + timezone +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +sys_date (OUT) - Pointer to output timestamp + +DESCRIPTION: + Gets the system current date and time as a timestamp with timezone +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + + +------------------------------OCIDateTimeIntervalAdd---------------------- +sword OCIDateTimeIntervalAdd(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); +NAME: OCIDateTimeIntervalAdd - Adds an interval to datetime +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - pointer to input datetime +inter (IN) - pointer to interval +outdatetime (IN) - pointer to output datetime. The output datetime + will be of same type as input datetime +DESCRIPTION: + Adds an interval to a datetime to produce a resulting datetime +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + resulting date is before Jan 1, -4713 + resulting date is after Dec 31, 9999 + +------------------------------OCIDateTimeIntervalSub---------------------- +sword OCIDateTimeIntervalSub(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); +NAME: OCIDateTimeIntervalSub - Subtracts an interval from a datetime +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - pointer to input datetime +inter (IN) - pointer to interval +outdatetime (IN) - pointer to output datetime. The output datetime + will be of same type as input datetime +DESCRIPTION: + Subtracts an interval from a datetime and stores the result in a + datetime +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + resulting date is before Jan 1, -4713 + resulting date is after Dec 31, 9999 + +--------------------------- OCIDateTimeConstruct------------------------- +sword OCIDateTimeConstruct(void *hndl,OCIError *err,OCIDateTime *datetime, + sb2 year,ub1 month,ub1 day,ub1 hour,ub1 min,ub1 sec,ub4 fsec, + OraText *timezone,size_t timezone_length); + +NAME: OCIDateTimeConstruct - Construct an OCIDateTime. Only the relevant + fields for the OCIDateTime descriptor types are used. +PARAMETERS: + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + datetime (IN) - Pointer to OCIDateTime + year (IN) - year value + month (IN) - month value + day (IN) - day value + hour (IN) - hour value + min (IN) - minute value + sec (IN) - second value + fsec (IN) - Fractional Second value + timezone (IN) - Timezone string + timezone_length(IN) - Length of timezone string + +DESCRIPTION: + Constructs a DateTime descriptor. The type of the datetime is the + type of the OCIDateTime descriptor. Only the relevant fields based + on the type are used. For Types with timezone, the date and time + fields are assumed to be in the local time of the specified timezone. + If timezone is not specified, then session default timezone is + assumed. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR if datetime is not valid. + +------------------------------OCIDateTimeSubtract----------------------- +sword OCIDateTimeSubtract(void *hndl, OCIError *err, OCIDateTime *indate1, + OCIDateTime *indate2, OCIInterval *inter); +NAME: OCIDateTimeSubtract - subtracts two datetimes to return an interval +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +indate1(IN) - pointer to subtrahend +indate2(IN) - pointer to minuend +inter (OUT) - pointer to output interval +DESCRIPTION: + Takes two datetimes as input and stores their difference in an + interval. The type of the interval is the type of the 'inter' + descriptor. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + datetimes are not comparable. + +--------------------------- OCIDateTimeToText-------------------------- +sword OCIDateTimeToText(void *hndl, OCIError *err, const OCIDateTime *date, + const OraText *fmt, ub1 fmt_length, ub1 fsprec, + const OraText *lang_name, size_t lang_length, + ub4 *buf_size, OraText *buf ); +NAME: OCIDateTimeToText - OCIDateTime convert date TO String +PARAMETERS: +hndl (IN) - Session/Env handle. If Session Handle is passed, the + conversion takes place in session NLS_LANGUAGE and + session NLS_CALENDAR, otherwise the default is used. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date (IN) - Oracle datetime to be converted +fmt (IN) - conversion format, if null string pointer (OraText*)0, then + the date is converted to a character string in the + default format for that type. +fmt_length (IN) - length of the 'fmt' parameter +fsprec (IN) - specifies the fractional second precision in which the + fractional seconds is returned. +lang_name (IN) - specifies the language in which the names and + abbreviations of months and days are returned; + default language of session is used if 'lang_name' + is null i.e. (OraText *)0 +lang_length (IN) - length of the 'nls_params' parameter +buf_size (IN/OUT) - size of the buffer; size of the resulting string + is returned via this parameter +buf (OUT) - buffer into which the converted string is placed +DESCRIPTION: + Converts the given date to a string according to the specified format. + Refer to "TO_DATE" conversion function described in + "Oracle SQL Language Reference Manual" for a description of format + and NLS arguments. The converted null-terminated date string is + stored in the buffer 'buf'. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + invalid format + unknown language + overflow error + +----------------------------OCIDateTimeGetTimeZoneName------------------------ +sword OCIDateTimeGetTimeZoneName(void *hndl, + OCIError *err, + const OCIDateTime *datetime, + ub1 *buf, + ub4 *buflen); +NAME OCIDateTimeGetTimeZoneName - OCI DateTime Get the Time Zone Name +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to an OCIDateTime. +buf (OUT) - User allocated storage for name string. +buflen (IN/OUT) - length of buf on input, length of name on out +DESCRIPTION: + Returns either the timezone region name or the absolute hour and minute + offset. If the DateTime was created with a region id then the region + name will be returned in the buf. If the region id is zero, then the + hour and minute offset is returned as "[-]HH:MM". +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + error retrieving timezone data + invalid region + invalid LdiDateTime type + +---------------------------------OCIDateTimeToArray---------------------------- +sword OCIDateTimeToArray(void *hndl, + OCIError *err, + const OCIDateTime *datetime, + const OCIInterval *reftz, + ub1 *outarray, + ub4 *len + ub1 *fsprec); +NAME OCIDateTimeToArray - OCI DateTime convert To Array format +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime to be converted. +outarray (OUT) - Result array storage +len (OUT) - pointer to length of outarray. +fsprec (IN) - Number of fractional seconds digits. +DESCRIPTION: + Returns an array representing the input DateTime descriptor. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + error retrieving timezone data + invalid region + invalid LdiDateTime type + +--------------------------------OCIDateTimeFromArray--------------------------- +sword OCIDateTimeFromArray(void *hndl, + OCIError *err, + ub1 *inarray, + ub4 len + ub1 type + OCIDateTime *datetime, + OCIInterval *reftz, + ub1 fsprec); +NAME OCIDateTimeFromArray - OCI DateTime convert From Array format +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +inarray (IN) - Pointer to input array representtion of DateTime +len (IN) - len of inarray. +type (IN) - One of SQLT_DATE, SQLT_TIME, SQLT_TIME_TZ, SQLT_TIMESTAMP, + SQLT_TIMESTAMP_TZ, or SQLT_TIMESTAMP_LTZ. +datetime (OUT) - Pointer to the result OCIDateTime. +reftz (IN) - timezone interval used with SQLT_TIMESTAMP_LTZ. +fsprec (IN) - fractionl seconds digits of precision (0-9). +DESCRIPTION: + Returns a pointer to an OCIDateTime of type type converted from + the inarray. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + error retrieving timezone data + invalid region + invalid LdiDateTime type + +----------------------------------OCIRowidToChar----------------------------- +Name +OCIRowidToChar + +Purpose +Converts physical/logical (universal) ROWID to chracter extended (Base 64) +representation into user provided buffer outbfp of length outbflp. After +execution outbflp contains amount of bytes converted.In case of truncation +error, outbflp contains required size to make this conversion successful +and returns ORA-1405. + +Syntax +sword OCIRowidToChar( OCIRowid *rowidDesc, + OraText *outbfp, + ub2 *outbflp, + OCIError *errhp) + +Comments +After this conversion, ROWID in character format can be bound using +OCIBindByPos or OCIBindByName call and used to query a row at a +desired ROWID. + +Parameters +rowidDesc (IN) - rowid DESCriptor which is allocated from OCIDescritorAlloc + and populated by a prior SQL statement execution +outbfp (OUT) - pointer to the buffer where converted rowid in character + representation is stored after successful execution. +outbflp (IN/OUT) - pointer to output buffer length variable. + Before execution (IN mode) *outbflp contains the size of + outbfp, after execution (OUT mode) *outbflp contains amount + of bytes converted. In an event of truncation during + conversion *outbflp contains the required length to make + conversion successful. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for + diagnostic information in the event of an error. + +------------------------------OCIDefineArrayOfStruct-------------------------- + + +OCIDefineArrayOfStruct() +Name +OCI Define for Array of Structures +Purpose +This call specifies additional attributes necessary for a static array define. +Syntax +sword OCIDefineArrayOfStruct ( OCIDefine *defnp, + OCIError *errhp, + ub4 pvskip, + ub4 indskip, + ub4 rlskip, + ub4 rcskip ); +Comments +This call specifies additional attributes necessary for an array define, +used in an array of structures (multi-row, multi-column) fetch. +For more information about skip parameters, see the section "Skip Parameters" +on page 4-17. +Parameters +defnp (IN) - the handle to the define structure which was returned by a call +to OCIDefineByPos(). +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +pvskip (IN) - skip parameter for the next data value. +indskip (IN) - skip parameter for the next indicator location. +rlskip (IN) - skip parameter for the next return length value. +rcskip (IN) - skip parameter for the next return code. +Related Functions +OCIAttrGet() + + + + + +OCIDefineByPos() +Name +OCI Define By Position +Purpose +Associates an item in a select-list with the type and output data buffer. +Syntax +sb4 OCIDefineByPos ( + OCIStmt *stmtp, + OCIDefine **defnp, + OCIError *errhp, + ub4 position, + void *valuep, + sb4 value_sz, + ub2 dty, + void *indp, + ub2 *rlenp, + ub2 *rcodep, + ub4 mode ); +Comments +This call defines an output buffer which will receive data retreived from +Oracle. The define is a local step which is necessary when a SELECT statement +returns data to your OCI application. +This call also implicitly allocates the define handle for the select-list item. +Defining attributes of a column for a fetch is done in one or more calls. The +first call is to OCIDefineByPos(), which defines the minimal attributes +required to specify the fetch. +This call takes as a parameter a define handle, which must have been +previously allocated with a call to OCIHandleAlloc(). +Following the call to OCIDefineByPos() additional define calls may be +necessary for certain data types or fetch modes: +A call to OCIDefineArrayOfStruct() is necessary to set up skip parameters +for an array fetch of multiple columns. +A call to OCIDefineObject() is necessary to set up the appropriate +attributes of a named data type fetch. In this case the data buffer pointer +in ocidefn() is ignored. +Both OCIDefineArrayOfStruct() and OCIDefineObject() must be called +after ocidefn() in order to fetch multiple rows with a column of named +data types. +For a LOB define, the buffer pointer must be a lob locator of type +OCILobLocator , allocated by the OCIDescAlloc() call. LOB locators, and not +LOB values, are always returned for a LOB column. LOB values can then be +fetched using OCI LOB calls on the fetched locator. +For NCHAR (fixed and varying length), the buffer pointer must point to an +array of bytes sufficient for holding the required NCHAR characters. +Nested table columns are defined and fetched like any other named data type. +If the mode parameter is this call is set to OCI_DYNAMIC_FETCH, the client +application can fetch data dynamically at runtime. +Runtime data can be provided in one of two ways: +callbacks using a user-defined function which must be registered with a +subsequent call to OCIDefineDynamic(). When the client library needs a +buffer to return the fetched data, the callback will be invoked and the +runtime buffers provided will return a piece or the whole data. +a polling mechanism using calls supplied by the OCI. This mode is +assumed if no callbacks are defined. In this case, the fetch call returns the +OCI_NEED_DATA error code, and a piecewise polling method is used +to provide the data. +Related Functions: For more information about using the +OCI_DYNAMIC_FETCH mode, see the section "Runtime Data +Allocation and Piecewise Operations" on page 5-16 of Volume 1.. +For more information about the define step, see the section "Defining" +on page 2-30. +Parameters +stmtp (IN) - a handle to the requested SQL query operation. +defnp (IN/OUT) - a pointer to a pointer to a define handle which is implicitly +allocated by this call. This handle is used to store the define information +for this column. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +position (IN) - the position of this value in the select list. Positions are +1-based and are numbered from left to right. For example, in the SELECT +statement +SELECT empno, ssn, mgrno FROM employees; +empno is at position 1, ssn is at position 2, and mgrno is at position 3. +valuep (IN/OUT) - a pointer to a buffer or an array of buffers of the type +specified in the dty parameter. A number of buffers can be specified when +results for more than one row are desired in a single fetch call. +value_sz (IN) - the size of each valuep buffer in bytes. If the data is stored +internally in VARCHAR2 format, the number of characters desired, if different +from the buffer size in bytes, may be additionally specified by the using +OCIAttrSet(). +In an NLS conversion environment, a truncation error will be generated if the +number of bytes specified is insufficient to handle the number of characters +desired. +dty (IN) - the data type. Named data type (SQLT_NTY) and REF (SQLT_REF) +are valid only if the environment has been intialized with in object mode. +indp - pointer to an indicator variable or array. For scalar data types, +pointer to sb2 or an array of sb2s. Ignored for named data types. For named +data types, a pointer to a named data type indicator structure or an array of +named data type indicator structures is associated by a subsequent +OCIDefineObject() call. +See the section "Indicator Variables" on page 2-43 for more information about +indicator variables. +rlenp (IN/OUT) - pointer to array of length of data fetched. Each element in +rlenp is the length of the data in the corresponding element in the row after +the fetch. +rcodep (OUT) - pointer to array of column-level return codes +mode (IN) - the valid modes are: +OCI_DEFAULT. This is the default mode. +OCI_DYNAMIC_FETCH. For applications requiring dynamically +allocated data at the time of fetch, this mode must be used. The user may +additionally call OCIDefineDynamic() to set up a callback function that +will be invoked to receive the dynamically allocated buffers and to set +up the memory allocate/free callbacks and the context for the callbacks. +valuep and value_sz are ignored in this mode. +Related Functions +OCIDefineArrayOfStruct(), OCIDefineDynamic(), OCIDefineObject() + + + + +OCIDefineDynamic() +Name +OCI Define Dynamic Fetch Attributes +Purpose +This call is used to set the additional attributes required if the +OCI_DYNAMIC_FETCH mode was selected in OCIDefineByPos(). +Syntax +sword OCIDefineDynamic( OCIDefine *defnp, + OCIError *errhp, + void *octxp, + OCICallbackDefine (ocbfp)( + void *octxp, + OCIDefine *defnp, + ub4 iter, + void **bufpp, + ub4 **alenpp, + ub1 *piecep, + void **indpp, + ub2 **rcodep) ); +Comments +This call is used to set the additional attributes required if the +OCI_DYNAMIC_FETCH mode has been selected in a call to +OCIDefineByPos(). +When the OCI_DYNAMIC_FETCH mode is selected, buffers will be +dynamically allocated for REF, and named data type, values to receive the +data. The pointers to these buffers will be returned. +If OCI_DYNAMIC_FETCH mode was selected, and the call to +OCIDefineDynamic() is skipped, then the application can fetch data piecewise +using OCI calls. +For more information about OCI_DYNAMIC_FETCH mode, see the section +"Runtime Data Allocation and Piecewise Operations" on page 5-16. +Parameters +defnp (IN/OUT) - the handle to a define structure returned by a call to +OCIDefineByPos(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +octxp (IN) - points to a context for the callback function. +ocbfp (IN) - points to a callback function. This is invoked at runtime to get +a pointer to the buffer into which the fetched data or a piece of it will be +retreived. The callback also specifies the indicator, the return code and the +lengths of the data piece and indicator. The callback has the following +parameters: +octxp (IN) - a context pointer passed as an argument to all the callback +functions. +defnp (IN) - the define handle. +iter (IN) - which row of this current fetch. +bufpp (OUT) - returns a pointer to a buffer to store the column value, ie. +*bufp points to some appropriate storage for the column value. +alenpp (OUT) - returns a pointer to the length of the buffer. *alenpp +contains the size of the buffer after return from callback. Gets set to +actual data size after fetch. +piecep (IN/OUT) - returns a piece value, as follows: +The IN value can be OCI_ONE_PIECE, OCI_FIRST_PIECE or +OCI_NEXT_PIECE. +The OUT value can be OCI_ONE_PIECE if the IN value was +OCI_ONE_PIECE. +The OUT value can be OCI_ONE_PIECE or OCI_FIRST_PIECE if +the IN value was OCI_FIRST_PIECE. +The OUT value can only be OCI_NEXT_PIECE or +OCI_LAST_PIECE if the IN value was OCI_NEXT_PIECE. +indpp (IN) - indicator variable pointer +rcodep (IN) - return code variable pointer +Related Functions +OCIAttrGet() +OCIDefineObject() + + + + +OCIDefineObject() +Name +OCI Define Named Data Type attributes +Purpose +Sets up additional attributes necessary for a Named Data Type define. +Syntax +sword OCIDefineObject ( OCIDefine *defnp, + OCIError *errhp, + const OCIType *type, + void **pgvpp, + ub4 *pvszsp, + void **indpp, + ub4 *indszp ); +Comments +This call sets up additional attributes necessary for a Named Data Type define. +An error will be returned if this function is called when the OCI environment +has been initialized in non-Object mode. +This call takes as a paramter a type descriptor object (TDO) of datatype +OCIType for the named data type being defined. The TDO can be retrieved +with a call to OCITypeByName(). +See the description of OCIInitialize() on page 13 - 43 for more information +about initializing the OCI process environment. +Parameters +defnp (IN/OUT) - a define handle previously allocated in a call to +OCIDefineByPos(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +type (IN, optional) - points to the Type Descriptor Object (TDO) which +describes the type of the program variable. Only used for program variables +of type SQLT_NTY. This parameter is optional, and may be passed as NULL +if it is not being used. +pgvpp (IN/OUT) - points to a pointer to a program variable buffer. For an +array, pgvpp points to an array of pointers. Memory for the fetched named data +type instance(s) is dynamically allocated in the object cache. At the end of +the fetch when all the values have been received, pgvpp points to the +pointer(s) to these newly allocated named data type instance(s). The +application must call OCIObjectMarkDel() to deallocate the named data type +instance(s) when they are no longer needed. +pvszsp (IN/OUT) - points to the size of the program variable. For an array, it +is an array of ub4s. On return points to the size(s) of unpickled fetched +values. +indpp (IN/OUT) - points to a pointer to the program variable buffer +containing the parallel indicator structure. For an array, points to an array +of pointers. Memory is allocated to store the indicator structures in the +object cache. At the end of the fetch when all values have been received, +indpp points to the pointer(s) to these newly allocated indicator structure(s). +indszp (IN/OUT) - points to the size(s) of the indicator structure program +variable. For an array, it is an array of ub4s. On return points to the size(s) +of the unpickled fetched indicator values. +Related Functions +OCIAttrGet() + + + +OCIDescAlloc() +Name +OCI Get DESCriptor or lob locator +Purpose +Allocates storage to hold certain data types. The descriptors can be used as +bind or define variables. +Syntax +sword OCIDescAlloc ( const void *parenth, + void **descpp, + ub4 type, + size_t xtramem_sz, + void **usrmempp); +Comments +Returns a pointer to an allocated and initialized structure, corresponding to +the type specified in type. A non-NULL descriptor or LOB locator is returned +on success. No diagnostics are available on error. +This call returns OCI_SUCCESS if successful, or OCI_INVALID_HANDLE if +an out-of-memory error occurs. +Parameters +parenth (IN) - an environment handle. +descpp (OUT) - returns a descriptor or LOB locator of desired type. +type (IN) - specifies the type of descriptor or LOB locator to be allocated. +The specific types are: +OCI_DTYPE_SNAP - specifies generation of snapshot descriptor of C +type - OCISnapshot +OCI_DTYPE_LOB - specifies generation of a LOB data type locator of C +type - OCILobLocator +OCI_DTYPE_RSET - specifies generation of a descriptor of C type +OCIResult that references a result set (a number of rows as a result of a +query). This descriptor is bound to a bind variable of data type +SQLT_RSET (result set). The descriptor has to be converted into a +statement handle using a function - OCIResultSetToStmt() - which can +then be passed to OCIDefineByPos() and OCIStmtFetch() to retrieve the +rows of the result set. +OCI_DTYPE_ROWID - specifies generation of a ROWID descriptor of C +type OCIRowid. +OCI_DTYPE_COMPLEXOBJECTCOMP - specifies generation of a +complex object retrieval descriptor of C type +OCIComplexObjectComp. +xtramemsz (IN) - specifies an amount of user memory to be allocated for use +by the application. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. +Related Functions +OCIDescFree() + + + + +OCIDescFree() +Name +OCI Free DESCriptor +Purpose +Deallocates a previously allocated descriptor. +Syntax +sword OCIDescFree ( void *descp, + ub4 type); +Comments +This call frees up storage associated with the descriptor, corresponding to the +type specified in type. Returns OCI_SUCCESS or OCI_INVALID_HANDLE. +All descriptors must be explicitly deallocated. OCI will not deallocate a +descriptor if the environment handle is deallocated. +Parameters +descp (IN) - an allocated descriptor. +type (IN) - specifies the type of storage to be freed. The specific types are: +OCI_DTYPE_SNAP - snapshot descriptor +OCI_DTYPE_LOB - a LOB data type descriptor +OCI_DTYPE_RSET - a descriptor that references a result set (a number +of rows as a result of a query). +OCI_DTYPE_ROWID - a ROWID descriptor +OCI_DTYPE_COMPLEXOBJECTCOMP - a complex object retrieval +descriptor +Related Functions +OCIDescAlloc() + + + +OCIDescribeAny() +Name +OCI DeSCribe Any +Purpose +Describes existing schema objects. +Syntax +sword OCIDescribeAny ( OCISvcCtx *svchp, + OCIError *errhp, + void *objptr, + ub4 objnm_len, + ub1 objptr_typ, + ub1 info_level, + ub1 objtype, + OCIDesc *dschp ); +Comments +This is a generic describe call that describes existing schema objects: tables, +views, synonyms, procedures, functions, packages, sequences, and types. As a +result of this call, the describe handle is populated with the object-specific +attributes which can be obtained through an OCIAttrGet() call. +An OCIParamGet() on the describe handle returns a parameter descriptor for a +specified position. Parameter positions begin with 1. Calling OCIAttrGet() on +the parameter descriptor returns the specific attributes of a stored procedure +or function parameter or a table column descriptor as the case may be. +These subsequent calls do not need an extra round trip to the server because +the entire schema object description cached on the client side by +OCIDescribeAny(). Calling OCIAttrGet() on the describe handle can also return +the total number of positions. +See the section "Describing" on page 2-33 for more information about describe +operations. +Parameters +TO BE UPDATED +svchp (IN/OUT) - a service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +objptr (IN) - the name of the object (a null-terminated string) to be +described. Only procedure or function names are valid when connected to an +Oracle7 Server. +objptr_len (IN) - the length of the string. Must be non-zero. +objptr_typ (IN) - Must be OCI_OTYPE_NAME, OCI_OTYPE_REF, or OCI_OTYPE_PTR. +info_level (IN) - reserved for future extensions. Pass OCI_DEFAULT. +objtype (IN/OUT) - object type. +dschp (IN/OUT) - a describe handle that is populated with describe +information about the object after the call. +Related Functions +OCIAttrGet() + + + +OCIEnvCreate() +Name +OCI ENVironment CREATE +Purpose +This function creates and initializes an environment for the rest of +the OCI functions to work under. This call is a replacement for both +the OCIInitialize and OCIEnvInit calls. +Syntax +sword OCIEnvCreate ( OCIEnv **envhpp, + ub4 mode, + const void *ctxp, + const void *(*malocfp) + (void *ctxp, + size_t size), + const void *(*ralocfp) + (void *ctxp, + void *memptr, + size_t newsize), + const void (*mfreefp) + ( void *ctxp, + void *memptr)) + size_t xtramemsz, + void **usrmempp ); + +Comments +This call creates an environment for all the OCI calls using the modes +specified by the user. This call can be used instead of the two calls +OCIInitialize and OCIEnvInit. This function returns an environment handle +which is then used by the remaining OCI functions. There can be multiple +environments in OCI each with its own environment modes. This function +also performs any process level initialization if required by any mode. +For example if the user wants to initialize an environment as OCI_THREADED, +then all libraries that are used by OCI are also initialized in the +threaded mode. + +This call should be invoked before anny other OCI call and should be used +instead of the OCIInitialize and OCIEnvInit calls. This is the recommended +call, although OCIInitialize and OCIEnvInit calls will still be supported +for backward compatibility. + +envpp (OUT) - a pointer to a handle to the environment. +mode (IN) - specifies initialization of the mode. The valid modes are: +OCI_DEFAULT - default mode. +OCI_THREADED - threaded environment. In this mode, internal data +structures are protected from concurrent accesses by multiple threads. +OCI_OBJECT - will use navigational object interface. +ctxp (IN) - user defined context for the memory call back routines. +malocfp (IN) - user-defined memory allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory allocation function. +size - size of memory to be allocated by the user-defined memory +allocation function +ralocfp (IN) - user-defined memory re-allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory reallocation +function. +memp - pointer to memory block +newsize - new size of memory to be allocated +mfreefp (IN) - user-defined memory free function. If mode is +OCI_THREADED, this memory free routine must be thread safe. +ctxp - context pointer for the user-defined memory free function. +memptr - pointer to memory to be freed +xtramemsz (IN) - specifies the amount of user memory to be allocated. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. + +Example + +Related Functions +OCIInitialize, OCIEnvInit + +OCIEnvNlsCreate() +Name +OCI ENVironment CREATE with NLS info +Purpose +This function does almost everything OCIEnvCreate does, plus enabling setting +of charset and ncharset programmatically, except OCI_UTF16 mode. +Syntax +sword OCIEnvNlsCreate(OCIEnv **envhpp, + ub4 mode, + void *ctxp, + void *(*malocfp) + (void *ctxp, + size_t size), + void *(*ralocfp) + (void *ctxp, + void *memptr, + size_t newsize), + void (*mfreefp) + (void *ctxp, + void *memptr), + size_t xtramemsz, + void **usrmempp, + ub2 charset, + ub2 ncharset) +Comments +The charset and ncharset must be both zero or non-zero. +The parameters have the same meaning as the ones in OCIEnvCreate(). +When charset or ncharset is non-zero, the corresponding character set will +be used to replace the ones specified in NLS_LANG or NLS_NCHAR. Moreover, +OCI_UTF16ID is allowed to be set as charset and ncharset. +On the other hand, OCI_UTF16 mode is deprecated with this function. +Applications can achieve the same effects by setting +both charset and ncharset as OCI_UTF16ID. + + +OCIEnvInit() +Name +OCI INITialize environment +Purpose +This call initializes the OCI environment handle. +Syntax +sword OCIEnvInit ( OCIEnv **envp, + ub4 mode, + size_t xtramemsz, + void **usrmempp ); +Comments +Initializes the OCI environment handle. No changes are done on an initialized +handle. If OCI_ERROR or OCI_SUCCESS_WITH_INFO is returned, the +environment handle can be used to obtain ORACLE specific errors and +diagnostics. +This call is processed locally, without a server round-trip. +Parameters +envpp (OUT) - a pointer to a handle to the environment. +mode (IN) - specifies initialization of an environment mode. The only valid +mode is OCI_DEFAULT for default mode +xtramemsz (IN) - specifies the amount of user memory to be allocated. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. +Example +See the description of OCISessionBegin() on page 13-84 for an example showing +the use of OCIEnvInit(). +Related Functions + + + + +OCIErrorGet() +Name +OCI Get Diagnostic Record +Purpose +Returns an error message in the buffer provided and an ORACLE error. +Syntax +sword OCIErrorGet ( void *hndlp, + ub4 recordno, + OraText *sqlstate, + ub4 *errcodep, + OraText *bufp, + ub4 bufsiz, + ub4 type ); +Comments +Returns an error message in the buffer provided and an ORACLE error. +Currently does not support SQL state. This call can be called a multiple +number of times if there are more than one diagnostic record for an error. +The error handle is originally allocated with a call to OCIHandleAlloc(). +Parameters +hndlp (IN) - the error handle, in most cases, or the environment handle (for +errors on OCIEnvInit(), OCIHandleAlloc()). +recordno (IN) - indicates the status record from which the application seeks +info. Starts from 1. +sqlstate (OUT) - Not supported in Version 8.0. +errcodep (OUT) - an ORACLE Error is returned. +bufp (OUT) - the error message text is returned. +bufsiz (IN) - the size of the buffer provide to get the error message. +type (IN) - the type of the handle. +Related Functions +OCIHandleAlloc() + +OCIExtractInit +Name +OCI Extract Initialize +Purpose +This function initializes the parameter manager. +Syntax +sword OCIExtractInit(void *hndl, OCIError *err); +Comments +It must be called before calling any other parameter manager routine. The NLS +information is stored inside the parameter manager context and used in +subsequent calls to OCIExtract routines. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +Related Functions +OCIExtractTerm() + +OCIExtractTerm +Name +OCI Extract Terminate +Purpose +This function releases all dynamically allocated storage and may perform +other internal bookkeeping functions. +Syntax +sword OCIExtractTerm(void *hndl, OCIError *err); +Comments +It must be called when the parameter manager is no longer being used. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +Related Functions +OCIExtractInit() + +OCIExtractReset +Name +OCI Extract Reset +Purpose +The memory currently used for parameter storage, key definition storage, and +parameter value lists is freed and the structure is reinitialized. +Syntax +sword OCIExtractReset(void *hndl, OCIError *err); +Comments +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +Related Functions + +OCIExtractSetNumKeys +Name +OCI Extract Set Number of Keys +Purpose +Informs the parameter manager of the number of keys that will be registered. +Syntax +sword OCIExtractSetNumKeys(void *hndl, OCIError *err, uword numkeys); +Comments +This routine must be called prior to the first call of OCIExtractSetKey(). +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +numkeys (IN) - The number of keys that will be registered with + OCIExtractSetKey(). +Related Functions +OCIExtractSetKey() + +OCIExtractSetKey +Name +OCI Extract Set Key definition +Purpose +Registers information about a key with the parameter manager. +Syntax +sword OCIExtractSetKey(void *hndl, OCIError *err, const OraText *name, + ub1 type, ub4 flag, const void *defval, + const sb4 *intrange, const OraText *const *strlist); +Comments +This routine must be called after calling OCIExtractSetKey() and before +calling OCIExtractFromFile() or OCIExtractFromStr(). +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +name (IN) - The name of the key. +type (IN) - The type of the key (OCI_EXTRACT_TYPE_INTEGER, + OCI_EXTRACT_TYPE_OCINUM, OCI_EXTRACT_TYPE_STRING, or + OCI_EXTRACT_TYPE_BOOLEAN). +flag (IN) - Set to OCI_EXTRACT_MULTIPLE if the key can take multiple values + or 0 otherwise. +defval (IN) - Set to the default value for the key. May be NULL if there is + no default. A string default must be a (text*) type, an + integer default must be an (sb4*) type, and a boolean default + must be a (ub1*) type. +intrange (IN) - Starting and ending values for the allowable range of integer + values. May be NULL if the key is not an integer type or if + all integer values are acceptable. +strlist (IN) - List of all acceptable text strings for the key. May be NULL + if the key is not a string type or if all text values are + acceptable. +Related Functions +OCIExtractSetNumKeys() + +OCIExtractFromFile +Name +OCI Extract parameters From File +Purpose +The keys and their values in the given file are processed. +Syntax +sword OCIExtractFromFile(void *hndl, OCIError *err, ub4 flag, + OraText *filename); +Comments +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +flag (IN) - Zero or has one or more of the following bits set: + OCI_EXTRACT_CASE_SENSITIVE, OCI_EXTRACT_UNIQUE_ABBREVS, or + OCI_EXTRACT_APPEND_VALUES. +filename (IN) - Null-terminated filename string. +Related Functions + +OCIExtractFromStr +Name +OCI Extract parameters From String +Purpose +The keys and their values in the given string are processed. +Syntax +sword OCIExtractFromStr(void *hndl, OCIError *err, ub4 flag, OraText *input); +Comments +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +flag (IN) - Zero or has one or more of the following bits set: + OCI_EXTRACT_CASE_SENSITIVE, OCI_EXTRACT_UNIQUE_ABBREVS, or + OCI_EXTRACT_APPEND_VALUES. +input (IN) - Null-terminated input string. +Related Functions + +OCIExtractToInt +Name +OCI Extract To Integer +Purpose +Gets the integer value for the specified key. +Syntax +sword OCIExtractToInt(void *hndl, OCIError *err, OraText *keyname, + uword valno, sb4 *retval); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual integer value. +Related Functions + +OCIExtractToBool +Name +OCI Extract To Boolean +Purpose +Gets the boolean value for the specified key. +Syntax +sword OCIExtractToBool(void *hndl, OCIError *err, OraText *keyname, + uword valno, ub1 *retval); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual boolean value. +Related Functions + +OCIExtractToStr +Name +OCI Extract To String +Purpose +Gets the string value for the specified key. +Syntax +sword OCIExtractToStr(void *hndl, OCIError *err, OraText *keyname, + uword valno, OraText *retval, uword buflen); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual null-terminated string value. +buflen (IN) - The length of the buffer for retval. +Related Functions + +Note: The following OCIExtract functions are unavailable in this release + +OCIExtractToOCINum +Name +OCI Extract To OCI Number +Purpose +Gets the OCINumber value for the specified key. +Syntax +sword OCIExtractToOCINum(void *hndl, OCIError *err, OraText *keyname, + uword valno, OCINumber *retval); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual OCINumber value. +Related Functions + +OCIExtractToList +Name +OCI Extract To parameter List +Purpose +Generates a list of parameters from the parameter structures that are stored +in memory. +Syntax +sword OCIExtractToList(void *hndl, OCIError *err, uword *numkeys); +Comments +Must be called before OCIExtractValues() is called. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +numkeys (OUT) - Number of distinct keys stored in memory. +Related Functions +OCIExtractFromList() + +OCIExtractFromList +Name +OCI Extract From parameter List +Purpose +Generates a list of values for the a parameter in the parameter list. +Syntax +sword OCIExtractFromList(void *hndl, OCIError *err, uword index, + OraText *name, ub1 *type, uword *numvals, + void ***values); +Comments +Parameters are specified by an index. OCIExtractToList() must be called prior +to calling this routine to generate the parameter list from the parameter +structures that are stored in memory. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +name (OUT) - Name of the key for the current parameter. +type (OUT) - Type of the current parameter (OCI_EXTRACT_TYPE_STRING, + OCI_EXTRACT_TYPE_INTEGER, OCI_EXTRACT_TYPE_OCINUM, or + OCI_EXTRACT_TYPE_BOOLEAN) +numvals (OUT) - Number of values for this parameter. +values (OUT) - The values for this parameter. +Related Functions +OCIExtractToList() + + +************************ OCIFileClose() *********************************** + +Name + OCIFileClose - Oracle Call Interface FILE i/o CLOSE + +Purpose + Close a previously opened file. + +Syntax + sword OCIFileClose ( void *hndl, + OCIError *err, + OCIFileObject *filep ) + +Comments + This function will close a previously opened file. If the function succeeds + then OCI_SUCCESS will be returned, else OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle + filep (IN) - the OCIFile file object + +Related Functions + OCIFileOpen. + + + +********************* OCIFileExists() ************************************** + +Name + OCIFileExists - Oracle Call Interface FILE i/o EXIST + +Purpose + Check to see if the file exists. + +Syntax + sword OCIFileExists ( void *hndl, + OCIError *err, + OraText *filename, + OraText *path, + ub1 *flag ) + +Comments + This function will set the flag to TRUE if the file exists else it will + be set to FALSE. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl(IN) - OCI environment or session handle + err(OUT) - OCI error handle + filename(IN) - filename + path(IN) - path of the file + flag(OUT) - whether the file exists or not + +Related Functions. + None. + + + **************************** OCIFileFlush() ****************************** + + +Name + OCIFileFlush - Oracle Call Interface File i/o FLUSH + +Purpose + Flush the buffers associated with the file to the disk. + +Syntax + sword OCIFileFlush ( void *hndl, + OCIError *err, + OCIFileObject *filep ) + +Comments + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle + filep (IN) - the OCIFile file object + +Related Functions + OCIFileOpen, OCIFileWrite + + + + *************************** OCIFileGetLength() **************************** + +Name + OCIFileGetLength - Oracle Call Interface FILE i/o GET file LENGTH + +Purpose + Get the length of a file. + +Syntax + OCIFileGetLength(void *hndl, + OCIError *err, + OraText *filename, + OraText *path, + ubig_ora *lenp ) + +Comments + The length of the file will be returned in lenp. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filename (IN) - file name. + path (IN) - path of the file. + lenp (OUT) - On output, it is the length of the file in bytes. + is the number of bytes in the file. + +Related Functions + None. + + + +******************************** OCIFileInit() ***************************** + +Name + OCIFileInit - Oracle Call Interface FILE i/o INITialize + +Purpose + Initialize the OCI File I/O package and create the OCIFile context. + +Syntax + sword OCIFileInit ( void *hndl, + OCIError *err) + +Comments + This function should be called before any of the OCIFile functions are + used. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl(IN) - OCI environment or session handle. + err(OUT) - OCI error structure. + +Related Functions + OCIFileTerm + + + +********************************* OCIFileOpen() ***************************** + +Name + OCIFileOpen - Oracle Call Interface File i/o OPEN + +Purpose + Open a file. + +Syntax + sword OCIFileOpen ( void *hndl, + OCIError *err, + OCIFileObject **filep, + OraText *filename, + OraText *path, + ub4 mode, + ub4 create, + ub4 type ) + +Comments + OCIFileOpen returns a handle to the open file in filep if the file is + successfully opened. + If one wants to use the standard file objects (stdin, stdout & stderr) + then OCIFileOpen whould be called with the type filed containing the + appropriate type (see the parameter type). If any of the standard files + are specified then filename, path, mode and create are ignored. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (OUT) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (OUT) - the file object to be returned. + filename (IN) - file name (NULL terminated string). + path (IN) - path of the file (NULL terminated string). + mode - mode in which to open the file (valid modes are OCI_FILE_READONLY, + OCI_FILE_WRITEONLY, OCI_FILE_READ_WRITE). + create - should the file be created if it does not exist. Valid values + are: + OCI_FILE_TRUNCATE - create a file regardless of whether or not it exists. + If the file already exists overwrite it. + OCI_FILE_EXIST - open it if it exists, else fail. + OCI_FILE_EXCL - fail if the file exists, else create. + OCI_FILE_CREATE - open the file if it exists, and create it if it doesn't. + OCI_FILE_APPEND - set the file pointer to the end of the file prior to + writing(this flag can be OR'ed with OCI_FILE_EXIST or + OCI_FILE_CREATE). +type - file type. Valid values are OCI_FILE_TEXT, OCI_FILE_BIN, + OCI_FILE_STDIN, OCI_FILE_STDOUT and OCI_FILE_STDERR. + If any of the standard files are specified then filename, path, mode + and create are ignored. + +Related Functions. + OCIFileClose + + + +************************** OCIFileRead() ************************************ + +Name + OCIFileRead - Oracle Call Interface FILE i/o READ + +Purpose + Read from a file into a buffer. + +Syntax + sword OCIFileRead ( void *hndl, + OCIError *err, + OCIFileObject *filep, + void *bufp, + ub4 bufl, + ub4 *bytesread ) + +Comments + Upto bufl bytes from the file will be read into bufp. The user should + allocate memory for the buffer. + The number of bytes read would be in bytesread. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (IN/OUT) - a File Object that uniquely references the file. + bufp (IN) - the pointer to a buffer into which the data will be read. The + length of the allocated memory is assumed to be bufl. + bufl - the length of the buffer in bytes. + bytesread (OUT) - the number of bytes read. + +Related Functions + OCIFileOpen, OCIFileSeek, OCIFileWrite + + + +****************************** OCIFileSeek() ****************************** + +Name + OCIFileSeek - Oracle Call Interface FILE i/o SEEK + +Purpose + Perfom a seek to a byte position. + +Syntax + sword OCIFileSeek ( void *hndl, + OCIError *err, + OCIFileObject *filep, + uword origin, + ubig_ora offset, + sb1 dir) + +Comments + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (IN/OUT) - a file handle that uniquely references the file. + origin - The starting point we want to seek from. NOTE: The starting + point may be OCI_FILE_SEEK_BEGINNING (beginning), OCI_FILE_SEEK_CURRENT + (current position), or OCI_FILE_SEEK_END (end of file). + offset - The number of bytes from the origin we want to start reading from. + dir - The direction we want to go from the origin. NOTE: The direction + can be either OCI_FILE_FORWARD or OCI_FILE_BACKWARD. + +Related Function + OCIFileOpen, OCIFileRead, OCIFileWrite + + + +*************************** OCIFileTerm() ********************************** + +Name + OCIFileTerm - Oracle Call Interface FILE i/o TERMinate + +Purpose + Terminate the OCI File I/O package and destroy the OCI File context. + +Syntax + sword OCIFileTerm ( void *hndl, + OCIError *err ) + +Comments + After this function has been called no OCIFile function should be used. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl(IN) - OCI environment or session handle. + err(OUT) - OCI error structure. + +Related Functions + OCIFileInit + + +********************************* OCIFileWrite() **************************** + +Name + OCIFileWrite - Oracle Call Interface FILE i/o WRITE + +Purpose + Write data from buffer into a file. + +Syntax + sword OCIFileWrite ( void *hndl, + OCIError *err, + OCIFileObject *filep, + void *bufp, + ub4 buflen + ub4 *byteswritten ) + +Comments + The number of bytes written will be in *byteswritten. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (IN/OUT) - a file handle that uniquely references the file. + bufp (IN) - the pointer to a buffer from which the data will be written. + The length of the allocated memory is assumed to be the value passed + in bufl. + bufl - the length of the buffer in bytes. + byteswritten (OUT) - the number of bytes written. + +Related Functions + OCIFileOpen, OCIFileSeek, OCIFileRead + + + + + +OCIHandleAlloc() +Name +OCI Get HaNDLe +Purpose +This call returns a pointer to an allocated and initialized handle. +Syntax +sword OCIHandleAlloc ( const void *parenth, + void **hndlpp, + ub4 type, + size_t xtramem_sz, + void **usrmempp); +Comments +Returns a pointer to an allocated and initialized structure, corresponding to +the type specified in type. A non-NULL handle is returned on success. Bind +handle and define handles are allocated with respect to a statement handle. All +other handles are allocated with respect to an environment handle which is +passed in as a parent handle. +No diagnostics are available on error. This call returns OCI_SUCCESS if +successful, or OCI_INVALID_HANDLE if an out-of-memory error occurs. +Handles must be allocated using OCIHandleAlloc() before they can be passed +into an OCI call. +Parameters +parenth (IN) - an environment or a statement handle. +hndlpp (OUT) - returns a handle to a handle type. +type (IN) - specifies the type of handle to be allocated. The specific types +are: +OCI_HTYPE_ERROR - specifies generation of an error report handle of +C type OCIError +OCI_HTYPE_SVCCTX - specifies generation of a service context handle +of C type OCISvcCtx +OCI_HTYPE_STMT - specifies generation of a statement (application +request) handle of C type OCIStmt +OCI_HTYPE_BIND - specifies generation of a bind information handle +of C type OCIBind +OCI_HTYPE_DEFINE - specifies generation of a column definition +handle of C type OCIDefine +OCI_HTYPE_DESCRIBE - specifies generation of a select list +description handle of C type OCIDesc +OCI_HTYPE_SERVER - specifies generation of a server context handle +of C type OCIServer +OCI_HTYPE_SESSION - specifies generation of an authentication +context handle of C type OCISession +OCI_HTYPE_TRANS - specifies generation of a transaction context +handle of C type OCITrans +OCI_HTYPE_COMPLEXOBJECT - specifies generation of a complex +object retrieval handle of C type OCIComplexObject +OCI_HTYPE_SECURITY - specifies generation of a security handle of C +type OCISecurity +xtramem_sz (IN) - specifies an amount of user memory to be allocated. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. +Related Functions +OCIHandleFree() + + + +OCIHandleFree() +Name +OCI Free HaNDLe +Purpose +This call explicitly deallocates a handle. +Syntax +sword OCIHandleFree ( void *hndlp, + ub4 type); +Comments +This call frees up storage associated with a handle, corresponding to the type +specified in the type parameter. +This call returns either OCI_SUCCESS or OCI_INVALID_HANDLE. +All handles must be explicitly deallocated. OCI will not deallocate a child +handle if the parent is deallocated. +Parameters +hndlp (IN) - an opaque pointer to some storage. +type (IN) - specifies the type of storage to be allocated. The specific types +are: +OCI_HTYPE_ENV - an environment handle +OCI_HTYPE_ERROR - an error report handle +OCI_HTYPE_SVCCTX - a service context handle +OCI_HTYPE_STMT - a statement (application request) handle +OCI_HTYPE_BIND - a bind information handle +OCI_HTYPE_DEFINE - a column definition handle +OCI_HTYPE_DESCRIBE - a select list description handle +OCI_HTYPE_SERVER - a server handle +OCI_HTYPE_SESSION - a user authentication handle +OCI_HTYPE_TRANS - a transaction handle +OCI_HTYPE_COMPLEXOBJECT - a complex object retrieval handle +OCI_HTYPE_SECURITY - a security handle +Related Functions +OCIHandleAlloc() + + + + +OCIInitialize() +Name +OCI Process Initialize +Purpose +Initializes the OCI process environment. +Syntax +sword OCIInitialize ( ub4 mode, + const void *ctxp, + const void *(*malocfp) + ( void *ctxp, + size_t size ), + const void *(*ralocfp) + ( void *ctxp, + void *memp, + size_t newsize ), + const void (*mfreefp) + ( void *ctxp, + void *memptr )); +Comments +This call initializes the OCI process environment. +OCIInitialize() must be invoked before any other OCI call. +Parameters +mode (IN) - specifies initialization of the mode. The valid modes are: +OCI_DEFAULT - default mode. +OCI_THREADED - threaded environment. In this mode, internal data +structures are protected from concurrent accesses by multiple threads. +OCI_OBJECT - will use navigational object interface. +ctxp (IN) - user defined context for the memory call back routines. +malocfp (IN) - user-defined memory allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory allocation function. +size - size of memory to be allocated by the user-defined memory +allocation function +ralocfp (IN) - user-defined memory re-allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory reallocation +function. +memp - pointer to memory block +newsize - new size of memory to be allocated +mfreefp (IN) - user-defined memory free function. If mode is +OCI_THREADED, this memory free routine must be thread safe. +ctxp - context pointer for the user-defined memory free function. +memptr - pointer to memory to be freed +Example +See the description of OCIStmtPrepare() on page 13-96 for an example showing +the use of OCIInitialize(). +Related Functions + +-------------------------------OCITerminate------------------------------------ + +OCITerminate() +Name +OCI process Terminate +Purpose +Do cleanup before process termination +Syntax +sword OCITerminate (ub4 mode); + +Comments +This call performs OCI related clean up before the OCI process terminates. +If the process is running in shared mode then the OCI process is disconnected +from the shared memory subsystem. + +OCITerminate() should be the last OCI call in any process. + +Parameters +mode (IN) - specifies different termination modes. + +OCI_DEFAULT - default mode. + +Example + +Related Functions +OCIInitialize() + +------------------------ OCIAppCtxSet-------------------------------------- +Name +OCI Application context Set +Purpose +Set an attribute and its value for a particular application context + namespace +Syntax + (sword) OCIAppCtxSet((void *) sesshndl, (void *)nsptr,(ub4) nsptrlen, + (void *)attrptr, (ub4) attrptrlen, (void *)valueptr, + (ub4) valueptrlen, errhp, (ub4)mode); + +Comments +Please note that the information set on the session handle is sent to the +server during the next OCIStatementExecute or OCISessionBegin. + +This information is cleared from the session handle, once the information + has been sent over to the server,and should be setup again if needed. + +Parameters + sesshndl (IN/OUT) - Pointer to a session handle + nsptr (IN) - Pointer to namespace string + nsptrlen (IN) - length of the nsptr + attrptr (IN) - Pointer to attribute string + attrptrlen (IN) - length of the attrptr + valueptr (IN) - Pointer to value string + valueptrlen(IN) - length of the valueptr + errhp (OUT) - Error from the API + mode (IN) - mode of operation (OCI_DEFAULT) + +Returns + error if any +Example + +Related Functions + OCIAppCtxClearAll + + +------------------------ OCIAppCtxClearAll--------------------------------- +Name + OCI Application Context Clear all attributes in a namespace +Purpose + To clear the values all attributes in a namespace +Syntax + (sword) OCIAppCtxClearAll((void *) sesshndl, (void *)nsptr, (ub4) nsptrlen, + (OCIError *)errhp, (ub4)mode); + +Comments +This will clean up the context information on the server side during the +next piggy-back to the server. + +Parameters + sesshndl (IN/OUT) - Pointer to a session handle + nsptr (IN) - Pointer to namespace string where the values of all + attributes are cleared + nsptrlen (IN) - length of the nsptr + errhp (OUT) - Error from the API + mode (IN) - mode of operation (OCI_DEFAULT) +Example + +Returns + error if any + +Related Functions + OCIAppCtxSet +---------------------- OCIIntervalAssign --------------------------------- +sword OCIIntervalAssign(void *hndl, OCIError *err, + const OCIInterval *inpinter, OCIInterval *outinter ); + + DESCRIPTION + Copies one interval to another to create a replica + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inpinter - Input Interval + (OUT) outinter - Output Interval + RETURNS + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_SUCCESS otherwise + + ---------------------- OCIIntervalCheck ------------------------------------ +sword OCIIntervalCheck(void *hndl, OCIError *err, const OCIInterval *interval, + ub4 *valid ); + + DESCRIPTION + Checks the validity of an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) interval - Interval to be checked + (OUT) valid - Zero if the interval is valid, else returns an Ored + combination of the following codes. + + Macro name Bit number Error + ---------- ---------- ----- + OCI_INTER_INVALID_DAY 0x1 Bad day + OCI_INTER_DAY_BELOW_VALID 0x2 Bad DAy Low/high bit (1=low) + OCI_INTER_INVALID_MONTH 0x4 Bad MOnth + OCI_INTER_MONTH_BELOW_VALID 0x8 Bad MOnth Low/high bit (1=low) + OCI_INTER_INVALID_YEAR 0x10 Bad YeaR + OCI_INTER_YEAR_BELOW_VALID 0x20 Bad YeaR Low/high bit (1=low) + OCI_INTER_INVALID_HOUR 0x40 Bad HouR + OCI_INTER_HOUR_BELOW_VALID 0x80 Bad HouR Low/high bit (1=low) + OCI_INTER_INVALID_MINUTE 0x100 Bad MiNute + OCI_INTER_MINUTE_BELOW_VALID 0x200 Bad MiNute Low/high bit(1=low) + OCI_INTER_INVALID_SECOND 0x400 Bad SeCond + OCI_INTER_SECOND_BELOW_VALID 0x800 bad second Low/high bit(1=low) + OCI_INTER_INVALID_FRACSEC 0x1000 Bad Fractional second + OCI_INTER_FRACSEC_BELOW_VALID 0x2000 Bad fractional second Low/High + + + RETURNS + OCI_SUCCESS if interval is okay + OCI_INVALID_HANDLE if 'err' is NULL. + + ---------------------- OCIIntervalCompare ----------------------------------- +sword OCIIntervalCompare(void *hndl, OCIError *err, OCIInterval *inter1, + OCIInterval *inter2, sword *result ); + + DESCRIPTION + Compares two intervals, returns 0 if equal, -1 if inter1 < inter2, + 1 if inter1 > inter2 + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inter1 (IN) - Interval to be compared + inter2 (IN) - Interval to be compared + result (OUT) - comparison result, 0 if equal, -1 if inter1 < inter2, + 1 if inter1 > inter2 + + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + the two input datetimes are not mutually comparable. + +---------------------- OCIIntervalDivide ------------------------------------ +sword OCIIntervalDivide(void *hndl, OCIError *err, OCIInterval *dividend, + OCINumber *divisor, OCIInterval *result ); + + DESCRIPTION + Divides an interval by an Oracle Number to produce an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + dividend (IN) - Interval to be divided + divisor (IN) - Oracle Number dividing `dividend' + result (OUT) - resulting interval (dividend / divisor) + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + ---------------------- OCIIntervalFromNumber -------------------- +sword OCIIntervalFromNumber(void *hndl, OCIError *err, + OCIInterval *inter, OCINumber *number); + DESCRIPTION + Converts an interval to an Oracle Number + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (OUT) interval - Interval to be converted + (IN) number - Oracle number result (in years for YEARMONTH interval + and in days for DAYSECOND) + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR on error. + NOTES + Fractional portions of the date (for instance, minutes and seconds if + the unit chosen is hours) will be included in the Oracle number produced. + Excess precision will be truncated. + + ---------------------- OCIIntervalFromText --------------------------------- +sword OCIIntervalFromText( void *hndl, OCIError *err, const OraText *inpstr, + size_t str_len, OCIInterval *result ); + + DESCRIPTION + Given an interval string produce the interval represented by the string. + The type of the interval is the type of the 'result' descriptor. + PARAMETERS + + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inpstr - Input string + (IN) str_len - Length of input string + (OUT) result - Resultant interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + there are too many fields in the literal string + the year is out of range (-4713 to 9999) + if the month is out of range (1 to 12) + if the day of month is out of range (1 to 28...31) + if hour is not in range (0 to 23) + if hour is not in range (0 to 11) + if minute is not in range (0 to 59) + if seconds in minute not in range (0 to 59) + if seconds in day not in range (0 to 86399) + if the interval is invalid + + + ---------------------- OCIIntervalGetDaySecond -------------------- + + DESCRIPTION + Gets values of day second interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + day (OUT) - number of days + hour (OUT) - number of hours + min (OUT) - number of mins + sec (OUT) - number of secs + fsec (OUT) - number of fractional seconds + result (IN) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + + ---------------------- OCIIntervalGetYearMonth -------------------- + + DESCRIPTION + Gets year month from an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + year (OUT) - year value + month (OUT) - month value + result (IN) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + + +-------------------------- OCIIntervalAdd ------------------------------ +sword OCIIntervalAdd(void *hndl, OCIError *err, OCIInterval *addend1, + OCIInterval *addend2, OCIInterval *result ); +NAME OCIIntervalAdd - Adds two intervals +PARAMETERS +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +addend1 (IN) - Interval to be added +addend2 (IN) - Interval to be added +result (OUT) - resulting interval (addend1 + addend2) +DESCRIPTION + Adds two intervals to produce a resulting interval +RETURNS + OCI_SUCCESS on success + OCI_ERROR if: + the two input intervals are not mutually comparable. + the resulting year would go above SB4MAXVAL + the resulting year would go below SB4MINVAL + OCI_INVALID_HANDLE if 'err' is NULL. +NOTES + The two input intervals must be mutually comparable + + ---------------------- OCIIntervalSubtract ------------------------------- +sword OCIIntervalSubtract(void *hndl, OCIError *err, OCIInterval *minuend, + OCIInterval *subtrahend, OCIInterval *result ); +NAME - OCIIntervalSubtract - subtracts two intervals +PARAMETERS +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +minuend (IN) - interval to be subtracted from +subtrahend (IN) - interval subtracted from minuend +result (OUT) - resulting interval (minuend - subtrahend) +DESCRIPTION + Subtracts two intervals and stores the result in an interval +RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + the two input intervals are not mutually comparable. + the resulting leading field would go below SB4MINVAL + the resulting leading field would go above SB4MAXVAL + +---------------------- OCIIntervalMultiply --------------------------------- +sword OCIIntervalMultiply(void *hndl, OCIError *err, const OCIInterval *inter, + OCINumber *nfactor, OCIInterval *result ); + + DESCRIPTION + Multiplies an interval by an Oracle Number to produce an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inter (IN) - Interval to be multiplied + nfactor (IN) - Oracle Number to be multiplied + result (OUT) - resulting interval (ifactor * nfactor) + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + the resulting year would go above SB4MAXVAL + the resulting year would go below SB4MINVAL + + + ---------------------- OCIIntervalSetDaySecond -------------------- + + DESCRIPTION + Sets day second interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + day (IN) - number of days + hour (IN) - number of hours + min (IN) - number of mins + sec (IN) - number of secs + fsec (IN) - number of fractional seconds + result (OUT) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + + ---------------------- OCIIntervalSetYearMonth -------------------- + + DESCRIPTION + Sets year month interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + year (IN) - year value + month (IN) - month value + result (OUT) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + +----------------------- OCIIntervalToNumber --------------------------------- +sword OCIIntervalToNumber(void *hndl, OCIError *err, const OCIInterval *inter, + OCINumber *number); + + DESCRIPTION + Converts an interval to an Oracle Number + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inter - Interval to be converted + (OUT) number - Oracle number result (in years for YEARMONTH interval + and in days for DAYSECOND) + RETURNS + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_SUCCESS on success + NOTES + Fractional portions of the date (for instance, minutes and seconds if + the unit chosen is hours) will be included in the Oracle number produced. + Excess precision will be truncated. + +------------------------------- OCIIntervalToText ------------------------- +sword OCIIntervalToText( void *hndl, OCIError *err, const OCIInterval *inter, + ub1 lfprec, ub1 fsprec, OraText *buffer, + size_t buflen, size_t *resultlen ); + + DESCRIPTION + Given an interval, produces a string representing the interval. + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inter - Interval to be converted + (IN) lfprec - Leading field precision. Number of digits used to + represent the leading field. + (IN) fsprec - Fractional second precision of the interval. Number of + digits used to represent the fractional seconds. + (OUT) buffer - buffer to hold result + (IN) buflen - length of above buffer + (OUT) resultlen - length of result placed into buffer + + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR + if the buffer is not large enough to hold the result + NOTES + The interval literal will be output as `year' or `[year-]month' for + YEAR-MONTH intervals and as `seconds' or `minutes[:seconds]' or + `hours[:minutes[:seconds]]' or `days[ hours[:minutes[:seconds]]]' for + DAY-TIME intervals (where optional fields are surrounded by brackets). + + ---------------------- OCIIntervalFromTZ -------------------- +sword OCIIntervalFromTZ(void *hndl, OCIError *err, const oratext *inpstring, + size_t str_len, OCIInterval *result); + + DESCRIPTION + Retuns an OCI_DTYPE_INTERVAL_DS OCIInterval with the region id (if + the region is specified in the input string) set and the current + absolute offset or an absolut offset with the region id set to 0. + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inpstring (IN) - pointer to the input string + str_len (IN) - inpstring length + result - Output Interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR on error + Bad interval type + Timezone errors + NOTES + The input string must be of the form [+/-]TZH:TZM or 'TZR [TZD]' + + ----------------------- OCIKerbAttrSet --------------------- +sword OCIKerbAttrSet(OCISession *trgthndlp, ub4 auth_mode, + ub1 *ftgt_ticket, ub4 ftgt_ticket_len, + ub1 *ftgt_sesskey, ub4 ftgt_sesskey_len, + ub2 ftgt_keytype, ub4 ftgt_ticket_flags, + sb4 ftgt_auth_time, sb4 ftgt_start_time, + sb4 ftgt_end_time, sb4 ftgt_renew_time, + oratext *ftgt_principal, ub4 ftgt_principal_len, + oratext *ftgt_realm, ub4 ftgt_realm_len, + OCIError *errhp); + + DESCRIPTION + This call sets the attributes required for Kerberos authentication + on the user handle. + + PARAMETERS + trgthndlp (IN) - The pointer to a user handle. + auth_mode (IN) - Indicates what type of Kerberos credentials should + be set. Options are: + + OCI_KERBCRED_PROXY + - Set Kerberos credentials for use with + proxy authentication. + OCI_KERBCRED_CLIENT_IDENTIFIER + - Set Kerberos credentials for use + with secure client identifier. + + ftgt_ticket (IN) - Forwardable Ticket Granting Ticket (FTGT). + ftgt_ticket_len (IN) - Length of FTGT. + ftgt_sesskey(IN) - Session Key associated with FTGT. + ftgt_sesskey_len (IN) - Length of session key. + ftgt_keytype (IN) - Type of encryption key used to encrypt FTGT. + ftgt_ticket_flags (IN) - Flags associated with encryption of FTGT. + ftgt_auth_time (IN) - Authentication time compatible with that in FTGT. + ftgt_start_time (IN) - Start time compatible with that indicated in FTGT. + ftgt_end_time (IN) - End time compatible with that indicated in FTGT. + ftgt_renew_time (IN) - Renew time compatible with that indicated in FTGT. + ftgt_principal (IN) - Client principal name from FTGT. + ftgt_principal_len (IN) - Length of client principal name. + ftgt_realm (IN) - Client realm name from FTGT. + ftgt_realm_len (IN) - Client realm name length. + errhp (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + RETURNS + OCI_SUCCESS on success + OCI_ERROR on error + NOTES + +OCILdaToSvcCtx() +Name +OCI toggle version 7 Lda_Def to SerVice context handle +Purpose +Converts a V7 Lda_Def to a V8 service context handle. +Syntax +sword OCILdaToSvcCtx ( OCISvcCtx **svchpp, + OCIError *errhp, + Lda_Def *ldap ); +Comments +Converts a V7 Lda_Def to a V8 service context handle. The action of this call +can be reversed by passing the resulting service context handle to the +OCISvcCtxToLda() function. +Parameters +svchpp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +ldap (IN/OUT) - the V7 logon data area returned by OCISvcCtxToLda() from +this service context. +Related Functions +OCISvcCtxToLda() + + + + +OCILobAppend() + +Name +OCI Lob APpend + +Purpose +Appends a LOB value at the end of another LOB. + +Syntax +sword OCILobAppend ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp ); +Comments +Appends a LOB value at the end of LOB. The data is +copied from the source to the destination at the end of the destination. The +source and the destination must already exist. The destination LOB is +extended to accommodate the newly written data. + +It is an error to extend the destination LOB beyond the maximum length +allowed or to try to copy from a NULL LOB. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dst_locp (IN/OUT) - a locator uniquely referencing the destination LOB. +src_locp (IN/OUT) - a locator uniquely referencing the source LOB. + +Related Functions +OCILobTrim() +OCIErrorGet() +OCILobWrite() +OCILobCopy() + + + +OCILobAssign() + +Name +OCI Lob ASsiGn + +Purpose +Assigns one LOB/FILE locator to another. + +Syntax +sword OCILobAssign ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp ); + +Comments +Assign source locator to destination locator. After the assignment, both +locators refer to the same LOB data. For internal LOBs, the source locator's +LOB data gets copied to the destination locator's LOB data only when the +destination locator gets stored in the table. Therefore, issuing a flush of +the object containing the destination locator will copy the LOB data. For +FILEs only the locator that refers to the OS file is copied to the table. The +OS file is not copied. +Note: The only difference between this and OCILobLocatorAssign is that this +takes an environment handle whereas OCILobLocatorAssign takes an OCI service +handle + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded +in errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +src_locp (IN) - LOB locator to copy from. +dst_locpp (IN/OUT) - LOB locator to copy to. The caller must allocate space +for the OCILobLocator by calling OCIDescriptorAlloc(). + +See also +OCIErrorGet() +OCILobIsEqual() +OCILobLocatorIsInit() +OCILobLocatorAssign() + + +OCILobCharSetForm() + +Name +OCI Lob Get Character Set Form + +Purpose +Gets the LOB locator's character set fpr,, if any. + +Syntax +sword OCILobCharSetForm ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *locp, + ub1 *csfrm ); + +Comments +Returns the character set form of the input LOB locator in the csfrm output +parameter. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +locp (IN) - LOB locator for which to get the character set form. +csfrm(OUT) - character set form of the input LOB locator. If the input +locator is for a BLOB or a BFILE, csfrm is set to 0 since there is no concept +of a character set for binary LOBs/FILEs. The caller must allocate space for +the csfrm (ub1) and not write into the space. +See also +OCIErrorGet(), OCILobCharSetId(), OCILobLocatorIsInit + + + +OCILobCharSetId() + +Name +OCI Lob get Character Set IDentifier + +Purpose +Gets the LOB locator's character set ID, if any. + +Syntax +sword OCILobCharSetId ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *locp, + ub2 *csid ); + +Comments +Returns the character set ID of the input LOB locator in the cid output +parameter. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +locp (IN) - LOB locator for which to get the character set ID. +csid (OUT) - character set ID of the input LOB locator. If the input locator +is for a BLOB or a BFILE, csid is set to 0 since there is no concept of a +character set for binary LOBs/FILEs. The caller must allocate space for the +character set id of type ub2 and not write into the space. + +See also +OCIErrorGet(), OCILobCharSetForm(), OCILobLocatorIsInit() + + + +OCILobCopy() + +Name +OCI Lob Copy + +Purpose +Copies a portion of a LOB value into another LOB value. + +Syntax +sword OCILobCopy ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp, + ub4 amount, + ub4 dst_offset, + ub4 src_offset ); + +Comments +Copies a portion of a LOB value into another LOB as specified. The data +is copied from the source to the destination. The source (src_locp) and the +destination (dlopb) LOBs must already exist. +If the data already exists at the destination's start position, it is +overwritten with the source data. If the destination's start position is +beyond the end of the current data, a hole is created from the end of the data +to the beginning of the newly written data from the source. The destination +LOB is extended to accommodate the newly written data if it extends +beyond the current length of the destination LOB. +It is an error to extend the destination LOB beyond the maximum length +allowed or to try to copy from a NULL LOB. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dst_locp (IN/OUT) - a locator uniquely referencing the destination LOB. +src_locp (IN/OUT) - a locator uniquely referencing the source LOB. +amount (IN) - the number of character or bytes, as appropriate, to be copied. +dst_offset (IN) - this is the absolute offset for the destination LOB. +For character LOBs it is the number of characters from the beginning of the +LOB at which to begin writing. For binary LOBs it is the number of bytes from +the beginning of the lob from which to begin reading. The offset starts at 1. +src_offset (IN) - this is the absolute offset for the source LOB. +For character LOBs it is the number of characters from the beginning of the +LOB, for binary LOBs it is the number of bytes. Starts at 1. + +See Also +OCIErrorGet(), OCILobAppend(), OCILobWrite(), OCILobTrim() + +OCILobCreateTemporary() + +Name +OCI Lob Create Temporary + +Purpose +Create a Temporary Lob + +Syntax +sword OCILobCreateTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub2 csid, + ub1 csfrm, + ub1 lobtype, + boolean cache, + OCIDuration duration); + + +Comments +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator which points to the temporary Lob +csid (IN) - the character set id +csfrm(IN) - the character set form +lobtype (IN) - the lob type - one of the three constants OCI_TEMP_BLOB, + OCI_TEMP_CLOB and OCI_TEMP_NCLOB +cache(IN)- TRUE if the temporary LOB goes through the cache; FALSE, if not. +duration(IN)- duration of the temporary LOB; Can be a valid duration id or one + of the values: OCI_DURATION_SESSION, OCI_DURATION_CALL + Note: OCI_DURATION_TRANSACTION is NOT supported in 8.1 +Related functions +OCILobFreeTemporary() +OCILobIsTemporary() + +OCILobDisableBuffering() + +Name +OCI Lob Disable Buffering + +Purpose +Disable lob buffering for the input locator. + + +Syntax +sword OCILobDisableBuffering ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +Comments + +Disable lob buffering for the input locator. The next time data is +read/written from/to the lob through the input locator, the lob +buffering subsystem is *not* used. Note that this call does *not* +implicitly flush the changes made in the buffering subsystem. The +user must explicitly call OCILobFlushBuffer() to do this. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB. + +Related Functions +OCILobEnableBuffering() +OCIErrorGet() +OCILobFlushBuffer() + + + + +OCILobEnableBuffering() + +Name +OCI Lob Enable Buffering + +Purpose +Enable lob buffering for the input locator. + + +Syntax +sword OCILobEnableBuffering ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +Comments + +Enable lob buffering for the input locator. The next time data is +read/written from/to the lob through the input locator, the lob +buffering subsystem is used. + +Once lob buffering is enabled for a locator, if that locator is passed to +one of the following routines, an error is returned: + OCILobCopy, OCILobAppend, OCILobErase, OCILobGetLength, OCILobTrim + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB. + +Related Functions +OCILobDisableBuffering() +OCIErrorGet() +OCILobWrite() +OCILobRead() +OCILobFlushBuffer() + + + + +OCILobErase() + +Name +OCI Lob ERase + +Purpose +Erases a specified portion of the LOB data starting at a specified offset. + +Syntax +sword OCILobErase ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *amount, + ub4 offset ); + +Comments +Erases a specified portion of the LOB data starting at a specified offset. +The actual number of characters/bytes erased is returned. The actual number +of characters/bytes and the requested number of characters/bytes will differ +if the end of the LOB data is reached before erasing the requested number of +characters/bytes. +If a section of data from the middle of the LOB data is erased, a hole is +created. When data from that hole is read, 0's are returned. If the LOB is +NULL, this routine will indicate that 0 characters/bytes were erased. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - the LOB for which to erase a section of data. +amount (IN/OUT) - On IN, the number of characters/bytes to erase. On OUT, +the actual number of characters/bytes erased. +offset (IN) - absolute offset from the beginning of the LOB data from which +to start erasing data. Starts at 1. + +See Also +OCIErrorGet(), OCILobRead(), OCILobWrite() + +OCILobOpen() + +Name +OCI Lob Open + +Purpose +Opens an internal or external Lob. + +Syntax +sword OCILobOpen( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub1 mode ); + +Comments +It is an error if the same lob is opened more than once in +the same transaction. Lobs are opened implicitly if they are +not opened before using them. A LOB has to be closed before +the transaction commits else the transaction is rolled back. +Open locators are closed if the transaction aborts. Multiple +users can open the same lob on different locators. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - locator points to the LOB to be opened +mode (IN) - mode in which to open the lob. The valid modes are +read-only - OCI_FILE_READONLY, read-write - OCI_FILE_READWRITE + +OCILobClose() + +Name +OCI Lob Close + +Purpose +Closes an open internal or external Lob. + +Syntax +sword OCILobClose( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp ); + + +Comments +It is an error if the lob is not open at this time. All LOBs +that have been opened in a transaction have to be closed +before the transaction commits, else the transaction gets +rolled back. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN) - A locator that was opened using OCILobOpen() + + +OCILobFileClose() + +Name +OCI Lob File CLoSe + +Purpose +Closes a previously opened FILE. + +Syntax +sword OCILobFileClose ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep ); + +Comments +Closes a previously opened FILE. It is an error if this function is called for +an internal LOB. No error is returned if the FILE exists but is not opened. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +filep (IN/OUT) - a pointer to a FILE locator to be closed. + +See Also +OCIErrorGet(), OCILobFileOpen(), OCILobFileCloseAll(), OCILobFileIsOpen(), +OCILobFileExists(), CREATE DIRECTORY DDL + + + + +OCILobFileCloseAll() + +Name +OCI LOB FILE Close All + +Purpose +Closes all open FILEs on a given service context. + +Syntax +sword OCILobFileCLoseAll ( OCISvcCtx *svchp, + OCIError *errhp ); + +Comments +Closes all open FILEs on a given service context. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. + +See also +OCILobFileClose(), +OCIErrorGet(), OCILobFileOpen(), OCILobFileIsOpen(), +OCILobFileExists(), CREATE DIRECTORY DDL + + + + +OCILobFileExists() + +Name +OCI LOB FILE exists + +Purpose +Tests to see if the FILE exists on the server + +Syntax +sword OCILobFileExists ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep, + boolean *flag ); + +Comments +Checks to see if a FILE exists for on the server. + +Parameters +svchp (IN) - the OCI service context handle. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, +it is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +filep (IN) - pointer to the FILE locator that refers to the file. +flag (OUT) - returns TRUE if the FILE exists; FALSE if it does not. + +See also +OCIErrorGet, CREATE DIRECTORY (DDL) + + + + +OCILobFileGetName() + +Name +OCI LOB FILE Get file Name + +Purpose +Gets the FILE locator's directory alias and file name. + +Syntax +sword OCILobFileGetName ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *filep, + OraText *dir_alias, + ub2 *d_length, + OraText *filename, + ub2 *f_length ); + +Comments +Returns the directory alias and file name associated with this file locator. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) -The OCI error handle. If there is an error, it is recorded in +errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +filep (IN) - FILE locator for which to get the directory alias and file name. +dir_alias (OUT) - buffer into which the directory alias name is placed. The +caller must allocate enough space for the directory alias name and must not +write into the space. +d_length (IN/OUT) + - IN: length of the input dir_alias string; + - OUT: length of the returned dir_alias string. +filename (OUT) - buffer into which the file name is placed. The caller must +allocate enough space for the file name and must not write into the space. +f_length (IN/OUT) + - IN: length of the input filename string; + - OUT: lenght of the returned filename string. + +See also +OCILobFileSetName(), OCIErrorGet() + + + + +OCILobFileIsOpen() + +Name +OCI LOB FILE Is Open? + +Purpose +Tests to see if the FILE is open + +Syntax +sword OCILobFileIsOpen ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep, + boolean *flag ); + +Comments +Checks to see if the FILE on the server is open for a given LobLocator. + +Parameters +svchp (IN) - the OCI service context handle. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +filep (IN) - pointer to the FILE locator being examined. If the input file +locator was never passed to OCILobFileOpen(), the file is considered not to +be opened by this locator. However, a different locator may have opened the +file. More than one file opens can be performed on the same file using +different locators. +flag (OUT) - returns TRUE if the FILE is opened using this locator; FALSE if +it is not. + +See also +OCIErrorGet, OCILobFileOpen, OCILobFileClose, OCILobFileCloseAll, CREATE +DIRECTORY SQL command + + +OCILobFileOpen() + +Name +OCI LOB FILE open + +Purpose +Opens a FILE for read-only access + +Syntax +sword OCILobFileOpen ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep, + ub1 mode ); + +Comments +Opens a FILE. The FILE can be opened for read-only access only. FILEs may not +be written to throough ORACLE. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +filep (IN/OUT) - the FILE to open. Error if the locator does not refer to a +FILE. +mode (IN) - mode in which to open the file. The only valid mode is +read-only - OCI_FILE_READONLY. + +See Also +OCILobFileClose, OCIErrorGet, OCILobFileCloseAll, OCILobFileIsOpen, +OCILobFileSetName, CREATE DIRECTORY + + + + +OCILobFileSetName() + +Name +OCI Lob File Set NaMe + +Purpose +Sets directory alias and file name in the FILE locator. + +Syntax +sword OCILobFileSetName ( OCIEnv *envhp, + OCIError *errhp, + OCILobLocator **filepp, + OraText *dir_alias, + ub2 d_length, + OraText *filename, + ub2 f_length ); +Comments +Sets the directory alias and file name in the LOB file locator. +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded +in errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +filepp (IN/OUT) - FILE locator for which to set the directory alias name. +The caller must have already allocated space for the locator by calling +OCIDescriptorAlloc(). +dir_alias (IN) - buffer that contains the directory alias name to set in the +locator. +d_length (IN) - length of the input dir_alias parameter. +filename (IN) - buffer that contains the file name is placed. +f_length (IN) - length of the input filename parameter. +See also +OCILobFileGetName, OCIErrorGet, CREATE DIRECTORY + + + + +OCILobFlushBuffer() + +Name +OCI Lob Flush all Buffers for this lob. + +Purpose +Flush/write all buffers for this lob to the server. + + +Syntax +sword OCILobFlushBuffer ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 flag); + +Comments + +Flushes to the server, changes made to the buffering subsystem that +are associated with the lob referenced by the input locator. This +routine will actually write the data in the buffer to the lob in +the database. Lob buffering must have already been enabled for the +input lob locator. + +This routine, by default, does not free the buffer resources for +reallocation to another buffered LOB operation. However, if you +want to free the buffer explicitly, you can set the flag parameter +to OCI_LOB_BUFFER_FREE. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB. +flag (IN) - to indicate if the buffer resources need to be freed + after a flush. Default value is OCI_LOB_BUFFER_NOFREE. + Set it to OCI_LOB_BUFFER_FREE if you want the buffer + resources to be freed. +Related Functions +OCILobEnableBuffering() +OCILobDisableBuffering() +OCIErrorGet() +OCILobWrite() +OCILobRead() + + +OCILobFreeTemporary() + +Name +OCI Lob Free Temporary + +Purpose +Free a temporary LOB + +Syntax +sword OCILobFreeTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +Comments + Frees the contents of the temporary Lob this locator is pointing to. Note + that the locator itself is not freed until a OCIDescriptorFree is done. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB + +Related functions +OCILobCreateTemporary() +OCILobIsTemporary() + + +Name +OCI Lob/File Get Chunk Size + +Purpose +When creating the table, the user can specify the chunking factor, which can +be a multiple of Oracle blocks. This corresponds to the chunk size used by the +LOB data layer when accessing/modifying the LOB value. Part of the chunk is +used to store system-related information and the rest stores the LOB value. +This function returns the amount of space used in the LOB chunk to store +the LOB value. + +Syntax +sword OCILobGetChunkSize ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *chunksizep ); + +Comments + Performance will be improved if the user issues read/write +requests using a multiple of this chunk size. For writes, there is an added +benefit since LOB chunks are versioned and, if all writes are done on chunk +basis, no extra/excess versioning is done nor duplicated. Users could batch +up the write until they have enough for a chunk instead of issuing several +write calls for the same chunk. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references the LOB. For internal +LOBs, this locator must be a locator that was obtained from the server +specified by svchp. For FILEs, this locator can be initialized by a Select or +OCILobFileSetName. +chunksizep (OUT) - On output, it is the length of the LOB if not NULL - for +character LOBs it is the number of characters, for binary LOBs it is the +number of bytes in the LOB. + +Related Functions + +OCILobGetLength() + +Name +OCI Lob/File Length + +Purpose +Gets the length of a LOB/FILE. + +Syntax +sword OCILobGetLength ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *lenp ); + +Comments +Gets the length of a LOB/FILE. If the LOB/FILE is NULL, the length is +undefined. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references the LOB. For internal +LOBs, this locator must be a locator that was obtained from the server +specified by svchp. For FILEs, this locator can be initialized by a Select or +OCILobFileSetName. +lenp (OUT) - On output, it is the length of the LOB if not NULL - for +character LOBs it is the number of characters, for binary LOBs it is the +number of bytes in the LOB. + +Related Functions +OCIErrorGet, OCIFileSetName + + + +OCILobIsEqual() + +Name + +OCI Lob Is Equal + +Purpose +Compares two LOB locators for equality. + +Syntax +sword OCILobIsEqual ( OCIEnv *envhp, + const OCILobLocator *x, + const OCILobLocator *y, + boolean *is_equal ); + +Comments +Compares the given LOB locators for equality. Two LOB locators are equal if +and only if they both refer to the same LOB data. +Two NULL locators are considered not equal by this function. +Parameters +envhp (IN) - the OCI environment handle. +x (IN) - LOB locator to compare. +y (IN) - LOB locator to compare. +is_equal (OUT) - TRUE, if the LOB locators are equal; FALSE if they are not. + +See also +OCILobAssign, OCILobLocatorIsInit +OCILobLocatorAssign, +OCILobIsOpen() + +Name + +OCI Lob Is Open +sword OCILobIsOpen(svchp, errhp, locp, flag) +OCISvcCtx *svchp; +OCIError *errhp; +OCILobLocator *locp; +boolean *flag; + +Comments + Checks if the LOB locator was opened before. flag is set to TRUE + if opened; FALSE otherwise + + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN) - the locator to test for temporary LOB +flag(OUT) - TRUE, if the LOB locator points to is open + FALSE, if not. + +OCILobIsTemporary() + +Name + +OCI Lob Is Temporary + +Purpose + Tests if this locator points to a temporary LOB + +Syntax +sword OCILobIsTemporary(OCIEnv *envhp, + OCIError *errhp, + OCILobLocator *locp, + boolean *is_temporary); + +Comments +Tests the locator to determine if it points to a temporary LOB. +If so, is_temporary is set to TRUE. If not, is_temporary is set +to FALSE. + +Parameters +envhp (IN) - the environment handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN) - the locator to test for temporary LOB +is_temporary(OUT) - TRUE, if the LOB locator points to a temporary LOB; + FALSE, if not. + +See Also +OCILobCreateTemporary, OCILobFreeTemporary + + +OCILobLoadFromFile() + +Name +OCI Lob Load From File + +Purpose +Load/copy all or a portion of the file into an internal LOB. + +Syntax +sword OCILobLoadFromFile ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_filep, + ub4 amount, + ub4 dst_offset, + ub4 src_offset ); + +Comments +Loads/copies a portion or all of a file value into an internal LOB as +specified. The data is copied from the source file to the destination +internal LOB (BLOB/CLOB). No character set conversions are performed +when copying the bfile data to a clob/nclob. The bfile data must already +be in the same character set as the clob/nclob in the database. No +error checking is performed to verify this. +The source (src_filep) and the destination (dst_locp) LOBs must already exist. +If the data already exists at the destination's start position, it is +overwritten with the source data. If the destination's start position is +beyond the end of the current data, a hole is created from the end of the data +to the beginning of the newly written data from the source. The destination +LOB is extended to accommodate the newly written data if it extends +beyond the current length of the destination LOB. +It is an error to extend the destination LOB beyond the maximum length +allowed or to try to copy from a NULL LOB. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dst_locp (IN/OUT) - a locator uniquely referencing the destination internal +LOB which may be of type blob, clob, or nclob. +src_filep (IN/OUT) - a locator uniquely referencing the source BFILE. +amount (IN) - the number of bytes to be copied. +dst_offset (IN) - this is the absolute offset for the destination LOB. +For character LOBs it is the number of characters from the beginning of the +LOB at which to begin writing. For binary LOBs it is the number of bytes from +the beginning of the lob from which to begin reading. The offset starts at 1. +src_offset (IN) - this is the absolute offset for the source BFILE. It is +the number of bytes from the beginning of the LOB. The offset starts at 1. + +See Also +OCIErrorGet(), OCILobAppend(), OCILobWrite(), OCILobTrim(), OCILobCopy() + +OCILobLocatorAssign() + +Name +OCI Lob LOCATOR ASsiGn + +Purpose +Assigns one LOB/FILE locator to another. + +Syntax +sword OCILobLocatorAssign ( OCISvcCtx *svchp, + OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp ); + +Comments +Assign source locator to destination locator. After the assignment, both +locators refer to the same LOB data. For internal LOBs, the source locator's +LOB data gets copied to the destination locator's LOB data only when the +destination locator gets stored in the table. Therefore, issuing a flush of +the object containing the destination locator will copy the LOB data. For +FILEs only the locator that refers to the OS file is copied to the table. The +OS file is not copied. +Note : the only difference between this and OCILobAssign is that this takes +a OCI service handle pointer instead of a OCI environment handle pointer + +Parameters +svchp (IN/OUT) - OCI service handle initialized in object mode. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded +in errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +src_locp (IN) - LOB locator to copy from. +dst_locpp (IN/OUT) - LOB locator to copy to. The caller must allocate space +for the OCILobLocator by calling OCIDescriptorAlloc(). + +See also +OCIErrorGet() +OCILobIsEqual() +OCILobLocatorIsInit() +OCILobAssign() + + + + +OCILobLocatorIsInit() + +Name +OCI LOB locator is initialized? + +Purpose +Tests to see if a given LOB locator is initialized. + +Syntax +sword OCILobLocatorIsInit ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *locp, + boolean *is_initialized ); + +Comments +Tests to see if a given LOB locator is initialized. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +locp (IN) - the LOB locator being tested +is_initialized (OUT) - returns TRUE if the given LOB locator is initialized; +FALSE if it is not. + +See also +OCIErrorGet, OCILobIsEqual + + + + +OCILobRead() + +Name +OCI Lob/File ReaD + +Purpose +Reads a portion of a LOB/FILE as specified by the call into a buffer. + +Syntax +sword OCILobRead ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 offset, + ub4 *amtp, + void *bufp, + ub4 bufl, + void *ctxp, + OCICallbackLobRead cbfp, + ub2 csid, + ub1 csfrm ); + +Comments +Reads a portion of a LOB/FILE as specified by the call into a buffer. Data +read from a hole is returned as 0s. It is an error to try to read from a NULL +LOB/FILE. The OS FILE must already exist on the server and must have been +opened using the input locator. Oracle must hav epermission to read the OS +file and user must have read permission on the directory object. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +offset (IN) - On input, it is the absolute offset, for character LOBs in the +number of characters from the beginning of the LOB, for binary LOBs it is the +number of bytes. Starts from 1. +amtp (IN/OUT) - On input, the number of character or bytes to be read. On +output, the actual number of bytes or characters read. +If the amount of bytes to be read is larger than the buffer length it is +assumed that the LOB is being read in a streamed mode. On input if this value +is 0, then the data shall be read in streamed mode from the LOB until the end +of LOB. If the data is read in pieces, *amtp always contains the length of +the last piece read. If a callback function is defined, then this callback +function will be invoked each time bufl bytes are read off the pipe. Each +piece will be written into bufp. +If the callback function is not defined, then OCI_NEED_DATA error code will +be returned. The application must invoke the LOB read over and over again to +read more pieces of the LOB until the OCI_NEED_DATA error code is not +returned. The buffer pointer and the length can be different in each call +if the pieces are being read into different sizes and location. +bufp (IN) - the pointer to a buffer into which the piece will be read. The +length of the allocated memory is assumed to be bufl. +bufl (IN) - the length of the buffer in octets. +ctxp (IN) - the context for the call back function. Can be NULL. +cbfp (IN) - a callback that may be registered to be called for each piece. If +this is NULL, then OCI_NEED_DATA will be returned for each piece. +The callback function must return OCI_CONTINUE for the read to continue. +If any other error code is returned, the LOB read is aborted. + ctxp (IN) - the context for the call back function. Can be NULL. + bufp (IN) - a buffer pointer for the piece. + len (IN) - the length of length of current piece in bufp. + piece (IN) - which piece - OCI_FIRST_PIECE, OCI_NEXT_PIECE or + OCI_LAST_PIECE. +csid - the character set ID of the buffer data +csfrm - the character set form of the buffer data + +Related Functions +OCIErrorGet, OCILobWrite, OCILobFileOpen, OCILobFileSetName, CREATE DIRECTORY + + + + +OCILobTrim() + +Name + +OCI Lob Trim + +Purpose +Trims the lob value to a shorter length + +Syntax +sword OCILobTrim ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 newlen ); + +Comments +Truncates LOB data to a specified shorter length. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references the LOB. This locator +must be a locator that was obtained from the server specified by svchp. +newlen (IN) - the new length of the LOB data, which must be less than or equal +to the current length. + +Related Functions +OCIErrorGet, OCILobWrite, OCiLobErase, OCILobAppend, OCILobCopy + + + + + +OCILobWrite() + +Name +OCI Lob Write + +Purpose +Writes a buffer into a LOB + +Syntax +sword OCILobWrite ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 offset, + ub4 *amtp, + void *bufp, + ub4 buflen, + ub1 piece, + void *ctxp, + OCICallbackLobWrite (cbfp) + ( + void *ctxp, + void *bufp, + ub4 *lenp, + ub1 *piecep ) + ub2 csid + ub1 csfrm ); + + +Comments +Writes a buffer into a LOB as specified. If LOB data already exists +it is overwritten with the data stored in the buffer. +The buffer can be written to the LOB in a single piece with this call, or +it can be provided piecewise using callbacks or a standard polling method. +If this value of the piece parameter is OCI_FIRST_PIECE, data must be +provided through callbacks or polling. +If a callback function is defined in the cbfp parameter, then this callback +function will be invoked to get the next piece after a piece is written to +the pipe. Each piece will be written from bufp. +If no callback function is defined, then OCILobWrite() returns the +OCI_NEED_DATA error code. The application must all OCILobWrite() again +to write more pieces of the LOB. In this mode, the buffer pointer and the +length can be different in each call if the pieces are of different sizes and +from different locations. A piece value of OCI_LAST_PIECE terminates the +piecewise write. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +offset (IN) - On input, it is the absolute offset, for character LOBs in +the number of characters from the beginning of the LOB, for binary LOBs it +is the number of bytes. Starts at 1. +bufp (IN) - the pointer to a buffer from which the piece will be written. The +length of the allocated memory is assumed to be the value passed in bufl. +Even if the data is being written in pieces, bufp must contain the first +piece of the LOB when this call is invoked. +bufl (IN) - the length of the buffer in bytes. +Note: This parameter assumes an 8-bit byte. If your platform uses a +longer byte, the value of bufl must be adjusted accordingly. +piece (IN) - which piece of the buffer is being written. The default value for +this parameter is OCI_ONE_PIECE, indicating the buffer will be written in a +single piece. +The following other values are also possible for piecewise or callback mode: +OCI_FIRST_PIECE, OCI_NEXT_PIECE and OCI_LAST_PIECE. +amtp (IN/OUT) - On input, takes the number of character or bytes to be +written. On output, returns the actual number of bytes or characters written. +If the data is written in pieces, *amtp will contain the total length of the +pieces written at the end of the call (last piece written) and is undefined in +between. +(Note it is different from the piecewise read case) +ctxp (IN) - the context for the call back function. Can be NULL. +cbfp (IN) - a callback that may be registered to be called for each piece in +a piecewise write. If this is NULL, the standard polling method will be used. +The callback function must return OCI_CONTINUE for the write to continue. +If any other error code is returned, the LOB write is aborted. The +callback takes the following parameters: + ctxp (IN) - the context for the call back function. Can be NULL. + bufp (IN/OUT) - a buffer pointer for the piece. + lenp (IN/OUT) - the length of the buffer (in octets) and the length of + current piece in bufp (out octets). + piecep (OUT) - which piece - OCI_NEXT_PIECE or OCI_LAST_PIECE. +csid - the character set ID of the buffer data +csfrm - the character set form of the buffer data +Related Functions + +OCILobWriteAppend() + +Name +OCI Lob Write Append + +Purpose +Writes data to the end of a LOB value. This call provides the ability +to get the length of the data and append it to the end of the LOB in +a single round trip to the server. + +Syntax +sword OCILobWriteAppend ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *amtp, + void *bufp, + ub4 buflen, + ub1 piece, + void *ctxp, + OCICallbackLobWrite (cbfp) + ( + void *ctxp, + void *bufp, + ub4 *lenp, + ub1 *piecep ) + ub2 csid + ub1 csfrm ); + + +Comments +Writes a buffer to the end of a LOB as specified. If LOB data already exists +it is overwritten with the data stored in the buffer. +The buffer can be written to the LOB in a single piece with this call, or +it can be provided piecewise using callbacks or a standard polling method. +If this value of the piece parameter is OCI_FIRST_PIECE, data must be +provided through callbacks or polling. +If a callback function is defined in the cbfp parameter, then this callback +function will be invoked to get the next piece after a piece is written to the +pipe. Each piece will be written from bufp. +If no callback function is defined, then OCILobWriteAppend() returns the +OCI_NEED_DATA error code. The application must all OCILobWriteAppend() again +to write more pieces of the LOB. In this mode, the buffer pointer and the +length can be different in each call if the pieces are of different sizes and +from different locations. A piece value of OCI_LAST_PIECE terminates the +piecewise write. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +bufp (IN) - the pointer to a buffer from which the piece will be written. The +length of the allocated memory is assumed to be the value passed in bufl. Even +if the data is being written in pieces, bufp must contain the first piece of +the LOB when this call is invoked. +bufl (IN) - the length of the buffer in bytes. +Note: This parameter assumes an 8-bit byte. If your platform uses a +longer byte, the value of bufl must be adjusted accordingly. +piece (IN) - which piece of the buffer is being written. The default value for +this parameter is OCI_ONE_PIECE, indicating the buffer will be written in a +single piece. +The following other values are also possible for piecewise or callback mode: +OCI_FIRST_PIECE, OCI_NEXT_PIECE and OCI_LAST_PIECE. +amtp (IN/OUT) - On input, takes the number of character or bytes to be +written. On output, returns the actual number of bytes or characters written. +If the data is written in pieces, *amtp will contain the total length of the +pieces written at the end of the call (last piece written) and is undefined in +between. +(Note it is different from the piecewise read case) +ctxp (IN) - the context for the call back function. Can be NULL. +cbfp (IN) - a callback that may be registered to be called for each piece in a +piecewise write. If this is NULL, the standard polling method will be used. +The callback function must return OCI_CONTINUE for the write to continue. +If any other error code is returned, the LOB write is aborted. The +callback takes the following parameters: + ctxp (IN) - the context for the call back function. Can be NULL. + bufp (IN/OUT) - a buffer pointer for the piece. + lenp (IN/OUT) - the length of the buffer (in octets) and the length of + current piece in bufp (out octets). + piecep (OUT) - which piece - OCI_NEXT_PIECE or OCI_LAST_PIECE. +csid - the character set ID of the buffer data +csfrm - the character set form of the buffer data +Related Functions + + + + +OCILobGetStorageLimit() + +Name +OCI Lob Get Storage Limit + +Purpose +To get the maximum Length of a LOB in bytes that can be stored in the database. + +Syntax +sword OCILobGetStorageLimit ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + oraub8 *limitp); + + +Comments +With unlimited size LOB support the limit for a LOB is no longer restricted +to 4GB. +This interface should be used to get the actual limit for storing data for +a specific +LOB locator. Note that if the compatibality is set to 9.2 or older the limit +would still be 4GB. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +limitp (OUT) - The storage limit for a LOB in bytes. +Related Functions + + + + +OCILobGetOptions() + +Name +OCI Lob Get Options + +Purpose +To get the current options set for the given SecureFile. + +Syntax +sword OCILobGetOptions ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 optypes, + void *optionsp, + ub4 *optionslenp, + ub4 mode); + + +Comments +This function only works on SecureFiles. All others will get an error. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +optypes (IN) - the types of options flags to be retrieved. +optionsp (OUT) - the options flags or value for the given types. +optionslenp (IN/OUT) - the length of option_value buffer +mode (IN) - for future use (pass 0 for now). +Related Functions +OCISetOptions() + +OCILobSetOptions() + +Name +OCI Lob Set Options + +Purpose +To set the options for the given SecureFile Lob. + +Syntax +sword OCILobSetOptions ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 optypes, + void *optionsp, + ub4 optionslen, + ub4 mode); + + +Comments +This function only works on SecureFile Lobs. All others will get an error. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +optypes (IN) - the types of options flags to be set. +optionsp (IN) - the options flags or value to be set for the given types. +optionslen (IN) - then length of option_value buffer +mode (IN) - for future use (pass 0 for now). +Related Functions +OCILobGetOptions() + +OCILobGetContentType() + +Name +OCI Lob Get Content Type + +Purpose +To get the current contenttype set for the given SecureFile. + +Syntax +sword OCILobGetContentType (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + oratext *contenttypep, + ub4 *contenttypelenp, + ub4 mode); + + +Comments +This function only works on SecureFiles. All others will get an error. +If the securefile does not have a contenttype associated with it, +the contenttype length (= *contenttypelenp) is returned as 0 without +modifying the buffer contenttypep. +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for + diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +contenttypep(IN/OUT)- pointer to the buffer where the contenttype is stored + after successful execution. + The caller needs to allocate the buffer before calling + this function. The size of the allocated buffer should + be >= OCI_LOB_CONTENTTYPE_MAXSIZE bytes +contenttypelenp(IN/OUT)- The caller should set this field to the size + of contenttypep buffer. + After the call successfully executes, it will hold the + size of the contenttype returned. +mode (IN) - for future use (pass 0 for now). +Related Functions +OCISetContentType() + +OCILobSetContentType() + +Name +OCI Lob Set Content Type + +Purpose +To set the contenttype for the given SecureFile Lob. + +Syntax +sword OCILobSetContentType (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + const oratext *contenttypep, + ub4 contenttypelen, + ub4 mode); + + +Comments +This function only works on SecureFiles. All others will get an error. +To clear an existing contenttype set on a securefile, the user will +invoke OCILobSetContentType API with contenttypep set to (oratext *)0, +and contenttypelen set to 0. +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +contenttypep (IN) - the contenttype to be set for the given LOB. +contenttypelen(IN) - the size of contenttype in bytes. The size of the + contenttype should be <= OCI_LOB_CONTENTTYPE_MAXSIZE + bytes. +mode (IN) - for future use (pass 0 for now). +Related Functions +OCILobGetContentType() + + +OCILogoff() +Name +OCI simplified Logoff +Purpose +This function is used to terminate a session created with OCILogon() or +OCILogon2(). +Syntax +sword OCILogoff ( OCISvcCtx *svchp + OCIError *errhp ); +Comments +This call is used to terminate a session which was created with OCILogon() or +OCILogon2(). +This call implicitly deallocates the server, authentication, and service +context handles. +Note: For more information on logging on and off in an application, +refer to the section "Application Initialization, Connection, and +Authorization" on page 2-16. +Parameters +svchp (IN) - the service context handle which was used in the call to +OCILogon() or OCILogon2(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +See Also +OCILogon(), OCILogon2(). + + + + + + +OCILogon() +Name +OCI Service Context Logon +Purpose +This function is used to create a simple logon session. +Syntax +sword OCILogon ( OCIEnv *envhp, + OCIError *errhp, + OCISvcCtx *svchp, + const OraText *username, + ub4 uname_len, + const OraText *password, + ub4 passwd_len, + const OraText *dbname, + ub4 dbname_len ); +Comments +This function is used to create a simple logon session for an application. +Note: Users requiring more complex session (e.g., TP monitor +applications) should refer to the section "Application Initialization, +Connection, and Authorization" on page 2-16. +This call allocates the error and service context handles which are passed to +it. This call also implicitly allocates server and authentication handles +associated with the session. These handles can be retrieved by calling +OCIAttrGet() on the service context handle. +Parameters +envhp (IN) - the OCI environment handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +svchp (OUT) - the service context pointer. +username (IN) - the username. +uname_len (IN) - the length of username. +password (IN) - the user's password. +passwd_len (IN) - the length of password. +dbname (IN) - the name of the database to connect to. +dbname_len (IN) - the length of dbname. +See Also +OCILogoff() + + + + + +OCILogon2() +Name +OCI Service Context Logon +Purpose +This function is used to create a logon session in connection pooling mode. +Syntax +sword OCILogon2 ( OCIEnv *envhp, + OCIError *errhp, + OCISvcCtx **svchp, + const OraText *username, + ub4 uname_len, + const OraText *password, + ub4 passwd_len, + const OraText *dbname, + ub4 dbname_len, + ub4 mode); +Comments +This function is used to create a simple logon session for an application in +Connection Pooling mode. The valid values for mode are currently OCI_POOL and +OCI_DEFAULT. Call to this function with OCI_DEFAULT mode is equivalent to +OCILogon() call. +This call allocates the error and service context handles which are passed to +it. This call also implicitly allocates server and authentication handles +associated with the session. These handles can be retrieved by calling +OCIAttrGet() on the service context handle. This call assumes that +OCIConnectionPoolCreate() has already been called for the same dbname. +Parameters +envhp (IN) - the OCI environment handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +svchp (OUT) - the service context pointer. +username (IN) - the username. +uname_len (IN) - the length of username. +password (IN) - the user's password. If this is null, it is assumed that a + proxy session has to be created and the required grants on + the database are already done. +passwd_len (IN) - the length of password. +dbname (IN) - the name of the database to connect to. +dbname_len (IN) - the length of dbname. +mode (IN) - the mode for doing the server attach. Should be OCI_POOL for + using Connection Pooling. + + +See Also +OCILogoff() + + + + + +OCIMemoryFree() +Name +OCI FREE Memory +Purpose +Frees up storage associated with the pointer. +Syntax +void OCIMemoryFree ( const OCIStmt *stmhp, + void *memptr); +Comments +Frees up dynamically allocated data pointers associated with the pointer using +either the default memory free function or the registered memory free +function, as the case may be. +A user-defined memory free function can be registered during the initial call +to OCIInitialize(). +This call is always successful. +Parameters +stmhp (IN) - statement handle which returned this data buffer. +memptr (IN) - pointer to data allocated by the client library. +Related Functions +OCIInitialize() + + + + + +OCIParamGet() +Name +OCI Get PARaMeter +Purpose +Returns a descriptor of a parameter specified by position in the describe +handle or statement handle. +Syntax +sword OCIParamGet ( const void *hndlp, + ub4 htype, + OCIError *errhp, + void **parmdpp, + ub4 pos ); +Comments +This call returns a descriptor of a parameter specified by position in the +describe handle or statement handle. Parameter descriptors are always +allocated internally by the OCI library. They are read-only. +OCI_NO_DATA may be returned if there are no parameter descriptors for this +position. +See Appendix B for more detailed information about parameter descriptor +attributes. +Parameters +hndlp (IN) - a statement handle or describe handle. The OCIParamGet() +function will return a parameter descriptor for this handle. +htype (IN) - the type of the handle passed in the handle parameter. Valid +types are OCI_HTYPE_DESCRIBE, for a describe handle OCI_HTYPE_STMT, for a +statement handle +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +parmdpp (OUT) - a descriptor of the parameter at the position given in the pos +parameter. +pos (IN) - position number in the statement handle or describe handle. A +parameter descriptor will be returned for this position. +Note: OCI_NO_DATA may be returned if there are no parameter +descriptors for this position. +Related Functions +OCIAttrGet(), OCIAttrSet() + + + + + +OCIParamSet() +Name +OCI Parameter Set in handle +Purpose +Used to set a complex object retrieval descriptor into a complex object +retrieval handle. +Syntax +sword OCIParamGet ( void *hndlp, + ub4 htyp, + OCIError *errhp, + const void *dscp, + ub4 dtyp, + ub4 pos ); +Comments +This call sets a given complex object retrieval descriptor into a complex +object retrieval handle. +The handle must have been previously allocated using OCIHandleAlloc(), and +the descriptor must have been previously allocated using OCIDescAlloc(). +Attributes of the descriptor are set using OCIAttrSet(). +Parameters +hndlp (IN/OUT) - handle pointer. +htype (IN) - handle type. +errhp (IN/OUT) - error handle. +dscp (IN) - complex object retrieval descriptor pointer. +dtyp (IN) - +pos (IN) - position number. +See Also + + + + + +OCIPasswordChange() +Name +OCI Change PassWord +Purpose +This call allows the password of an account to be changed. +Syntax +sword OCIPasswordChange ( OCISvcCtx *svchp, + OCIError *errhp, + const OraText *user_name, + ub4 usernm_len, + const OraText *opasswd, + ub4 opasswd_len, + const OraText *npasswd, + sb4 npasswd_len, + ub4 mode); +Comments +This call allows the password of an account to be changed. This call is +similar to OCISessionBegin() with the following differences: +If the user authentication is already established, it authenticates +the account using the old password and then changes the +password to the new password +If the user authentication is not established, it establishes a user +authentication and authenticates the account using the old +password, then changes the password to the new password. +This call is useful when the password of an account is expired and +OCISessionBegin() returns an error or warning which indicates that the +password has expired. +Parameters +svchp (IN/OUT) - a handle to a service context. The service context handle +must be initialized and have a server context handle associated with it. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +user_name (IN) - specifies the user name. It points to a character string, +whose length is specified in usernm_len. This parameter must be NULL if the +service context has been initialized with an authentication handle. +usernm_len (IN) - the length of the user name string specified in user_name. +For a valid user name string, usernm_len must be non-zero. +opasswd (IN) - specifies the user's old password. It points to a character +string, whose length is specified in opasswd_len . +opasswd_len (IN) - the length of the old password string specified in opasswd. +For a valid password string, opasswd_len must be non-zero. +npasswd (IN) - specifies the user's new password. It points to a character +string, whose length is specified in npasswd_len which must be non-zero for a +valid password string. If the password complexity verification routine is +specified in the user's profile to verify the new password's complexity, the +new password must meet the complexity requirements of the verification +function. +npasswd_len (IN) - then length of the new password string specified in +npasswd. For a valid password string, npasswd_len must be non-zero. +mode - pass as OCI_DEFAULT. +Related Functions +OCISessionBegin() + + +----------------------------------OCIReset------------------------------------ + + +OCIReset() +Name +OCI Reset +Purpose +Resets the interrupted asynchronous operation and protocol. Must be called +if a OCIBreak call had been issued while a non-blocking operation was in +progress. +Syntax +sword OCIReset ( void *hndlp, + OCIError *errhp); +Comments +This call is called in non-blocking mode ONLY. Resets the interrupted +asynchronous operation and protocol. Must be called if a OCIBreak call +had been issued while a non-blocking operation was in progress. +Parameters +hndlp (IN) - the service context handle or the server context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions + + +OCIResultSetToStmt() +Name +OCI convert Result Set to Statement Handle +Purpose +Converts a descriptor to statement handle for fetching rows. +Syntax +sword OCIResultSetToStmt ( OCIResult *rsetdp, + OCIError *errhp ); +Comments +Converts a descriptor to statement handle for fetching rows. +A result set descriptor can be allocated with a call to OCIDescAlloc(). +Parameters +rsetdp (IN/OUT) - a result set descriptor pointer. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions +OCIDescAlloc() + + + + +OCIServerAttach() +Name +OCI ATtaCH to server +Purpose +Creates an access path to a data source for OCI operations. +Syntax +sword OCIServerAttach ( OCIServer *srvhp, + OCIError *errhp, + const OraText *dblink, + sb4 dblink_len, + ub4 mode); +Comments +This call is used to create an association between an OCI application and a +particular server. +This call initializes a server context handle, which must have been previously +allocated with a call to OCIHandleAlloc(). +The server context handle initialized by this call can be associated with a +service context through a call to OCIAttrSet(). Once that association has been +made, OCI operations can be performed against the server. +If an application is operating against multiple servers, multiple server +context handles can be maintained. OCI operations are performed against +whichever server context is currently associated with the service context. +Parameters +srvhp (IN/OUT) - an uninitialized server context handle, which gets +initialized by this call. Passing in an initialized server handle causes an +error. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dblink (IN) - specifies the database (server) to use. This parameter points to +a character string which specifies a connect string or a service point. If the +connect string is NULL, then this call attaches to the default host. The length +of connstr is specified in connstr_len. The connstr pointer may be freed by the +caller on return. +dblink_len (IN) - the length of the string pointed to by connstr. For a valid +connect string name or alias, connstr_len must be non-zero. +mode (IN) - specifies the various modes of operation. For release 8.0, pass as +OCI_DEFAULT - in this mode, calls made to the server on this server context +are made in blocking mode. +Example +See the description of OCIStmtPrepare() on page 13-96 for an example showing +the use of OCIServerAttach(). +Related Functions +OCIServerDetach() + + + +OCIServerDetach() +Name +OCI DeTaCH server +Purpose +Deletes an access to a data source for OCI operations. +Syntax +sword OCIServerDetach ( OCIServer *svrhp, + OCIError *errhp, + ub4 mode); +Comments +This call deletes an access to data source for OCI operations, which was +established by a call to OCIServerAttach(). +Parameters +srvhp (IN) - a handle to an initialized server context, which gets reset to +uninitialized state. The handle is not de-allocated. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +mode (IN) - specifies the various modes of operation. The only valid mode is +OCI_DEFAULT for the default mode. +Related Functions +OCIServerAttach() + + + +OCIServerVersion() +Name +OCI VERSion +Purpose +Returns the version string of the Oracle server. +Syntax +sword OCIServerVersion ( void *hndlp, + OCIError *errhp, + OraText *bufp, + ub4 bufsz + ub1 hndltype ); +Comments +This call returns the version string of the Oracle server. +For example, the following might be returned as the version string if your +application is running against a 7.3.2 server: +Oracle7 Server Release 7.3.2.0.0 - Production Release +PL/SQL Release 2.3.2.0.0 - Production +CORE Version 3.5.2.0.0 - Production +TNS for SEQUENT DYNIX/ptx: Version 2.3.2.0.0 - Production +NLSRTL Version 3.2.2.0.0 - Production + +Parameters +hndlp (IN) - the service context handle or the server context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +bufp (IN) - the buffer in which the version information is returned. +bufsz (IN) - the length of the buffer. +hndltype (IN) - the type of handle passed to the function. +Related Functions + + + + + +OCISessionBegin() +Name +OCI Session Begin and authenticate user +Purpose +Creates a user authentication and begins a user session for a given server. +Syntax +sword OCISessionBegin ( OCISvcCtx *svchp, + OCIError *errhp, + OCISession *usrhp, + ub4 credt, + ub4 mode); + +Comments +For Oracle8, OCISessionBegin() must be called for any given server handle +before requests can be made against it. Also, OCISessionBegin() only supports +authenticating the user for access to the Oracle server specified by the +server handle in the service context. In other words, after OCIServerAttach() +is called to initialize a server handle, OCISessionBegin() must be called to +authenticate the user for that given server. +When OCISessionBegin() is called for the first time for the given server +handle, the initialized authentication handle is called a primary +authentication context. A primary authentication context may not be created +with the OCI_MIGRATE mode. Also, only one primary authentication context can +be created for a given server handle and the primary authentication context c +an only ever be used with that server handle. If the primary authentication +context is set in a service handle with a different server handle, then an +error will result. +After OCISessionBegin() has been called for the server handle, and the primary +authentication context is set in the service handle, OCISessionBegin() may be +called again to initialize another authentication handle with different (or +the same) credentials. When OCISessionBegin() is called with a service handle +set with a primary authentication context, the returned authentication context +in authp is called a user authentication context. As many user authentication +contexts may be initialized as desired. +User authentication contexts may be created with the OCI_MIGRATE mode. +If the OCI_MIGRATE mode is not specified, then the user authentication +context can only ever be used with the same server handle set in svchp. If +OCI_MIGRATE mode is specified, then the user authentication may be set +with different server handles. However, the user authentication context is +restricted to use with only server handles which resolve to the same database +instance and that have equivalent primary authentication contexts. Equivalent +authentication contexts are those which were authenticated as the same +database user. +OCI_SYSDBA, OCI_SYSOPER, OCI_SYSASM, and OCI_PRELIM_AUTH may only be used +with a primary authentication context. +To provide credentials for a call to OCISessionBegin(), one of two methods are +supported. The first is to provide a valid username and password pair for +database authentication in the user authentication handle passed to +OCISessionBegin(). This involves using OCIAttrSet() to set the +OCI_ATTR_USERNAME and OCI_ATTR_PASSWORD attributes on the +authentication handle. Then OCISessionBegin() is called with +OCI_CRED_RDBMS. +Note: When the authentication handle is terminated using +OCISessionEnd(), the username and password attributes remain +unchanged and thus can be re-used in a future call to OCISessionBegin(). +Otherwise, they must be reset to new values before the next +OCISessionBegin() call. +The second type of credentials supported are external credentials. No +attributes need to be set on the authentication handle before calling +OCISessionBegin(). The credential type is OCI_CRED_EXT. This is equivalent +to the Oracle7 `connect /' syntax. If values have been set for +OCI_ATTR_USERNAME and OCI_ATTR_PASSWORD, then these are +ignored if OCI_CRED_EXT is used. +Parameters +svchp (IN) - a handle to a service context. There must be a valid server +handle set in svchp. +errhp (IN) - an error handle to the retrieve diagnostic information. +usrhp (IN/OUT) - a handle to an authentication context, which is initialized +by this call. +credt (IN) - specifies the type of credentials to use for authentication. +Valid values for credt are: +OCI_CRED_RDBMS - authenticate using a database username and +password pair as credentials. The attributes OCI_ATTR_USERNAME +and OCI_ATTR_PASSWORD should be set on the authentication +context before this call. +OCI_CRED_EXT - authenticate using external credentials. No username +or password is provided. +mode (IN) - specifies the various modes of operation. Valid modes are: +OCI_DEFAULT - in this mode, the authentication context returned may +only ever be set with the same server context specified in svchp. This +establishes the primary authentication context. +OCI_MIGRATE - in this mode, the new authentication context may be +set in a service handle with a different server handle. This mode +establishes the user authentication context. +OCI_SYSDBA - in this mode, the user is authenticated for SYSDBA +access. +OCI_SYSOPER - in this mode, the user is authenticated for SYSOPER +access. +OCI_SYSASM - in this mode, the user is authenticated for SYSASM +access. Note that only an ASM instance can grant SYSASM access. +OCI_PRELIM_AUTH - this mode may only be used with OCI_SYSDBA, OCI_SYSASM, +or OCI_SYSOPER to authenticate for certain administration tasks. +Related Functions +OCISessionEnd() + + + + + + +OCISessionEnd() +Name +OCI Terminate user Authentication Context +Purpose +Terminates a user authentication context created by OCISessionBegin() +Syntax +sword OCISessionEnd ( OCISvcCtx *svchp, + OCIError *errhp, + OCISession *usrhp, + ub4 mode); + +Comments +The user security context associated with the service context is invalidated +by this call. Storage for the authentication context is not freed. The +transaction specified by the service context is implicitly committed. The +transaction handle, if explicitly allocated, may be freed if not being used. +Resources allocated on the server for this user are freed. +The authentication handle may be reused in a new call to OCISessionBegin(). +Parameters +svchp (IN/OUT) - the service context handle. There must be a valid server +handle and user authentication handle associated with svchp. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +usrhp (IN) - de-authenticate this user. If this parameter is passed as NULL, +the user in the service context handle is de-authenticated. +mode (IN) - the only valid mode is OCI_DEFAULT. +Example +In this example, an authentication context is destroyed. +Related Functions +OCISessionBegin() + + + + +OCIStmtExecute() +Name +OCI EXECute +Purpose +This call associates an application request with a server. +Syntax +sword OCIStmtExecute ( OCISvcCtx *svchp, + OCIStmt *stmtp, + OCIError *errhp, + ub4 iters, + ub4 rowoff, + const OCISnapshot *snap_in, + OCISnapshot *snap_out, + ub4 mode ); +Comments +This function is used to execute a prepared SQL statement. +Using an execute call, the application associates a request with a server. On +success, OCI_SUCCESS is returned. +If a SELECT statement is executed, the description of the select list follows +implicitly as a response. This description is buffered on the client side for +describes, fetches and define type conversions. Hence it is optimal to +describe a select list only after an execute. +Also for SELECT statements, some results are available implicitly. Rows will +be received and buffered at the end of the execute. For queries with small row +count, a prefetch causes memory to be released in the server if the end of +fetch is reached, an optimization that may result in memory usage reduction. +Set attribute call has been defined to set the number of rows to be prefetched +per result set. +For SELECT statements, at the end of the execute, the statement handle +implicitly maintains a reference to the service context on which it is +executed. It is the user's responsibility to maintain the integrity of the +service context. If the attributes of a service context is changed for +executing some operations on this service context, the service context must +be restored to have the same attributes, that a statement was executed with, +prior to a fetch on the statement handle. The implicit reference is maintained +until the statement handle is freed or the fetch is cancelled or an end of +fetch condition is reached. +Note: If output variables are defined for a SELECT statement before a +call to OCIStmtExecute(), the number of rows specified by iters will be +fetched directly into the defined output buffers and additional rows +equivalent to the prefetch count will be prefetched. If there are no +additional rows, then the fetch is complete without calling +OCIStmtFetch(). +The execute call will return errors if the statement has bind data types that +are not supported in an Oracle7 server. +Parameters +svchp (IN/OUT) - service context handle. +stmtp (IN/OUT) - an statement handle - defines the statement and the +associated data to be executed at the server. It is invalid to pass in a +statement handle that has bind of data types only supported in release 8.0 +when srvchp points to an Oracle7 server. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. If the statement is being +batched and it is successful, then this handle will contain this particular +statement execution specific errors returned from the server when the batch is +flushed. +iters (IN) - the number of times this statement is executed for non-Select +statements. For Select statements, if iters is non-zero, then defines must +have been done for the statement handle. The execution fetches iters rows into +these predefined buffers and prefetches more rows depending upon the prefetch +row count. This function returns an error if iters=0 for non-SELECT +statements. +rowoff (IN) - the index from which the data in an array bind is relevant for +this multiple row execution. +snap_in (IN) - this parameter is optional. if supplied, must point to a +snapshot descriptor of type OCI_DTYPE_SNAP. The contents of this descriptor +must be obtained from the snap_out parameter of a previous call. The +descriptor is ignored if the SQL is not a SELECT. This facility allows +multiple service contexts to ORACLE to see the same consistent snapshot of the +database's committed data. However, uncommitted data in one context is not +visible to another context even using the same snapshot. +snap_out (OUT) - this parameter optional. if supplied, must point to a +descriptor of type OCI_DTYPE_SNAP. This descriptor is filled in with an +opaque representation which is the current ORACLE "system change +number" suitable as a snap_in input to a subsequent call to OCIStmtExecute(). +This descriptor should not be used any longer than necessary in order to avoid +"snapshot too old" errors. +mode (IN) - The modes are: +If OCI_DEFAULT_MODE, the default mode, is selected, the request is +immediately executed. Error handle contains diagnostics on error if any. +OCI_EXACT_FETCH - if the statement is a SQL SELECT, this mode is +only valid if the application has set the prefetch row count prior to this +call. In this mode, the OCI library will get up to the number of rows +specified (i.e., prefetch row count plus iters). If the number of rows +returned by the query is greater than this value, OCI_ERROR will be +returned with ORA-01422 as the implementation specific error in a +diagnostic record. If the number of rows returned by the query is +smaller than the prefetch row count, OCI_SUCCESS_WITH_INFO will +be returned with ORA-01403 as the implementation specific error. The +prefetch buffer size is ignored and the OCI library tries to allocate all the +space required to contain the prefetched rows. The exact fetch semantics +apply to only the top level rows. No more rows can be fetched for this +query at the end of the call. +OCI_KEEP_FETCH_STATE - the result set rows (not yet fetched) of this +statement executed in this transaction will be maintained when the +transaction is detached for migration. By default, a query is cancelled +when a transaction is detached for migration. This mode is the default +mode when connected to a V7 server. +Related Functions +OCIStmtPrepare() + + + + + +OCIStmtFetch() +Name +OCI FetCH +Purpose +Fetches rows from a query. +Syntax +sword OCIStmtFetch ( OCIStmt *stmtp, + OCIError *errhp, + ub4 nrows, + ub2 orientation, + ub4 mode); +Comments +The fetch call is a local call, if prefetched rows suffice. However, this is +transparent to the application. If LOB columns are being read, LOB locators +are fetched for subsequent LOB operations to be performed on these locators. +Prefetching is turned off if LONG columns are involved. +A fetch with nrows set to 0 rows effectively cancels the fetch for this +statement. +Parameters +stmtp (IN) - a statement (application request) handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +nrows (IN) - number of rows to be fetched from the current position. +orientation (IN) - for release 8.0, the only acceptable value is +OCI_FETCH_NEXT, which is also the default value. +mode (IN) - for release 8.0, beta-1, the following mode is defined. +OCI_DEFAULT - default mode +OCI_EOF_FETCH - indicates that it is the last fetch from the result set. +If nrows is non-zero, setting this mode effectively cancels fetching after +retrieving nrows, otherwise it cancels fetching immediately. +Related Functions +OCIAttrGet() + +OCIStmtFetch2() +Name +OCI FetCH2 +Purpose +Fetches rows from a query. +Syntax +sword OCIStmtFetch2 ( OCIStmt *stmtp, + OCIError *errhp, + ub4 nrows, + ub2 orientation, + ub4 scrollOffset, + ub4 mode); +Comments +The fetch call works similar to the OCIStmtFetch call with the +addition of the fetchOffset parameter. It can be used on any +statement handle, whether it is scrollable or not. For a +non-scrollable statement handle, the only acceptable value +will be OCI_FETCH_NEXT, and the fetchOffset parameter will be +ignored. Applications are encouraged to use this new call. + +A fetchOffset with OCI_FETCH_RELATIVE is equivalent to +OCI_FETCH_CURRENT with a value of 0, is equivalent to +OCI_FETCH_NEXT with a value of 1, and equivalent to +OCI_FETCH_PRIOR with a value of -1. Note that the range of +accessible rows is [1,OCI_ATTR_ROW_COUNT] beyond which an +error could be raised if sufficient rows do not exist in + +The fetch call is a local call, if prefetched rows suffice. However, this is +transparent to the application. If LOB columns are being read, LOB locators +are fetched for subsequent LOB operations to be performed on these locators. +Prefetching is turned off if LONG columns are involved. +A fetch with nrows set to 0 rows effectively cancels the fetch for this +statement. +Parameters +stmtp (IN) - a statement (application request) handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +nrows (IN) - number of rows to be fetched from the current position. +It defaults to 1 for orientation OCI_FETCH_LAST. +orientation (IN) - The acceptable values are as follows, with +OCI_FETCH_NEXT being the default value. +OCI_FETCH_CURRENT gets the current row, +OCI_FETCH_NEXT gets the next row from the current position, +OCI_FETCH_FIRST gets the first row in the result set, +OCI_FETCH_LAST gets the last row in the result set, +OCI_FETCH_PRIOR gets the previous row from the current row in the result set, +OCI_FETCH_ABSOLUTE will fetch the row number (specified by fetchOffset +parameter) in the result set using absolute positioning, +OCI_FETCH_RELATIVE will fetch the row number (specified by fetchOffset +parameter) in the result set using relative positioning. +scrollOffset(IN) - offset used with the OCI_FETCH_ABSOLUTE and +OCI_FETCH_RELATIVE orientation parameters only. It specify +the new current position for scrollable result set. It is +ignored for non-scrollable result sets. +mode (IN) - for release 8.0, beta-1, the following mode is defined. +OCI_DEFAULT - default mode +OCI_EOF_FETCH - indicates that it is the last fetch from the result set. +If nrows is non-zero, setting this mode effectively cancels fetching after +retrieving nrows, otherwise it cancels fetching immediately. +Related Functions +OCIAttrGet() + + + +OCIStmtGetPieceInfo() +Name +OCI Get Piece Information +Purpose +Returns piece information for a piecewise operation. +Syntax +sword OCIStmtGetPieceInfo( const OCIStmt *stmtp, + OCIError *errhp, + void **hndlpp, + ub4 *typep, + ub1 *in_outp, + ub4 *iterp, + ub4 *idxp, + ub1 *piecep ); + +Comments +When an execute/fetch call returns OCI_NEED_DATA to get/return a +dynamic bind/define value or piece, OCIStmtGetPieceInfo() returns the +relevant information: bind/define handle, iteration or index number and +which piece. +See the section "Runtime Data Allocation and Piecewise Operations" on page +5-16 for more information about using OCIStmtGetPieceInfo(). +Parameters +stmtp (IN) - the statement when executed returned OCI_NEED_DATA. +errhp (OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +hndlpp (OUT) - returns a pointer to the bind or define handle of the bind or +define whose runtime data is required or is being provided. +typep (OUT) - the type of the handle pointed to by hndlpp: OCI_HTYPE_BIND +(for a bind handle) or OCI_HTYPE_DEFINE (for a define handle). +in_outp (OUT) - returns OCI_PARAM_IN if the data is required for an IN bind +value. Returns OCI_PARAM_OUT if the data is available as an OUT bind +variable or a define position value. +iterp (OUT) - returns the row number of a multiple row operation. +idxp (OUT) - the index of an array element of a PL/SQL array bind operation. +piecep (OUT) - returns one of the following defined values - +OCI_ONE_PIECE, OCI_FIRST_PIECE, OCI_NEXT_PIECE and +OCI_LAST_PIECE. The default value is always OCI_ONE_PIECE. +Related Functions +OCIAttrGet(), OCIAttrGet(), OCIStmtExecute(), OCIStmtFetch(), +OCIStmtSetPieceInfo() + + + + +OCIStmtPrepare() +Name +OCI Statement REQuest +Purpose +This call defines the SQL/PLSQL statement to be executed. +Syntax +sword OCIStmtPrepare ( OCIStmt *stmtp, + OCIError *errhp, + const OraText *stmt, + ub4 stmt_len, + ub4 language, + ub4 mode); +Comments +This call is used to prepare a SQL or PL/SQL statement for execution. The +OCIStmtPrepare() call defines an application request. +This is a purely local call. Data values for this statement initialized in +subsequent bind calls will be stored in a bind handle which will hang off this +statement handle. +This call does not create an association between this statement handle and any +particular server. +See the section "Preparing Statements" on page 2-21 for more information +about using this call. +Parameters +stmtp (IN) - a statement handle. +errhp (IN) - an error handle to retrieve diagnostic information. +stmt (IN) - SQL or PL/SQL statement to be executed. Must be a null-terminated +string. The pointer to the OraText of the statement must be available as long +as the statement is executed. +stmt_len (IN) - length of the statement. Must not be zero. +language (IN) - V7, V8, or native syntax. Possible values are: +OCI_V7_SYNTAX - V7 ORACLE parsing syntax +OCI_V8_SYNTAX - V8 ORACLE parsing syntax +OCI_NTV_SYNTAX - syntax depending upon the version of the server. +mode (IN) - the only defined mode is OCI_DEFAULT for default mode. +Example +This example demonstrates the use of OCIStmtPrepare(), as well as the OCI +application initialization calls. +Related Functions +OCIAttrGet(), OCIStmtExecute() + + +OCIStmtPrepare2() +Name +OCI Statement REQuest with (a) early binding to svchp and/or +(b) stmt caching +Purpose +This call defines the SQL/PLSQL statement to be executed. +Syntax +sword OCIStmtPrepare2 ( OCISvcCtx *svchp, + OCIStmt **stmtp, + OCIError *errhp, + const OraText *stmt, + ub4 stmt_len, + const OraText *key, + ub4 key_len, + ub4 language, + ub4 mode); +Comments +This call is used to prepare a SQL or PL/SQL statement for execution. The +OCIStmtPrepare() call defines an application request. +This is a purely local call. Data values for this statement initialized in +subsequent bind calls will be stored in a bind handle which will hang off this +statement handle. +This call creates an association between the statement handle and a service +context. It differs from OCIStmtPrepare in that respect.It also supports +stmt caching. The stmt will automatically be cached if the authp of the stmt +has enabled stmt caching. +Parameters +svchp (IN) - the service context handle that contains the session that + this stmt handle belongs to. +stmtp (OUT) - an unallocated stmt handle must be pased in. An allocated + and prepared statement handle will be returned. +errhp (IN) - an error handle to retrieve diagnostic information. +stmt (IN) - SQL or PL/SQL statement to be executed. Must be a null- + terminated string. The pointer to the OraText of the statement + must be available as long as the statement is executed. +stmt_len (IN) - length of the statement. Must not be zero. +key (IN) - This is only Valid for OCI Stmt Caching. It indicates the + key to search with. It thus optimizes the search in the cache. +key_len (IN) - the length of the key. This, too, is onlly valid for stmt + caching. +language (IN) - V7, V8, or native syntax. Possible values are: +OCI_V7_SYNTAX - V7 ORACLE parsing syntax +OCI_V8_SYNTAX - V8 ORACLE parsing syntax +OCI_NTV_SYNTAX - syntax depending upon the version of the server. +mode (IN) - the defined modes are OCI_DEFAULT and OCI_PREP2_CACHE_SEARCHONLY. +Example +Related Functions +OCIStmtExecute(), OCIStmtRelease() + + +OCIStmtRelease() +Name +OCI Statement Release. This call is used to relesae the stmt that +was retreived using OCIStmtPrepare2(). If the stmt is release +using this call, OCIHandleFree() must not be called on the stmt +handle. +Purpose +This call releases the statement obtained by OCIStmtPrepare2 +Syntax +sword OCIStmtRelease ( OCIStmt *stmtp, + OCIError *errhp, + cONST OraText *key, + ub4 key_len, + ub4 mode); +Comments +This call is used to release a handle obtained via OCIStmtPrepare2(). +It also frees the memory associated with the handle. +This is a purely local call. +Parameters +stmtp (IN/OUT) - The statement handle to be released/freed. +errhp (IN) - an error handle to retrieve diagnostic information. +key (IN) - This is only Valid for OCI Stmt Caching. It indicates the + key to tag the stmt with. +key_len (IN) - the length of the key. This, too, is only valid for stmt + caching. +mode (IN) - the defined modes are OCI_DEFAULT for default mode and + OCI_STRLS_CACHE_DELETE (only used for Stmt Caching). +Example +Related Functions +OCIStmtExecute(), OCIStmtPrepare2() + + +OCIStmtSetPieceInfo() +Name +OCI Set Piece Information +Purpose +Sets piece information for a piecewise operation. +Syntax +sword OCIStmtSetPieceInfo ( void *hndlp, + ub4 type, + OCIError *errhp, + const void *bufp, + ub4 *alenp, + ub1 piece, + const void *indp, + ub2 *rcodep ); +Comments +When an execute call returns OCI_NEED_DATA to get a dynamic IN/OUT +bind value or piece, OCIStmtSetPieceInfo() sets the piece information: the +buffer, the length, the indicator and which piece is currently being processed. +For more information about using OCIStmtSetPieceInfo() see the section +"Runtime Data Allocation and Piecewise Operations" on page 5-16. +Parameters +hndlp (IN/OUT) - the bind/define handle. +type (IN) - type of the handle. +errhp (OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +bufp (IN/OUT) - bufp is a pointer to a storage containing the data value or +the piece when it is an IN bind variable, otherwise bufp is a pointer to +storage for getting a piece or a value for OUT binds and define variables. For +named data types or REFs, a pointer to the object or REF is returned. +alenp (IN/OUT) - the length of the piece or the value. +piece (IN) - the piece parameter. The following are valid values: +OCI_ONE_PIECE, OCI_FIRST_PIECE, OCI_NEXT_PIECE, or +OCI_LAST_PIECE. +The default value is OCI_ONE_PIECE. This parameter is used for IN bind +variables only. +indp (IN/OUT) - indicator. A pointer to a sb2 value or pointer to an indicator +structure for named data types (SQLT_NTY) and REFs (SQLT_REF), i.e., *indp +is either an sb2 or a void * depending upon the data type. +rcodep (IN/OUT) - return code. +Related Functions +OCIAttrGet(), OCIAttrGet(), OCIStmtExecute(), OCIStmtFetch(), +OCIStmtGetPieceInfo() + + +OCIFormatInit +Name +OCIFormat Package Initialize +Purpose +Initializes the OCIFormat package. +Syntax +sword OCIFormatInit(void *hndl, OCIError *err); +Comments +This routine must be called before calling any other OCIFormat routine. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - OCI environment or session handle +err (IN/OUT) - OCI error handle +Related Functions +OCIFormatTerm() + + +OCIFormatString +Name +OCIFormat Package Format String +Purpose +Writes a text string into the supplied text buffer using the argument +list submitted to it and in accordance with the format string given. +Syntax +sword OCIFormatString(void *hndl, OCIError *err, OraText *buffer, + sbig_ora bufferLength, sbig_ora *returnLength, + const OraText *formatString, ...); +Comments +The first call to this routine must be preceded by a call to the +OCIFormatInit routine that initializes the OCIFormat package +for use. When this routine is no longer needed then terminate +the OCIFormat package by a call to the OCIFormatTerm routine. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - OCI environment or session handle +err (IN/OUT) - OCI error handle +buffer (OUT) - text buffer for the string +bufferLength (IN) - length of the text buffer +returnLength (OUT) - length of the formatted string +formatString (IN) - format specification string +... (IN) - variable argument list +Related Functions + + +OCIFormatTerm +Name +OCIFormat Package Terminate +Purpose +Terminates the OCIFormat package. +Syntax +sword OCIFormatTerm(void *hndl, OCIError *err); +Comments +It must be called after the OCIFormat package is no longer being used. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - OCI environment or session handle +err (IN/OUT) - OCI error handle +Related Functions +OCIFormatInit() + + +OCIFormatTUb1 +Name +OCIFormat Package ub1 Type +Purpose +Return the type value for the ub1 type. +Syntax +sword OCIFormatTUb1(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUb2 +Name +OCIFormat Package ub2 Type +Purpose +Return the type value for the ub2 type. +Syntax +sword OCIFormatTUb2(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUb4 +Name +OCIFormat Package ub4 Type +Purpose +Return the type value for the ub4 type. +Syntax +sword OCIFormatTUb4(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUword +Name +OCIFormat Package uword Type +Purpose +Return the type value for the uword type. +Syntax +sword OCIFormatTUword(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUbig_ora +Name +OCIFormat Package ubig_ora Type +Purpose +Return the type value for the ubig_ora type. +Syntax +sword OCIFormatTUbig_ora(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSb1 +Name +OCIFormat Package sb1 Type +Purpose +Return the type value for the sb1 type. +Syntax +sword OCIFormatTSb1(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSb2 +Name +OCIFormat Package sb2 Type +Purpose +Return the type value for the sb2 type. +Syntax +sword OCIFormatTSb2(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSb4 +Name +OCIFormat Package sb4 Type +Purpose +Return the type value for the sb4 type. +Syntax +sword OCIFormatTSb4(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSword +Name +OCIFormat Package sword Type +Purpose +Return the type value for the sword type. +Syntax +sword OCIFormatTSword(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSbig_ora +Name +OCIFormat Package sbig_ora Type +Purpose +Return the type value for the sbig_ora type. +Syntax +sword OCIFormatTSbig_ora(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEb1 +Name +OCIFormat Package eb1 Type +Purpose +Return the type value for the eb1 type. +Syntax +sword OCIFormatTEb1(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEb2 +Name +OCIFormat Package eb2 Type +Purpose +Return the type value for the eb2 type. +Syntax +sword OCIFormatTEb2(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEb4 +Name +OCIFormat Package eb4 Type +Purpose +Return the type value for the eb4 type. +Syntax +sword OCIFormatTEb4(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEword +Name +OCIFormat Package eword Type +Purpose +Return the type value for the eword type. +Syntax +sword OCIFormatTEword(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTChar +Name +OCIFormat Package text Type +Purpose +Return the type value for the text type. +Syntax +sword OCIFormatTChar(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTText +Name +OCIFormat Package *text Type +Purpose +Return the type value for the *text type. +Syntax +sword OCIFormatTText(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTDouble +Name +OCIFormat Package double Type +Purpose +Return the type value for the double type. +Syntax +sword OCIFormatTDouble(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatDvoid +Name +OCIFormat Package void Type +Purpose +Return the type value for the void type. +Syntax +sword OCIFormatTDvoid(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEnd +Name +OCIFormat Package end Type +Purpose +Return the list terminator's "type". +Syntax +sword OCIFormatTEnd(void); +Comments +None +Parameters +None +Related Functions +None + + +OCISvcCtxToLda() +Name +OCI toggle SerVice context handle to Version 7 Lda_Def +Purpose +Toggles between a V8 service context handle and a V7 Lda_Def. +Syntax +sword OCISvcCtxToLda ( OCISvcCtx *srvhp, + OCIError *errhp, + Lda_Def *ldap ); +Comments +Toggles between an Oracle8 service context handle and an Oracle7 Lda_Def. +This function can only be called after a service context has been properly +initialized. +Once the service context has been translated to an Lda_Def, it can be used in +release 7.x OCI calls (e.g., obindps(), ofen()). +Note: If there are multiple service contexts which share the same server +handle, only one can be in V7 mode at any time. +The action of this call can be reversed by passing the resulting Lda_Def to +the OCILdaToSvcCtx() function. +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +ldap (IN/OUT) - a Logon Data Area for V7-style OCI calls which is initialized +by this call. +Related Functions +OCILdaToSvcCtx() + + + + +OCITransCommit() +Name +OCI TX (transaction) CoMmit +Purpose +Commits the transaction associated with a specified service context. +Syntax +sword OCITransCommit ( OCISvcCtx *srvcp, + OCIError *errhp, + ub4 flags ); +Comments +The transaction currently associated with the service context is committed. If +it is a distributed transaction that the server cannot commit, this call +additionally retrieves the state of the transaction from the database to be +returned to the user in the error handle. +If the application has defined multiple transactions, this function operates +on the transaction currently associated with the service context. If the +application is working with only the implicit local transaction created when +database changes are made, that implicit transaction is committed. +If the application is running in the object mode, then the modified or updated +objects in the object cache for this transaction are also committed. +The flags parameter is used for one-phase commit optimization in distributed +transactions. If the transaction is non-distributed, the flags parameter is +ignored, and OCI_DEFAULT can be passed as its value. OCI applications +managing global transactions should pass a value of +OCI_TRANS_TWOPHASE to the flags parameter for a two-phase commit. The +default is one-phase commit. +Under normal circumstances, OCITransCommit() returns with a status +indicating that the transaction has either been committed or rolled back. With +distributed transactions, it is possible that the transaction is now in-doubt +(i.e., neither committed nor aborted). In this case, OCITransCommit() +attempts to retrieve the status of the transaction from the server. +The status is returned. +Parameters +srvcp (IN) - the service context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags -see the "Comments" section above. +Related Functions +OCITransRollback() + + + + +OCITransDetach() +Name +OCI TX (transaction) DeTach +Purpose +Detaches a transaction. +Syntax +sword OCITransDetach ( OCISvcCtx *srvcp, + OCIError *errhp, + ub4 flags); +Comments +Detaches a global transaction from the service context handle. The transaction +currently attached to the service context handle becomes inactive at the end +of this call. The transaction may be resumed later by calling OCITransStart(), +specifying a flags value of OCI_TRANS_RESUME. +When a transaction is detached, the value which was specified in the timeout +parameter of OCITransStart() when the transaction was started is used to +determine the amount of time the branch can remain inactive before being +deleted by the server's PMON process. +Note: The transaction can be resumed by a different process than the one +that detached it, provided that the transaction has the same +authorization. +Parameters +srvcp (IN) - the service context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags (IN) - you must pass a value of OCI_DEFAULT for this parameter. +Related Functions +OCITransStart() + + + +OCITransForget() +Name +OCI TX (transaction) ForGeT +Purpose +Causes the server to forget a heuristically completed global transaction. +Syntax +sword OCITransForget ( OCISvcCtx *svchp, + OCIError *errhp, + ub4 flags); + +Comments + +Forgets a heuristically completed global transaction. The server deletes the +status of the transaction from the system's pending transaction table. +The XID of the transaction to be forgotten is set as an attribute of the +transaction handle (OCI_ATTR_XID). +Parameters +srvcp (IN) - the service context handle - the transaction is rolled back. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags (IN) - you must pass OCI_DEFAULT for this parameter. +Related Functions +OCITransCommit(), OCITransRollback() + + +OCITransMultiPrepare() +Name +OCI Trans(action) Multi-Branch Prepare +Purpose +Prepares a transaction with multiple branches in a single call. +Syntax +sword OCITransMultiPrepare ( OCISvcCtx *svchp, + ub4 numBranches, + OCITrans **txns, + OCIError **errhp); + +Comments + +Prepares the specified global transaction for commit. +This call is valid only for distributed transactions. +This call is an advanced performance feature intended for use only in +situations where the caller is responsible for preparing all the branches +in a transaction. +Parameters +srvcp (IN) - the service context handle. +numBranches (IN) - This is the number of branches expected. It is also the +array size for the next two parameters. +txns (IN) - This is the array of transaction handles for the branches to +prepare. They should all have the OCI_ATTR_XID set. The global transaction +ID should be the same. +errhp (IN) - This is the array of error handles. If OCI_SUCCESS is not +returned, then these will indicate which branches received which errors. +Related Functions +OCITransPrepare() + + +OCITransPrepare() +Name +OCI TX (transaction) PREpare +Purpose +Prepares a transaction for commit. +Syntax +sword OCITransPrepare ( OCISvcCtx *svchp, + OCIError *errhp, + ub4 flags); + +Comments + +Prepares the specified global transaction for commit. +This call is valid only for distributed transactions. +The call returns OCI_SUCCESS_WITH_INFO if the transaction has not made +any changes. The error handle will indicate that the transaction is read-only. +The flag parameter is not currently used. +Parameters +srvcp (IN) - the service context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags (IN) - you must pass OCI_DEFAULT for this parameter. +Related Functions +OCITransCommit(), OCITransForget() + + + + +OCITransRollback() +Name +OCI TX (transaction) RoLlback +Purpose +Rolls back the current transaction. +Syntax +sword OCITransRollback ( void *svchp, + OCIError *errhp, + ub4 flags ); +Comments +The current transaction- defined as the set of statements executed since the +last OCITransCommit() or since OCISessionBegin()-is rolled back. +If the application is running under object mode then the modified or updated +objects in the object cache for this transaction are also rolled back. +An error is returned if an attempt is made to roll back a global transaction +that is not currently active. +Parameters +svchp (IN) - a service context handle. The transaction currently set in the +service context handle is rolled back. +errhp -(IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags - you must pass a value of OCI_DEFAULT for this parameter. +Related Functions +OCITransCommit() + + + + +OCITransStart() +Name +OCI TX (transaction) STart +Purpose +Sets the beginning of a transaction. +Syntax +sword OCITransStart ( OCISvcCtx *svchp, + OCIError *errhp, + uword timeout, + ub4 flags); + +Comments +This function sets the beginning of a global or serializable transaction. The +transaction context currently associated with the service context handle is +initialized at the end of the call if the flags parameter specifies that a new +transaction should be started. +The XID of the transaction is set as an attribute of the transaction handle +(OCI_ATTR_XID) +Parameters +svchp (IN/OUT) - the service context handle. The transaction context in the +service context handle is initialized at the end of the call if the flag +specified a new transaction to be started. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded in +err and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +timeout (IN) - the time, in seconds, to wait for a transaction to become +available for resumption when OCI_TRANS_RESUME is specified. When +OCI_TRANS_NEW is specified, this value is stored and may be used later by +OCITransDetach(). +flags (IN) - specifies whether a new transaction is being started or an +existing transaction is being resumed. Also specifies serializiability or +read-only status. More than a single value can be specified. By default, +a read/write transaction is started. The flag values are: +OCI_TRANS_NEW - starts a new transaction branch. By default starts a +tightly coupled and migratable branch. +OCI_TRANS_TIGHT - explicitly specifies a tightly coupled branch +OCI_TRANS_LOOSE - specifies a loosely coupled branch +OCI_TRANS_RESUME - resumes an existing transaction branch. +OCI_TRANS_READONLY - start a readonly transaction +OCI_TRANS_SERIALIZABLE - start a serializable transaction +Related Functions +OCITransDetach() + + + + + +******************************************************************************/ +/*-----------------------Dynamic Callback Function Pointers------------------*/ + + +typedef sb4 (*OCICallbackInBind)(void *ictxp, OCIBind *bindp, ub4 iter, + ub4 index, void **bufpp, ub4 *alenp, + ub1 *piecep, void **indp); + +typedef sb4 (*OCICallbackOutBind)(void *octxp, OCIBind *bindp, ub4 iter, + ub4 index, void **bufpp, ub4 **alenp, + ub1 *piecep, void **indp, + ub2 **rcodep); + +typedef sb4 (*OCICallbackDefine)(void *octxp, OCIDefine *defnp, ub4 iter, + void **bufpp, ub4 **alenp, ub1 *piecep, + void **indp, ub2 **rcodep); + +typedef sword (*OCIUserCallback)(void *ctxp, void *hndlp, ub4 type, + ub4 fcode, ub4 when, sword returnCode, + sb4 *errnop, va_list arglist); + +typedef sword (*OCIEnvCallbackType)(OCIEnv *env, ub4 mode, + size_t xtramem_sz, void *usrmemp, + OCIUcb *ucbDesc); + +typedef sb4 (*OCICallbackLobRead)(void *ctxp, const void *bufp, + ub4 len, ub1 piece); + +typedef sb4 (*OCICallbackLobWrite)(void *ctxp, void *bufp, + ub4 *lenp, ub1 *piece); + +#ifdef ORAXB8_DEFINED + +typedef sb4 (*OCICallbackLobRead2)(void *ctxp, const void *bufp, oraub8 len, + ub1 piece, void **changed_bufpp, + oraub8 *changed_lenp); + +typedef sb4 (*OCICallbackLobWrite2)(void *ctxp, void *bufp, oraub8 *lenp, + ub1 *piece, void **changed_bufpp, + oraub8 *changed_lenp); + +typedef sb4 (*OCICallbackLobArrayRead)(void *ctxp, ub4 array_iter, + const void *bufp, oraub8 len, + ub1 piece, void **changed_bufpp, + oraub8 *changed_lenp); + +typedef sb4 (*OCICallbackLobArrayWrite)(void *ctxp, ub4 array_iter, + void *bufp, oraub8 *lenp, + ub1 *piece, void **changed_bufpp, + oraub8 *changed_lenp); +#endif + +typedef sb4 (*OCICallbackLobGetDeduplicateRegions)(void *ctxp, + OCILobRegion *regions, + ub4 count, ub1 piece, + OCILobRegion **changed_reg, + ub4 *changed_count); + +typedef sb4 (*OCICallbackAQEnq)(void *ctxp, void **payload, + void **payload_ind); + +typedef sb4 (*OCICallbackAQEnqStreaming)(void *ctxp, void **payload, + void **payload_ind, + OCIAQMsgProperties **msgprop, + OCIType **tdo); + +typedef sb4 (*OCICallbackAQDeq)(void *ctxp, void **payload, + void **payload_ind); + +/*--------------------------Failover Callback Structure ---------------------*/ +typedef sb4 (*OCICallbackFailover)(void *svcctx, void *envctx, + void *fo_ctx, ub4 fo_type, + ub4 fo_event); + +typedef struct +{ + OCICallbackFailover callback_function; + void *fo_ctx; +} +OCIFocbkStruct; + +/*---------------------Statement Cache callback function ------------------*/ + +typedef sword (*OCICallbackStmtCache)(void *ctx, OCIStmt *stmt, ub4 mode); + +/*--------------------------HA Callback Structure ---------------------*/ +typedef void (*OCIEventCallback)(void *evtctx, OCIEvent *eventhp); + + +/***************************************************************************** + ACTUAL PROTOTYPE DECLARATIONS +******************************************************************************/ + +sword OCIInitialize (ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr) ); + +sword OCITerminate( ub4 mode); + +sword OCIEnvCreate (OCIEnv **envp, ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr), + size_t xtramem_sz, void **usrmempp); + +sword OCIEnvNlsCreate (OCIEnv **envp, ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr), + size_t xtramem_sz, void **usrmempp, + ub2 charset, ub2 ncharset); + +sword OCIFEnvCreate (OCIEnv **envp, ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr), + size_t xtramem_sz, void **usrmempp, void *fupg); + +sword OCIHandleAlloc(const void *parenth, void **hndlpp, const ub4 type, + const size_t xtramem_sz, void **usrmempp); + +sword OCIHandleFree(void *hndlp, const ub4 type); + + +sword OCIDescriptorAlloc(const void *parenth, void **descpp, + const ub4 type, const size_t xtramem_sz, + void **usrmempp); + +sword OCIArrayDescriptorAlloc(const void *parenth, void **descpp, + const ub4 type, ub4 array_size, + const size_t xtramem_sz, void **usrmempp); + +sword OCIDescriptorFree(void *descp, const ub4 type); + +sword OCIArrayDescriptorFree(void **descp, const ub4 type); + +sword OCIEnvInit (OCIEnv **envp, ub4 mode, + size_t xtramem_sz, void **usrmempp); + +sword OCIServerAttach (OCIServer *srvhp, OCIError *errhp, + const OraText *dblink, sb4 dblink_len, ub4 mode); + +sword OCIServerDetach (OCIServer *srvhp, OCIError *errhp, ub4 mode); + +sword OCISessionBegin (OCISvcCtx *svchp, OCIError *errhp, OCISession *usrhp, + ub4 credt, ub4 mode); + +sword OCISessionEnd (OCISvcCtx *svchp, OCIError *errhp, OCISession *usrhp, + ub4 mode); + +sword OCILogon (OCIEnv *envhp, OCIError *errhp, OCISvcCtx **svchp, + const OraText *username, ub4 uname_len, + const OraText *password, ub4 passwd_len, + const OraText *dbname, ub4 dbname_len); + +sword OCILogon2 (OCIEnv *envhp, OCIError *errhp, OCISvcCtx **svchp, + const OraText *username, ub4 uname_len, + const OraText *password, ub4 passwd_len, + const OraText *dbname, ub4 dbname_len, + ub4 mode); + +sword OCILogoff (OCISvcCtx *svchp, OCIError *errhp); + + +sword OCIPasswordChange (OCISvcCtx *svchp, OCIError *errhp, + const OraText *user_name, ub4 usernm_len, + const OraText *opasswd, ub4 opasswd_len, + const OraText *npasswd, ub4 npasswd_len, + ub4 mode); + +sword OCIStmtPrepare (OCIStmt *stmtp, OCIError *errhp, const OraText *stmt, + ub4 stmt_len, ub4 language, ub4 mode); + +sword OCIStmtPrepare2 ( OCISvcCtx *svchp, OCIStmt **stmtp, OCIError *errhp, + const OraText *stmt, ub4 stmt_len, const OraText *key, + ub4 key_len, ub4 language, ub4 mode); + +sword OCIStmtRelease ( OCIStmt *stmtp, OCIError *errhp, const OraText *key, + ub4 key_len, ub4 mode); + +sword OCIBindByPos (OCIStmt *stmtp, OCIBind **bindp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, + ub2 dty, void *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + +sword OCIBindByName (OCIStmt *stmtp, OCIBind **bindp, OCIError *errhp, + const OraText *placeholder, sb4 placeh_len, + void *valuep, sb4 value_sz, ub2 dty, + void *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + +sword OCIBindObject (OCIBind *bindp, OCIError *errhp, const OCIType *type, + void **pgvpp, ub4 *pvszsp, void **indpp, + ub4 *indszp); + +sword OCIBindDynamic (OCIBind *bindp, OCIError *errhp, void *ictxp, + OCICallbackInBind icbfp, void *octxp, + OCICallbackOutBind ocbfp); + +sword OCIBindArrayOfStruct (OCIBind *bindp, OCIError *errhp, + ub4 pvskip, ub4 indskip, + ub4 alskip, ub4 rcskip); + +sword OCIStmtGetPieceInfo (OCIStmt *stmtp, OCIError *errhp, + void **hndlpp, ub4 *typep, + ub1 *in_outp, ub4 *iterp, ub4 *idxp, + ub1 *piecep); + +sword OCIStmtSetPieceInfo (void *hndlp, ub4 type, OCIError *errhp, + const void *bufp, ub4 *alenp, ub1 piece, + const void *indp, ub2 *rcodep); + +sword OCIStmtExecute (OCISvcCtx *svchp, OCIStmt *stmtp, OCIError *errhp, + ub4 iters, ub4 rowoff, const OCISnapshot *snap_in, + OCISnapshot *snap_out, ub4 mode); + +sword OCIDefineByPos (OCIStmt *stmtp, OCIDefine **defnp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, ub2 dty, + void *indp, ub2 *rlenp, ub2 *rcodep, ub4 mode); + +sword OCIDefineObject (OCIDefine *defnp, OCIError *errhp, + const OCIType *type, void **pgvpp, + ub4 *pvszsp, void **indpp, ub4 *indszp); + +sword OCIDefineDynamic (OCIDefine *defnp, OCIError *errhp, void *octxp, + OCICallbackDefine ocbfp); + +sword OCIRowidToChar (OCIRowid *rowidDesc, OraText *outbfp, ub2 *outbflp, + OCIError *errhp); + +sword OCIDefineArrayOfStruct (OCIDefine *defnp, OCIError *errhp, ub4 pvskip, + ub4 indskip, ub4 rlskip, ub4 rcskip); + +sword OCIStmtFetch (OCIStmt *stmtp, OCIError *errhp, ub4 nrows, + ub2 orientation, ub4 mode); + +sword OCIStmtFetch2 (OCIStmt *stmtp, OCIError *errhp, ub4 nrows, + ub2 orientation, sb4 scrollOffset, ub4 mode); + +sword OCIStmtGetBindInfo (OCIStmt *stmtp, OCIError *errhp, ub4 size, + ub4 startloc, + sb4 *found, OraText *bvnp[], ub1 bvnl[], + OraText *invp[], ub1 inpl[], ub1 dupl[], + OCIBind **hndl); + +sword OCIDescribeAny (OCISvcCtx *svchp, OCIError *errhp, + void *objptr, + ub4 objnm_len, ub1 objptr_typ, ub1 info_level, + ub1 objtyp, OCIDescribe *dschp); + +sword OCIParamGet (const void *hndlp, ub4 htype, OCIError *errhp, + void **parmdpp, ub4 pos); + +sword OCIParamSet(void *hdlp, ub4 htyp, OCIError *errhp, const void *dscp, + ub4 dtyp, ub4 pos); + +sword OCITransStart (OCISvcCtx *svchp, OCIError *errhp, + uword timeout, ub4 flags ); + +sword OCITransDetach (OCISvcCtx *svchp, OCIError *errhp, ub4 flags ); + +sword OCITransCommit (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCITransRollback (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCITransPrepare (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCITransMultiPrepare (OCISvcCtx *svchp, ub4 numBranches, + OCITrans **txns, OCIError **errhp); + +sword OCITransForget (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCIErrorGet (void *hndlp, ub4 recordno, OraText *sqlstate, + sb4 *errcodep, OraText *bufp, ub4 bufsiz, ub4 type); + +sword OCILobAppend (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp); + +sword OCILobAssign (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp); + +sword OCILobCharSetForm (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *locp, ub1 *csfrm); + +sword OCILobCharSetId (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *locp, ub2 *csid); + +sword OCILobCopy (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *dst_locp, + OCILobLocator *src_locp, ub4 amount, ub4 dst_offset, + ub4 src_offset); + +sword OCILobCreateTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub2 csid, + ub1 csfrm, + ub1 lobtype, + boolean cache, + OCIDuration duration); + + +sword OCILobClose( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp ); + + +sword OCILobDisableBuffering (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +sword OCILobEnableBuffering (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +sword OCILobErase (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amount, ub4 offset); + +sword OCILobFileClose (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep); + +sword OCILobFileCloseAll (OCISvcCtx *svchp, OCIError *errhp); + +sword OCILobFileExists (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + boolean *flag); + +sword OCILobFileGetName (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *filep, + OraText *dir_alias, ub2 *d_length, + OraText *filename, ub2 *f_length); + +sword OCILobFileIsOpen (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + boolean *flag); + +sword OCILobFileOpen (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + ub1 mode); + +sword OCILobFileSetName (OCIEnv *envhp, OCIError *errhp, + OCILobLocator **filepp, + const OraText *dir_alias, ub2 d_length, + const OraText *filename, ub2 f_length); + +sword OCILobFlushBuffer (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 flag); + +sword OCILobFreeTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +sword OCILobGetChunkSize(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *chunksizep); + +sword OCILobGetLength (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *locp, + ub4 *lenp); + +sword OCILobIsEqual (OCIEnv *envhp, const OCILobLocator *x, + const OCILobLocator *y, + boolean *is_equal); + +sword OCILobIsOpen( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + boolean *flag); + +sword OCILobIsTemporary(OCIEnv *envp, + OCIError *errhp, + OCILobLocator *locp, + boolean *is_temporary); + +sword OCILobLoadFromFile (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_filep, + ub4 amount, ub4 dst_offset, + ub4 src_offset); + +sword OCILobLocatorAssign (OCISvcCtx *svchp, OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp); + + +sword OCILobLocatorIsInit (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *locp, + boolean *is_initialized); + +sword OCILobOpen( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub1 mode ); + +sword OCILobRead (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amtp, ub4 offset, void *bufp, ub4 bufl, void *ctxp, + OCICallbackLobRead cbfp, ub2 csid, ub1 csfrm); + +sword OCILobTrim (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 newlen); + +sword OCILobWrite (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amtp, ub4 offset, void *bufp, ub4 buflen, + ub1 piece, void *ctxp, OCICallbackLobWrite cbfp, + ub2 csid, ub1 csfrm); + +sword OCILobGetDeduplicateRegions(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *locp, + OCILobRegion *regp, ub4 *count, ub1 piece, + void *ctxp, + OCICallbackLobGetDeduplicateRegions cbfp); + +sword OCILobWriteAppend(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *lobp, + ub4 *amtp, void *bufp, ub4 bufl, ub1 piece, + void *ctxp, OCICallbackLobWrite cbfp, ub2 csid, + ub1 csfrm); + +sword OCIBreak (void *hndlp, OCIError *errhp); + +sword OCIReset (void *hndlp, OCIError *errhp); + +sword OCIServerVersion (void *hndlp, OCIError *errhp, OraText *bufp, + ub4 bufsz, + ub1 hndltype); + +sword OCIServerRelease (void *hndlp, OCIError *errhp, OraText *bufp, + ub4 bufsz, + ub1 hndltype, ub4 *version); + +sword OCIAttrGet (const void *trgthndlp, ub4 trghndltyp, + void *attributep, ub4 *sizep, ub4 attrtype, + OCIError *errhp); + +sword OCIAttrSet (void *trgthndlp, ub4 trghndltyp, void *attributep, + ub4 size, ub4 attrtype, OCIError *errhp); + +sword OCISvcCtxToLda (OCISvcCtx *svchp, OCIError *errhp, Lda_Def *ldap); + +sword OCILdaToSvcCtx (OCISvcCtx **svchpp, OCIError *errhp, Lda_Def *ldap); + +sword OCIResultSetToStmt (OCIResult *rsetdp, OCIError *errhp); + +sword OCIFileClose ( void *hndl, OCIError *err, OCIFileObject *filep ); + +sword OCIUserCallbackRegister(void *hndlp, ub4 type, void *ehndlp, + OCIUserCallback callback, void *ctxp, + ub4 fcode, ub4 when, OCIUcb *ucbDesc); + +sword OCIUserCallbackGet(void *hndlp, ub4 type, void *ehndlp, + ub4 fcode, ub4 when, OCIUserCallback *callbackp, + void **ctxpp, OCIUcb *ucbDesc); + +sword OCISharedLibInit(void *metaCtx, void *libCtx, ub4 argfmt, sword argc, + void **argv, OCIEnvCallbackType envCallback); + +sword OCIFileExists ( void *hndl, OCIError *err, OraText *filename, + OraText *path, ub1 *flag ); + +sword OCIFileFlush( void *hndl, OCIError *err, OCIFileObject *filep ); + + +sword OCIFileGetLength( void *hndl, OCIError *err, OraText *filename, + OraText *path, ubig_ora *lenp ); + +sword OCIFileInit ( void *hndl, OCIError *err ); + +sword OCIFileOpen ( void *hndl, OCIError *err, OCIFileObject **filep, + OraText *filename, OraText *path, ub4 mode, ub4 create, + ub4 type ); + +sword OCIFileRead ( void *hndl, OCIError *err, OCIFileObject *filep, + void *bufp, ub4 bufl, ub4 *bytesread ); + +sword OCIFileSeek ( void *hndl, OCIError *err, OCIFileObject *filep, + uword origin, ubig_ora offset, sb1 dir ); + +sword OCIFileTerm ( void *hndl, OCIError *err ); + + +sword OCIFileWrite ( void *hndl, OCIError *err, OCIFileObject *filep, + void *bufp, ub4 buflen, ub4 *byteswritten ); + + +#ifdef ORAXB8_DEFINED + +sword OCILobCopy2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp, oraub8 amount, + oraub8 dst_offset, + oraub8 src_offset); + +sword OCILobErase2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *amount, oraub8 offset); + +sword OCILobGetLength2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *locp, oraub8 *lenp); + +sword OCILobLoadFromFile2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_filep, + oraub8 amount, oraub8 dst_offset, + oraub8 src_offset); + +sword OCILobRead2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *byte_amtp, oraub8 *char_amtp, oraub8 offset, + void *bufp, oraub8 bufl, ub1 piece, void *ctxp, + OCICallbackLobRead2 cbfp, ub2 csid, ub1 csfrm); + +sword OCILobArrayRead (OCISvcCtx *svchp, OCIError *errhp, ub4 *array_iter, + OCILobLocator **lobp_arr, oraub8 *byte_amt_arr, + oraub8 *char_amt_arr, oraub8 *offset_arr, + void **bufp_arr, oraub8 *bufl_arr, ub1 piece, + void *ctxp, OCICallbackLobArrayRead cbfp, ub2 csid, + ub1 csfrm); + +sword OCILobTrim2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 newlen); + +sword OCILobWrite2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *byte_amtp, oraub8 *char_amtp, oraub8 offset, + void *bufp, oraub8 buflen, ub1 piece, void *ctxp, + OCICallbackLobWrite2 cbfp, ub2 csid, ub1 csfrm); + +sword OCILobArrayWrite (OCISvcCtx *svchp, OCIError *errhp, ub4 *array_iter, + OCILobLocator **lobp_arr, oraub8 *byte_amt_arr, + oraub8 *char_amt_arr, oraub8 *offset_arr, + void **bufp_arr, oraub8 *bufl_arr, ub1 piece, + void *ctxp, OCICallbackLobArrayWrite cbfp, ub2 csid, + ub1 csfrm); + +sword OCILobWriteAppend2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, + oraub8 *byte_amtp, oraub8 *char_amtp, void *bufp, + oraub8 bufl, ub1 piece, void *ctxp, + OCICallbackLobWrite2 cbfp, ub2 csid, ub1 csfrm); + +sword OCILobGetStorageLimit (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, oraub8 *limitp); + +sword OCILobGetOptions (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, + ub4 optypes, void *optionsp, ub4 *optionslenp, + ub4 mode); + +sword OCILobSetOptions (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, + ub4 optypes, void *optionsp, ub4 optionslen, + ub4 mode); + +sword OCILobGetContentType (OCISvcCtx *svchp, + OCIError *errhp, OCILobLocator *lobp, + oratext *contenttypep, ub4 *contenttypelenp, + ub4 mode); + +sword OCILobSetContentType (OCISvcCtx *svchp, + OCIError *errhp, OCILobLocator *lobp, + const oratext *contenttypep, ub4 contenttypelen, + ub4 mode); + +#endif + +/* + ** Initialize the security package + */ +sword OCISecurityInitialize (OCISecurity *sechandle, OCIError *error_handle); + +sword OCISecurityTerminate (OCISecurity *sechandle, OCIError *error_handle); + +sword OCISecurityOpenWallet(OCISecurity *osshandle, + OCIError *error_handle, + size_t wrllen, + OraText *wallet_resource_locator, + size_t pwdlen, + OraText *password, + nzttWallet *wallet); + +sword OCISecurityCloseWallet(OCISecurity *osshandle, + OCIError *error_handle, + nzttWallet *wallet); + +sword OCISecurityCreateWallet(OCISecurity *osshandle, + OCIError *error_handle, + size_t wrllen, + OraText *wallet_resource_locator, + size_t pwdlen, + OraText *password, + nzttWallet *wallet); + +sword OCISecurityDestroyWallet(OCISecurity *osshandle, + OCIError *error_handle, + size_t wrllen, + OraText *wallet_resource_locator, + size_t pwdlen, + OraText *password); + +sword OCISecurityStorePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona **persona, + nzttWallet *wallet); + +sword OCISecurityOpenPersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona); + +sword OCISecurityClosePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona); + +sword OCISecurityRemovePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona **persona); + +sword OCISecurityCreatePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentType identity_type, + nzttCipherType cipher_type, + nzttPersonaDesc *desc, + nzttPersona **persona); + +sword OCISecuritySetProtection(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttcef crypto_engine_function, + nztttdufmt data_unit_format, + nzttProtInfo *protection_info); + +sword OCISecurityGetProtection(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttcef crypto_engine_function, + nztttdufmt * data_unit_format_ptr, + nzttProtInfo *protection_info); + +sword OCISecurityRemoveIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr); + +sword OCISecurityCreateIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentType type, + nzttIdentityDesc *desc, + nzttIdentity **identity_ptr); + +sword OCISecurityAbortIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr); + +sword OCISecurityFreeIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr); + + +sword OCISecurityStoreTrustedIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr, + nzttPersona *persona); + +sword OCISecuritySign(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *buffer_block); + +sword OCISecuritySignExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t inputlen, + size_t *signature_length); + +sword OCISecurityVerify(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t siglen, + ub1 *signature, + nzttBufferBlock *extracted_message, + boolean *verified, + boolean *validated, + nzttIdentity **signing_party_identity); + +sword OCISecurityValidate(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttIdentity *identity, + boolean *validated); + +sword OCISecuritySignDetached(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t input_length, + ub1 * input, + nzttBufferBlock *signature); + +sword OCISecuritySignDetExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *required_buffer_length); + +sword OCISecurityVerifyDetached(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t data_length, + ub1 *data, + size_t siglen, + ub1 *signature, + boolean *verified, + boolean *validated, + nzttIdentity **signing_party_identity); + +sword OCISecurity_PKEncrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_of_recipients, + nzttIdentity *recipient_list, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *encrypted_data); + +sword OCISecurityPKEncryptExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_recipients, + size_t input_length, + size_t *buffer_length_required); + +sword OCISecurityPKDecrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *encrypted_data); + +sword OCISecurityEncrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *encrypted_data); + +sword OCISecurityEncryptExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *encrypted_data_length); + +sword OCISecurityDecrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces decryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *decrypted_data); + +sword OCISecurityEnvelope(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_of_recipients, + nzttIdentity *identity, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *enveloped_data); + +sword OCISecurityDeEnvelope(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces decryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *output_message, + boolean *verified, + boolean *validated, + nzttIdentity **sender_identity); + +sword OCISecurityKeyedHash(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces hash_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *keyed_hash); + +sword OCISecurityKeyedHashExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *required_buffer_length); + +sword OCISecurityHash(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces hash_state, + size_t input, + ub1 *input_length, + nzttBufferBlock *hash); + +sword OCISecurityHashExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *required_buffer_length); + +sword OCISecuritySeedRandom(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t seed_length, + ub1 *seed); + +sword OCISecurityRandomBytes(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_of_bytes_desired, + nzttBufferBlock *random_bytes); + +sword OCISecurityRandomNumber(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + uword *random_number_ptr); + +sword OCISecurityInitBlock(OCISecurity *osshandle, + OCIError *error_handle, + nzttBufferBlock *buffer_block); + +sword OCISecurityReuseBlock(OCISecurity *osshandle, + OCIError *error_handle, + nzttBufferBlock *buffer_block); + +sword OCISecurityPurgeBlock(OCISecurity *osshandle, + OCIError *error_handle, + nzttBufferBlock *buffer_block); + +sword OCISecuritySetBlock(OCISecurity *osshandle, + OCIError *error_handle, + uword flags_to_set, + size_t buffer_length, + size_t used_buffer_length, + ub1 *buffer, + nzttBufferBlock *buffer_block); + +sword OCISecurityGetIdentity(OCISecurity *osshandle, + OCIError *error_handle, + size_t namelen, + OraText *distinguished_name, + nzttIdentity **identity); + +sword OCIAQEnq(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQEnqOptions *enqopt, OCIAQMsgProperties *msgprop, + OCIType *payload_tdo, void **payload, void **payload_ind, + OCIRaw **msgid, ub4 flags); + +sword OCIAQDeq(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQDeqOptions *deqopt, OCIAQMsgProperties *msgprop, + OCIType *payload_tdo, void **payload, void **payload_ind, + OCIRaw **msgid, ub4 flags); + +sword OCIAQEnqArray(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQEnqOptions *enqopt, ub4 *iters, + OCIAQMsgProperties **msgprop, OCIType *payload_tdo, + void **payload, void **payload_ind, OCIRaw **msgid, + void *ctxp, OCICallbackAQEnq enqcbfp, ub4 flags); + +sword OCIAQEnqStreaming(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQEnqOptions *enqopt, OCIType *payload_tdo, + void *ctxp, OCICallbackAQEnqStreaming enqcbfp, + ub4 flags); + +sword OCIAQDeqArray(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQDeqOptions *deqopt, ub4 *iters, + OCIAQMsgProperties **msgprop, OCIType *payload_tdo, + void **payload, void **payload_ind, OCIRaw **msgid, + void *ctxp, OCICallbackAQDeq deqcbfp, ub4 flags); + +sword OCIAQListen(OCISvcCtx *svchp, OCIError *errhp, + OCIAQAgent **agent_list, ub4 num_agents, + sb4 wait, OCIAQAgent **agent, + ub4 flags); + +sword OCIAQListen2(OCISvcCtx *svchp, OCIError *errhp, + OCIAQAgent **agent_list, ub4 num_agents, + OCIAQListenOpts *lopts, OCIAQAgent **agent, + OCIAQLisMsgProps *lmops, ub4 flags); + +sword OCIAQGetReplayInfo(OCISvcCtx *svchp, OCIError *errhp, + OraText *queue_name, OCIAQAgent *sender, + ub4 replay_attribute, OraText *correlation, + ub2 *corr_len); + +sword OCIAQResetReplayInfo(OCISvcCtx *svchp, OCIError *errhp, + OraText *queue_name, OCIAQAgent *sender, + ub4 replay_attribute); + +sword OCIExtractInit(void *hndl, OCIError *err); + +sword OCIExtractTerm(void *hndl, OCIError *err); + +sword OCIExtractReset(void *hndl, OCIError *err); + +sword OCIExtractSetNumKeys(void *hndl, OCIError *err, uword numkeys); + +sword OCIExtractSetKey(void *hndl, OCIError *err, const OraText *name, + ub1 type, ub4 flag, const void *defval, + const sb4 *intrange, const OraText *const *strlist); + +sword OCIExtractFromFile(void *hndl, OCIError *err, ub4 flag, + OraText *filename); + +sword OCIExtractFromStr(void *hndl, OCIError *err, ub4 flag, OraText *input); + +sword OCIExtractToInt(void *hndl, OCIError *err, OraText *keyname, + uword valno, sb4 *retval); + +sword OCIExtractToBool(void *hndl, OCIError *err, OraText *keyname, + uword valno, ub1 *retval); + +sword OCIExtractToStr(void *hndl, OCIError *err, OraText *keyname, + uword valno, OraText *retval, uword buflen); + +sword OCIExtractToOCINum(void *hndl, OCIError *err, OraText *keyname, + uword valno, OCINumber *retval); + +sword OCIExtractToList(void *hndl, OCIError *err, uword *numkeys); + +sword OCIExtractFromList(void *hndl, OCIError *err, uword index, + OraText **name, + ub1 *type, uword *numvals, void ***values); + +/* Memory Related Service Interfaces */ + +sword OCIMemoryAlloc(void *hdl, OCIError *err, void **mem, + OCIDuration dur, ub4 size, ub4 flags); + +sword OCIMemoryResize(void *hdl, OCIError *err, void **mem, + ub4 newsize, ub4 flags); + +sword OCIMemoryFree(void *hdl, OCIError *err, void *mem); + +sword OCIContextSetValue(void *hdl, OCIError *err, OCIDuration duration, + ub1 *key, ub1 keylen, void *ctx_value); + +sword OCIContextGetValue(void *hdl, OCIError *err, ub1 *key, + ub1 keylen, void **ctx_value); + +sword OCIContextClearValue(void *hdl, OCIError *err, ub1 *key, + ub1 keylen); + +sword OCIContextGenerateKey(void *hdl, OCIError *err, ub4 *key); + +sword OCIMemorySetCurrentIDs(void *hdl, OCIError *err, + ub4 curr_session_id, ub4 curr_trans_id, + ub4 curr_stmt_id); + +sword OCIPicklerTdsCtxInit(OCIEnv *env, OCIError *err, + OCIPicklerTdsCtx **tdsc); + +sword OCIPicklerTdsCtxFree(OCIEnv *env, OCIError *err, OCIPicklerTdsCtx *tdsc); + +sword OCIPicklerTdsInit(OCIEnv *env, OCIError *err, OCIPicklerTdsCtx *tdsc, + OCIPicklerTds **tdsh); + +sword OCIPicklerTdsFree(OCIEnv *env, OCIError *err, OCIPicklerTds *tdsh); + +sword OCIPicklerTdsCreateElementNumber(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub1 prec, + sb1 scale, OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElementChar(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub2 len, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElementVarchar(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub2 len, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElementRaw(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub2 len, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElement(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, OCITypeCode dty, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsAddAttr(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, OCIPicklerTdsElement elt); + +sword OCIPicklerTdsGenerate(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh); + +sword OCIPicklerTdsGetAttr(OCIEnv *env, OCIError *err, + const OCIPicklerTds *tdsh, ub1 attrno, + OCITypeCode *typ, ub2 *len); + +sword OCIPicklerFdoInit(OCIEnv *env, OCIError *err, + OCIPicklerFdo **fdoh); + +sword OCIPicklerFdoFree(OCIEnv *env, OCIError *err, + OCIPicklerFdo *fdoh); + +sword OCIPicklerImageInit(OCIEnv *env, OCIError *err, + OCIPicklerFdo *fdoh, + OCIPicklerTds *tdsh, + OCIPicklerImage **imgh); + +sword OCIPicklerImageFree(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +sword OCIPicklerImageAddScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, + void *scalar, ub4 len); + +sword OCIPicklerImageAddNullScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +sword OCIPicklerImageGenerate(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +sword OCIPicklerImageGetScalarSize(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, + ub4 attrno, ub4 *size); + +sword OCIPicklerImageGetScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, ub4 attrno, + void *buf, ub4 *len, OCIInd *ind); + +sword OCIPicklerImageCollBegin(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, const OCIPicklerTds *colltdsh); + +sword OCIPicklerImageCollAddScalar( OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, void *scalar, + ub4 buflen, OCIInd ind); + +sword OCIPicklerImageCollEnd(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +/* should take svcctx for locator stuff */ +sword OCIPicklerImageCollBeginScan(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, const OCIPicklerTds *coll_tdsh, + ub4 attrnum, ub4 startidx, OCIInd *ind); + +sword OCIPicklerImageCollGetScalarSize(OCIEnv *env, OCIError *err, + const OCIPicklerTds *coll_tdsh, ub4 *size); + +sword OCIPicklerImageCollGetScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, void *buf, + ub4 *buflen, OCIInd *ind); + +sword OCIAnyDataGetType(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode *tc, OCIType **type); + +sword OCIAnyDataIsNull(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + boolean *isnull); + +sword OCIAnyDataConvert(OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, + OCIType *type, OCIDuration dur, void *ind, void *data_val, + ub4 len, OCIAnyData **sdata); + +sword OCIAnyDataBeginCreate(OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, + OCIType *type, OCIDuration dur, OCIAnyData **sdata); + +sword OCIAnyDataDestroy(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata); + +sword OCIAnyDataAttrSet(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *attr_val, + ub4 length, boolean is_any); + +sword OCIAnyDataCollAddElem(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata, OCITypeCode tc, OCIType *type, void *ind, + void *attr_val, ub4 length, boolean is_any, boolean last_elem); + +sword OCIAnyDataEndCreate(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata); + +sword OCIAnyDataAccess(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *attr_val, + ub4 *length); + +sword OCIAnyDataGetCurrAttrNum(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata, ub4 *attrnum); + +sword OCIAnyDataAttrGet(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *attr_val, + ub4 *length, boolean is_any); + +sword OCIAnyDataCollGetElem(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *celem_val, + ub4 *length, boolean is_any); + + +/*------------------------ OCIAnyDataSet interfaces -------------------------*/ + +/* + NAME + OCIAnyDataSetBeginCreate - OCIAnyDataSet Begin Creation + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns OCI_ERROR. + Diagnostic information can be obtained by calling + OCIErrorGet(). + typecode - typecode corresponding to the OCIAnyDataSet. + type (IN) - type corresponding to the OCIAnyDataSet. If the typecode + corresponds to a built-in type (OCI_TYPECODE_NUMBER etc.) + , this parameter can be NULL. It should be non NULL for + user defined types (OCI_TYPECODE_OBJECT, + OCI_TYPECODE_REF, collection types etc.) + dur (IN) - duration for which OCIAnyDataSet is allocated. + data_set (OUT) - Initialized OCIAnyDataSet. + RETURNS - error code + NOTES + This call allocates an OCIAnyDataSet for the duration of dur and + initializes it with the type information. The OCIAnyDataSet can hold + multiple instances of the given type. For performance reasons, the + OCIAnyDataSet will end up pointing to the passed in OCIType parameter. + It is the responsibility of the caller to ensure that the OCIType is + longer lived (has allocation duration >= the duration of the OCIAnyData + if the OCIType is a transient one, allocation/pin duration >= duration of + the OCIAnyData if the OCIType is a persistent one). + +*/ +sword OCIAnyDataSetBeginCreate(OCISvcCtx *svchp, OCIError *errhp, + OCITypeCode typecode, const OCIType *type, OCIDuration dur, + OCIAnyDataSet ** data_set); + +/* + NAME + OCIAnyDataSetDestroy - OCIAnyDataSet Destroy + DESCRIPTION + This call frees the OCIAnyDataSet allocated using + OCIAnyDataSetBeginCreate(). + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI Error handle. + data_set (IN/OUT) - OCIAnyDataSet to be freed. +*/ +sword OCIAnyDataSetDestroy(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set); + + +/* + NAME + OCIAnyDataSetAddInstance - OCIAnyDataSet Add an instance + DESCRIPTION + This call adds a new skeleton instance to the OCIAnyDataSet and all the + attributes of the instance are set to NULL. It returns this skeleton + instance through the OCIAnyData parameter which can be constructed + subsequently by invoking the OCIAnyData API. + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI Error handle. + data_set (IN/OUT) - OCIAnyDataSet to which a new instance is added. + data (IN/OUT) - OCIAnyData corresponding to the newly added + instance. If (*data) is NULL, a new OCIAnyData will + be allocated for same duration as the OCIAnyDataSet. + If (*data) is not NULL, it will get reused. This + OCIAnyData can be subseqently constructed using the + OCIAnyDataConvert() call or it can be constructed + piece-wise using the OCIAnyDataAttrSet and + OCIAnyDataCollAddElem calls. + NOTES + No Destruction of the old value is done here. It is the responsibility of + the caller to destroy the old value pointed to by (*data) and set (*data) + to a null pointer before beginning to make a sequence of this call. No + deep copying (of OCIType information nor the data part.) is done in the + returned OCIAnyData. This OCIAnyData cannot be used beyond the allocation + duration of the OCIAnyDataSet (it is like a reference into the + OCIAnyDataSet). The returned OCIAnyData can be reused on subsequent calls + to this function, to sequentially add new data instances to the + OCIAnyDataSet. +*/ +sword OCIAnyDataSetAddInstance(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, OCIAnyData **data); + +/* + NAME + OCIAnyDataSetEndCreate - OCIAnyDataSet End Creation process. + DESCRIPTION + This call marks the end of OCIAnyDataSet creation. It should be called + after constructing all of its instance(s). + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained + by calling OCIErrorGet(). + data_set (IN/OUT) - OCIAnyDataSet that has been fully constructed. +*/ +sword OCIAnyDataSetEndCreate(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set); + +/* + NAME + OCIAnyDataSetGetType - OCIAnyDataSet Get Type of an OCIAnyDataSet + DESCRIPTION + Gets the Type corresponding to an OCIAnyDataSet. It returns the actual + pointer to the type maintained inside an OCIAnyDataSet. No copying is + done for performance reasons. The client is responsible for not using + this type once the OCIAnyDataSet is freed (or its duration ends). + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI Error handle. + data_set (IN) - Initialized OCIAnyDataSet. + tc (OUT) - The typecode of the type. + type (OUT) - The type corresponding to the OCIAnyDataSet. This + could be null if the OCIAnyData corresponds to a + built-in type. +*/ +sword OCIAnyDataSetGetType (OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, OCITypeCode *tc, OCIType **type); + +/* + NAME + OCIAnyDataSetGetCount - OCIAnyDataSet Get Count of instances. + DESCRIPTION + This call gets the number of instances in the OCIAnyDataSet. + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - OCI Service Context + errhp (IN/OUT) - OCI Error handle + data_set (IN) - Well formed OCIAnyDataSet. + count (OUT) - number of instances in OCIAnyDataSet +*/ +sword OCIAnyDataSetGetCount(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, ub4 *count); + +/* + NAME + OCIAnyDataSetGetInstance - OCIAnyDataSet Get next instance. + DESCRIPTION + Only sequential access to the instances in an OCIAnyDataSet is allowed. + This call returns the OCIAnyData corresponding to an instance at the + current position and updates the current position. Subsequently, the + OCIAnyData access routines may be used to access the instance. + RETURNS + error code. Returns OCI_NO_DATA if the current position is at the end of + the set, OCI_SUCCESS otherwise. + PARAMETERS + svchp (IN/OUT) - OCI Service Context + errhp (IN/OUT) - OCI Error handle + data_set (IN) - Well formed OCIAnyDataSet + data (IN/OUT) - OCIAnyData corresponding to the instance. If (*data) + is NULL, a new OCIAnyData will be allocated for same + duration as the OCIAnyDataSet. If (*data) is not NULL + , it will get reused. This OCIAnyData can be + subsequently accessed using the OCIAnyDataAccess() + call or piece-wise by using the OCIAnyDataAttrGet() + call. + NOTE + No Destruction of the old value is done here. It is the responsibility of + the caller to destroy the old value pointed to by (*data) and set (*data) + to a null pointer before beginning to make a sequence of this call. No deep + copying (of OCIType information nor the data part.) is done in the returned + OCIAnyData. This OCIAnyData cannot be used beyond the allocation duration + of the OCIAnyDataSet (it is like a reference into the OCIAnyDataSet). The + returned OCIAnyData can be reused on subsequent calls to this function to + sequentially access the OCIAnyDataSet. +*/ +sword OCIAnyDataSetGetInstance(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, OCIAnyData **data); + +/*--------------------- End of OCIAnyDataSet interfaces ---------------------*/ + +sword OCIFormatInit(void *hndl, OCIError *err); + +sword OCIFormatString(void *hndl, OCIError *err, OraText *buffer, + sbig_ora bufferLength, sbig_ora *returnLength, + const OraText *formatString, ...); + +sword OCIFormatTerm(void *hndl, OCIError *err); + +sword OCIFormatTUb1(void); +sword OCIFormatTUb2(void); +sword OCIFormatTUb4(void); +sword OCIFormatTUword(void); +sword OCIFormatTUbig_ora(void); +sword OCIFormatTSb1(void); +sword OCIFormatTSb2(void); +sword OCIFormatTSb4(void); +sword OCIFormatTSword(void); +sword OCIFormatTSbig_ora(void); +sword OCIFormatTEb1(void); +sword OCIFormatTEb2(void); +sword OCIFormatTEb4(void); +sword OCIFormatTEword(void); +sword OCIFormatTChar(void); +sword OCIFormatTText(void); +sword OCIFormatTDouble(void); +sword OCIFormatTDvoid(void); +sword OCIFormatTEnd(void); + +/*-------------------------- Extensions to XA interface ---------------------*/ +/* ------------------------- xaosvch ----------------------------------------*/ +/* + NAME + xaosvch - XA Oracle get SerViCe Handle + DESCRIPTION + Given a database name return the service handle that is used by the + XA library + NOTE + This macro has been provided for backward compatibilty with 8.0.2 +*/ +OCISvcCtx *xaosvch(OraText *dbname); + +/* ------------------------- xaoSvcCtx --------------------------------------*/ +/* + NAME + xaoSvcCtx - XA Oracle get SerViCe ConTeXt + DESCRIPTION + Given a database name return the service handle that is used by the + XA library + NOTE + This routine has been provided for APs to get access to the service + handle that XA library uses. Without this routine APs must use SQLLIB + routine sqlld2 to get access to the Logon data area registered by the + XA library +*/ +OCISvcCtx *xaoSvcCtx(OraText *dbname); + +/* ------------------------- xaoEnv -----------------------------------------*/ +/* + NAME + xaoEnv - XA Oracle get ENvironment Handle + DESCRIPTION + Given a database name return the environment handle that is used by the + XA library + NOTE + This routine has been provided for APs to get access to the environment + handle that XA library uses. Without this routine APs must use SQLLIB + routine sqlld2 to get access to the Logon data area registered by the + XA library +*/ +OCIEnv *xaoEnv(OraText *dbname); + +/* ------------------------- xaosterr ---------------------------------------*/ +/* + NAME + xaosterr - XA Oracle get xa STart ERRor code + DESCRIPTION + Given an oracle error code return the XA error code + */ +int xaosterr(OCISvcCtx *svch, sb4 error); +/*-------------------------- End Extensions ---------------------------------*/ +/*---------------------- Extensions to NLS cartridge service ----------------*/ +/* ----------------------- OCINlsGetInfo ------------------------------------*/ +/* + NAME + OCINlsGetInfo - Get NLS info from OCI environment handle + REMARKS + This function generates language information specified by item from OCI + environment handle envhp into an array pointed to by buf within size + limitation as buflen. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR on wrong item. + envhp(IN/OUT) + OCI environment handle. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and + this function returns a NULL pointer. Diagnostic information can be + obtained by calling OCIErrorGet(). + buf(OUT) + Pointer to the destination buffer. + buflen(IN) + The size of destination buffer. The maximum length for each information + is 32 bytes. + item(IN) + It specifies to get which item in OCI environment handle and can be one + of following values: + OCI_NLS_DAYNAME1 : Native name for Monday. + OCI_NLS_DAYNAME2 : Native name for Tuesday. + OCI_NLS_DAYNAME3 : Native name for Wednesday. + OCI_NLS_DAYNAME4 : Native name for Thursday. + OCI_NLS_DAYNAME5 : Native name for Friday. + OCI_NLS_DAYNAME6 : Native name for for Saturday. + OCI_NLS_DAYNAME7 : Native name for for Sunday. + OCI_NLS_ABDAYNAME1 : Native abbreviated name for Monday. + OCI_NLS_ABDAYNAME2 : Native abbreviated name for Tuesday. + OCI_NLS_ABDAYNAME3 : Native abbreviated name for Wednesday. + OCI_NLS_ABDAYNAME4 : Native abbreviated name for Thursday. + OCI_NLS_ABDAYNAME5 : Native abbreviated name for Friday. + OCI_NLS_ABDAYNAME6 : Native abbreviated name for for Saturday. + OCI_NLS_ABDAYNAME7 : Native abbreviated name for for Sunday. + OCI_NLS_MONTHNAME1 : Native name for January. + OCI_NLS_MONTHNAME2 : Native name for February. + OCI_NLS_MONTHNAME3 : Native name for March. + OCI_NLS_MONTHNAME4 : Native name for April. + OCI_NLS_MONTHNAME5 : Native name for May. + OCI_NLS_MONTHNAME6 : Native name for June. + OCI_NLS_MONTHNAME7 : Native name for July. + OCI_NLS_MONTHNAME8 : Native name for August. + OCI_NLS_MONTHNAME9 : Native name for September. + OCI_NLS_MONTHNAME10 : Native name for October. + OCI_NLS_MONTHNAME11 : Native name for November. + OCI_NLS_MONTHNAME12 : Native name for December. + OCI_NLS_ABMONTHNAME1 : Native abbreviated name for January. + OCI_NLS_ABMONTHNAME2 : Native abbreviated name for February. + OCI_NLS_ABMONTHNAME3 : Native abbreviated name for March. + OCI_NLS_ABMONTHNAME4 : Native abbreviated name for April. + OCI_NLS_ABMONTHNAME5 : Native abbreviated name for May. + OCI_NLS_ABMONTHNAME6 : Native abbreviated name for June. + OCI_NLS_ABMONTHNAME7 : Native abbreviated name for July. + OCI_NLS_ABMONTHNAME8 : Native abbreviated name for August. + OCI_NLS_ABMONTHNAME9 : Native abbreviated name for September. + OCI_NLS_ABMONTHNAME10 : Native abbreviated name for October. + OCI_NLS_ABMONTHNAME11 : Native abbreviated name for November. + OCI_NLS_ABMONTHNAME12 : Native abbreviated name for December. + OCI_NLS_YES : Native string for affirmative response. + OCI_NLS_NO : Native negative response. + OCI_NLS_AM : Native equivalent string of AM. + OCI_NLS_PM : Native equivalent string of PM. + OCI_NLS_AD : Native equivalent string of AD. + OCI_NLS_BC : Native equivalent string of BC. + OCI_NLS_DECIMAL : decimal character. + OCI_NLS_GROUP : group separator. + OCI_NLS_DEBIT : Native symbol of debit. + OCI_NLS_CREDIT : Native sumbol of credit. + OCI_NLS_DATEFORMAT : Oracle date format. + OCI_NLS_INT_CURRENCY: International currency symbol. + OCI_NLS_LOC_CURRENCY : Locale currency symbol. + OCI_NLS_LANGUAGE : Language name. + OCI_NLS_ABLANGUAGE : Abbreviation for language name. + OCI_NLS_TERRITORY : Territory name. + OCI_NLS_CHARACTER_SET : Character set name. + OCI_NLS_LINGUISTIC : Linguistic name. + OCI_NLS_CALENDAR : Calendar name. + OCI_NLS_DUAL_CURRENCY : Dual currency symbol. +*/ +sword OCINlsGetInfo(void *envhp, OCIError *errhp, OraText *buf, + size_t buflen, ub2 item); + +/* ----------------------- OCINlsNumericInfoGet -----------------------------*/ +/* + NAME + OCINlsNumericInfoGet - Get NLS numeric info from OCI environment handle + REMARKS + This function generates numeric language information specified by item + from OCI environment handle envhp into an output number variable. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR on wrong item. + envhp(IN/OUT) + OCI environment handle. If handle invalid, returns OCI_INVALID_HANDLE. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and + this function returns a NULL pointer. Diagnostic information can be + obtained by calling OCIErrorGet(). + val(OUT) + Pointer to the output number variable. On OCI_SUCCESS return, it will + contain the requested NLS numeric info. + item(IN) + It specifies to get which item in OCI environment handle and can be one + of following values: + OCI_NLS_CHARSET_MAXBYTESZ : Maximum character byte size for OCI + environment or session handle charset + OCI_NLS_CHARSET_FIXEDWIDTH: Character byte size for fixed-width charset; + 0 for variable-width charset +*/ +sword OCINlsNumericInfoGet(void *envhp, OCIError *errhp, sb4 *val, ub2 item); + +/* ----------------------- OCINlsCharSetNameToId ----------------------------*/ +/* + NAME + OCINlsCharSetNameToId - Get Oracle charset id given Oracle charset name + REMARKS + This function will get the Oracle character set id corresponding to + the given Oracle character set name. + RETURNS + Oracle character set id for the given Oracle character set name if + character set name and OCI handle are valid; otherwise returns 0. + envhp(IN/OUT) + OCI environment handle. + name(IN) + Pointer to a null-terminated Oracle character set name whose id + will be returned. +*/ +ub2 OCINlsCharSetNameToId(void *envhp, const oratext *name); + +/* ----------------------- OCINlsCharSetIdToName ----------------------------*/ +/* + NAME + OCINlsCharSetIdToName - Get Oracle charset name given Oracle charset id + REMARKS + This function will get the Oracle character set name corresponding to + the given Oracle character set id. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR + envhp(IN/OUT) + OCI environment handle. If handle invalid, returns OCI_INVALID_HANDLE. + buf(OUT) + Pointer to the destination buffer. On OCI_SUCCESS return, it will contain + the null-terminated string for character set name. + buflen(IN) + Size of destination buffer. Recommended size is OCI_NLS_MAXBUFSZ for + guarantee to store an Oracle character set name. If it's smaller than + the length of the character set name, the function will return OCI_ERROR. + id(IN) + Oracle character set id. +*/ +sword OCINlsCharSetIdToName(void *envhp, oratext *buf, size_t buflen, ub2 id); + +/* ----------------------- OCINlsNameMap ------------------------------------*/ +/* + NAME + OCINlsNameMap - Map NLS naming from Oracle to other standards and vice + versa + REMARKS + This function will map NLS naming from Oracle to other standards (such + as ISO, IANA) and vice versa. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR + envhp(IN/OUT) + OCI environment handle. If handle invalid, returns OCI_INVALID_HANDLE. + buf(OUT) + Pointer to the destination buffer. On OCI_SUCCESS return, it will + contain null-terminated string for requested mapped name. + buflen(IN) + The size of destination buffer. Recommended size is OCI_NLS_MAXBUFSZ + for guarantee to store an NLS name. If it is smaller than the length + of the name, the function will return OCI_ERROR. + srcbuf(IN) + Pointer to null-terminated NLS name. If it is not a valid name in its + define scope, the function will return OCI_ERROR. + flag(IN) + It specifies name mapping direction and can take the following values: + OCI_NLS_CS_IANA_TO_ORA : Map character set name from IANA to Oracle + OCI_NLS_CS_ORA_TO_IANA : Map character set name from Oracle to IANA + OCI_NLS_LANG_ISO_TO_ORA : Map language name from ISO to Oracle + OCI_NLS_LANG_ORA_TO_ISO : Map language name from Oracle to ISO + OCI_NLS_TERR_ISO_TO_ORA : Map territory name from ISO to Oracle + OCI_NLS_TERR_ORA_TO_ISO : Map territory name from Oracle to ISO + OCI_NLS_TERR_ISO3_TO_ORA : Map territory name from 3-letter ISO + abbreviation to Oracle + OCI_NLS_TERR_ORA_TO_ISO3 : Map territory name from Oracle to 3-letter + ISO abbreviation +*/ +sword OCINlsNameMap(void *envhp, oratext *buf, size_t buflen, + const oratext *srcbuf, ub4 flag); + +/* -------------------- OCIMultiByteToWideChar ------------------------------*/ +/* + NAME + OCIMultiByteToWideChar - Convert a null terminated multibyte string into + wchar + REMARKS + This routine converts an entire null-terminated string into the wchar + format. The wchar output buffer will be null-terminated. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Destination buffer for wchar. + src (IN) + Source string to be converted. + rsize (OUT) + Number of characters converted including null-terminator. + If it is a NULL pointer, no number return +*/ +sword OCIMultiByteToWideChar(void *envhp, OCIWchar *dst, const OraText *src, + size_t *rsize); + + +/* --------------------- OCIMultiByteInSizeToWideChar -----------------------*/ +/* + NAME + OCIMultiByteInSizeToWideChar - Convert a mulitbyte string in length into + wchar + REMARKS + This routine converts part of string into the wchar format. It will + convert as many complete characters as it can until it reaches output + buffer size or input buffer size or it reaches a null-terminator in + source string. The output buffer will be null-terminated if space permits. + If dstsz is zero, this function will only return number of characters not + including ending null terminator for converted string. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Pointer to a destination buffer for wchar. It can be NULL pointer when + dstsz is zero. + dstsz(IN) + Destination buffer size in character. If it is zero, this function just + returns number of characters will be need for the conversion. + src (IN) + Source string to be converted. + srcsz(IN) + Length of source string in byte. + rsize(OUT) + Number of characters written into destination buffer, or number of + characters for converted string is dstsz is zero. + If it is NULL pointer, nothing to return. +*/ +sword OCIMultiByteInSizeToWideChar(void *envhp, OCIWchar *dst, + size_t dstsz, const OraText *src, + size_t srcsz, size_t *rsize); + + +/* ---------------------- OCIWideCharToMultiByte ----------------------------*/ +/* + NAME + OCIWideCharToMultiByte - Convert a null terminated wchar string into + multibyte + REMARKS + This routine converts an entire null-terminated wide character string into + multi-byte string. The output buffer will be null-terminated. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Destination buffer for multi-byte string. + src (IN) + Source wchar string to be converted. + rsize (OUT) + Number of bytes written into the destination buffer. + If it is NULL pointer, nothing to return. +*/ +sword OCIWideCharToMultiByte(void *envhp, OraText *dst, const OCIWchar *src, + size_t *rsize); + + +/* ---------------------- OCIWideCharInSizeToMultiByte ----------------------*/ +/* + NAME + OCIWideCharInSizeToMultiByte - Convert a wchar string in length into + mulitbyte + REMARKS + This routine converts part of wchar string into the multi-byte format. + It will convert as many complete characters as it can until it reaches + output buffer size or input buffer size or it reaches a null-terminator + in source string. The output buffer will be null-terminated if space + permits. If dstsz is zero, the function just returns the size of byte not + including ending null-terminator need to store the converted string. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Destination buffer for multi-byte. It can be NULL pointer if dstsz is + zero. + dstsz(IN) + Destination buffer size in byte. If it is zero, it just returns the size + of bytes need for converted string. + src (IN) + Source wchar string to be converted. + srcsz(IN) + Length of source string in character. + rsize(OUT) + Number of bytes written into destination buffer, or number of bytes need + to store the converted string if dstsz is zero. + If it is NULL pointer, nothing to return. +*/ +sword OCIWideCharInSizeToMultiByte(void *envhp, OraText *dst, + size_t dstsz, const OCIWchar *src, + size_t srcsz, size_t *rsize); + + + +/* ----------------------- OCIWideCharIsAlnum -------------------------------*/ +/* + NAME + OCIWideCharIsAlnum - test whether wc is a letter or decimal digit + REMARKS + It tests whether wc is a letter or decimal digit. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsAlnum(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsAlpha -------------------------------*/ +/* + NAME + OCIWideCharIsAlpha - test whether wc is an alphabetic letter + REMARKS + It tests whether wc is an alphabetic letter + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsAlpha(void *envhp, OCIWchar wc); + + +/* --------------------- OCIWideCharIsCntrl ---------------------------------*/ +/* + NAME + OCIWideCharIsCntrl - test whether wc is a control character + REMARKS + It tests whether wc is a control character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsCntrl(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsDigit -------------------------------*/ +/* + NAME + OCIWideCharIsDigit - test whether wc is a decimal digit character + REMARKS + It tests whether wc is a decimal digit character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsDigit(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsGraph -------------------------------*/ +/* + NAME + OCIWideCharIsGraph - test whether wc is a graph character + REMARKS + It tests whether wc is a graph character. A graph character is character + with a visible representation and normally includes alphabetic letter, + decimal digit, and punctuation. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsGraph(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsLower -------------------------------*/ +/* + NAME + OCIWideCharIsLower - test whether wc is a lowercase letter + REMARKS + It tests whether wc is a lowercase letter. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsLower(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsPrint -------------------------------*/ +/* + NAME + OCIWideCharIsPrint - test whether wc is a printable character + REMARKS + It tests whether wc is a printable character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsPrint(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsPunct -------------------------------*/ +/* + NAME + OCIWideCharIsPunct - test whether wc is a punctuation character + REMARKS + It tests whether wc is a punctuation character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsPunct(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsSpace -------------------------------*/ +/* + NAME + OCIWideCharIsSpace - test whether wc is a space character + REMARKS + It tests whether wc is a space character. A space character only causes + white space in displayed text(for example, space, tab, carriage return, + newline, vertical tab or form feed). + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsSpace(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsUpper -------------------------------*/ +/* + NAME + OCIWideCharIsUpper - test whether wc is a uppercase letter + REMARKS + It tests whether wc is a uppercase letter. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsUpper(void *envhp, OCIWchar wc); + + +/*----------------------- OCIWideCharIsXdigit -------------------------------*/ +/* + NAME + OCIWideCharIsXdigit - test whether wc is a hexadecimal digit + REMARKS + It tests whether wc is a hexadecimal digit ( 0-9, A-F, a-f ). + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsXdigit(void *envhp, OCIWchar wc); + + +/* --------------------- OCIWideCharIsSingleByte ----------------------------*/ +/* + NAME + OCIWideCharIsSingleByte - test whether wc is a single-byte character + REMARKS + It tests whether wc is a single-byte character when converted into + multi-byte. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsSingleByte(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharToLower -------------------------------*/ +/* + NAME + OCIWideCharToLower - Convert a wchar into the lowercase + REMARKS + If there is a lower-case character mapping for wc in the specified locale, + it will return the lower-case in wchar, else return wc itself. + RETURNS + A wchar + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for lowercase mapping. +*/ +OCIWchar OCIWideCharToLower(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharToUpper -------------------------------*/ +/* + NAME + OCIWideCharToUpper - Convert a wchar into the uppercase + REMARKS + If there is a upper-case character mapping for wc in the specified locale, + it will return the upper-case in wchar, else return wc itself. + RETURNS + A wchar + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for uppercase mapping. +*/ +OCIWchar OCIWideCharToUpper(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharStrcmp --------------------------------*/ +/* + NAME + OCIWideCharStrcmp - compare two null terminated wchar string + REMARKS + It compares two wchar string in binary ( based on wchar encoding value ), + linguistic, or case-insensitive. + RETURNS + 0, if wstr1 == wstr2. + Positive, if wstr1 > wstr2. + Negative, if wstr1 < wstr2. + envhp(IN/OUT) + OCI environment handle to determine the character set. + wstr1(IN) + Pointer to a null-terminated wchar string. + wstr2(IN) + Pointer to a null-terminated wchar string. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY : for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC : for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIWideCharStrcmp(void *envhp, const OCIWchar *wstr1, + const OCIWchar *wstr2, int flag); + + +/* ----------------------- OCIWideCharStrncmp -------------------------------*/ +/* + NAME + OCIWideCharStrncmp - compare twe wchar string in length + REMARKS + This function is similar to OCIWideCharStrcmp(), except that at most len1 + characters from wstr1 and len2 characters from wstr1 are compared. The + null-terminator will be taken into the comparison. + RETURNS + 0, if wstr1 = wstr2 + Positive, if wstr1 > wstr2 + Negative, if wstr1 < wstr2 + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr1(IN) + Pointer to the first wchar string + len1(IN) + The length for the first string for comparison + wstr2(IN) + Pointer to the second wchar string + len2(IN) + The length for the second string for comparison. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY : for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC : for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIWideCharStrncmp(void *envhp, const OCIWchar *wstr1, size_t len1, + const OCIWchar *wstr2, size_t len2, int flag); + + +/* ----------------------- OCIWideCharStrcat --------------------------------*/ +/* + NAME + OCIWideCharStrcat - concatenate two wchar strings + REMARKS + This function appends a copy of the wchar string pointed to by wsrcstr, + including the null-terminator to the end of wchar string pointed to by + wdststr. It returns the number of character in the result string not + including the ending null-terminator. + RETURNS + number of characters in the result string not including the ending + null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(IN/OUT) + Pointer to the destination wchar string for appending. + wsrcstr(IN) + Pointer to the source wchar string to append. +*/ +size_t OCIWideCharStrcat(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr); + + +/* ----------------------- OCIWideCharStrchr --------------------------------*/ +/* + NAME + OCIWideCharStrchr - Search the first occurrence of wchar in a wchar string + REMARKS + This function searchs for the first occurrence of wc in the wchar string + pointed to by wstr. It returns a pointer to the whcar if successful, or + a null pointer. + RETURNS + wchar pointer if successful, otherwise a null pointer. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr(IN) + Pointer to the wchar string to search + wc(IN) + Wchar to search for. +*/ +OCIWchar *OCIWideCharStrchr(void *envhp, const OCIWchar *wstr, + OCIWchar wc); + + +/* ----------------------- OCIWideCharStrcpy --------------------------------*/ +/* + NAME + OCIWideCharStrcpy - copy a wchar string + REMARKS + This function copies the wchar string pointed to by wsrcstr, including the + null-terminator, into the array pointed to by wdststr. It returns the + number of character copied not including the ending null-terminator. + RETURNS + number of characters copied not including the ending null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(OUT) + Pointer to the destination wchar buffer. + wsrcstr(IN) + Pointer to the source wchar string. +*/ +size_t OCIWideCharStrcpy(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr); + + +/* ----------------------- OCIWideCharStrlen --------------------------------*/ +/* + NAME + OCIWideCharStrlen - Return number of character in a wchar string + REMARKS + This function computes the number of characters in the wchar string + pointed to by wstr, not including the null-terminator, and returns + this number. + RETURNS + number of characters not including ending null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr(IN) + Pointer to the source wchar string. +*/ +size_t OCIWideCharStrlen(void *envhp, const OCIWchar *wstr); + + +/* ----------------------- OCIWideCharStrncat -------------------------------*/ +/* + NAME + OCIWideCharStrncat - Concatenate wchar string in length + REMARKS + This function is similar to OCIWideCharStrcat(), except that at most n + characters from wsrcstr are appended to wdststr. Note that the + null-terminator in wsrcstr will stop appending. wdststr will be + null-terminated.. + RETURNS + Number of characters in the result string not including the ending + null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(IN/OUT) + Pointer to the destination wchar string for appending. + wsrcstr(IN) + Pointer to the source wchar string to append. + n(IN) + Number of characters from wsrcstr to append. +*/ +size_t OCIWideCharStrncat(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr, size_t n); + + +/* ----------------------- OCIWideCharStrncpy -------------------------------*/ +/* + NAME + OCIWideCharStrncpy - Copy wchar string in length + REMARKS + This function is similar to OCIWideCharStrcpy(), except that at most n + characters are copied from the array pointed to by wsrcstr to the array + pointed to by wdststr. Note that the null-terminator in wdststr will + stop coping and result string will be null-terminated. + RETURNS + number of characters copied not including the ending null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(OUT) + Pointer to the destination wchar buffer. + wsrcstr(IN) + Pointer to the source wchar string. + n(IN) + Number of characters from wsrcstr to copy. +*/ +size_t OCIWideCharStrncpy(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr, size_t n); + + +/* ----------------------- OCIWideCharStrrchr -------------------------------*/ +/* + NAME + OCIWideCharStrrchr - search the last occurrence of a wchar in wchar string + REMARKS + This function searchs for the last occurrence of wc in the wchar string + pointed to by wstr. It returns a pointer to the whcar if successful, or + a null pointer. + RETURNS + wchar pointer if successful, otherwise a null pointer. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr(IN) + Pointer to the wchar string to search + wc(IN) + Wchar to search for. +*/ +OCIWchar *OCIWideCharStrrchr(void *envhp, const OCIWchar *wstr, + OCIWchar wc); + + +/* --------------------- OCIWideCharStrCaseConversion -----------------------*/ +/* + NAME + OCIWideCharStrCaseConversion - convert a wchar string into lowercase or + uppercase + REMARKS + This function convert the wide char string pointed to by wsrcstr into the + uppercase or lowercase specified by flag and copies the result into the + array pointed to by wdststr. The result string will be null-terminated. + RETURNS + number of characters for result string not including null-terminator. + envhp(IN/OUT) + OCI environment handle. + wdststr(OUT) + Pointer to destination array. + wsrcstr(IN) + Pointer to source string. + flag(IN) + Specify the case to convert: + OCI_NLS_UPPERCASE : convert to uppercase. + OCI_NLS_LOWERCASE: convert to lowercase. + This flag can be ORed with OCI_NLS_LINGUISTIC to specify that the + linguistic setting in the locale will be used for case conversion. +*/ +size_t OCIWideCharStrCaseConversion(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr, ub4 flag); + + +/*---------------------- OCIWideCharDisplayLength ---------------------------*/ +/* + NAME + OCIWideCharDisplayLength - Calculate the display length for a wchar + REMARKS + This function determines the number of column positions required for wc + in display. It returns number of column positions, or 0 if wc is + null-terminator. + RETURNS + Number of display positions. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar character. +*/ +size_t OCIWideCharDisplayLength(void *envhp, OCIWchar wc ); + + +/*---------------------- OCIWideCharMultiByteLength -------------------------*/ +/* + NAME + OCIWideCharMultiByteLength - Determine byte size in multi-byte encoding + REMARKS + This function determines the number of byte required for wc in multi-byte + encoding. It returns number of bytes in multi-byte for wc. + RETURNS + Number of bytes. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar character. +*/ +size_t OCIWideCharMultiByteLength(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIMultiByteStrcmp -------------------------------*/ +/* + NAME + OCIMultiByteStrcmp - Compare two multi-byte strings + REMARKS + It compares two multi-byte strings in binary ( based on encoding value ), + linguistic, or case-insensitive. + RETURNS + 0, if str1 == str2. + Positive, if str1 > str2. + Negative, if str1 < str2. + envhp(IN/OUT) + OCI environment handle to determine the character set. + str1(IN) + Pointer to a null-terminated string. + str2(IN) + Pointer to a null-terminated string. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY: for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC: for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIMultiByteStrcmp(void *envhp, const OraText *str1, + const OraText *str2, int flag); + + +/*----------------------- OCIMultiByteStrncmp -------------------------------*/ +/* + NAME + OCIMultiByteStrncmp - compare two strings in length + REMARKS + This function is similar to OCIMultiBytestrcmp(), except that at most + len1 bytes from str1 and len2 bytes from str2 are compared. The + null-terminator will be taken into the comparison. + RETURNS + 0, if str1 = str2 + Positive, if str1 > str2 + Negative, if str1 < str2 + envhp(IN/OUT) + OCI environment handle to determine the character set. + str1(IN) + Pointer to the first string + len1(IN) + The length for the first string for comparison + str2(IN) + Pointer to the second string + len2(IN) + The length for the second string for comparison. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY: for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC: for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIMultiByteStrncmp(void *envhp, const OraText *str1, size_t len1, + OraText *str2, size_t len2, int flag); + + +/*----------------------- OCIMultiByteStrcat --------------------------------*/ +/* + NAME + OCIMultiByteStrcat - concatenate multibyte strings + REMARKS + This function appends a copy of the multi-byte string pointed to by + srcstr, including the null-terminator to the end of string pointed to by + dststr. It returns the number of bytes in the result string not including + the ending null-terminator. + RETURNS + number of bytes in the result string not including the ending + null-terminator. + envhp(IN/OUT) + Pointer to OCI environment handle + dststr(IN/OUT) + Pointer to the destination multi-byte string for appending. + srcstr(IN) + Pointer to the source string to append. +*/ +size_t OCIMultiByteStrcat(void *envhp, OraText *dststr, + const OraText *srcstr); + + +/*------------------------- OCIMultiByteStrcpy ------------------------------*/ +/* + NAME + OCIMultiByteStrcpy - copy multibyte string + REMARKS + This function copies the multi-byte string pointed to by srcstr, + including the null-terminator, into the array pointed to by dststr. It + returns the number of bytes copied not including the ending + null-terminator. + RETURNS + number of bytes copied not including the ending null-terminator. + envhp(IN/OUT) + Pointer to the OCI environment handle. + srcstr(OUT) + Pointer to the destination buffer. + dststr(IN) + Pointer to the source multi-byte string. +*/ +size_t OCIMultiByteStrcpy(void *envhp, OraText *dststr, + const OraText *srcstr); + + +/*----------------------- OCIMultiByteStrlen --------------------------------*/ +/* + NAME + OCIMultiByteStrlen - Calculate multibyte string length + REMARKS + This function computes the number of bytes in the multi-byte string + pointed to by str, not including the null-terminator, and returns this + number. + RETURNS + number of bytes not including ending null-terminator. + str(IN) + Pointer to the source multi-byte string. +*/ +size_t OCIMultiByteStrlen(void *envhp, const OraText *str); + + +/*----------------------- OCIMultiByteStrncat -------------------------------*/ +/* + NAME + OCIMultiByteStrncat - concatenate string in length + REMARKS + This function is similar to OCIMultiBytestrcat(), except that at most n + bytes from srcstr are appended to dststr. Note that the null-terminator in + srcstr will stop appending and the function will append as many character + as possible within n bytes. dststr will be null-terminated. + RETURNS + Number of bytes in the result string not including the ending + null-terminator. + envhp(IN/OUT) + Pointer to OCI environment handle. + srcstr(IN/OUT) + Pointer to the destination multi-byte string for appending. + dststr(IN) + Pointer to the source multi-byte string to append. + n(IN) + Number of bytes from srcstr to append. +*/ +size_t OCIMultiByteStrncat(void *envhp, OraText *dststr, + const OraText *srcstr, size_t n); + + +/*----------------------- OCIMultiByteStrncpy -------------------------------*/ +/* + NAME + OCIMultiByteStrncpy - copy multibyte string in length + REMARKS + This function is similar to OCIMultiBytestrcpy(), except that at most n + bytes are copied from the array pointed to by srcstr to the array pointed + to by dststr. Note that the null-terminator in srcstr will stop coping and + the function will copy as many character as possible within n bytes. The + result string will be null-terminated. + RETURNS + number of bytes copied not including the ending null-terminator. + envhp(IN/OUT) + Pointer to a OCI environment handle. + dststr(IN) + Pointer to the source multi-byte string. + srcstr(OUT) + Pointer to the destination buffer. + n(IN) + Number of bytes from srcstr to copy. +*/ +size_t OCIMultiByteStrncpy(void *envhp, OraText *dststr, + const OraText *srcstr, size_t n); + + +/*----------------------- OCIMultiByteStrnDisplayLength ---------------------*/ +/* + NAME + OCIMultiByteStrnDisplayLength - calculate the display length for a + multibyt string + REMARKS + This function returns the number of display positions occupied by the + complete characters within the range of n bytes. + RETURNS + number of display positions. + envhp(IN/OUT) + OCI environment handle. + str(IN) + Pointer to a multi-byte string. + n(IN) + Number of bytes to examine. +*/ +size_t OCIMultiByteStrnDisplayLength(void *envhp, const OraText *str1, + size_t n); + + +/*---------------------- OCIMultiByteStrCaseConversion ---------------------*/ +/* + NAME + OCIMultiByteStrCaseConversion + REMARKS + This function convert the multi-byte string pointed to by srcstr into the + uppercase or lowercase specified by flag and copies the result into the + array pointed to by dststr. The result string will be null-terminated. + RETURNS + number of bytes for result string not including null-terminator. + envhp(IN/OUT) + OCI environment handle. + dststr(OUT) + Pointer to destination array. + srcstr(IN) + Pointer to source string. + flag(IN) + Specify the case to convert: + OCI_NLS_UPPERCASE: convert to uppercase. + OCI_NLS_LOWERCASE: convert to lowercase. + This flag can be ORed with OCI_NLS_LINGUISTIC to specify that the + linguistic setting in the locale will be used for case conversion. +*/ +size_t OCIMultiByteStrCaseConversion(void *envhp, OraText *dststr, + const OraText *srcstr, ub4 flag); + + +/*------------------------- OCICharSetToUnicode -----------------------------*/ +/* + NAME + OCICharSetToUnicode - convert multibyte string into Unicode as UCS2 + REMARKS + This function converts a multi-byte string pointed to by src to Unicode + into the array pointed to by dst. The conversion will stop when it reach + to the source limitation or destination limitation. + The function will return number of characters converted into Unicode. + If dstlen is zero, it will just return the number of characters for the + result without real conversion. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + Pointer to an OCI environment handle + dst(OUT) + Pointer to a destination buffer + dstlen(IN) + Size of destination buffer in character + src(IN) + Pointer to multi-byte source string. + srclen(IN) + Size of source string in bytes. + rsize(OUT) + Number of characters converted. + If it is a NULL pointer, nothing to return. +*/ +sword OCICharSetToUnicode(void *envhp, ub2 *dst, size_t dstlen, + const OraText *src, size_t srclen, size_t *rsize); + + +/*------------------------- OCIUnicodeToCharSet -----------------------------*/ +/* + NAME + OCIUnicodeToCharSet - convert Unicode into multibyte + REMARKS + This function converts a Unicode string pointed to by src to multi-byte + into the array pointed to by dst. The conversion will stop when it reach + to the source limitation or destination limitation. The function will + return number of bytes converted into multi-byte. If dstlen is zero, it + will just return the number of bytes for the result without real + conversion. If a Unicode character is not convertible for the character + set specified in OCI environment handle, a replacement character will be + used for it. In this case, OCICharSetConversionIsReplacementUsed() will + return ture. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + Pointer to an OCI environment handle. + dst(OUT) + Pointer to a destination buffer. + dstlen(IN) + Size of destination buffer in byte. + src(IN) + Pointer to a Unicode string. + srclen(IN) + Size of source string in characters. + rsize(OUT) + Number of bytes converted. + If it is a NULL pointer, nothing to return. +*/ +sword OCIUnicodeToCharSet(void *envhp, OraText *dst, size_t dstlen, + const ub2 *src, size_t srclen, size_t *rsize); + +/*----------------------- OCINlsCharSetConvert ------------------------------*/ +/* + NAME + OCINlsCharSetConvert - convert between any two character set. + REMARKS + This function converts a string pointed to by src in the character set + specified with srcid to the array pointed to by dst in the character set + specified with dstid. The conversion will stop when it reaches the source + limitation or destination limitation. The function will return the number + of bytes converted into the destination buffer. Even though either source + or destination character set id is OCI_UTF16ID, given and return data + length will be represented with the byte length as this function is + intended for generic purpose. Note the conversion will not stop at null + data. + To get character set id from name, OCINlsCharSetNameToId can be used. + To check if derived data in the destination buffer contains any + replacement character resulting from conversion failure, + OCICharSetConversionIsReplacementUsed can be used to get the status. + Data alignment should be guaranteed by a caller. For example, UTF-16 data + should be aligned to ub2 type. + + RETURNS + OCI_SUCCESS or OCI_ERROR. + errhp(IN/OUT) + OCI error handle. If there is an error, it is recorded in errhp and this + function returns a NULL pointer. Diagnostic information can be obtained + by calling OCIErrorGet(). + dstid(IN) + Character set id for the destination buffer. + dstp(OUT) + Pointer to the destination buffer. + dstlen(IN) + The maximum byte size of destination buffer. + srcid(IN) + Character set id for the source buffer. + srcp(IN) + Pointer to the source buffer. + srclen(IN) + The length byte size of source buffer. + rsize(OUT) + The number of characters converted. If it is a NULL pointer, nothing to + return. +*/ +sword OCINlsCharSetConvert(void *envhp, OCIError *errhp, + ub2 dstid, void *dstp, size_t dstlen, + ub2 srcid, const void *srcp, size_t srclen, + size_t *rsize); + + +/* ------------------- OCICharsetConversionIsReplacementUsed ----------------*/ +/* + NAME + OCICharsetConversionIsReplacementUsed - chech if replacement is used in + conversion + REMARKS + This function indicates whether or not the replacement character was used + for nonconvertible characters in character set conversion in last invoke + of OCICharsetUcs2ToMb(). + RETURNS + TRUE is the replacement character was used in last OCICharsetUcs2ToMb() + invoking, else FALSE. + envhp(IN/OUT) + OCI environment handle. This should be the first handle passed to + OCICharsetUcs2ToMb(). +*/ +boolean OCICharSetConversionIsReplacementUsed(void *envhp); + +/*------------------- OCINlsEnvironmentVariableGet -----------------*/ +/* + NAME + OCINlsEnvironmentVariableGet - get a value of NLS environment variable. + + DESCRIPTION + This function retrieves a value of NLS environment variable to the buffer + pointed to by val. Data type is determined by the parameter specified by + item. Either numeric data or string data can be retrieved. + + RETURNS + OCI_SUCCESS or OCI_ERROR. + + PARAMETERS + valp(OUT) - + Pointer to the buffer. + size(IN) - + Size of the buffer. This argument is only applicable to string data type, + but not to numerical data, in such case, it is ignored. + item(IN) - + NLS item value, which can be one of following values: + OCI_NLS_CHARSET_ID - NLS_LANG character set id in ub2 data type. + OCI_NLS_NCHARSET_ID - NLS_NCHAR character set id in ub2 data type. + charset(IN) - + Character set id for retrieved string data. If it is 0, NLS_LANG will be + used. OCI_UTF16ID is a valid id. In case of numeric data, this argument + is ignored. + rsize(OUT) - + Size of return value. + + NOTE + This functions is mainly used for retrieving character set id from either + NLS_LANG or NLS_NCHAR environment variables. If NLS_LANG is not set, + the default character set id is returned. + For future extension, the buffer is capable for storing other data types. +*/ +sword OCINlsEnvironmentVariableGet(void *valp, size_t size, ub2 item, + ub2 charset, size_t *rsize); + + +/*------------------------- OCIMessageOpen ----------------------------------*/ +/* + NAME + OCIMessageOpen - open a locale message file + REMARKS + This function opens a message handle for facility of product in a language + pointed to by envhp. It first try to open the message file corresponding + to envhp for the facility. If it successes, it will use that file to + initialize a message handle, else it will use the default message file + which is for American language for the facility. The function return a + pointer pointed to a message handle into msghp parameter. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + A pointer to OCI environment handle for message language. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and this + function returns a NULL pointer. Diagnostic information can be obtained by + calling OCIErrorGet(). + msghp(OUT) + a message handle for return + product(IN) + A pointer to a product name. Product name is used to locate the directory + for message in a system dependent way. For example, in Solaris, the + directory of message files for the product `rdbms' is + `${ORACLE_HOME}/rdbms'. + facility(IN) + A pointer to a facility name in the product. It is used to construct a + message file name. A message file name follows the conversion with + facility as prefix. For example, the message file name for facility + `img' in American language will be `imgus.msb' where `us' is the + abbreviation of American language and `msb' as message binary file + extension. + dur(IN) + Duration for memory allocation for the return message handle. It can be + the following values: + OCI_DURATION_CALL + OCI_DURATION_STATEMENT + OCI_DURATION_SESSION + OCI_DURATION_TRANSACTION + For the detail description, please refer to Memory Related Service + Interfaces section. +*/ +sword OCIMessageOpen(void *envhp, OCIError *errhp, OCIMsg **msghp, + const OraText *product, const OraText *facility, + OCIDuration dur); + + +/*------------------------- OCIMessageGet -----------------------------------*/ +/* + NAME + OCIMessageGet - get a locale message from a message handle + REMARKS + This function will get message with message number identified by msgno and + if buflen is not zero, the function will copy the message into the buffer + pointed to by msgbuf. If buflen is zero, the message will be copied into + a message buffer inside the message handle pointed to by msgh. For both + cases. it will return the pointer to the null-terminated message string. + If it cannot get the message required, it will return a NULL pointer. + RETURNS + A pointer to a null-terminated message string on success, otherwise a NULL + pointer. + msgh(IN/OUT) + Pointer to a message handle which was previously opened by + OCIMessageOpen(). + msgno(IN) + The message number for getting message. + msgbuf(OUT) + Pointer to a destination buffer to the message retrieved. If buflen is + zero, it can be NULL pointer. + buflen(IN) + The size of the above destination buffer. +*/ +OraText *OCIMessageGet(OCIMsg *msgh, ub4 msgno, OraText *msgbuf, + size_t buflen); + +/*------------------------- OCIMessageClose ---------------------------------*/ +/* + NAME + OCIMessageClose - close a message handle + REMARKS + This function closes a message handle pointed to by msgh and frees any + memory associated with this handle. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + A pointer to OCI environment handle for message language. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and this + function returns a NULL pointer. Diagnostic information can be obtained by + calling OCIErrorGet(). + msghp(IN/OUT) + A pointer to a message handle which was previously opened by + OCIMessageOpen(). +*/ +sword OCIMessageClose(void *envhp, OCIError *errhp, OCIMsg *msghp); + +/*--------------- End of Extensions to NLS cartridge service ----------------*/ + + +/*----------------- Extensions to OCI Thread interface ---------------------*/ +/***************************************************************************** + DESCRIPTION +****************************************************************************** +1 Threads Interface + +The OCIThread package provides a number of commonly used threading +primitives for use by Oracle customers. It offers a portable interface to +threading capabilities native to various platforms. It does not implement +threading on platforms which do not have native threading capability. + +OCIThread does not provide a portable implementation of multithreaded +facilities. It only serves as a set of portable covers for native +multithreaded facilities. Therefore, platforms that do not have native +support for multi-threading will only be able to support a limited +implementation of OCIThread. As a result, products that rely on all of +OCIThread's functionality will not port to all platforms. Products that must +port to all platforms must use only a subset of OCIThread's functionality. +This issue is discussed further in later sections of this document. + +The OCIThread API is split into four main parts. Each part is described +briefly here. The following subsections describe each in greater detail. + + 1. Initialization and Termination Calls + + These calls deal with the initialization and termination of OCIThread. + Initialization of OCIThread initializes the OCIThread context which is + a member of the OCI environment or session handle. This context is + required for other OCIThread calls. + + 2. Passive Threading Primitives + + The passive threading primitives include primitives to manipulate mutual + exclusion (mutex) locks, thread ID's, and thread-specific data keys. + + The reason that these primitives are described as 'passive' is that while + their specifications allow for the existence of multiple threads, they do + not require it. This means that it is possible for these primitives to + be implemented according to specification in both single-threaded and + multi-threaded environments. + + As a result, OCIThread clients that use only these primitives will not + require the existence of multiple threads in order to work correctly, + i.e., they will be able to work in single-threaded environments without + branching code. + + 3. Active Threading Primitives + + Active threading primitives include primitives dealing with the creation, + termination, and other manipulation of threads. + + The reason that these primitives are described as 'active' is that they + can only be used in true multi-threaded environments. Their + specifications explicitly require that it be possible to have multiple + threads. If you need to determine at runtime whether or not you are in a + multi-threaded environment, call OCIThreadIsMulti() before calling an + OCIThread active primitive. + + +1.1 Initialization & Termination +================================== + +The types and functions described in this section are associated with the +initialization and termination of the OCIThread package. OCIThread must +be properly initialized before any of its functionality can be used. +OCIThread's process initialization function, 'OCIThreadProcessInit()', +must be called with care; see below. + +The observed behavior of the initialization and termination functions is the +same regardless of whether OCIThread is in single-threaded or multi-threaded +environment. It is OK to call the initialization functions from both generic +and operating system specific (OSD) code. + +1.1.1 Types + + OCIThreadContext - OCIThread Context + ------------------------------------- + + Most calls to OCIThread functions take the OCI environment or session + handle as a parameter. The OCIThread context is part of the OCI + environment or session handle and it must be initialized by calling + 'OCIThreadInit()'. Termination of the OCIThread context occurs by calling + 'OCIThreadTerm()'. + + The OCIThread context is a private data structure. Clients must NEVER + attempt to examine the contents of the context. + +1.1.2 OCIThreadProcessInit + + OCIThreadProcessInit - OCIThread Process INITialization + -------------------------------------------------------- + + Description + + This function should be called to perform OCIThread process + initialization. + + Prototype + + void OCIThreadProcessInit(); + + Returns + + Nothing. + + Notes + + Whether or not this function needs to be called depends on how OCI + Thread is going to be used. + + * In a single-threaded application, calling this function is optional. + If it is called at all, the first call to it must occur before calls + to any other OCIThread functions. Subsequent calls can be made + without restriction; they will not have any effect. + + * In a multi-threaded application, this function MUST be called. The + first call to it MUST occur 'strictly before' any other OCIThread + calls; i.e., no other calls to OCIThread functions (including other + calls to this one) can be concurrent with the first call. + Subsequent calls to this function can be made without restriction; + they will not have any effect. + + +1.1.3 OCIThreadInit + + OCIThreadInit - OCIThread INITialize + ------------------------------------- + + Description + + This initializes OCIThread context. + + Prototype + + sword OCIThreadInit(void *hndl, OCIError *err); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal for OCIThread clients to try an examine the memory + pointed to by the returned pointer. + + It is safe to make concurrent calls to 'OCIThreadInit()'. Unlike + 'OCIThreadProcessInit()', there is no need to have a first call + that occurs before all the others. + + The first time 'OCIThreadInit()' is called, it initilaizes the OCI + Thread context. It also saves a pointer to the context in some system + dependent manner. Subsequent calls to 'OCIThreadInit()' will return + the same context. + + Each call to 'OCIThreadInit()' must eventually be matched by a call to + 'OCIThreadTerm()'. + + OCIThreadTerm - OCIThread TERMinate + ------------------------------------ + + Description + + This should be called to release the OCIThread context. It should be + called exactly once for each call made to 'OCIThreadInit()'. + + Prototype + + sword OCIThreadTerm(void *hndl, OCIError *err); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is safe to make concurrent calls to 'OCIThreadTerm()'. + + 'OCIThreadTerm()' will not do anything until it has been called as + many times as 'OCIThreadInit()' has been called. When that happens, + it terminates the OCIThread layer and frees the memory allocated for + the context. Once this happens, the context should not be re-used. + It will be necessary to obtain a new one by calling 'OCIThreadInit()'. + + + OCIThreadIsMulti - OCIThread Is Multi-Threaded? + ------------------------------------------------ + + Description + + This tells the caller whether the application is running in a + multi-threaded environment or a single-threaded environment. + + Prototype + boolean OCIThreadIsMulti(void); + + Returns + + TRUE if the environment is multi-threaded; + FALSE if the environment is single-threaded. + + +1.2 Passive Threading Primitives +================================== + +1.2.1 Types + +The passive threading primitives deal with the manipulation of mutex, +thread ID's, and thread-specific data. Since the specifications of these +primitives do not require the existence of multiple threads, they can be +used both on multithreaded and single-threaded platforms. + +1.2.1.1 OCIThreadMutex - OCIThread Mutual Exclusion Lock +----------------------------------------------------------- + + The type 'OCIThreadMutex' is used to represent a mutual exclusion lock + (mutex). A mutex is typically used for one of two purposes: (i) to + ensure that only one thread accesses a given set of data at a time, or + (ii) to ensure that only one thread executes a given critical section of + code at a time. + + Mutexes pointer can be declared as parts of client structures or as + stand-alone variables. Before they can be used, they must be initialized + using 'OCIThreadMutexInit()'. Once they are no longer needed, they must be + destroyed using 'OCIThreadMutexDestroy()'. A mutex pointer must NOT be + used after it is destroyed. + + A thread can acquire a mutex by using either 'OCIThreadMutexAcquire()' or + 'OCIThreadMutexTry()'. They both ensure that only one thread at a time is + allowed to hold a given mutex. A thread that holds a mutex can release it + by calling 'OCIThreadMutexRelease()'. + + +1.2.1.2 OCIThreadKey - OCIThread Key for Thread-Specific Data +---------------------------------------------------------------- + + A key can be thought of as a process-wide variable that has a + thread-specific value. What this means is that all the threads in a + process can use any given key. However, each thread can examine or modify + that key independently of the other threads. The value that a thread sees + when it examines the key will always be the same as the value that it last + set for the key. It will not see any values set for the key by the other + threads. + + The type of the value held by a key is a 'void *' generic pointer. + + Keys can be created using 'OCIThreadKeyInit()'. When a key is created, its + value is initialized to 'NULL' for all threads. + + A thread can set a key's value using 'OCIThreadKeySet()'. A thread can + get a key's value using 'OCIThreadKeyGet()'. + + The OCIThread key functions will save and retrieve data SPECIFIC TO THE + THREAD. When clients maintain a pool of threads and assign the threads to + different tasks, it *may not* be appropriate for a task to use OCIThread + key functions to save data associated with it. Here is a scenario of how + things can fail: A thread is assigned to execute the initialization of a + task. During the initialization, the task stored some data related to it + in the thread using OCIThread key functions. After the initialization, + the thread is returned back to the threads pool. Later, the threads pool + manager assigned another thread to perform some operations on the task, + and the task needs to retrieve those data it stored earlier in + initialization. Since the task is running in another thread, it will not + be able to retrieve the same data back! Applications that use thread + pools should be aware of this and be cautious when using OCIThread key + functions. + + +1.2.1.3 OCIThreadKeyDestFunc - OCIThread Key Destructor Function Type +------------------------------------------------------------------------ + + This is the type of a pointer to a key's destructor routine. Keys can be + associated with a destructor routine when they are created (see + 'OCIThreadKeyInit()'). + + A key's destructor routine will be called whenever a thread that has a + non-NULL value for the key terminates. + + The destructor routine returns nothing and takes one parameter. The + parameter will be the value that was set for key when the thread + terminated. + + The destructor routine is guaranteed to be called on a thread's value + in the key after the termination of the thread and before process + termination. No more precise guarantee can be made about the timing + of the destructor routine call; thus no code in the process may assume + any post-condition of the destructor routine. In particular, the + destructor is not guaranteed to execute before a join call on the + terminated thread returns. + + +1.2.1.4 OCIThreadId - OCIThread Thread ID +-------------------------------------------- + + Type 'OCIThreadId' is the type that will be used to identify a thread. + At any given time, no two threads will ever have the same 'OCIThreadId'. + However, 'OCIThreadId' values can be recycled; i.e., once a thread dies, + a new thread may be created that has the same 'OCIThreadId' as the one + that died. In particular, the thread ID must uniquely identify a thread + T within a process, and it must be consistent and valid in all threads U + of the process for which it can be guaranteed that T is running + concurrently with U. The thread ID for a thread T must be retrievable + within thread T. This will be done via OCIThreadIdGet(). + + The 'OCIThreadId' type supports the concept of a NULL thread ID: the NULL + thread ID will never be the same as the ID of an actual thread. + + + +1.2.2 Function prototypes for passive primitives +-------------------------------------------------- + +1.2.2.1 Mutex functions +------------------------- + + OCIThreadMutexInit - OCIThread MuteX Initialize + ----------------------------------------------- + + Description + + This allocate and initializes a mutex. All mutexes must be + initialized prior to use. + + Prototype + + sword OCIThreadMutexInit(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + mutex(OUT): The mutex to initialize. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + Multiple threads must not initialize the same mutex simultaneously. + Also, a mutex must not be reinitialized until it has been destroyed (see + 'OCIThreadMutexDestroy()'). + + OCIThreadMutexDestroy - OCIThread MuteX Destroy + ----------------------------------------------- + + Description + + This destroys and deallocate a mutex. Each mutex must be destroyed + once it is no longer needed. + + Prototype + + sword OCIThreadMutexDestroy(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + mutex(IN/OUT): The mutex to destroy. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is not legal to destroy a mutex that is uninitialized or is currently + held by a thread. The destruction of a mutex must not occur concurrently + with any other operations on the mutex. A mutex must not be used after + it has been destroyed. + + + OCIThreadMutexAcquire - OCIThread MuteX Acquire + ----------------------------------------------- + + Description + + This acquires a mutex for the thread in which it is called. If the mutex + is held by another thread, the calling thread is blocked until it can + acquire the mutex. + + Prototype + + sword OCIThreadMutexAcquire(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error, it is + recorded in err and this function returns OCI_ERROR. + Diagnostic information can be obtained by calling + OCIErrorGet(). + + mutex(IN/OUT): The mutex to acquire. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to attempt to acquire an uninitialized mutex. + + This function's behavior is undefined if it is used by a thread to + acquire a mutex that is already held by that thread. + + + + OCIThreadMutexRelease - OCIThread MuteX Release + ----------------------------------------------- + + Description + + This releases a mutex. If there are any threads blocked on the mutex, + one of them will acquire it and become unblocked. + + Prototype + + sword OCIThreadMutexRelease(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + mutex(IN/OUT): The mutex to release. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to attempt to release an uninitialized mutex. It is also + illegal for a thread to release a mutex that it does not hold. + + + OCIThreadKeyInit - OCIThread KeY Initialize + ------------------------------------------- + + Description + + This creates a key. Each call to this routine allocate and generates + a new key that is distinct from all other keys. + + Prototype + + sword OCIThreadKeyInit(void *hndl, OCIError *err, OCIThreadKey **key, + OCIThreadKeyDestFunc destFn); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(OUT): The 'OCIThreadKey' in which to create the new key. + + destFn(IN): The destructor for the key. NULL is permitted. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + Once this function executes successfully, a pointer to an allocated and + initialized key is return. That key can be used with 'OCIThreadKeyGet()' + and 'OCIThreadKeySet()'. The initial value of the key will be 'NULL' for + all threads. + + It is illegal for this function to be called more than once to create the + same key (i.e., to be called more than once with the same value for the + 'key' parameter). + + If the 'destFn' parameter is not NULL, the routine pointed to by 'destFn' + will be called whenever a thread that has a non-NULL value for the key + terminates. The routine will be called with one parameter. The + parameter will be the key's value for the thread at the time at which the + thread terminated. + If the key does not need a destructor function, pass NULL for 'destFn'. + + + OCIThreadKeyDestroy - OCIThread KeY DESTROY + ------------------------------------------- + + Description + + Destroy and deallocate the key pointed to by 'key'. + + Prototype + + sword OCIThreadKeyDestroy(void *hndl, OCIError *err, + OCIThreadKey **key); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(IN/OUT): The 'OCIThreadKey' in which to destroy the key. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + This is different from the destructor function callback passed to the + key create routine. This new destroy function 'OCIThreadKeyDestroy' is + used to terminate any resources OCI THREAD acquired when it created + 'key'. [The 'OCIThreadKeyDestFunc' callback type is a key VALUE + destructor; it does in no way operate on the key itself.] + + This must be called once the user has finished using the key. Not + calling the key destroy function may result in memory leaks. + + + + +1.2.2.2 Thread Key operations +------------------------------- + + OCIThreadKeyGet - OCIThread KeY Get value + ----------------------------------------- + + Description + + This gets the calling thread's current value for a key. + + Prototype + + sword OCIThreadKeyGet(void *hndl, OCIError *err, OCIThreadKey *key, + void **pValue); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(IN): The key. + + pValue(IN/OUT): The location in which to place the thread-specific + key value. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to use this function on a key that has not been created + using 'OCIThreadKeyInit()'. + + If the calling thread has not yet assigned a value to the key, 'NULL' is + placed in the location pointed to by 'pValue'. + + + OCIThreadKeySet - OCIThread KeY Set value + ----------------------------------------- + + Description + + This sets the calling thread's value for a key. + + Prototype + + sword OCIThreadKeySet(void *hndl, OCIError *err, OCIThreadKey *key, + void *value); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(IN/OUT): The key. + + value(IN): The thread-specific value to set in the key. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to use this function on a key that has not been created + using 'OCIThreadKeyInit()'. + +1.2.2.3 Thread Id +-------------------- + + OCIThreadIdInit - OCIThread Thread Id INITialize + -------------------------------------------------- + + Description + + Allocate and initialize the thread id 'tid'. + + Prototype + + sword OCIThreadIdInit(void *hndl, OCIError *err, OCIThreadId **tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid (OUT): Pointer to the thread ID to initialize. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + + OCIThreadIdDestroy - OCIThread Thread Id DESTROY + -------------------------------------------------- + + Description + + Destroy and deallocate the thread id 'tid'. + + Prototype + + sword OCIThreadIdDestroy(void *hndl, OCIError *err, OCIThreadId **tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid(IN/OUT): Pointer to the thread ID to destroy. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Note + + 'tid' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdSet - OCIThread Thread Id Set + ----------------------------------------- + + Description + + This sets one 'OCIThreadId' to another. + + Prototype + + sword OCIThreadIdSet(void *hndl, OCIError *err, + OCIThreadId *tidDest, + OCIThreadId *tidSrc); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tidDest(OUT): This should point to the location of the 'OCIThreadId' + to be set to. + + tidSrc(IN): This should point to the 'OCIThreadId' to set from. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'tid' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdSetNull - OCIThread Thread Id Set Null + --------------------------------------------------------- + + Description + + This sets the NULL thread ID to a given 'OCIThreadId'. + + Prototype + + sword OCIThreadIdSetNull(void *hndl, OCIError *err, + OCIThreadId *tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error, it is + recorded in err and this function returns OCI_ERROR. + Diagnostic information can be obtained by calling + OCIErrorGet(). + + tid(OUT): This should point to the 'OCIThreadId' in which to put + the NULL thread ID. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'tid' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdGet - OCIThread Thread Id Get + ------------------------------------------ + + Description + + This retrieves the 'OCIThreadId' of the thread in which it is called. + + Prototype + + sword OCIThreadIdGet(void *hndl, OCIError *err, + OCIThreadId *tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid(OUT): This should point to the location in which to place the + ID of the calling thread. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'tid' should be initialized by OCIThreadIdInit(). + + When OCIThread is used in a single-threaded environment, + OCIThreadIdGet() will always place the same value in the location + pointed to by 'tid'. The exact value itself is not important. The + important thing is that it is not the same as the NULL thread ID and + that it is always the same value. + + + OCIThreadIdSame - OCIThread Thread Ids Same? + ---------------------------------------------- + + Description + + This determines whether or not two 'OCIThreadId's represent the same + thread. + + Prototype + + sword OCIThreadIdSame(void *hndl, OCIError *err, + OCIThreadId *tid1, OCIThreadId *tid2, + boolean *result); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid1(IN): Pointer to the first 'OCIThreadId'. + + tid2(IN): Pointer to the second 'OCIThreadId'. + + result(IN/OUT): Pointer to the result. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + If 'tid1' and 'tid2' represent the same thread, 'result' is set to TRUE. + Otherwise, 'result' is set to FALSE. + + 'result' is set to TRUE if both 'tid1' and 'tid2' are the NULL thread ID. + + 'ti1d' and 'tid2' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdNull - OCIThread Thread Id NULL? + --------------------------------------------- + + Description + + This determines whether or not a given 'OCIThreadId' is the NULL thread + ID. + + Prototype + + sword OCIThreadIdNull(void *hndl, OCIError *err, + OCIThreadId *tid, + boolean *result); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid(IN): Pointer to the 'OCIThreadId' to check. + + result(IN/OUT): Pointer to the result. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + If 'tid' is the NULL thread ID, 'result' is set to TRUE. Otherwise, + 'result' is set to FALSE. + + 'tid' should be initialized by OCIThreadIdInit(). + + +1.3 Active Threading Primitives +================================= + +The active threading primitives deal with the manipulation of actual +threads. Because the specifications of most of these primitives require +that it be possible to have multiple threads, they work correctly only in +the enabled OCIThread; In the disabled OCIThread, they always return +failure. The exception is OCIThreadHandleGet(); it may be called in a +single-threaded environment, in which case it will have no effect. + +Active primitives should only be called by code running in a multi-threaded +environment. You can call OCIThreadIsMulti() to determine whether the +environment is multi-threaded or single-threaded. + + +1.3.1 Types +-------------- + +1.3.1.1 OCIThreadHandle - OCIThread Thread Handle +------------------------------------------------------ + + Type 'OCIThreadHandle' is used to manipulate a thread in the active + primitives: OCIThreadJoin()and OCIThreadClose(). A thread handle opened by + OCIThreadCreate() must be closed in a matching call to + OCIThreadClose(). A thread handle is invalid after the call to + OCIThreadClose(). + + The distinction between a thread ID and a thread handle in OCIThread usage + follows the distinction between the thread ID and the thread handle on + Windows NT. On many platforms, the underlying native types are the same. + + +1.3.2 Functions +------------------ + + OCIThreadHndInit - OCIThread HaNDle Initialize + ---------------------------------------------- + + Description + + Allocate and initialize the thread handle. + + Prototype + + sword OCIThreadHndInit(void *hndl, OCIError *err, + OCIThreadHandle **thnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + thnd(OUT): The address of pointer to the thread handle to initialize. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + + OCIThreadHndDestroy - OCIThread HaNDle Destroy + ---------------------------------------------- + + Description + + Destroy and deallocate the thread handle. + + Prototype + + sword OCIThreadHndDestroy(void *hndl, OCIError *err, + OCIThreadHandle **thnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + thnd(IN/OUT): The address of pointer to the thread handle to destroy. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + + OCIThreadCreate - OCIThread Thread Create + ----------------------------------------- + + Description + + This creates a new thread. + + Prototype + + sword OCIThreadCreate(void *hndl, OCIError *err, + void (*start)(void *), void *arg, + OCIThreadId *tid, OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + start(IN): The function in which the new thread should begin + execution. + + arg(IN): The argument to give the function pointed to by 'start'. + + tid(IN/OUT): If not NULL, gets the ID for the new thread. + + tHnd(IN/OUT): If not NULL, gets the handle for the new thread. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + The new thread will start by executing a call to the function pointed + to by 'start' with the argument given by 'arg'. When that function + returns, the new thread will terminate. The function should not + return a value and should accept one parameter, a 'void *'. + + The call to OCIThreadCreate() must be matched by a call to + OCIThreadClose() if and only if tHnd is non-NULL. + + If tHnd is NULL, a thread ID placed in *tid will not be valid in the + calling thread because the timing of the spawned thread's termination + is unknown. + + 'tid' should be initialized by OCIThreadIdInit(). + + 'thnd' should be initialized by OCIThreadHndInit(). + + + + OCIThreadJoin - OCIThread Thread Join + ------------------------------------- + + Description + + This function allows the calling thread to 'join' with another thread. + It blocks the caller until the specified thread terminates. + + Prototype + + sword OCIThreadJoin(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tHnd(IN): The 'OCIThreadHandle' of the thread to join with. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + The result of multiple threads all trying to join with the same thread is + undefined. + + + OCIThreadClose - OCIThread Thread Close + --------------------------------------- + + Description + + This function should be called to close a thread handle. + + Prototype + + sword OCIThreadClose(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tHnd(IN/OUT): The OCIThread thread handle to close. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + Both thread handle and the thread ID that was returned by the same call + to OCIThreadCreate() are invalid after the call to OCIThreadClose(). + + + + OCIThreadHandleGet - OCIThread Thread Get Handle + ------------------------------------------------ + + Description + + Retrieve the 'OCIThreadHandle' of the thread in which it is called. + + Prototype + + sword OCIThreadHandleGet(void *hndl, OCIError *err, + OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tHnd(IN/OUT): If not NULL, the location to place the thread + handle for the thread. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + The thread handle 'tHnd' retrieved by this function must be closed + with OCIThreadClose() and destroyed by OCIThreadHndDestroy() after it + is used. + + + + +1.4 Using OCIThread +===================== + +This section summarizes some of the more important details relating to the use +of OCIThread. + + * Process initialization + + OCIThread only requires that the process initialization function + ('OCIThreadProcessInit()') be called when OCIThread is being used in a + multi-threaded application. Failing to call 'OCIThreadProcessInit()' in + a single-threaded application is not an error. + + * OCIThread initialization + + Separate calls to 'OCIThreadInit()' will all return the same OCIThread + context. + + Also, remember that each call to 'OCIThreadInit()' must eventually be + matched by a call to 'OCIThreadTerm()'. + + * Active vs. Passive Threading primitives + + OCIThread client code written without using any active primitives can be + compiled and used without change on both single-threaded and + multi-threaded platforms. + + OCIThread client code written using active primitives will only work + correctly on multi-threaded platforms. In order to write a version of the + same application to run on single-threaded platform, it is necessary to + branch the your code, whether by branching versions of the source file or + by branching at runtime with the OCIThreadIsMulti() call. + +******************************************************************************/ + +/***************************************************************************** + ACTUAL PROTOTYPE DECLARATIONS +******************************************************************************/ + +void OCIThreadProcessInit(); + +sword OCIThreadInit(void *hndl, OCIError *err); + +sword OCIThreadTerm(void *hndl, OCIError *err); + +boolean OCIThreadIsMulti(); + +sword OCIThreadMutexInit(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + +sword OCIThreadMutexDestroy(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + +sword OCIThreadMutexAcquire(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + +sword OCIThreadMutexRelease(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + +sword OCIThreadKeyInit(void *hndl, OCIError *err, OCIThreadKey **key, + OCIThreadKeyDestFunc destFn); + +sword OCIThreadKeyDestroy(void *hndl, OCIError *err, + OCIThreadKey **key); + +sword OCIThreadKeyGet(void *hndl, OCIError *err, OCIThreadKey *key, + void **pValue); + +sword OCIThreadKeySet(void *hndl, OCIError *err, OCIThreadKey *key, + void *value); + +sword OCIThreadIdInit(void *hndl, OCIError *err, OCIThreadId **tid); + +sword OCIThreadIdDestroy(void *hndl, OCIError *err, OCIThreadId **tid); + +sword OCIThreadIdSet(void *hndl, OCIError *err, + OCIThreadId *tidDest, OCIThreadId *tidSrc); + +sword OCIThreadIdSetNull(void *hndl, OCIError *err, OCIThreadId *tid); + +sword OCIThreadIdGet(void *hndl, OCIError *err, OCIThreadId *tid); + +sword OCIThreadIdSame(void *hndl, OCIError *err, + OCIThreadId *tid1, OCIThreadId *tid2, + boolean *result); + +sword OCIThreadIdNull(void *hndl, OCIError *err, + OCIThreadId *tid, boolean *result); + +sword OCIThreadHndInit(void *hndl, OCIError *err, OCIThreadHandle **thnd); + +sword OCIThreadHndDestroy(void *hndl, OCIError *err, OCIThreadHandle **thnd); + +sword OCIThreadCreate(void *hndl, OCIError *err, + void (*start)(void *), void *arg, + OCIThreadId *tid, OCIThreadHandle *tHnd); + +sword OCIThreadJoin(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + +sword OCIThreadClose(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + +sword OCIThreadHandleGet(void *hndl, OCIError *err, OCIThreadHandle *tHnd); +/*----------------- End OCI Thread interface Extensions ---------------------*/ + +/*------------------ Begin OCI Row Callback Interfaces ----------------------*/ + +typedef sword (*OCIBindRowCallback)(void *ctx); +typedef sword (*OCIFetchRowCallback)(void *ctx); + +/*------------------ Begin OCI Row Callback Interfaces ----------------------*/ + +/*--------------- Begin OCI Client Notification Interfaces ------------------*/ + +typedef ub4 (*OCISubscriptionNotify)(void *ctx, OCISubscription *subscrhp, + void *pay, ub4 payl, + void *desc, ub4 mode); + +sword OCISubscriptionRegister(OCISvcCtx *svchp, OCISubscription **subscrhpp, + ub2 count, OCIError *errhp, ub4 mode); + + +sword OCISubscriptionPost(OCISvcCtx *svchp, OCISubscription **subscrhpp, + ub2 count, OCIError *errhp, ub4 mode); + +sword OCISubscriptionUnRegister(OCISvcCtx *svchp, OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +sword OCISubscriptionDisable(OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +sword OCISubscriptionEnable(OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +/*------------------- End OCI Publish/Subscribe Interfaces ------------------*/ + +/*----------------- Extensions to Datetime interfaces -----------------------*/ +/*--------------------- Actual Prototypes -----------------------------------*/ +sword OCIDateTimeGetTime(void *hndl, OCIError *err, OCIDateTime *datetime, + ub1 *hr, ub1 *mm, ub1 *ss, ub4 *fsec); + +sword OCIDateTimeGetDate(void *hndl, OCIError *err, const OCIDateTime *date, + sb2 *yr, ub1 *mnth, ub1 *dy ); + +sword OCIDateTimeGetTimeZoneOffset(void *hndl,OCIError *err, + const OCIDateTime *datetime, + sb1 *hr,sb1 *mm); + +sword OCIDateTimeConstruct(void *hndl,OCIError *err,OCIDateTime *datetime, + sb2 yr,ub1 mnth,ub1 dy,ub1 hr,ub1 mm,ub1 ss,ub4 fsec, + OraText *timezone,size_t timezone_length); + +sword OCIDateTimeSysTimeStamp(void *hndl, OCIError *err, + OCIDateTime *sys_date ); + +sword OCIDateTimeAssign(void *hndl, OCIError *err, const OCIDateTime *from, + OCIDateTime *to); + +sword OCIDateTimeToText(void *hndl, OCIError *err, const OCIDateTime *date, + const OraText *fmt, ub1 fmt_length, ub1 fsprec, + const OraText *lang_name, size_t lang_length, + ub4 *buf_size, OraText *buf ); + +sword OCIDateTimeFromText(void *hndl, OCIError *err, const OraText *date_str, + size_t dstr_length, const OraText *fmt, ub1 fmt_length, + const OraText *lang_name, size_t lang_length, OCIDateTime *date ); + +sword OCIDateTimeCompare(void *hndl, OCIError *err, const OCIDateTime *date1, + const OCIDateTime *date2, sword *result ); + +sword OCIDateTimeCheck(void *hndl, OCIError *err, const OCIDateTime *date, + ub4 *valid ); + +sword OCIDateTimeConvert(void *hndl, OCIError *err, OCIDateTime *indate, + OCIDateTime *outdate); + +sword OCIDateTimeSubtract(void *hndl, OCIError *err, OCIDateTime *indate1, + OCIDateTime *indate2, OCIInterval *inter); + +sword OCIDateTimeIntervalAdd(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); + +sword OCIDateTimeIntervalSub(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); + +sword OCIIntervalSubtract(void *hndl, OCIError *err, OCIInterval *minuend, + OCIInterval *subtrahend, OCIInterval *result ); + +sword OCIIntervalAdd(void *hndl, OCIError *err, OCIInterval *addend1, + OCIInterval *addend2, OCIInterval *result ); + +sword OCIIntervalMultiply(void *hndl, OCIError *err, const OCIInterval *inter, + OCINumber *nfactor, OCIInterval *result ); + +sword OCIIntervalDivide(void *hndl, OCIError *err, OCIInterval *dividend, + OCINumber *divisor, OCIInterval *result ); + +sword OCIIntervalCompare(void *hndl, OCIError *err, OCIInterval *inter1, + OCIInterval *inter2, sword *result ); + +sword OCIIntervalFromNumber(void *hndl, OCIError *err, OCIInterval *inter, + OCINumber *number); + +sword OCIIntervalFromText( void *hndl, OCIError *err, const OraText *inpstr, + size_t str_len, OCIInterval *result ); + +sword OCIIntervalToText( void *hndl, OCIError *err, const OCIInterval *inter, + ub1 lfprec, ub1 fsprec, + OraText *buffer, size_t buflen, size_t *resultlen ); + +sword OCIIntervalToNumber(void *hndl, OCIError *err,const OCIInterval *inter, + OCINumber *number); + +sword OCIIntervalCheck(void *hndl, OCIError *err, const OCIInterval *interval, + ub4 *valid ); + +sword OCIIntervalAssign(void *hndl, OCIError *err, const OCIInterval *ininter, + OCIInterval *outinter ); + +sword OCIIntervalSetYearMonth(void *hndl, OCIError *err, sb4 yr, sb4 mnth, + OCIInterval *result ); + +sword OCIIntervalGetYearMonth(void *hndl, OCIError *err, sb4 *yr, sb4 *mnth, + const OCIInterval *result ); + +sword OCIIntervalSetDaySecond(void *hndl, OCIError *err, sb4 dy, sb4 hr, + sb4 mm, sb4 ss, sb4 fsec, OCIInterval *result ); + +sword OCIIntervalGetDaySecond(void *hndl, OCIError *err, sb4 *dy, sb4 *hr, + sb4 *mm, sb4 *ss, sb4 *fsec, const OCIInterval *result ); + +sword OCIDateTimeToArray(void *hndl, OCIError *err, + const OCIDateTime *datetime, const OCIInterval *reftz, + ub1 *outarray, ub4 *len, ub1 fsprec); + +sword OCIDateTimeFromArray(void *hndl, OCIError *err, ub1 *inarray, ub4 len, + ub1 type, OCIDateTime *datetime, + const OCIInterval *reftz, ub1 fsprec); + +sword OCIDateTimeGetTimeZoneName(void *hndl, OCIError *err, + const OCIDateTime *datetime, + ub1 *buf, ub4 *buflen); + +sword OCIIntervalFromTZ(void *hndl, OCIError *err, const oratext *inpstring, + size_t str_len, OCIInterval *result); + +/*----------------- End Datetime interface Extensions -----------------------*/ + +/*----------------- Connection Pooling prototypes ---------------------------*/ +sword OCIConnectionPoolCreate(OCIEnv *envhp, OCIError *errhp, OCICPool *poolhp, + OraText **poolName, sb4 *poolNameLen, + const OraText *dblink, sb4 dblinkLen, + ub4 connMin, ub4 connMax, ub4 connIncr, + const OraText *poolUserName, sb4 poolUserLen, + const OraText *poolPassword, sb4 poolPassLen, + ub4 mode); + +sword OCIConnectionPoolDestroy(OCICPool *poolhp, + OCIError *errhp, ub4 mode); + +/*----------------- End Connection Pooling prototypes -----------------------*/ + +/*-------------------- Session Pooling prototypes ---------------------------*/ + +sword OCISessionPoolCreate (OCIEnv *envhp, OCIError *errhp, OCISPool *spoolhp, + OraText **poolName, ub4 *poolNameLen, + const OraText *connStr, ub4 connStrLen, + ub4 sessMin, ub4 sessMax, ub4 sessIncr, + OraText *userid, ub4 useridLen, + OraText *password, ub4 passwordLen, + ub4 mode); + +sword OCISessionPoolDestroy (OCISPool *spoolhp, + OCIError *errhp, + ub4 mode); + +sword OCISessionGet (OCIEnv *envhp, OCIError *errhp, OCISvcCtx **svchp, + OCIAuthInfo *authhp, + OraText *poolName, ub4 poolName_len, + const OraText *tagInfo, ub4 tagInfo_len, + OraText **retTagInfo, ub4 *retTagInfo_len, + boolean *found, ub4 mode); + +sword OCISessionRelease (OCISvcCtx *svchp, OCIError *errhp, + OraText *tag, ub4 tag_len, + ub4 mode); + +/*-------------------- End Session Pooling prototypes -----------------------*/ + +/* --------------------- OCI Application Context --------------------------*/ + + +sword OCIAppCtxSet(void * sesshndl, void *nsptr, ub4 nsptrlen, + void *attrptr, ub4 attrptrlen, + void *valueptr, ub4 valueptrlen, + OCIError *errhp, ub4 mode); + +sword OCIAppCtxClearAll(void *sesshndl, void *nsptr, ub4 nsptrlen, + OCIError *errhp, ub4 mode); + +/*-------------------------------- OCIMemStats ------------------------------*/ +sword OCIMemStats(void *hndlp, OCIError *errhp, OCIEnv **envhp, + ub4 mode, ub4 mode1, oratext *tabname); + +/*-------------------------------- OCIPing ----------------------------------*/ +sword OCIPing (OCISvcCtx *svchp, OCIError *errhp, ub4 mode); + +/*----------------- Kerberos Authentication prototypes ----------------------*/ + +sword OCIKerbAttrSet(OCISession *trgthndlp, ub4 cred_use, ub1 *ftgt_ticket, + ub4 ticket_len, ub1 *session_key, ub4 skey_len, + ub2 ftgt_keytype, ub4 ftgt_ticket_flags, + sb4 ftgt_auth_time, sb4 ftgt_start_time, + sb4 ftgt_end_time, sb4 ftgt_renew_time, + oratext *ftgt_client_principal, + ub4 ftgt_client_principal_len, oratext *ftgt_client_realm, + ub4 ftgt_client_realm_len, OCIError *errhp); + +/*------------------- End Kerberos Authentication prototypes ----------------*/ + +/*------------------- Database Startup/Shutdown prototypes ------------------*/ + +sword OCIDBStartup (OCISvcCtx *svchp, + OCIError *errhp, + OCIAdmin *admhp, + ub4 mode, + ub4 flags); + +sword OCIDBShutdown(OCISvcCtx *svchp, + OCIError *errhp, + OCIAdmin *admhp, + ub4 mode); + +/*------------------ End Database Startup/Shutdown prototypes ---------------*/ + +/*----------------------- OCIClientVersion ------------------------------*/ +void OCIClientVersion(sword *major_version, + sword *minor_version, + sword *update_num, + sword *patch_num, + sword *port_update_num); +/*----------------------- End OCIClientVersion --------------------------*/ + +/*----------------------- HA Event prototypes ------------------------------*/ + +sword OCIInitEventHandle(OCIError *errhp, + OCIEvent *event, + text *str, + ub4 size); + +/*----------------------- End HA Event prototypes --------------------------*/ + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + /* the following functions are depracated and should not be used */ +#ifdef NEVER +sword OCIStmtBindByPos (OCIStmt *stmtp, OCIBind *bindp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, + ub2 dty, void *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + + +sword OCIStmtBindByName (OCIStmt *stmtp, OCIBind *bindp, OCIError *errhp, + const OraText *placeholder, sb4 placeh_len, void *valuep, + sb4 value_sz, ub2 dty, void *indp, ub2 *alenp, + ub2 *rcodep, ub4 maxarr_len, ub4 *curelep, ub4 mode); + +sword ocidefn (OCIStmt *stmtp, OCIDefine *defnp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, ub2 dty, + void *indp, ub2 *rlenp, ub2 *rcodep, ub4 mode); +#endif /* NEVER */ + +#endif /* OCIAP_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/ociapr.h b/libraries/SQLAPI/include/ora_win/ociapr.h new file mode 100644 index 000000000..0a0443d13 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ociapr.h @@ -0,0 +1,155 @@ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ociapr.h + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + dsaha 05/19/00 - Fix lint + sgollapu 05/19/98 - Change text to OraText + dchatter 11/10/95 - add ognfd() - get native fd + lchidamb 04/06/95 - drop maxdsz from obindps/odefinps + slari 04/07/95 - add opinit + dchatter 03/08/95 - osetpi and ogetpi + lchidamb 12/09/94 - add obindps() and odefinps() + dchatter 03/06/95 - merge changes from branch 1.1.720.2 + dchatter 11/14/94 - merge changes from branch 1.1.720.1 + dchatter 02/08/95 - olog call; drop onblon + dchatter 10/31/94 - new functions for non-blocking oci + rkooi2 11/27/92 - Changing datatypes to agree with ocidef.h + rkooi2 10/26/92 - More portability mods + rkooi2 10/18/92 - Changed to agree with oci.c + sjain 03/16/92 - Creation +*/ +/* + * Declare the OCI functions. + * Prototype information is included. + * Use this header for ANSI C compilers. + */ + +#ifndef OCIAPR +#define OCIAPR + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN +#include +#endif + +/* + * Oci BIND (Piecewise or with Skips) + */ +sword obindps(struct cda_def *cursor, ub1 opcode, OraText *sqlvar, + sb4 sqlvl, ub1 *pvctx, sb4 progvl, + sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip, + ub4 maxsiz, ub4 *cursiz, + OraText *fmt, sb4 fmtl, sword fmtt); +sword obreak(struct cda_def *lda); +sword ocan (struct cda_def *cursor); +sword oclose(struct cda_def *cursor); +sword ocof (struct cda_def *lda); +sword ocom (struct cda_def *lda); +sword ocon (struct cda_def *lda); + + +/* + * Oci DEFINe (Piecewise or with Skips) + */ +sword odefinps(struct cda_def *cursor, ub1 opcode, sword pos,ub1 *bufctx, + sb4 bufl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sb4 fmtl, sword fmtt, + ub2 *rlen, ub2 *rcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip); +sword odessp(struct cda_def *cursor, OraText *objnam, size_t onlen, + ub1 *rsv1, size_t rsv1ln, ub1 *rsv2, size_t rsv2ln, + ub2 *ovrld, ub2 *pos, ub2 *level, OraText **argnam, + ub2 *arnlen, ub2 *dtype, ub1 *defsup, ub1* mode, + ub4 *dtsiz, sb2 *prec, sb2 *scale, ub1 *radix, + ub4 *spare, ub4 *arrsiz); +sword odescr(struct cda_def *cursor, sword pos, sb4 *dbsize, + sb2 *dbtype, sb1 *cbuf, sb4 *cbufl, sb4 *dsize, + sb2 *prec, sb2 *scale, sb2 *nullok); +sword oerhms (struct cda_def *lda, sb2 rcode, OraText *buf, + sword bufsiz); +sword oermsg (sb2 rcode, OraText *buf); +sword oexec (struct cda_def *cursor); +sword oexfet (struct cda_def *cursor, ub4 nrows, + sword cancel, sword exact); +sword oexn (struct cda_def *cursor, sword iters, sword rowoff); +sword ofen (struct cda_def *cursor, sword nrows); +sword ofetch (struct cda_def *cursor); +sword oflng (struct cda_def *cursor, sword pos, ub1 *buf, + sb4 bufl, sword dtype, ub4 *retl, sb4 offset); +sword ogetpi (struct cda_def *cursor, ub1 *piecep, void **ctxpp, + ub4 *iterp, ub4 *indexp); +sword oopt (struct cda_def *cursor, sword rbopt, sword waitopt); +sword opinit (ub4 mode); +sword olog (struct cda_def *lda, ub1* hda, + OraText *uid, sword uidl, + OraText *pswd, sword pswdl, + OraText *conn, sword connl, + ub4 mode); +sword ologof (struct cda_def *lda); +sword oopen (struct cda_def *cursor, struct cda_def *lda, + OraText *dbn, sword dbnl, sword arsize, + OraText *uid, sword uidl); +sword oparse (struct cda_def *cursor, OraText *sqlstm, sb4 sqllen, + sword defflg, ub4 lngflg); +sword orol (struct cda_def *lda); +sword osetpi (struct cda_def *cursor, ub1 piece, void *bufp, ub4 *lenp); + +void sqlld2 (struct cda_def *lda, OraText *cname, sb4 *cnlen); +void sqllda (struct cda_def *lda); + +/* non-blocking functions */ +sword onbset (struct cda_def *lda ); +sword onbtst (struct cda_def *lda ); +sword onbclr (struct cda_def *lda ); +sword ognfd (struct cda_def *lda, void *fdp); + + +/* + * OBSOLETE CALLS + */ + +/* + * OBSOLETE BIND CALLS + */ +sword obndra(struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, ub4 maxsiz, + ub4 *cursiz, OraText *fmt, sword fmtl, sword fmtt); +sword obndrn(struct cda_def *cursor, sword sqlvn, ub1 *progv, + sword progvl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt); +sword obndrv(struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sword fmtl, sword fmtt); + +/* + * OBSOLETE DEFINE CALLS + */ +sword odefin(struct cda_def *cursor, sword pos, ub1 *buf, + sword bufl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt, ub2 *rlen, ub2 *rcode); + +/* older calls ; preferred equivalent calls above */ + +sword oname (struct cda_def *cursor, sword pos, sb1 *tbuf, + sb2 *tbufl, sb1 *buf, sb2 *bufl); +sword orlon (struct cda_def *lda, ub1 *hda, + OraText *uid, sword uidl, + OraText *pswd, sword pswdl, + sword audit); +sword olon (struct cda_def *lda, OraText *uid, sword uidl, + OraText *pswd, sword pswdl, sword audit); +sword osql3 (struct cda_def *cda, OraText *sqlstm, sword sqllen); +sword odsc (struct cda_def *cursor, sword pos, sb2 *dbsize, + sb2 *fsize, sb2 *rcode, sb2 *dtype, sb1 *buf, + sb2 *bufl, sb2 *dsize); + +#endif /* OCIAPR */ diff --git a/libraries/SQLAPI/include/ora_win/ocidef.h b/libraries/SQLAPI/include/ora_win/ocidef.h new file mode 100644 index 000000000..a5002479b --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ocidef.h @@ -0,0 +1,886 @@ +/* Copyright (c) 1981, 2005, Oracle. All rights reserved. */ +/* Copyright (c) 1984, 2005, Oracle. All rights reserved. */ + +/* +NAME + ocidef +CONTENTS + Oracle Call Interface cursor area and LDA definitions +NOTES + none +OWNER + Oates +DATE + 09/07/82 +MODIFIED + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/25/03 - convert oci public api to ansi + csteinba 11/05/02 - bug 2521931: redefine OTYACL + aahluwal 06/03/02 - bug 2360115 + bpalaval 02/08/01 - Change text to oratext. + chliang 02/01/01 - fix olint error. + bpalaval 11/16/00 - Bug 1244685 : Fix ALTER CLUSTER issue.. + slari 11/08/00 - remove functions duplicated in ociapr.h + whe 09/01/99 - 976457:check __cplusplus for C++ code + skmishra 04/23/97 - Provide C++ compatibility + lchidamb 06/26/96 - put upidef.h, riddef.h within #ifndef + slari 06/12/96 - add ocigft_getFcnType + dchatter 11/10/95 - ocignfd - oci get native file descriptor + slari 05/11/95 - change OCIEVDEF/OCIEVTSF to UPIEVDEF/UPIEVTSF + dchatter 04/06/95 - add ifdef flags around OCI_flags + lchidamb 04/06/95 - drop maxdsz from ocibndps/ocidfnps + slari 04/07/95 - rename opinit to ocipin + slari 03/13/95 - thread safety changes + dchatter 03/08/95 - piece definitions OCI_*_PIECE + lchidamb 12/06/94 - add support for binding/defining with skips + dchatter 03/06/95 - merge changes from branch 1.12.720.1 + dchatter 02/06/95 - add defines for login mode parameters + dchatter 07/06/94 - Deleting CRSCHK, with refcursor, no way to set this + dchatter 06/13/94 - add a new LDA flag LDANBL + rkooi 11/18/92 - update ocidpr interface + mmoore 10/31/92 - add ocidpr + gpongrac 11/17/92 - fix oexfet prototype + sjain 01/03/92 - Add ocibra + rjenkins 11/04/91 - adding prototypes for oparse and oexfet + sjain 04/15/91 - Change ocistf proto + sjain 04/01/91 - Rearrange oty codes. Add new ones + Jain 12/03/90 - Add #define for new describe call + Jain 11/29/90 - Add new function code for the new oci calls + Mendels 01/20/89 - fix 19170: make ocitbl CONST_DATA + Kabcene 01/27/88 - change interfaces to match V5 + Navab 12/09/87 - add a parameter to ocierr call + Navab 11/30/87 - add ocierr, rename ocioer + Navab 10/08/87 - add prototypes for procedure declarations + Howard 09/07/87 - endif blah + Howard 05/11/87 - Add OTY types + Howard 04/27/87 - move ocldef defines here + Oates 10/15/85 - Add OCANCEL + Oates 09/30/85 - Implement ORA*Net + Oates 06/27/85 - Make datatype compatible with upidef.h + Andy 05/07/85 - delete CSRFBPIC +*/ + +#ifndef UPIDEF +#include +#endif + +#ifndef RIDDEF +#include +#endif + +#include + +#ifndef OCIDEF +#define OCIDEF + + +#define CSRCHECK 172 /* csrdef is a cursor */ +#define LDACHECK 202 /* csrdef is a login data area */ +struct csrdef +{ + sb2 csrrc; /* return code: v2 codes, v4 codes negative */ + ub2 csrft; /* function type */ + ub4 csrrpc; /* rows processed count */ + ub2 csrpeo; /* parse error offset */ + ub1 csrfc; /* function code */ + ub1 csrlfl; /* lda flag to indicate type of login */ + ub2 csrarc; /* actual untranslated return code */ + ub1 csrwrn; /* warning flags */ + ub1 csrflg; /* error action */ + sword csrcn; /* cursor number */ + riddef csrrid; /* rowid structure */ + sword csrose; /* os dependent error code */ + ub1 csrchk; /* check byte = CSRCHECK - in cursor */ + /* check byte = LDACHECK - in LDA */ + struct hstdef *csrhst; /* pointer to the hst */ +}; +typedef struct csrdef csrdef; +typedef struct csrdef ldadef; /* lda is the same as a csr */ + + +/* values for csrlfl */ +#define LDAFLG 1 /* ...via ologon */ +#define LDAFLO 2 /* ...via olon or orlon */ +#define LDANBL 3 /* ...nb logon in progress */ + +/* valuses for crsfc */ +#define csrfpa 2 /* ...OSQL */ +#define csrfex 4 /* ...OEXEC */ +#define csrfbi 6 /* ...OBIND */ +#define csrfdb 8 /* ...ODFINN */ +#define csrfdi 10 /* ...ODSRBN */ +#define csrffe 12 /* ...OFETCH */ +#define csrfop 14 /* ...OOPEN */ +#define csrfcl 16 /* ...OCLOSE */ +#define csrfds 22 /* ...ODSC */ +#define csrfnm 24 /* ...ONAME */ +#define csrfp3 26 /* ...OSQL3 */ +#define csrfbr 28 /* ...OBNDRV */ +#define csrfbx 30 /* ...OBNDRN */ +/*#defe csrfdf 32*/ /* ???? */ +#define csrfso 34 /* ...OOPT */ +#define csrfre 36 /* ...ORESUM */ +#define csrfbn 50 /* ...OBINDN */ +#define csrfca 52 /* ..OCANCEL */ +#define csrfsd 54 /* ..OSQLD */ +#define csrfef 56 /* ..OEXFEN */ +#define csrfln 58 /* ..OFLNG */ +#define csrfdp 60 /* ..ODSCSP */ +#define csrfba 62 /* ..OBNDRA */ +#define csrfbps 63 /*..OBINDPS */ +#define csrfdps 64 /*..ODEFINPS */ +#define csrfgpi 65 /* ...OGETPI */ +#define csrfspi 66 /* ...OSETPI */ + +/* values for csrwrn */ +#define CSRWANY 0x01 /* there is a warning flag set */ +#define CSRWTRUN 0x02 /* a data item was truncated */ +#define CSRWNVIC 0x04 /* NULL values were used in an aggregate function */ +#define CSRWITCE 0x08 /* column count not equal to into list count */ +#define CSRWUDNW 0x10 /* update or delete without where clause */ +#define CSRWRSV0 0x20 +#define CSRWROLL 0x40 /* rollback required */ +#define CSRWRCHG 0x80 /* change after query start on select for update */ + +/* values fro csrflg */ +#define CSRFSPND 0x01 /* current operation suspended */ +#define CSRFATAL 0x02 /* fatal operation: transaction rolled back */ +#define CSRFBROW 0x04 /* current row backed out */ +#define CSRFREFC 0x08 /* ref cursor type CRSCHK disabled for this cursor */ +#define CSRFNOAR 0x10 /* ref cursor type binds, so no array bind/execute */ + +/* define function codes; in order of octdef.h */ +#define OTYCTB 1 /* CREATE TABLE */ +#define OTYSER 2 /* set role */ +#define OTYINS 3 /* INSERT */ +#define OTYSEL 4 /* SELECT */ +#define OTYUPD 5 /* UPDATE */ +#define OTYDRO 6 /* drop role */ +#define OTYDVW 7 /* DROP VIEW */ + /* once was validate index */ + /* once was create partition */ + /* once was alter partition */ +#define OTYDTB 8 /* DROP TABLE */ + /* once was alter space */ + /* once was drop space */ +#define OTYDEL 9 /* DELETE */ +#define OTYCVW 10 /* create view */ +#define OTYDUS 11 /* drop user */ +#define OTYCRO 12 /* create role */ +#define OTYCSQ 13 /* create sequence */ +#define OTYASQ 14 /* alter sequence */ +#define OTYACL 15 /* alter cluster */ +#define OTYDSQ 16 /* drop sequence */ +#define OTYCSC 17 /* create schema */ +#define OTYCCL 18 /* CREATE CLUSTER */ + /* once was alter cluster */ +#define OTYCUS 19 /* create user */ +#define OTYCIX 20 /* CREATE INDEX */ +#define OTYDIX 21 /* DROP INDEX */ +#define OTYDCL 22 /* DROP CLUSTER */ +#define OTYVIX 23 /* validate index */ +#define OTYCPR 24 /* create procedure */ +#define OTYAPR 25 /* alter procedure */ +#define OTYATB 26 /* alter table */ + /* once was evaluate */ +#define OTYXPL 27 /* explain */ +#define OTYGRA 28 /* grant */ +#define OTYREV 29 /* revoke */ +#define OTYCSY 30 /* create synonym */ +#define OTYDSY 31 /* drop synonym */ +#define OTYASY 32 /* alter system switch log */ +#define OTYSET 33 /* set transaction */ +#define OTYPLS 34 /* pl/sql execute */ +#define OTYLTB 35 /* lock */ +#define OTYNOP 36 /* noop */ +#define OTYRNM 37 /* rename */ +#define OTYCMT 38 /* comment */ +#define OTYAUD 39 /* audit */ +#define OTYNOA 40 /* no audit */ +#define OTYAIX 41 /* ALTER INDEX */ +#define OTYCED 42 /* create external database */ +#define OTYDED 43 /* drop external database */ +#define OTYCDB 44 /* create database */ +#define OTYADB 45 /* alter database */ +#define OTYCRS 46 /* create rollback segment */ +#define OTYARS 47 /* alter rollback segment */ +#define OTYDRS 48 /* drop rollback segment */ +#define OTYCTS 49 /* create tablespace */ +#define OTYATS 50 /* alter tablespace */ +#define OTYDTS 51 /* drop tablespace */ +#define OTYASE 52 /* alter session */ +#define OTYAUR 53 /* alter user */ +#define OTYCWK 54 /* commit (work) */ +#define OTYROL 55 /* rollback */ +#define OTYSPT 56 /* savepoint */ + +/* For number greater than 56 the the type is the same as defined in +** octdef.h for that number. So for completion look at octdef.h +*/ + +#define OTYDEV OTYCVW /* old DEFINE VIEW = create view */ + +/* FUNCTION CODES */ +#define OCLFPA 2 /* parse - OSQL */ +#define OCLFEX 4 /* execute - OEXEC */ +#define OCLFBI 6 /* BIND by name - OBIND */ +#define OCLFDB 8 /* define buffer - ODEFIN */ +#define OCLFDI 10 /* describe item - ODSC */ +#define OCLFFE 12 /* fetch - OFETCH */ +#define OCLFOC 14 /* open cursor - OOPEN */ +# define OCLFLI OCLFOC /* old name for open cursor - OOPEN */ +#define OCLFCC 16 /* close cursor - OCLOSE */ +# define OCLFLO OCLFCC /* old name for close cursor - OCLOSE */ +#define OCLFDS 22 /* describe - ODSC */ +#define OCLFON 24 /* get table and column names - ONAME */ +#define OCLFP3 26 /* parse - OSQL3 */ +#define OCLFBR 28 /* bind reference by name - OBNDRV */ +#define OCLFBX 30 /* bind referecne numeric - OBNDRN */ +#define OCLFSO 34 /* special function - OOPT */ +#define OCLFRE 36 /* resume - ORESUM */ +#define OCLFBN 50 /* bindn */ +#define OCLFMX 52 /* maximum function number */ + +#ifdef NEVER /* unused codes */ +# define OCLFLK 18 /* open for kernel operations */ +# define OCLFEK 20 /* execute kernel operations */ +# define OCLFOK 22 /* kernel close */ +# define OCLFIN 28 /* logon to oracle */ +# define OCLFOF 30 /* logoff from oracle */ +# define OCLFAX 32 /* allocate a context area */ +# define OCLFPI 34 /* page in context area */ +# define OCLFIS 36 /* special system logon */ +# define OCLFCO 38 /* cancel the current operation */ +# define OCLFGI 40 /* get database id */ +# define OCLFJN 42 /* journal operation */ +# define OCLFCL 44 /* cleanup prior execute operation */ +# define OCLFMC 46 /* map a cursor area */ +# define OCLFUC 48 /* unmap cursor and restore user maping */ +#endif /*NEVER *//* obsolete codes */ + + +/* values for ocimode in ocipin call */ + +#define OCIEVDEF UPIEVDEF /* default : non-thread safe enivronment */ +#define OCIEVTSF UPIEVTSF /* thread-safe environment */ + + +/* OCIL* flags used to determine the mode of login, using ocilog(). +** Currently defined only for non-blocking and thread-safe logins. +*/ + +#define OCILMDEF UPILMDEF /* default, regular login */ +#define OCILMNBL UPILMNBL /* non-blocking logon */ +#define OCILMESY UPILMESY /* thread safe but external sync */ +#define OCILMISY UPILMISY /* internal sync, we do it */ +#define OCILMTRY UPILMTRY /* try to, but do not block on mutex */ + + +/* + * since sqllib uses both ocidef and ocidfn the following defines + * need to be guarded + */ +#ifndef OCI_FLAGS +#define OCI_FLAGS + +/* OCI_*_PIECE defines the piece types that are returned or set +*/ + +#define OCI_ONE_PIECE UPI_ONE_PIECE /* there or this is the only piece */ +#define OCI_FIRST_PIECE UPI_FIRST_PIECE /* the first of many pieces */ +#define OCI_NEXT_PIECE UPI_NEXT_PIECE /* the next of many pieces */ +#define OCI_LAST_PIECE UPI_LAST_PIECE /* the last piece of this column */ +#endif + +/* +** OCITAB: define return code pairs for version 2 to 3 conversions +*/ +struct ocitab +{ + sb2 ocitv3; /* Version 3/4 return code */ + sb2 ocitv2; /* Version 2 equivalent return code */ +}; +typedef struct ocitab ocitab; + +externref const ocitab ocitbl[]; + +/* macros to check cursors and LDA's. */ +/* macros to set error codes */ + +# define CRSCHK(c) if ((c->csrchk != CSRCHECK)\ + && !bit(c->csrflg, CSRFREFC))\ + return(ocir32(c, OER(1001))) +# define ldaerr(l, e) ( l->csrrc = (sb2)(-( l->csrarc = (ub2)(e)) ) ) +# define LDACHK(l) if (l->csrchk != LDACHECK) \ + return(ldaerr(l, OER(1001))) + + +/************************************************/ +/* OCI PROCEDURE DECLARATIONS */ +/************************************************/ + + + + +/*****************************/ +/* Database logon/logout */ +/*****************************/ +sword ocilog( ldadef *lda, struct hstdef *hst, oratext *uid, sword uidl, + oratext *psw, sword pswl, oratext* conn, sword connl, + ub4 mode ); +sword ocilon( ldadef *lda, oratext *uid, sword uidl, oratext *psw, + sword pswl, sword audit ); +sword ocilgi( ldadef *lda, sb2 areacount ); +sword ocirlo( ldadef *lda, struct hstdef *hst, oratext *uid, sword uidl, + oratext *psw, sword pswl, sword audit ); + /* ocilon - logon to oracle + ** ocilgi - version 2 compatible ORACLE logon call. + ** no login to ORACLE is performed: the LDA is initialized + ** ocirlo - version 5 compatible ORACLE Remote Login call, + ** oracle login is executed. + ** lda - pointer to ldadef + ** uid - user id [USER[/PASSWORD]] + ** uidl - length of uid, if -1 strlen(uid) is used + ** psw - password string; ignored if specified in uid + ** pswl - length of psw, if -1 strlen(psw) is used + ** audit - is not supported; the only permissible value is 0 + ** areacount - unused + */ + +sword ocilof( ldadef *lda ); + /* + ** ocilof - disconnect from ORACLE + ** lda - pointer to ldadef + */ + + +/*********************/ +/* Error Messages */ +/*********************/ +sword ocierr( ldadef *lda, sb2 rcode, oratext *buffer, sword bufl ); +sword ocidhe( sb2 rcode, oratext *buffer ); + /* + ** Move the text explanation for an ORACLE error to a user defined buffer + ** ocierr - will return the message associated with the hstdef stored + ** in the lda. + ** ocidhe - will return the message associated with the default host. + ** lda - lda associated with the login session + ** rcode - error code as returned by V3 call interface + ** buffer - address of a user buffer of at least 132 characters + */ + + +/***********************/ +/* Cursor Open/Close */ +/***********************/ +sword ociope( struct csrdef *cursor, ldadef *lda, oratext *dbn, sword dbnl, + sword areasize, oratext *uid, sword uidl ); + +sword ociclo( struct csrdef *cursor ); + /* + ** open or close a cursor. + ** cursor - pointer to csrdef + ** ldadef - pointer to ldadef + ** dbn - unused + ** dbnl - unused + ** areasize - if (areasize == -1) areasize <- system default initial size + ** else if (areasize IN [1..256]) areasize <- areasize * 1024; + ** most applications should use the default size since context + ** areas are extended as needed until memory is exhausted. + ** uid - user id + ** uidl - userid length + */ + +/***********************************/ +/* CONTROL AND OPTIONS */ +/***********************************/ +sword ocibre( ldadef *lda ); + /* + ** ocibrk - Oracle Call Interface send BReaK Sends a break to + ** oracle. If oracle is active, the current operation is + ** cancelled. May be called asynchronously. DOES NOT SET + ** OERRCD in the hst. This is because ocibrk may be called + ** asynchronously. Callers must test the return code. + ** lda - pointer to a ldadef + */ + +sword ocican( struct csrdef *cursor ); + /* + ** cancel the operation on the cursor, no additional OFETCH calls + ** will be issued for the existing cursor without an intervening + ** OEXEC call. + ** cursor - pointer to csrdef + */ + +sword ocisfe( struct csrdef *cursor, sword erropt, sword waitopt ); + /* + ** ocisfe - user interface set error options + ** set the error and cursor options. + ** allows user to set the options for dealing with fatal dml errors + ** and other cursor related options + ** see oerdef for valid settings + ** cursor - pointer to csrdef + ** erropt - error optionsn + ** waitopr - wait options + */ + + +/***************************************/ +/* COMMIT/ROLLBACK/AUTOCOMMIT */ +/***************************************/ +sword ocicom( ldadef *lda ); +sword ocirol( ldadef *lda ); + /* + ** ocicom - commit the current transaction + ** ocirol - roll back the current transaction + */ + +sword ocicon( ldadef *lda ); +sword ocicof( ldadef *lda ); + /* + ** ocicon - auto Commit ON + ** ocicof - auto Commit OFf + */ + + + +/************************/ +/* parsing */ +/************************/ +sword ocisq3(struct csrdef *cursor, oratext * /* sqlstm */, sword sqllen); + /* + ** ocisq3 - user interface parse sql statement + ** cursor - pointer to csrdef + ** sqlstm - pointer to SQL statement + ** sqllen - length of SQL statement. if -1, strlen(sqlstm) is used + */ + + + +/***************************/ +/* BINDING */ +/***************************/ +/* these are for the opcode in ocibndps, ocidfnps */ +#define OCI_PCWS 0 +#define OCI_SKIP 1 + +sword ocibin( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + oratext *fmt, sword fmtl, sword fmtt ); +sword ocibrv( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, sb2 *indp, + oratext *fmt, sword fmtl, sword fmtt ); +sword ocibra( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, ub2 *aln, ub2 *rcp, ub4 mal, ub4 *cal, + oratext *fmt, sword fmtl, sword fmtt ); +sword ocibndps( struct csrdef *cursor, ub1 opcode, oratext *sqlvar, + sb4 sqlvl, ub1 *progv, sb4 progvl, sword ftype, + sword scale, sb2 *indp, ub2 *aln, ub2 *rcp, sb4 pv_skip, + sb4 ind_skip, sb4 len_skip, sb4 rc_skip, ub4 mal, + ub4 *cal, oratext *fmt, sb4 fmtl, sword fmtt ); +sword ocibnn ( struct csrdef *cursor, ub2 sqlvn, ub1 *progv, sword progvl, + sword ftype, sword scale, oratext *fmt, sword fmtl, + sword fmtt ); +sword ocibrn( struct csrdef *cursor, sword sqlvn, ub1 *progv, sword progvl, + sword ftype, sword scale, sb2 *indp, oratext *fmt, sword fmtl, + sword fmtt ); + /* + ** ocibin - bind by value by name + ** ocibrv - bind by reference by name + ** ocibra - bind by reference by name (array) + ** ocibndps - bind by reference by name (array) piecewise or with skips + ** ocibnn - bind by value numeric + ** ocibrn - bind by reference numeric + ** + ** the contents of storage specified in bind-by-value calls are + ** evaluated immediately. + ** the addresses of storage specified in bind-by-reference calls are + ** remembered, and the contents are examined at every execute. + ** + ** cursor - pointer to csrdef + ** sqlvn - the number represented by the name of the bind variables + ** for variables of the form :n or &n for n in [1..256) + ** (i.e. &1, :234). unnecessarily using larger numbers + ** in the range wastes space. + ** sqlvar - the name of the bind variable (:name or &name) + ** sqlval - the length of the name; + ** in bindif -1, strlen(bvname) is used + ** progv - pointer to the object to bind. + ** progvl - length of object to bind. + ** in bind-by-value if specified as -1 then strlen(bfa) is + ** used (really only makes sends with character types) + ** in bind-by-value, if specified as -1 then UB2MAXVAL + ** is used. Again this really makes sense only with + ** SQLT_STR. + ** ftype - datatype of object + ** indp - pointer to indicator variable. + ** -1 means to ignore bfa/bfl and bind NULL; + ** not -1 means to bind the contents of bfa/bfl + ** bind the contents pointed to by bfa + ** aln - Alternate length pointer + ** rcp - Return code pointer + ** mal - Maximum array length + ** cal - Current array length pointer + ** fmt - format string + ** fmtl - length of format string; if -1, strlen(fmt) is used + ** fmtt - desired output type after applying forat mask. Not + ** really yet implemented + ** scale - number of decimal digits in a cobol packed decimal (type 7) + ** + ** Note that the length of bfa when bound as SQLT_STR is reduced + ** to strlen(bfa). + ** Note that trailing blanks are stripped of storage of SQLT_STR. + */ + +/***************************/ +/* DESCRIBING */ +/***************************/ +sword ocidsc ( struct csrdef *cursor, sword pos, sb2 *dbsize, sb2 *fsize, + sb2 *rcode, sb2 *dtype, sb1 *buf, sb2 *bufl, sb2 *dsize ); +sword ocidsr( struct csrdef *cursor, sword pos, sb2 *dbsize, sb2 *dtype, + sb2 *fsize ); +sword ocinam( struct csrdef *cursor, sword pos, sb1 *tbuf, sb2 *tbufl, + sb1 *buf, sb2 *bufl ); + /* + ** ocidsc, ocidsr: Obtain information about a column + ** ocinam : get the name of a column + ** cursor - pointer to csrdef + ** pos - position in select list from [1..N] + ** dbsize - place to store the database size + ** fsize - place to store the fetched size + ** rcode - place to store the fetched column returned code + ** dtype - place to store the data type + ** buf - array to store the column name + ** bufl - place to store the column name length + ** dsize - maximum display size + ** tbuf - place to store the table name + ** tbufl - place to store the table name length + */ + +sword ocidsp ( struct csrdef *cursor, sword pos, sb4 *dbsize, sb2 *dbtype, + sb1 *cbuf, sb4 *cbufl, sb4 *dsize, sb2 *pre, sb2 *scl, + sb2 *nul ); + +sword ocidpr( ldadef *lda, oratext *object_name, size_t object_length, + void * reserved1, size_t reserved1_length, void * reserved2, + size_t reserved2_length, ub2 *overload, ub2 *position, + ub2 *level, oratext **argument_name, ub2 *argument_length, + ub2 *datatype, ub1 *default_supplied, ub1 *in_out, + ub4 *length, sb2 *precision, sb2 *scale, ub1 *radix, + ub4 *spare, ub4 *total_elements ); + /* + ** OCIDPR - User Program Interface: Describe Stored Procedure + ** + ** This routine is used to obtain information about the calling + ** arguments of a stored procedure. The client provides the + ** name of the procedure using "object_name" and "database_name" + ** (database name is optional). The client also supplies the + ** arrays for OCIDPR to return the values and indicates the + ** length of array via the "total_elements" parameter. Upon return + ** the number of elements used in the arrays is returned in the + ** "total_elements" parameter. If the array is too small then + ** an error will be returned and the contents of the return arrays + ** are invalid. + ** + ** + ** EXAMPLE : + ** + ** Client provides - + ** + ** object_name - SCOTT.ACCOUNT_UPDATE@BOSTON + ** total_elements - 100 + ** + ** + ** ACCOUNT_UPDATE is an overloaded function with specification : + ** + ** type number_table is table of number index by binary_integer; + ** table account (account_no number, person_id number, + ** balance number(7,2)) + ** table person (person_id number(4), person_nm varchar2(10)) + ** + ** function ACCOUNT_UPDATE (account number, + ** person person%rowtype, amounts number_table, + ** trans_date date) return accounts.balance%type; + ** + ** function ACCOUNT_UPDATE (account number, + ** person person%rowtype, amounts number_table, + ** trans_no number) return accounts.balance%type; + ** + ** + ** Values returned - + ** + ** overload position argument level datatype length prec scale rad + ** ------------------------------------------------------------------- + ** 0 0 0 NUMBER 22 7 2 10 + ** 0 1 ACCOUNT 0 NUMBER 22 0 0 0 + ** 0 2 PERSON 0 RECORD 0 0 0 0 + ** 0 2 PERSON_ID 1 NUMBER 22 4 0 10 + ** 0 2 PERSON_NM 1 VARCHAR2 10 0 0 0 + ** 0 3 AMOUNTS 0 TABLE 0 0 0 0 + ** 0 3 1 NUMBER 22 0 0 0 + ** 0 4 TRANS_NO 0 NUMBER 22 0 0 0 + ** + ** 1 0 0 NUMBER 22 7 2 10 + ** 1 1 ACCOUNT 0 NUMBER 22 0 0 0 + ** 1 2 PERSON 0 RECORD 0 0 0 0 + ** 1 2 PERSON_ID 1 NUMBER 22 4 0 10 + ** 1 2 PERSON_NM 1 VARCHAR2 10 0 0 0 + ** 1 3 AMOUNTS 0 TABLE 0 0 0 0 + ** 1 3 1 NUMBER 22 0 0 0 + ** 1 4 TRANS_DATE 0 NUMBER 22 0 0 0 + ** + ** + ** OCIDPR Argument Descriptions - + ** + ** ldadef - pointer to ldadef + ** object_name - object name, synonyms are also accepted and will + ** be translate, currently only procedure and function + ** names are accepted, also NLS names are accepted. + ** Currently, the accepted format of a name is + ** [[part1.]part2.]part3[@dblink] (required) + ** object_length - object name length (required) + ** reserved1 - reserved for future use + ** reserved1_length - reserved for future use + ** reserved2 - reserved for future use + ** reserved2_length - reserved for future use + ** overload - array indicating overloaded procedure # (returned) + ** position - array of argument positions, position 0 is a + ** function return argument (returned) + ** level - array of argument type levels, used to describe + ** sub-datatypes of data structures like records + ** and arrays (returned) + ** argument_name - array of argument names, only returns first + ** 30 characters of argument names, note storage + ** for 30 characters is allocated by client (returned) + ** argument_length - array of argument name lengths (returned) + ** datatype - array of oracle datatypes (returned) + ** default_supplied - array indicating parameter has default (returned) + ** 0 = no default, 1 = default supplied + ** in_out - array indicating if argument is IN or OUT (returned + ** 0 = IN param, 1 = OUT param, 2 = IN/OUT param + ** length - array of argument lengths (returned) + ** precision - array of precisions (if number type)(returned) + ** scale - array of scales (if number type)(returned) + ** radix - array of radix (if number type)(returned) + ** spare - array of spares. + ** total_elements - size of arrays supplied by client (required), + ** total number of elements filled (returned) + */ + +/*************************************/ +/* DEFINING */ +/*************************************/ +sword ocidfi( struct csrdef *cursor, sword pos, ub1 *buf, sword bufl, + sword ftype, sb2 *rc, sword scale ); +sword ocidfn( struct csrdef *cursor, sword pos, ub1 *buf, sword bufl, + sword ftype, sword scale, sb2 *indp, oratext *fmt, sword fmtl, + sword fmtt, ub2 *rl, ub2 *rc ); +sword ocidfnps( struct csrdef *cursor, ub1 opcode, sword pos, ub1 *buf, + sb4 bufl, sword ftype, sword scale, + sb2 *indp, oratext *fmt, sb4 fmtl, + sword fmtt, ub2 *rl, ub2 *rc, + sb4 pv_skip, sb4 ind_skip, sb4 len_skip, + sb4 rc_skip ); + + + /* Define a user data buffer using upidfn + ** cursor - pointer to csrdef + ** pos - position of a field or exp in the select list of a query + ** bfa/bfl - address and length of client-supplied storage + to receive data + ** ftype - user datatype + ** scale - number of fractional digits for cobol packed decimals + ** indp - place to store the length of the returned value. If returned + ** value is: + ** negative, the field fetched was NULL + ** zero , the field fetched was same length or shorter than + ** the buffer provided + ** positive, the field fetched was truncated + ** fmt - format string + ** fmtl - length of format string, if -1 strlent(fmt) used + ** rl - place to store column length after each fetch + ** rc - place to store column error code after each fetch + ** fmtt - fomat type + */ + +/********************************/ +/* PIECE INFORMATION GET/SET */ +/********************************/ +sword ocigetpi( struct csrdef *cursor, ub1 *piecep, + void **ctxpp, ub4 *iterp, ub4 *indexp ); +sword ocisetpi( struct csrdef *cursor, ub1 piece, + void *bufp, ub4 *lenp ); + + +/********************************/ +/* EXECUTE */ +/********************************/ +sword ociexe( struct csrdef *cursor ); +sword ociexn( struct csrdef *cursor, sword iters, sword roff ); +sword ociefn( struct csrdef *cursor, ub4 nrows, sword can, sword exact ); + /* + ** ociexe - execute a cursor + ** ociexn - execute a cursosr N times + ** cursor - pointer to a csrdef + ** iters - number of times to execute cursor + ** roff - offset within the bind variable array at which to begin + ** operations. + */ + + +/*********************************/ +/* FETCHING */ +/*********************************/ +sword ocifet( struct csrdef *cursor ); +sword ocifen( struct csrdef *cursor, sword nrows ); + /* ocifet - fetch the next row + ** ocifen - fetch n rows + ** cursor - pointer to csrdef + ** nrows - number of rows to be fetched + */ + +sword ocilng( struct csrdef *cursor, sword posit, ub1 *bfa, sb4 bfl, + sword dty, ub4 *rln, sb4 off ); + +/*********************************/ +/* CONVERSION */ +/*********************************/ +sword ocic32( struct csrdef *cursor ); + /* + ** Convert selected version 3 return codes to the equivalent + ** version 2 code. + ** csrdef->csrrc is set to the converted code + ** csrdef->csrft is set to v2 oracle statment type + ** csrdef->csrrpc is set to the rows processed count + ** csrdef->csrpeo is set to error postion + ** + ** cursor - pointer to csrdef + */ + + +sword ocir32( struct csrdef *cursor, sword retcode ); + /* + ** Convert selected version 3 return codes to the equivalent version 2 + ** code. + ** + ** cursor - pointer to csrdef + ** retcode - place to store the return code + */ + + +void ociscn( sword **arglst, char *mask_addr, sword **newlst ); + /* + ** Convert call-by-ref to call-by-value: + ** takes an arg list and a mask address, determines which args need + ** conversion to a value, and creates a new list begging at the address + ** of newlst. + ** + ** arglst - list of arguments + ** mast_addr _ mask address determines args needing conversion + ** newlst - new list of args + */ + +sword ocistf ( sword typ, sword bufl, sword rdig, oratext *fmt, + struct csrdef *cursor, sword *err ); +/* Convert a packed decimal buffer length (bytes) and scale to a format +** string of the form mm.+/-nn, where mm is the number of packed +** decimal digits, and nn is the scaling factor. A positive scale name +** nn digits to the rights of the decimal; a negative scale means nn zeros +** should be supplied to the left of the decimal. +** bufl - length of the packed decimal buffer +** rdig - number of fractional digits +** fmt - pointer to a string holding the conversion format +** cursor - pointer to csrdef +** err - pointer to word storing error code +*/ + + +/******************************************/ +/* Non-blocking operations */ +/******************************************/ +sword ocinbs( ldadef *lda ); /* set a connection to non-blocking */ +sword ocinbt( ldadef *lda ); /* test if connection is non-blocking */ +sword ocinbc( ldadef *lda ); /* clear a connection to blocking */ +sword ocinlo( ldadef *lda, struct hstdef *hst, oratext *conn, + sword connl, oratext *uid, sword uidl, + oratext *psw, sword pswl, sword audit ); + /* logon in non-blocking fashion */ +/* ocinlo allows an application to logon in non-blocking fashion. +** lda - pointer to ldadef +** hst - pointer to a 256 byte area, must be cleared to zero before call +** conn - the database link (if specified @LINK in uid will be ignored) +** connl - length of conn; if -1 strlen(conn) is used +** uid - user id [USER[/PASSWORD][@LINK]] +** uidl - length of uid, if -1 strlen(uid) is used +** psw - password string; ignored if specified in uid +** pswl - length of psw, if -1 strlen(psw) is used +** audit - is not supported; the only permissible value is 0 +*/ + +/***************************************************/ +/* Procedure Declaration for Pro*C */ +/***************************************************/ +/* Note: The following routines are used in Pro*C and have the + same interface as their couterpart in OCI. + Althought the interface follows for more details please refer + to the above routines */ + +/******************************************/ +/* initialization/logon/logof */ +/******************************************/ +sword ocipin( ub4 mode ); + +sword ologin( ldadef *lda, sb2 areacount ); +sword ologon( ldadef *lda, sb2 areacount ); + +/*****************************************/ +/* Open/Close/Parse Cursor */ +/*****************************************/ + +/* +** ocisqd - oci delayed parse (Should be used only with deferred upi/oci) +** FUNCTION: Call upidpr to delay the parse of the sql statement till the +** time that a call needs to be made to the kernel (execution or +** describe time ) +** RETURNS: Oracle return code. +*/ +sword ocisq7( struct csrdef *cursor, oratext * /* sqlstm */, sb4 sqllen, + sword defflg, ub4 sqlt ); + +/*****************************************/ +/* Bind */ +/*****************************************/ +sword obind( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + oratext *fmt, sword fmtl, sword fmtt ); +sword obindn( struct csrdef *cursor, ub2 sqlvn, ub1 *progv, sword progvl, + sword ftype, sword scale, oratext *fmt, sword fmtl, + sword fmtt ); + +/**********************************************/ +/* Define */ +/**********************************************/ +sword odfinn( struct csrdef *cursor, sword pos, ub1 *buf, sword bufl, + sword ftype, sb2 *rc, sword scale ); + +/**********************************************/ +/* Describe */ +/**********************************************/ +sword odsrbn( struct csrdef *cursor, sword pos, sb2 *dbsize, sb2 *dtype, + sb2 *fsize ); + + +/******************************************/ +/* Non-blocking operations */ +/******************************************/ +sword onblon( ldadef *lda, struct hstdef *hst, oratext *conn, + sword connl, oratext *uid, sword uidl, + oratext *psw, sword pswl, sword audit ); + /* logon in non-blocking fashion */ +sword ocignfd( ldadef *lda, void *nfdp ); /* get native fd */ + +ub2 ocigft_getFcnType( ub2 oertyp ); /* get sql function code */ + +#endif diff --git a/libraries/SQLAPI/include/ora_win/ocidem.h b/libraries/SQLAPI/include/ora_win/ocidem.h new file mode 100644 index 000000000..a6d0eaf37 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ocidem.h @@ -0,0 +1,113 @@ +/* + * + */ + +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ocidem.h - OCI demo header + MODIFIED (MM/DD/YY) + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + whe 04/07/99 - bug#810071 + whe 03/19/99 - lrg 32079 etc.: putting static back for oci_func_tab + nmacnaug 02/02/99 - static declarations should not be in header files + mygopala 09/22/97 - Fix for bug 550351 + surman 03/14/97 - Merge 413362 to 8.0.3 + surman 11/08/96 - 413362: Add SS_64BIT_SERVER macro + emendez 04/07/94 - merge changes from branch 1.6.710.1 + emendez 02/02/94 - Fix for bug 157576 + jnlee 01/05/93 - include oratypes.h once, make oci_func_tab static + rkooi2 10/26/92 - More portability mods + rkooi2 10/22/92 - Change text back to char to avoid casts + rkooi2 10/20/92 - Changes to make it portable + sjain 03/16/92 - Creation +*/ + +/* + * ocidem.h + * + * Declares additional functions and data structures + * used in the OCI C sample programs. + */ + + +#ifndef ORATYPES +#include +#endif /* ORATYPES */ + +#ifndef OCIDFN +#include +#endif /* OCIDFN */ + +#ifndef OCIDEM +#define OCIDEM + + +/* internal/external datatype codes */ +#define VARCHAR2_TYPE 1 +#define NUMBER_TYPE 2 +#define INT_TYPE 3 +#define FLOAT_TYPE 4 +#define STRING_TYPE 5 +#define ROWID_TYPE 11 +#define DATE_TYPE 12 + +/* ORACLE error codes used in demonstration programs */ +#define VAR_NOT_IN_LIST 1007 +#ifndef NO_DATA_FOUND +# define NO_DATA_FOUND 1403 +#endif +#define NULL_VALUE_RETURNED 1405 + +/* some SQL and OCI function codes */ +#define FT_INSERT 3 +#define FT_SELECT 4 +#define FT_UPDATE 5 +#define FT_DELETE 9 + +#define FC_OOPEN 14 + +/* + * OCI function code labels, + * corresponding to the fc numbers + * in the cursor data area. + */ +static const text *oci_func_tab[] = {(text *) "not used", +/* 1-2 */ (text *) "not used", (text *) "OSQL", +/* 3-4 */ (text *) "not used", (text *) "OEXEC, OEXN", +/* 5-6 */ (text *) "not used", (text *) "OBIND", +/* 7-8 */ (text *) "not used", (text *) "ODEFIN", +/* 9-10 */ (text *) "not used", (text *) "ODSRBN", +/* 11-12 */ (text *) "not used", (text *) "OFETCH, OFEN", +/* 13-14 */ (text *) "not used", (text *) "OOPEN", +/* 15-16 */ (text *) "not used", (text *) "OCLOSE", +/* 17-18 */ (text *) "not used", (text *) "not used", +/* 19-20 */ (text *) "not used", (text *) "not used", +/* 21-22 */ (text *) "not used", (text *) "ODSC", +/* 23-24 */ (text *) "not used", (text *) "ONAME", +/* 25-26 */ (text *) "not used", (text *) "OSQL3", +/* 27-28 */ (text *) "not used", (text *) "OBNDRV", +/* 29-30 */ (text *) "not used", (text *) "OBNDRN", +/* 31-32 */ (text *) "not used", (text *) "not used", +/* 33-34 */ (text *) "not used", (text *) "OOPT", +/* 35-36 */ (text *) "not used", (text *) "not used", +/* 37-38 */ (text *) "not used", (text *) "not used", +/* 39-40 */ (text *) "not used", (text *) "not used", +/* 41-42 */ (text *) "not used", (text *) "not used", +/* 43-44 */ (text *) "not used", (text *) "not used", +/* 45-46 */ (text *) "not used", (text *) "not used", +/* 47-48 */ (text *) "not used", (text *) "not used", +/* 49-50 */ (text *) "not used", (text *) "not used", +/* 51-52 */ (text *) "not used", (text *) "OCAN", +/* 53-54 */ (text *) "not used", (text *) "OPARSE", +/* 55-56 */ (text *) "not used", (text *) "OEXFET", +/* 57-58 */ (text *) "not used", (text *) "OFLNG", +/* 59-60 */ (text *) "not used", (text *) "ODESCR", +/* 61-62 */ (text *) "not used", (text *) "OBNDRA", +/* 63-64 */ (text *) "OBINDPS", (text *) "ODEFINPS", +/* 65-66 */ (text *) "OGETPI", (text *) "OSETPI" +}; + +#endif /* OCIDEM */ + diff --git a/libraries/SQLAPI/include/ora_win/ocidfn.h b/libraries/SQLAPI/include/ora_win/ocidfn.h new file mode 100644 index 000000000..7a3ac2de3 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ocidfn.h @@ -0,0 +1,249 @@ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ocidfn.h - OCI Definations + NOTES + Shipped to users. + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 11/25/02 - change binary float/double codes + srseshad 11/14/02 - Add SQLT_IBFLOAT, SQLT_IBDOUBLE + mxyang 09/17/02 - grabtrans 'mmorsi_obj_float' + srseshad 09/06/02 - Add binary float/double + aahluwal 06/04/02 - bug 2360115 + kmuthukk 05/02/00 - add SQLT_PNTY + amangal 07/30/99 - Merge into 8.1.6 : Bug 879031 + tnbui 07/28/99 - Remove SQLT_TIMESTAMP_ITZ + tnbui 07/21/99 - SQLT_TIMESTAMP_LTZ + tnbui 06/16/99 - TIMESTAMP WITH IMPLICIT TIME ZONE + whe 04/07/99 - bug#810075 + whe 03/19/99 - lrg 32079 etc.: move HDA def from ocidem.h to ocidfn. + skmishra 05/10/98 - + vyanaman 04/16/98 - update sql92 datatypes + khnguyen 01/16/98 - + khnguyen 12/23/97 - SQLT* for datetimes and intervals + tanguyen 08/19/97 - + dchatter 03/18/97 - porting exception 390897 + dchatter 05/02/97 - merge porting exception + dalpern 12/04/96 - SQLCS_LIT_NULL added + cxcheng 11/14/96 - add SQLT_BFILE/SQLT_CFILE to fix compile prob + cxcheng 11/12/96 - add SQLT_NCO for named collection + lchidamb 10/17/96 - add SQLT_VST and SQLT_ODT + sgollapu 10/14/96 - Mutual exclusion of ocidfn and sqldef + sgollapu 10/07/96 - OCI Simplification + aroy 09/09/96 - add SQLCS* definitions + slari 08/07/96 - add SQLT_RDD, rowid descriptor + slari 06/12/96 - remove SQLT_TTBL + dchatter 04/21/96 - prepare for merge into main + slari 08/24/95 - b299432, define CDA_SIZE + zwalcott 02/28/96 - add SQLT_BFILEE and SQLT_CFILEE. + lchidamb 02/22/96 - make dtys consistent with dtydef.h + lchidamb 02/16/96 - add SQLT_BFILEE and SQLT_CFILEE + lchidamb 01/30/96 - rename new datatypes for v8 + lchidamb 09/06/95 - add new datatypes + slari 05/11/95 - add OCI_EV_DEF and OCI_EV_TSF + dchatter 04/06/95 - add ifdef flags around OCI_flags + dchatter 03/08/95 - piece values + dchatter 03/06/95 - merge changes from branch 1.2.720.3 + jfbrown 02/17/95 - merge changes from branch 1.2.720.2 + dchatter 02/08/95 - olog call modes + jfbrown 02/03/95 - remove non-printable characters + lchidamb 12/06/94 - merge changes from branch 1.2.720.1 + lchidamb 10/04/94 - added field chk to cda_head, cda_def + dchatter 07/05/94 - SQLT_CUR added + rkooi2 11/27/92 - Changing e* datatypes to s* + rkooi2 10/26/92 - More portability mods + rkooi2 10/22/92 - Added #ifndef ORATYPES ... + rkooi2 10/18/92 - Changes to make it portable. + sjain 03/16/92 - Creation +*/ + +/* + * ocidfn.h + * + * Common header file for OCI C sample programs. + * This header declares the cursor and logon data area structure. + * The types used are defined in . + * + */ + +#ifndef OCIDFN +#define OCIDFN + +#include + +/* The cda_head struct is strictly PRIVATE. It is used + internally only. Do not use this struct in OCI programs. */ + +struct cda_head { + sb2 v2_rc; + ub2 ft; + ub4 rpc; + ub2 peo; + ub1 fc; + ub1 rcs1; + ub2 rc; + ub1 wrn; + ub1 rcs2; + sword rcs3; + struct { + struct { + ub4 rcs4; + ub2 rcs5; + ub1 rcs6; + } rd; + ub4 rcs7; + ub2 rcs8; + } rid; + sword ose; + ub1 chk; + void *rcsp; +}; + +/* +** Size of HDA area: +** 512 for 64 bit arquitectures +** 256 for 32 bit arquitectures +*/ + +#if defined(SS_64BIT_SERVER) || defined(__64BIT__) +# define HDA_SIZE 512 +#else +# define HDA_SIZE 256 +#endif + +#if defined(SS_64BIT_SERVER) || defined(__64BIT__) +#define CDA_SIZE 88 +#else +# define CDA_SIZE 64 +#endif + +/* the real CDA, padded to CDA_SIZE bytes in size */ +struct cda_def { + sb2 v2_rc; /* V2 return code */ + ub2 ft; /* SQL function type */ + ub4 rpc; /* rows processed count */ + ub2 peo; /* parse error offset */ + ub1 fc; /* OCI function code */ + ub1 rcs1; /* filler area */ + ub2 rc; /* V7 return code */ + ub1 wrn; /* warning flags */ + ub1 rcs2; /* reserved */ + sword rcs3; /* reserved */ + struct { /* rowid structure */ + struct { + ub4 rcs4; + ub2 rcs5; + ub1 rcs6; + } rd; + ub4 rcs7; + ub2 rcs8; + } rid; + sword ose; /* OSD dependent error */ + ub1 chk; + void *rcsp; /* pointer to reserved area */ + ub1 rcs9[CDA_SIZE - sizeof (struct cda_head)]; /* filler */ +}; + +typedef struct cda_def Cda_Def; + +/* the logon data area (LDA) + is the same shape as the CDA */ +typedef struct cda_def Lda_Def; + +/* OCI Environment Modes for opinit call */ +#define OCI_EV_DEF 0 /* default single-threaded environment */ +#define OCI_EV_TSF 1 /* thread-safe environment */ + +/* OCI Logon Modes for olog call */ +#define OCI_LM_DEF 0 /* default login */ +#define OCI_LM_NBL 1 /* non-blocking logon */ + +/* + * since sqllib uses both ocidef and ocidfn the following defines + * need to be guarded + */ +#ifndef OCI_FLAGS +#define OCI_FLAGS + +/* OCI_*_PIECE defines the piece types that are returned or set +*/ +#define OCI_ONE_PIECE 0 /* there or this is the only piece */ +#define OCI_FIRST_PIECE 1 /* the first of many pieces */ +#define OCI_NEXT_PIECE 2 /* the next of many pieces */ +#define OCI_LAST_PIECE 3 /* the last piece of this column */ +#endif + +#ifndef SQLDEF + +/* input data types */ +#define SQLT_CHR 1 /* (ORANET TYPE) character string */ +#define SQLT_NUM 2 /* (ORANET TYPE) oracle numeric */ +#define SQLT_INT 3 /* (ORANET TYPE) integer */ +#define SQLT_FLT 4 /* (ORANET TYPE) Floating point number */ +#define SQLT_STR 5 /* zero terminated string */ +#define SQLT_VNU 6 /* NUM with preceding length byte */ +#define SQLT_PDN 7 /* (ORANET TYPE) Packed Decimal Numeric */ +#define SQLT_LNG 8 /* long */ +#define SQLT_VCS 9 /* Variable character string */ +#define SQLT_NON 10 /* Null/empty PCC Descriptor entry */ +#define SQLT_RID 11 /* rowid */ +#define SQLT_DAT 12 /* date in oracle format */ +#define SQLT_VBI 15 /* binary in VCS format */ +#define SQLT_BFLOAT 21 /* Native Binary float*/ +#define SQLT_BDOUBLE 22 /* NAtive binary double */ +#define SQLT_BIN 23 /* binary data(DTYBIN) */ +#define SQLT_LBI 24 /* long binary */ +#define SQLT_UIN 68 /* unsigned integer */ +#define SQLT_SLS 91 /* Display sign leading separate */ +#define SQLT_LVC 94 /* Longer longs (char) */ +#define SQLT_LVB 95 /* Longer long binary */ +#define SQLT_AFC 96 /* Ansi fixed char */ +#define SQLT_AVC 97 /* Ansi Var char */ +#define SQLT_IBFLOAT 100 /* binary float canonical */ +#define SQLT_IBDOUBLE 101 /* binary double canonical */ +#define SQLT_CUR 102 /* cursor type */ +#define SQLT_RDD 104 /* rowid descriptor */ +#define SQLT_LAB 105 /* label type */ +#define SQLT_OSL 106 /* oslabel type */ + +#define SQLT_NTY 108 /* named object type */ +#define SQLT_REF 110 /* ref type */ +#define SQLT_CLOB 112 /* character lob */ +#define SQLT_BLOB 113 /* binary lob */ +#define SQLT_BFILEE 114 /* binary file lob */ +#define SQLT_CFILEE 115 /* character file lob */ +#define SQLT_RSET 116 /* result set type */ +#define SQLT_NCO 122 /* named collection type (varray or nested table) */ +#define SQLT_VST 155 /* OCIString type */ +#define SQLT_ODT 156 /* OCIDate type */ + +/* datetimes and intervals */ +#define SQLT_DATE 184 /* ANSI Date */ +#define SQLT_TIME 185 /* TIME */ +#define SQLT_TIME_TZ 186 /* TIME WITH TIME ZONE */ +#define SQLT_TIMESTAMP 187 /* TIMESTAMP */ +#define SQLT_TIMESTAMP_TZ 188 /* TIMESTAMP WITH TIME ZONE */ +#define SQLT_INTERVAL_YM 189 /* INTERVAL YEAR TO MONTH */ +#define SQLT_INTERVAL_DS 190 /* INTERVAL DAY TO SECOND */ +#define SQLT_TIMESTAMP_LTZ 232 /* TIMESTAMP WITH LOCAL TZ */ + +#define SQLT_PNTY 241 /* pl/sql representation of named types */ + +/* cxcheng: this has been added for backward compatibility - + it needs to be here because ocidfn.h can get included ahead of sqldef.h */ +#define SQLT_FILE SQLT_BFILEE /* binary file lob */ +#define SQLT_CFILE SQLT_CFILEE +#define SQLT_BFILE SQLT_BFILEE + +/* CHAR/NCHAR/VARCHAR2/NVARCHAR2/CLOB/NCLOB char set "form" information */ +#define SQLCS_IMPLICIT 1 /* for CHAR, VARCHAR2, CLOB w/o a specified set */ +#define SQLCS_NCHAR 2 /* for NCHAR, NCHAR VARYING, NCLOB */ +#define SQLCS_EXPLICIT 3 /* for CHAR, etc, with "CHARACTER SET ..." syntax */ +#define SQLCS_FLEXIBLE 4 /* for PL/SQL "flexible" parameters */ +#define SQLCS_LIT_NULL 5 /* for typecheck of NULL and empty_clob() lits */ + +#endif /* SQLDEF */ +#endif /* OCIDFN */ diff --git a/libraries/SQLAPI/include/ora_win/ociextp.h b/libraries/SQLAPI/include/ora_win/ociextp.h new file mode 100644 index 000000000..cab02dc9f --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ociextp.h @@ -0,0 +1,282 @@ +/* + * + */ + +/* Copyright (c) 1996, 2005, Oracle. All rights reserved. */ + +/* + NAME + ociextp.h - Interface Definitions for PL/SQL External Procedures + + DESCRIPTION + This header file contains C language callable interface from + PL/SQL External Procedures. + + PUBLIC FUNCTION(S) + OCIExtProcAllocCallMemory - Allocate Call memory + OCIExtProcRaiseExcp - Raise Exception + OCIExtProcRaiseExcpWithMsg - Raise Exception with message + OCIExtProcGetEnv - Get OCI Environment + + PRIVATE FUNCTION(S) + + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + rdecker 01/10/02 - change 32k to MAX_OEN for error numbers + sagrawal 07/20/01 - Statement Handle to safe cal outs + abrumm 04/19/01 - move include of oci.h after defines/typedef + rdecker 02/22/01 - lint fix + bpalaval 02/08/01 - Change text to oratext. + sagrawal 06/16/00 - ref cursor in callouts + whe 09/01/99 - 976457:check __cplusplus for C++ code + asethi 04/15/99 - Created (by moving ociextp.h from /vobs/plsql/public) + rhari 03/25/97 - Use ifndef + rhari 12/18/96 - Include oratypes.h + rhari 12/11/96 - #416977, Flip values of return codes + rhari 12/02/96 - Define Return Code Macros + rhari 11/18/96 - Error number is int + rhari 10/30/96 - Fix OCIExtProcRaiseExcpWithMsg + rhari 10/30/96 - Get rid of warnings + rhari 10/04/96 - Fix OCIExtProcRaiseExcpWithMsg + rhari 09/23/96 - Creation + +*/ + + +#ifndef OCIEXTP_ORACLE +# define OCIEXTP_ORACLE + +# ifndef ORATYPES +# include +# endif + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/* ----------------------------- Return Codes ----------------------------- */ +/* Success and Error return codes for certain external procedure interface + * functions. If a particular interface function returns OCIEXTPROC_SUCCESS + * or OCIEXTPROC_ERROR, then applications must use these macros to check + * for return values. + * + * OCIEXTPROC_SUCCESS -- External Procedure Success Return Code + * OCIEXTPROC_ERROR -- External Procedure Failure Return Code + */ +#define OCIEXTPROC_SUCCESS 0 +#define OCIEXTPROC_ERROR 1 + + +/* --------------------------- With-Context Type --------------------------- */ +/* + * The C callable interface to PL/SQL External Procedures require the + * With-Context parameter to be passed. The type of this structure is + * OCIExtProcContext is is opaque to the user. + * + * The user can declare the With-Context parameter in the application as + * + * OCIExtProcContext *with_context; + */ +typedef struct OCIExtProcContext OCIExtProcContext; + +/* NOTE: OCIExtProcContext must be visible prior to including */ + +# ifndef OCI_ORACLE +# include +# endif + + +/* ----------------------- OCIExtProcAllocCallMemory ----------------------- */ +/* OCIExtProcAllocCallMemory + * Allocate N bytes of memory for the duration of the External Procedure. + * + * Memory thus allocated will be freed by PL/SQL upon return from the + * External Procedure. You must not use any kind of 'free' function on + * memory allocated by OCIExtProcAllocCallMemory. + * Use this function to allocate memory for function returns. + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * Type of with_context : OCIExtProcContext * + * amount - The number of bytes to allocate. + * Type of amount : size_t + * + * Output : + * Nothing + * + * Return : + * An untyped (opaque) Pointer to the allocated memory. + * + * Errors : + * A 0 return value should be treated as an error + * + * EXAMPLE + * text *ptr = (text *)OCIExtProcAllocCallMemory(wctx, 1024) + * + */ +#define OCIExtProcAllocCallMemory(with_context, amount) \ +ociepacm(with_context, (size_t)amount) + + + + +/* -------------------------- OCIExtProcRaiseExcp -------------------------- */ +/* OCIExtProcRaiseExcp + * Raise an Exception to PL/SQL. + * + * Calling this function signalls an exception back to PL/SQL. After a + * successful return from this function, the External Procedure must start + * its exit handling and return back to PL/SQL. Once an exception is + * signalled to PL/SQL, INOUT and OUT arguments, if any, are not processed + * at all. + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * Type of with_context : OCIExtProcContext * + * errnum - Oracle Error number to signal to PL/SQL. errnum + * must be a positive number and in the range 1 to MAX_OEN + * Type of errnum : int + * Output : + * Nothing + * + * Return : + * OCIEXTPROC_SUCCESS - If the call was successful. + * OCIEXTPROC_ERROR - If the call failed. + * + */ +#define OCIExtProcRaiseExcp(with_context, errnum) \ +ocieperr(with_context, (int)errnum) + + + + + +/* ---------------------- OCIExtProcRaiseExcpWithMsg ---------------------- */ +/* OCIExtProcRaiseExcpWithMsg + * Raise an exception to PL/SQL. In addition, substitute the + * following error message string within the standard Oracle error + * message string. See note for OCIExtProcRaiseExcp + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * Type of with_context : OCIExtProcContext * + * errnum - Oracle Error number to signal to PL/SQL. errnum + * must be a positive number and in the range 1 to MAX_OEN + * Type of errnum : int + * errmsg - The error message associated with the errnum. + * Type of errmsg : char * + * len - The length of the error message. 0 if errmsg is + * null terminated string. + * Type of len : size_t + * Output : + * Nothing + * + * Return : + * OCIEXTPROC_SUCCESS - If the call was successful. + * OCIEXTPROC_ERROR - If the call failed. + * + */ +#define OCIExtProcRaiseExcpWithMsg(with_context, errnum, errmsg, msglen) \ +ociepmsg(with_context, (int)errnum, errmsg, (size_t)msglen) + + + +/* --------------------------- OCIExtProcGetEnv --------------------------- */ +/* OCIExtProcGetEnv + * Get OCI Environment + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * + * Output : + * envh - The OCI Environment handle. + * svch - The OCI Service handle. + * errh - The OCI Error handle. + * + * Return : + * OCI_SUCCESS - Successful completion of the function. + * OCI_ERROR - Error. + * + */ +#define OCIExtProcGetEnv(with_context, envh, svch, errh) \ +ociepgoe(with_context, envh, svch, errh) + + + +/* ------------------------ OCIInitializeStatementHandle ------------------- */ +/* OCIreateStatementHandle + * Initialize Statement Handle + * + * PARAMETERS + * Input : + * wctx - The + * cursorno - The cursor number for which we need to initialize + * the statement handle + * svch - The OCI Service handle. + * + * Output : + * stmthp - The OCI Statement handle. + * errh - The OCI Error handle. + * + * Return : + * OCI_SUCCESS - Successful completion of the function. + * OCI_ERROR - Error. + * + */ +#define OCIInitializeStatementHandle(wctx, cursorno, svch, stmthp, errh) \ +ociepish(wctx, cursor, svch, stmthp, errh) + + + + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + + +void *ociepacm(OCIExtProcContext *with_context, size_t amount); + + + +size_t ocieperr(OCIExtProcContext *with_context, int error_number); + + + +size_t ociepmsg(OCIExtProcContext *with_context, int error_number, + oratext *error_message, size_t len ); + + + +sword ociepgoe(OCIExtProcContext *with_context, OCIEnv **envh, + OCISvcCtx **svch, OCIError **errh); + + +#endif /* OCIEXTP_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/ocikpr.h b/libraries/SQLAPI/include/ora_win/ocikpr.h new file mode 100644 index 000000000..465960d99 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ocikpr.h @@ -0,0 +1,165 @@ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ocikpr.h - header of K & R compilers + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + porangas 12/04/00 - Forward merge bug#974710 to 9i + sgollapu 05/19/98 - Change text to OraText + dchatter 04/21/96 - + dchatter 11/10/95 - add ognfd() - get native fd + lchidamb 04/06/95 - drop maxdsz from obindps/odefinps + slari 04/07/95 - add opinit + dchatter 03/08/95 - osetpi and ogetpi + lchidamb 12/09/94 - add obindps() and odefinps() + dchatter 03/06/95 - merge changes from branch 1.1.720.2 + dchatter 11/14/94 - merge changes from branch 1.1.720.1 + dchatter 02/08/95 - olog call; drop onblon + dchatter 10/31/94 - new functions for non-blocking oci + rkooi2 11/27/92 - Changing datatypes (in comments) and return types + rkooi2 10/26/92 - More portability mods + rkooi2 10/18/92 - Changed to agree with oci.c + sjain 03/16/92 - Creation +*/ + +/* + * Declare the OCI functions. + * Prototype information is commented out. + * Use this header for non-ANSI C compilers. + * Note that you will need to include ocidfn.h in the .c files + * to get the definition for cda_def. + */ + +#ifndef OCIKPR +#define OCIKPR + +#include + +/* + * Oci BIND (Piecewise or with Skips) + */ +sword obindps( struct cda_def *cursor, ub1 opcode, OraText *sqlvar, + sb4 sqlvl, ub1 *pvctx, sb4 progvl, + sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip, + ub4 maxsiz, ub4 *cursiz, + OraText *fmt, sb4 fmtl, sword fmtt ); +sword obreak( struct cda_def *lda ); +sword ocan ( struct cda_def *cursor ); +sword oclose( struct cda_def *cursor ); +sword ocof ( struct cda_def *lda ); +sword ocom ( struct cda_def *lda ); +sword ocon ( struct cda_def *lda ); + + +/* + * Oci DEFINe (Piecewise or with Skips) + */ +sword odefinps( struct cda_def *cursor, ub1 opcode, sword pos,ub1 *bufctx, + sb4 bufl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sb4 fmtl, sword fmtt, + ub2 *rlen, ub2 *rcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip ); +sword odescr( struct cda_def *cursor, sword pos, sb4 *dbsize, + sb2 *dbtype, sb1 *cbuf, sb4 *cbufl, sb4 *dsize, + sb2 *prec, sb2 *scale, sb2 *nullok ); +sword odessp( struct cda_def *cursor, OraText *objnam, size_t onlen, + ub1 *rsv1, size_t rsv1ln, ub1 *rsv2, size_t rsv2ln, + ub2 *ovrld, ub2 *pos, ub2 *level, OraText **argnam, + ub2 *arnlen, ub2 *dtype, ub1 *defsup, ub1* mode, + ub4 *dtsiz, sb2 *prec, sb2 *scale, ub1 *radix, + ub4 *spare, ub4 *arrsiz ); +sword oerhms( struct cda_def *lda, sb2 rcode, OraText *buf, + sword bufsiz ); +sword oermsg( sb2 rcode, OraText *buf ); +sword oexec ( struct cda_def *cursor ); +sword oexfet( struct cda_def *cursor, ub4 nrows, + sword cancel, sword exact ); +sword oexn ( struct cda_def *cursor, sword iters, sword rowoff ); +sword ofen ( struct cda_def *cursor, sword nrows ); +sword ofetch( struct cda_def *cursor ); +sword oflng ( struct cda_def *cursor, sword pos, ub1 *buf, + sb4 bufl, sword dtype, ub4 *retl, sb4 offset ); +sword ogetpi( struct cda_def *cursor, ub1 *piecep, void **ctxpp, + ub4 *iterp, ub4 *indexp ); +sword opinit( ub4 mode ); +sword olog ( struct cda_def *lda, ub1 *hst, + OraText *uid, sword uidl, + OraText *psw, sword pswl, + OraText *conn, sword connl, + ub4 mode ); +sword ologof( struct cda_def *lda ); +sword oopen ( struct cda_def *cursor, struct cda_def *lda, + OraText *dbn, sword dbnl, sword arsize, + OraText *uid, sword uidl ); +sword oopt ( struct cda_def *cursor, sword rbopt, sword waitopt ); +sword oparse( struct cda_def *cursor, OraText *sqlstm, sb4 sqllen, + sword defflg, ub4 lngflg ); +sword orol ( struct cda_def *lda ); +sword osetpi( struct cda_def *cursor, ub1 piece, void *bufp, + ub4 *lenp ); +void sqlld2 ( struct cda_def *lda, OraText *cname, sb4 *cnlen ); +void sqllda ( struct cda_def *lda ); + +/* non-blocking functions */ +sword onbset( struct cda_def *lda ); +sword onbtst( struct cda_def *lda ); +sword onbclr( struct cda_def *lda ); +sword ognfd ( struct cda_def *lda, void *fdp ); + + + +/* + * OBSOLETE FUNCTIONS + */ + +/* + * OBSOLETE BIND CALLS-- use obindps() + */ +sword obndra( struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, ub4 maxsiz, + ub4 *cursiz, OraText *fmt, sword fmtl, sword fmtt ); +sword obndrn( struct cda_def *cursor, sword sqlvn, ub1 *progv, + sword progvl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt ); +sword obndrv( struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sword fmtl, sword fmtt ); + +/* + * OBSOLETE DEFINE CALLS-- use odefinps() + */ +sword odefin( struct cda_def *cursor, sword pos, ub1 *buf, + sword bufl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt, ub2 *rlen, + ub2 *rcode ); + + +/* older calls ; preferred equivalent calls above */ +sword odsc ( struct cda_def *cursor, sword pos, sb2 *dbsize, + sb2 *fsize, sb2 *rcode, sb2 *dtype, sb1 *buf, + sb2 *bufl, sb2 *dsize ); +sword oname ( struct cda_def *cursor, sword pos, sb1 *tbuf, + sb2 *tbufl, sb1 *buf, sb2 *bufl ); +sword olon ( struct cda_def *lda, OraText *uid, sword uidl, + OraText *pswd, sword pswdl, sword audit ); +sword orlon ( struct cda_def *lda, ub1 *hda, OraText *uid, + sword uidl, OraText *pswd, sword pswdl, sword audit ); +sword osql3 ( struct cda_def *cda, OraText *sqlstm, sword sqllen ); + + + + + + + +#endif /* OCIKPR */ + + + + + + + diff --git a/libraries/SQLAPI/include/ora_win/ocixml.h b/libraries/SQLAPI/include/ora_win/ocixml.h new file mode 100644 index 000000000..0c7d6381d --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ocixml.h @@ -0,0 +1,188 @@ +/* Copyright (c) 2003, 2009, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + ocixml.h - OCIXMLType functions + + DESCRIPTION + This file contains all OCIXMLType functions defined in ocixml.c + + + ****************************IMPORTANT*********************************** + *** If you change the signatures of any fucntions in this file, make sure + *** to make same changes to Windows OSD file ociclnt.c. Otherwise, users + *** of OCI instant client like ODP.NET will have build issues or crashes + ****************************IMPORTANT*********************************** + + PUBLIC FUNCTION(S) + OCIXMLTypeNew() + OCIXMLTypeCreateFromSrc() + OCIXMLTypeCreateFromSrcWithSchema() + OCIXMLTypeTransform() + OCIXMLTypeExtract() + OCIXMLTypeIsSchemaBased() + OCIXMLTypeValidate() + OCIXMLTypeExists() + OCIXMLTypeGetDOM() + OCIXMLTypeGetFromDOM() + OCIDOMFree() + OCIXMLSEMutexAcq() + OCIXMLSEMutexRel() + OCIXMLUpdateNodeValues() + + INTERNAL FUNCTION(S) + + EXAMPLES + + NOTES + + MODIFIED (MM/DD/YY) + spetride 03/02/09 - add isdoc to OCIXMLTypeCreateFromSrc* + bsthanik 01/17/07 - 5753599: wrappers for service mutex acq/rel + bkhaladk 05/10/06 - add setpicklepref + nitgupta 01/30/06 - add signatures for OCIBinXMl* + dmukhin 06/16/05 - ANSI prototypes; miscellaneous cleanup + dmukhin 06/14/05 - ANSI prototypes; miscellaneous cleanup + ataracha 12/04/03 - convert public oci api to ansi + ataracha 01/21/03 - ataracha_uni_capi_cleanup + ataracha 01/08/03 - Creation + +*/ +#ifndef OCI_ORACLE +# include +#endif + +#ifndef XML0_ORACLE +# include +#endif + +#ifndef OCIXML_ORACLE +# define OCIXML_ORACLE + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/* parameters for OCIXMLUpdateNodeValues */ +struct OCIXMLunv +{ + void * xpth_OCIXMLunv; /* xpath expression */ + void * val_OCIXMLunv; /* value - string literal or xmltype */ + ub4 xpthL_OCIXMLunv; /* length of xpath expression string */ + ub4 valL_OCIXMLunv; /* length of value string */ + ub1 tp_OCIXMLunv; /* type of value - xmltype of string */ + +#define OCIXMLUNV_XTP 0x00 /* param is xmltype */ +#define OCIXMLUNV_STP 0x01 /* param is string literal */ +#define OCIXMLUNV_STM 0x02 /* param is a stream (kghsstream *) */ +#define OCIXMLUNV_CLOB 0x03 /* param is a CLOB locator (kolblc *) */ +#define OCIXMLUNV_BLOB 0x04 /* param is a BLOB locator (kolblc *) */ +}; +typedef struct OCIXMLunv OCIXMLunv; + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ +sword OCIXMLTypeNew(OCISvcCtx *svchp, OCIError *errhp, OCIDuration dur, + OraText *elname, ub4 elname_Len, + OraText *schemaURL, ub4 schemaURL_Len, + OCIXMLType **retInstance); + +sword OCIXMLTypeCreateFromSrc(OCISvcCtx *svchp, OCIError *errhp, + OCIDuration dur, ub1 src_type, void *src_ptr, + sb4 ind, OCIXMLType **retInstance, ub4 csid); +sword OCIXMLTypeCreateFromSrcInt(OCISvcCtx *svchp, OCIError *errhp, + OCIDuration dur, ub1 src_type, void *src_ptr, + sb4 ind, OCIXMLType **retInstance, ub4 csid, + boolean isdoc); + +sword OCIXMLTypeCreateFromSrcWithSchema(OCISvcCtx *svchp, OCIError *errhp, + OCIDuration dur, ub1 src_type, void *src_ptr, + sb4 ind, OraText *schemaURL, ub4 schemaURL_Len, + boolean wellformed, boolean valid, + OCIXMLType **retInstance, ub4 csid); +sword OCIXMLTypeCreateFromSrcWithSchemaInt(OCISvcCtx *svchp, OCIError *errhp, + OCIDuration dur, ub1 src_type, void *src_ptr, + sb4 ind, OraText *schemaURL, ub4 schemaURL_Len, + boolean wellformed, boolean valid, + OCIXMLType **retInstance, ub4 csid, + boolean isdoc); + +sword OCIXMLTypeExtract(OCIError *errhp, + OCIXMLType *doc, OCIDuration dur, + OraText *xpathexpr, ub4 xpathexpr_Len, + OraText *nsmap, ub4 nsmap_Len, + OCIXMLType **retDoc); + +sword OCIXMLTypeTransform(OCIError *errhp, OCIDuration dur, + OCIXMLType *doc, OCIXMLType *xsldoc, + OCIXMLType **retDoc); + +/* Note: xpathexpr is case sensitive */ +sword OCIXMLTypeExists(OCIError *errhp, OCIXMLType *doc, + OraText *xpathexpr, ub4 xpathexpr_Len, + OraText *nsmap, ub4 nsmap_Len, + boolean *retval); + +sword OCIXMLTypeIsSchemaBased(OCIError *errhp, + OCIXMLType *doc, boolean *retval); + +sword OCIXMLTypeIsFragment(OCIError *errhp, OCIXMLType *doc, boolean *retval); + +sword OCIXMLTypeGetSchema(OCIError *errhp, OCIXMLType *doc, + OCIXMLType **schemadoc, + OraText **schemaURL, ub4 *schemaURL_Len, + OraText **rootelem, ub4 *rootelem_Len); + +sword OCIXMLTypeValidate(OCIError *errhp, OCIXMLType *doc, + OraText *schemaURL, ub4 schemaURL_Len, boolean *retval); + +sword OCIXMLTypeGetDOM(OCIError *errhp, OCIXMLType *doc, OCIDuration dur, + OCIDOMDocument **retDom); + +sword OCIXMLTypeGetFromDOM(OCIError *errhp, OCIDOMDocument *domdoc, + OCIXMLType **retXMLType); + +sword OCIXMLTypeGetNS(OCIError *errhp, OCIXMLType *domdoc, + OraText **ns, ub4 *ns_len); + +sword OCIDOMFree(OCIError *errhp, OCIDOMDocument *domdoc); + +sword OCIBinXmlCreateReposCtxFromConn(OCIEnv *env, OCISvcCtx *svcctx, + OCIError *err, OCIBinXmlReposCtx **ctx); +sword OCIBinXmlCreateReposCtxFromCPool(OCIEnv *env, OCICPool *cpool, + OCIError *err, OCIBinXmlReposCtx **ctx); +sword OCIBinXmlSetReposCtxForConn(OCISvcCtx *dataconn, + OCIBinXmlReposCtx *reposctx); + +#define OCIXML_FORMATTYPE_TEXT 0 +#define OCIXML_FORMATTYPE_BINXML 1 + +sword OCIBinXmlSetFormatPref(xmldocnode *doc, ub4 format); + +/* OCI Wrapper to acquire mutex associated with service handle and + * env handle + */ +sword OCIXMLSEMutexAcq(OCISvcCtx *svchp, OCIError *errhp); + +/* release wrapper corresponding to OCIXMLSEMutexAcq */ +sword OCIXMLSEMutexRel(OCISvcCtx *svchp, OCIError *errhp); + +/* acquires OCI svc and env mutexes, updates values of nodes pointed to by + * given XPATH locations, and releases mutexes. + */ +sword OCIXMLUpdateNodeValues(OCISvcCtx *svchp, OCIError *errhp, OCIXMLType + **docp, struct OCIXMLunv *values, ub4 numvalues, oratext *nsmap, + ub4 nsmapl); +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#endif /* OCIXML_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/ocixmldb.h b/libraries/SQLAPI/include/ora_win/ocixmldb.h new file mode 100644 index 000000000..0a3f576e2 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ocixmldb.h @@ -0,0 +1,141 @@ +/* Copyright (c) 2003, 2009, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + ocixmldb.h - XDB public functions + + DESCRIPTION + This file contains XDB specific public functions required for DOM C-API. + + RELATED DOCUMENTS + + + EXPORT FUNCTION(S) + struct xmlctx *OCIXmlDbInitXmlCtx(OCIEnv *, OCISvcCtx *, OCIError *, + ocixmldbparam *params, int num_params); + + void OCIXmlDbFreeXmlCtx(struct xmlctx *xctx); + + + ------------------------------------------------------------------------ + EXAMPLES + + NOTES + + MODIFIED (MM/DD/YY) + ataracha 12/11/03 - remove redundant definitions + ataracha 05/28/03 - change names + ataracha 02/18/03 - add oratypes, remove XMLERR_* + imacky 02/01/03 - remove xml.h; xdbs fix + ataracha 01/24/03 - use "struct xmlctx" instead of xmlctx + imacky 01/28/03 - fix XMLERR defs + ataracha 01/21/03 - ataracha_uni_capi_cleanup + ataracha 01/09/03 - Creation + +*/ + +#ifndef ORATYPES +#include +#endif + +#ifndef OCI_ORACLE +# include +#endif + +#ifndef OCIXMLDB_ORACLE +# define OCIXMLDB_ORACLE + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +#ifndef XMLCTX_DEFINED +# define XMLCTX_DEFINED +/* DATATYPE xmlctx - XML top-level context +*/ +struct xmlctx; typedef struct xmlctx xmlctx; +#endif + +typedef enum +{ + XCTXINIT_OCIDUR = 1, + XCTXINIT_ERRHDL = 2 +} ocixmldbpname; + +typedef struct ocixmldbparam +{ + ocixmldbpname name_ocixmldbparam; + void *value_ocixmldbparam; +} ocixmldbparam; + +#define NUM_OCIXMLDBPARAMS 2 + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ +/***************************************************************************** + DESCRIPTION + +-----------------------------OCIXmlDbInitXmlCtx--------------------------------- +Name +OCIXmlDbInitXmlCtx +Purpose +To get a xmlctx structure initialized with error-handler and XDB callbacks. +Syntax +struct xmlctx *OCIXmlDbInitXmlCtx (OCIEnv *envhp, + OCISvcCtx *svchp, + OCIError *err, + params_ocixmldb *params, + int num_params); +Parameters +envhp (IN) - The OCI environment handle +svchp (IN) - The OCI service handle +errhp (IN) - The OCI error handle +params (IN)- This contains the following optional parameters : + (a) OCIDuration dur (IN - The OCI Duration (Default: OCI_DURATION_SESSION) + (b) void (*err_handler) (sword, (const oratext *) (IN) - + Pointer to the error handling function (Default: null) +num_params (IN) - Number of parameters to be read from parameter params. + If the value of num_params exceeds the size of array + "params", unexpected behavior will result. + +Returns +A pointer to xmlctx structure, with xdb context, error handler and callbacks +populated with appropriate values. This is later used for all API calls. NULL +if no database connection available. + +-----------------------------OCIXmlDbFreeXmlCtx---------------------------- +Name +OCIXmlDbFreeXmlCtx +Pupose +To free any allocations done during OCIXmlDbInitXmlCtx. +Syntax +void OCIXmlDbFreeXmlCtx (struct xmlctx *xctx) +Parameters +xctx (IN) - The xmlctx to terminate +Returns +- +******************************************************************************/ + +struct xmlctx *OCIXmlDbInitXmlCtx(OCIEnv *, OCISvcCtx *, OCIError *, + ocixmldbparam *, int); + +void OCIXmlDbFreeXmlCtx(struct xmlctx *xctx); +sword OCIXmlDbStreamFromXMLType(OCIError *errhp, void **stream, + OCIXMLType *doc, ub4 mode); +sword OCIXmlDbStreamRead(OCIError *errhp, void *stream, + void *bufp, sb8 *len, ub4 mode); +sword OCIXmlDbStreamClose(OCIError *errhp, void *stream); +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#endif /* OCIXMLDB_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/ocixstream.h b/libraries/SQLAPI/include/ora_win/ocixstream.h new file mode 100644 index 000000000..869206577 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ocixstream.h @@ -0,0 +1,1899 @@ +/* Copyright (c) 2006, 2009, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + ocixstreams.h - OCI X-Stream APIs + + DESCRIPTION + OCI APIs for X-Stream + + RELATED DOCUMENTS + + EXPORT FUNCTION(S) + + INTERNAL FUNCTION(S) + + EXAMPLES + + NOTES + + MODIFIED (MM/DD/YY) + thoang 05/08/09 - Add OCILCR_NEW_ONLY_MODE + praghuna 05/11/09 - removed 'TODO' comments + thoang 02/15/09 - Change lob_column_* to chunk_column_* + thoang 01/27/09 - 8216105 - add OLD/NEW column parms to OCILCRHeaderGet + rihuang 01/05/09 - Add OCI_LCR_ATTR_TRACKING_LABEL + tianli 11/28/08 - add DDL flags + tianli 11/20/08 - add OCILCRAttribute methods + thoang 11/20/08 - Define OCI_LCR_MAX_TXID_LEN + tianli 11/07/08 - add edition + thoang 11/10/08 - change return type to sword for consistency + thoang 10/16/08 - remove commit position arg + tianli 08/26/08 - rename client_name in XStreamIn attach call + thoang 06/30/08 - Support XStream APIs using two callbacks. + praghuna 05/14/08 - charset id is ub2, OCILcrGetRowStmtWithBindVar + thoang 06/02/08 - Define reserved attach mode for internal clients + elu 05/08/08 - add pos functions + thoang 04/29/08 - API changes + jinwu 04/28/08 - add OCILcrGetExtraAttributes + elu 04/14/08 - add OCI_LCR_MAX_POSITION_LEN + juyuan 03/27/08 - add flag for Set/GetHeader and Set/GetColumnInfo + thoang 02/25/08 - Add GetNextChunk and SetNextChunk + rihuang 03/24/08 - Signature change for OCILcrNew + elu 03/05/08 - add lcr id + praghuna 02/26/08 - Added OCILcrGetRowStmt + thoang 01/25/08 - Add wm_time parameter to XApply APIs + thoang 12/28/07 - Add mode parameter to XApplyDetach + thoang 11/07/07 - Change extapp apis to return ub1[] watermark + juyuan 05/23/07 - XStream In + thoang 11/13/06 - Add XStream Out methods + thoang 11/13/06 - Add LCR getter methods + nshodhan 05/12/06 - streams OCI APIs + nshodhan 05/12/06 - Creation + +*/ + +#ifndef OCIXSTREAM_ORACLE +# define OCIXSTREAM_ORACLE + +#ifndef ORATYPES +# include +#endif + +#ifndef OCI_ORACLE +# include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ +/* LCR Types -- must match with values defined in kngo.h */ +#define OCI_LCR_XROW (3) /* External Row LCR */ +#define OCI_LCR_XDDL (4) /* External DDL LCR */ + +/* DML Command Types -- must match with values defined in kngl.h */ +#define OCI_LCR_ROW_CMD_INSERT "INSERT" +#define OCI_LCR_ROW_CMD_DELETE "DELETE" +#define OCI_LCR_ROW_CMD_UPDATE "UPDATE" +#define OCI_LCR_ROW_CMD_COMMIT "COMMIT" +#define OCI_LCR_ROW_CMD_LOB_WRITE "LOB WRITE" +#define OCI_LCR_ROW_CMD_LOB_TRIM "LOB TRIM" +#define OCI_LCR_ROW_CMD_LOB_ERASE "LOB ERASE" + +/* LCR Extra Attribute Name -- must match with values defined in knll.h */ +#define OCI_LCR_ATTR_THREAD_NO "THREAD#" +#define OCI_LCR_ATTR_ROW_ID "ROW_ID" +#define OCI_LCR_ATTR_SESSION_NO "SESSION#" +#define OCI_LCR_ATTR_SERIAL_NO "SERIAL#" +#define OCI_LCR_ATTR_USERNAME "USERNAME" +#define OCI_LCR_ATTR_TX_NAME "TX_NAME" + +/* below are non first class LCR field specific */ +#define OCI_LCR_ATTR_EDITION_NAME "EDITION_NAME" +#define OCI_LCR_ATTR_MESSAGE_TRACKING_LABEL "MESSAGE_TRACKING_LABEL" + +/* the maximum total number of attributes, total of extra attributes + * plus non first class LCR field. */ +#define OCI_LCR_MAX_ATTRIBUTES 8 + +/* Row LCR column value types used in OCILCRRowColumnInfoGet/Set functions. */ +#define OCI_LCR_ROW_COLVAL_OLD 0 /* OLD columns */ +#define OCI_LCR_ROW_COLVAL_NEW 1 /* NEW columns */ + +/* maximum length for position */ +#define OCI_LCR_MAX_POSITION_LEN 64 + +/* maximum length for txid */ +#define OCI_LCR_MAX_TXID_LEN 128 + +/* Valid column flags used in OCILCRRowColumnInfoSet, OCILCRRowColumnInfoGet, + * OCILCRLobInfoSet, OCILCRLobInfoGet, OCIXStreamOutChunkReceive, + * OCIXStreamInChunkSend calls. + */ +#define OCI_LCR_COLUMN_LOB_DATA (0x00000001) /* col contains lob data */ +#define OCI_LCR_COLUMN_LONG_DATA (0x00000002) /* col contains long data*/ +#define OCI_LCR_COLUMN_EMPTY_LOB (0x00000004) /* col has an empty lob */ +#define OCI_LCR_COLUMN_LAST_CHUNK (0x00000008) /* last chunk of current col*/ +#define OCI_LCR_COLUMN_AL16UTF16 (0x00000010) /* col is in AL16UTF16 fmt */ +#define OCI_LCR_COLUMN_NCLOB (0x00000020) /* col has NCLOB data */ +#define OCI_LCR_COLUMN_XML_DATA (0x00000040) /* col contains xml data */ +#define OCI_LCR_COLUMN_XML_DIFF (0x00000080)/* col contains xmldiff data */ +#define OCI_LCR_COLUMN_ENCRYPTED (0x00000100) /* col is encrypted */ + +/* OCI_LCR_COLUMN_UPDATED is set only for the modified columns in the NEW + * column list of an update LCR. + */ +#define OCI_LCR_COLUMN_UPDATED (0x00000200) /* col is updated */ + +/* Valid bit values for flag parameter in the following APIs: + * - OCIXStreamOutChunkReceive & OCIXStreamOutLCRReceive + * - OCIXStreamInChunkSend & OCIXStreamInLCRSend + */ +#define OCI_XSTREAM_MORE_ROW_DATA (0x00000001) /* LCR contains more data */ + +/* Valid mode flag for OCILCRHeaderGet and OCILCRRowColumnInfoGet functions */ +#define OCILCR_NEW_ONLY_MODE (0x0001) /* NEW columns only -- dont */ + /* include OLD columns */ + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ +/* +------------------------------------------------------------------------------= +NAME + OCILCRNew - OCI LCR NEW +DESCRIPTION + Create a new Streams LCR for the user specified duration and type +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + duration (IN) - allocation duration for LCR memory + lcrtype (IN) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + lcrp (IN/OUT) - Streams LCR. (*lcrp must be initialized to null.) + mode (IN) - mode +NOTES + - memory will be based on the duration specified by the user + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRNew(OCISvcCtx *svchp, + OCIError *errhp, + OCIDuration duration, + ub1 lcrtype, + void **lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRFree - OCI LCR FREE +DESCRIPTION + Free Streams LCR specified by the user +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + lcrp (IN/OUT) - Streams LCR + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRFree(OCISvcCtx *svchp, + OCIError *errhp, + void *lcrp, + ub4 mode); + + +/* +------------------------------------------------------------------------------= +NAME + OCILCRHeaderSet - OCI LCR Set Header +DESCRIPTION + Initialize elements of Streams LCR's header +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + src_db_name (IN) - Pointer to Canonicalized source database name. + Must be non-NULL. + src_db_name_len (IN) - Length of source database name in bytes + excluding NULL terminator. Should follow Oracle + naming conventions and size limitations. + cmd_type (IN) - For ROW LCRs: OCI_LCR_ROW_CMD_XXXXXXX + For DDL LCRs: One of the command types + corresponding to OCI Reference manual + cmd_type_len (IN) - Length of cmd_type. + owner (IN) - Canonicalized table owner name. Not required + for COMMIT LCR. + owner_len (IN) - Length of owner name in bytes excluding the + NULL terminator. Should follow Oracle naming + conventions and size limitations. + oname (IN) - Canonicalized table name. Not required for + COMIT LCR. + oname_len (IN) - Length of table name in bytes excluding the + NULL terminator. Should follow Oracle naming + conventions and size limitations. + tag (IN) - A binary tag that enables tracking of the LCR. + For example, this tag can be used to determine + the original source database of the DML + statement if apply forwarding is used. + tag_len (IN) - Number of bytes in the tag. Cannot exceed 2000 + bytes + txid (IN) - Transaction ID. + txid_len (IN) - Length of transaction id in bytes excluding the + NULL terminator. Should not exceeed + OCI_LCR_MAX_TXID_LEN bytes. + src_time (IN) - The time when the change was generated at the + source database. + position (IN) - position for LCR. Must be byte-comparable. + position_len (IN) - Length of position. Must be non-zero. + flag (IN) - LCR flag. + lcrp (IN/OUT) - Streams LCR + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode + - This function clears the current contents of the input LCR before + setting the header to the new values. +------------------------------------------------------------------------------= +*/ +sword OCILCRHeaderSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *src_db_name, + ub2 src_db_name_len, + oratext *cmd_type, + ub2 cmd_type_len, + oratext *owner, + ub2 owner_len, + oratext *oname, + ub2 oname_len, + ub1 *tag, + ub2 tag_len, + oratext *txid, + ub2 txid_len, + OCIDate *src_time, + ub1 *position, + ub2 position_len, + oraub8 flag, + void *lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRHeaderGet - OCI LCR Get Header +DESCRIPTION + Get header information from Streams LCR +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + src_db_name (OUT) - Pointer to Canonicalized source database name. + Optional, if src_db_name is specified then + must specify src_db_name_len as well. + src_db_name_len (OUT) - Length of source database name in bytes + excluding NULL terminator. + Optional, if specified src_db_name_len then + must specify src_db_name as well. + cmd_type (OUT) - Command type. Must be non-null if + cmd_type_len is non-null. Must be null if + cmd_type_len is NULL. + cmd_type_len (OUT) - Length of cmd_type. Optional. + owner (OUT) - Canonicalized table owner name. + Optional, if owner is specified then + must specify owner_len as well. + owner_len (OUT) - Length of owner name in bytes excluding the + NULL terminator. + Optional, if owner_len is specified then + must specify owner as well. + oname (OUT) - Canonicalized table name. + Optional, if oname is specified then + must specify oname_len as well. + oname_len (OUT) - Length of table name in bytes excluding the + NULL terminator. + Optional, if oname_len is specified then + must specify oname as well. + tag (OUT) - A binary tag that enables tracking of the LCR. + For example, this tag can be used to determine + the original source database of the + DML statement if apply forwarding is used. + Optional, if tag is specified then + must specify tag_len as well. + tag_len (OUT) - Number of bytes in the tag. + Optional, if tag_len is specified then + must specify tag as well. + txid (OUT) - Transaction ID. + Optional, if txid is specified then + must specify txid_len as well. + txid_len (OUT) - Length of transaction id in bytes excluding + the NULL terminator. + Optional, if txid_len is specified then + must specify txid as well. + src_time (OUT) - The time when the change was generated at the + source database. Optional. + old_columns (OUT) - Number of columns in the OLD column list. + Return 0 if input lcr is DDL LCR. Optional. + new_columns (OUT) - Number of columns present in either + the OLD or NEW column list. + Return 0 if input lcr is DDL LCR. Optional. + See NOTES below for the special mode supported + by this function. + position (OUT) - LCR position. Optional. + position_len (OUT) - Length of position. Must be non-null if + position is non-null. Must be null if + position is null. + flag (OUT) - LCR flag. Optional. + lcrp (IN) - Streams LCR + mode (IN) - mode (see NOTES) +NOTES + - Parameter src_time is optional. If specified the appropriate return + structure must be pre-allocated before calling OCILCRHeaderGet. + - The return values for src_db_name, cmd_type, owner, oname, tag, txid and + position are shallow-copied (i.e., they point directly into the LCR + structure). + - Valid mode flags: + - OCILCR_NEW_ONLY_MODE: if this mode is specified then the new_columns + returned is the count of the columns in the NEW column list only. + Otherwise, the new_columns returned is the number of distinct + columns present in either the NEW or the OLD column list of the given + ROW LCR. +------------------------------------------------------------------------------= +*/ + +sword OCILCRHeaderGet(OCISvcCtx *svchp, + OCIError *errhp, + oratext **src_db_name, + ub2 *src_db_name_len, + oratext **cmd_type, + ub2 *cmd_type_len, + oratext **owner, + ub2 *owner_len, + oratext **oname, + ub2 *oname_len, + ub1 **tag, + ub2 *tag_len, + oratext **txid, + ub2 *txid_len, + OCIDate *src_time, + ub2 *old_columns, + ub2 *new_columns, + ub1 **position, + ub2 *position_len, + oraub8 *flag, + void *lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRRowColumnInfoSet - OCI LCR ROW SET COLUMN INFO +DESCRIPTION + Populates column information as specified by the user. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_value_type (IN) - ROW LCR column value type: + - OCI_LCR_ROW_COLVAL_OLD + - OCI_LCR_ROW_COLVAL_NEW + num_columns (IN) - Number of columns to be populated + column_names (IN) - Pointer to an array of column names. Column + names must be canonicalized. Column names should + follow Oracle naming conventions + column_name_lens (IN) - Pointer to an array of column name lengths + in bytes, excluding the NULL terminator. + column_dtyp (IN) - Pointer to an array of column datatypes. + column_valuesp (IN) - Pointer to an array of column data values. + column_indp (IN) - Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + column_alensp (IN) - Pointer to an array of actual column lengths in + bytes. + column_csetfp (IN) - Pointer to an array of character set forms for + the columns. The default form is SQLCS_IMPLICIT. + Setting this attribute will cause the database or + national character set to be used on the client + side. Set this attribute to SQLCS_NCHAR for the + national character set or SQLCS_IMPLICIT for the + database character set. + Pass 0 for non-character columns. + column_flags (IN) - Pointer to an array of column flags. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + column_csid (IN) - Pointer to an array of column character set id. + The character set id is only required for + XMLType column; otherwise, the csid is ignored. + row_lcrp (IN/OUT)- Streams Row LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRRowColumnInfoSet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 column_value_type, + ub2 num_columns, + oratext **column_names, + ub2 *column_name_lens, + ub2 *column_dtyp, + void **column_valuesp, + OCIInd *column_indp, + ub2 *column_alensp, + ub1 *column_csetfp, + oraub8 *column_flags, + ub2 *column_csid, + void *row_lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRRowColumnInfoGet - OCI LCR ROW GET COLUMN INFO +DESCRIPTION + Returns column information as requested by the user. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_value_type (IN) - ROW LCR column value type: + - OCI_LCR_ROW_COLVAL_OLD + - OCI_LCR_ROW_COLVAL_NEW + (See NOTES for special mode supported by this + function.) + num_columns (OUT) - Number of columns in requested column list + column_names (IN/OUT)- Pointer to an array of column names. + Optional. If specified then column_namesl must + be specified as well, and both arrays must be the + size specified by array_size parameter. + column_name_lens (IN/OUT)- Pointer to an array of column name lengths + in bytes, excluding the NULL terminator. + Optional. If specified then column_names must + be specified as well, and both arrays must be the + size specified by array_size parameter. + column_dtyp (IN/OUT)- Pointer to an array of column datatypes. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_valuesp (IN/OUT)- Pointer to an array of column data values. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_indp (IN/OUT)- Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + Optional. If specified then this array must be + the size specified by array_size parameter. + column_alensp (IN/OUT)- Pointer to an array of actual column lengths in + bytes. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_csetfp (IN/OUT)- Pointer to an array of character set forms for + the columns. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_flags (IN/OUT)- Pointer to an array of column flags for + the columns. + Optional. If specified then this array must be + the size specified by array_size parameter. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + column_csid (IN/OUT)- Pointer to an array of column character set id for + the columns. + Optional. If specified then this array must be + the size specified by array_size parameter. + The column csid is returned only for XMLType + column. + row_lcrp (IN) - Streams Row LCR pointer + array_size (IN) - Size of each of above arrays + mode (IN) - mode (see NOTES) +NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of columns + in the requested column list then OCI_ERROR is returned. Parameter + num_columns will have the number of columns in the requested column list. + - The return values for column_names and column_valuesp will be shallow + copied (i.e., they reference directly into the LCR structure). + Client should not modify those pointers directly. + - Valid mode flags: + - OCILCR_NEW_ONLY_MODE: this mode is valid only for OCI_LCR_ROW_COLVAL_NEW + column_value_type; otherwise, an error is raised. + If this mode is specified then the columns returned include only the + columns in the NEW column list. + If this mode is not specified then the columns returned is the union + of the NEW columns plus the OLD columns that are not present in the + NEW column list. +------------------------------------------------------------------------------= +*/ +sword OCILCRRowColumnInfoGet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 column_value_type, + ub2 *num_columns, + oratext **column_names, + ub2 *column_name_lens, + ub2 *column_dtyp, + void **column_valuesp, + OCIInd *column_indp, + ub2 *column_alensp, + ub1 *column_csetfp, + oraub8 *column_flags, + ub2 *column_csid, + void *row_lcrp, + ub2 array_size, + ub4 mode); + + +/* +------------------------------------------------------------------------------= +NAME + OCILCRDDLInfoSet - OCI LCR SET DDL INFO +DESCRIPTION + populates DDL information as sepcified by the user. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + object_type (IN) - The type of object on which the DDL statement was + executed. The following are valid object types: + CLUSTER, FUNCTION, INDEX, LINK, OUTLINE, + PACKAGE, PACKAGE BODY, PROCEDURE, SEQUENCE, + SYNONYM, TABLE, TRIGGER, TYPE, USER, VIEW + LINK represents a database link. + NULL is also a valid object type. Specify NULL + for all object types not listed. + object_type_len (IN) - Length of object_type without the NULL terminator. + ddl_text (IN) - The text of the DDL statement. This parameter + should be set to a non-NULL value. + DDL text must be in Oracle DDL format. + ddl_text_len (IN) - DDL text length in bytes without NULL terminator. + logon_user (IN) - Canonicalized name of the user whose session + executed the DDL statement. Should follow Oracle + naming conventions and size limitations. + logon_user_len (IN) - logon user name length in bytes without NULL + terminator. + current_schema (IN) - The canonicalized schema name that is used if no + schema is specified explicitly for the modified + database objects in ddl_text. If a schema is + specified in ddl_text that differs from the one + specified for current_schema, then the schema + specified in ddl_text will be used. + This parameter should be set to a non-NULL value. + Should follow Oracle naming conventions and size + limitations. + current_schema_len (IN) - schema name length in bytes without NULL terminator + base_table_owner (IN) - If the DDL statement is a table related DDL + (such as CREATE TABLE and ALTER TABLE), or if the + DDL statement involves a table (such as creating + a trigger on a table), then base_table_owner + specifies the canonicalized owner of the table + involved. Otherwise, base_table_owner is NULL. + Should follow Oracle naming conventions and size + limitations. + base_table_owner_len (IN)- base table owner name length in bytes without NULL + terminator. + base_table_name (IN) - If the DDL statement is a table related DDL (such + as CREATE TABLE and ALTER TABLE), or if the DDL + statement involves a table (such as creating a + trigger on a table), then base_table_name + specifies the canonicalized name of the table + involved. Otherwise, base_table_name is NULL. + Length of the above string without the NULL + terminator. Should follow Oracle naming + conventions and size limitations. + Should follow Oracle naming conventions and size + limitations. + base_table_name_len (IN)- base table name length in bytes without NULL + terminator. + flag (IN) - DDL LCR flag. + ddl_lcrp (IN/OUT) - Streams Ddl LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRDDLInfoSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *object_type, + ub2 object_type_len, + oratext *ddl_text, + ub4 ddl_text_len, + oratext *logon_user, + ub2 logon_user_len, + oratext *current_schema, + ub2 current_schema_len, + oratext *base_table_owner, + ub2 base_table_owner_len, + oratext *base_table_name, + ub2 base_table_name_len, + oraub8 flag, + void *ddl_lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRDDLInfoGet - OCI LCR GET DDL INFO +DESCRIPTION + Returns DDL information from specified lcr. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + object_type (OUT) - The type of object on which the DDL statement + was executed. + Optional, if object_type is specified then + must specify object_type_len as well. + object_type_len (OUT) - Length of object_type without the NULL + terminator. + ddl_text (OUT) - The text of the DDL statement. + Optional, if ddl_text is specified then + must specify ddl_text_len as well. + ddl_text_len (OUT) - DDL text length in bytes without NULL + terminator. + logon_user (OUT) - Canonicalized name of the user whose session + executed the DDL statement. + Optional, if logon_user is specified then + must specify logon_user_len as well. + logon_user_len (OUT) - logon user name length in bytes without NULL + terminator. + current_schema (OUT) - The canonicalized schema name that is used if + no schema is specified explicitly for the + modified database objects in ddl_text. + Optional, if current_schema is specified then + must specify current_schema_len as well. + current_schema_len (OUT)- schema name length in bytes without NULL + terminator + base_table_owner (OUT) - If the DDL statement is a table related DDL + (such as CREATE TABLE and ALTER TABLE), or if + the DDL statement involves a table (such as + creating a trigger on a table), then + base_table_owner specifies the canonicalized + owner of the table involved. Otherwise, + base_table_owner is NULL. Optional, if + base_table_owner is specified then must specify + base_table_owner_len as well. + base_table_owner_len (OUT) - base table owner name length in bytes without + NULL terminator. + base_table_name (OUT) - If the DDL statement is a table related DDL + (such as CREATE TABLE and ALTER TABLE), or if + the DDL statement involves a table (such as + creating a trigger on a table), then + base_table_name specifies the canonicalized name + of the table involved. Otherwise, + base_table_name is NULL. Optional, if + base_table_name is specified then must specify + base_table_name_len as well. + base_table_name_len (OUT) - base table name length in bytes without NULL + terminator. + flag (OUT) - DDL LCR flag. Optional, data not returned if + NULL. + ddl_lcrp (IN) - Streams DDL LCR pointer + mode (IN) - mode (for future extention - not used currently) +RETURNS + OCI_SUCCESS or OCI_ERROR. +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRDDLInfoGet(OCISvcCtx *svchp, + OCIError *errhp, + oratext **object_type, + ub2 *object_type_len, + oratext **ddl_text, + ub4 *ddl_text_len, + oratext **logon_user, + ub2 *logon_user_len, + oratext **current_schema, + ub2 *current_schema_len, + oratext **base_table_owner, + ub2 *base_table_owner_len, + oratext **base_table_name, + ub2 *base_table_name_len, + oraub8 *flag, + void *ddl_lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRAttributesSet - OCI LCR SET ATTRIBUTES +DESCRIPTION + populates extra attribute information in ROW/DDL LCR, as well as any + non first class attributes that can not be set through + OCILCRHeaderSet, OCILCRDDLInfoSet, or OCILCRRowColumnInfoSet. + e.g. edition name +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + num_attrs (IN) - Number of extra attributes to be populated + attr_names (IN) - Pointer to an array of attribute names. Attribute + names must be canonicalized and should follow + Oracle naming conventions + attr_names_lens (IN) - Pointer to an array of attribute name lengths + in bytes, excluding the NULL terminator. + attr_dtyp (IN) - Pointer to an array of attribute datatypes. + attr_valuesp (IN) - Pointer to an array of attribute data values. + attr_indp (IN) - Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + attr_alensp (IN) - Pointer to an array of actual attribute lengths in + bytes. + lcrp (IN/OUT)- Streams (Row/DDL) LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRAttributesSet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 num_attrs, + oratext **attr_names, + ub2 *attr_name_lens, + ub2 *attr_dtyp, + void **attr_valuesp, + OCIInd *attr_indp, + ub2 *attr_alensp, + void *lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRAttributesGet - OCI LCR GET EXTRA ATTRIBUTES +DESCRIPTION + Gets extra attribute information in (ROW/DDL) LCR, as well as any + non first class attributes that are not populated through + OCILCRHeaderGet, OCILCRDDLInfoGet, or OCILCRRowColumnInfoGet + e.g. edition name +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + num_attrs (OUT) - Number of extra attributes to be populated + attr_names (IN/OUT)- Pointer to an array of attribute names. Attribute + names must be canonicalized and should follow + Oracle naming conventions + attr_namesl (IN/OUT)- Pointer to an array of attribute name lengths + in bytes, excluding the NULL terminator. + attr_dtyp (IN/OUT)- Pointer to an array of attribute datatypes. + attr_valuesp (IN/OUT)- Pointer to an array of attribute data values. + attr_indp (IN/OUT)- Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + attr_alensp (IN/OUT)- Pointer to an array of actual attribute lengths in + bytes. + lcrp (IN) - Streams (Row/DDL) LCR pointer + array_size (IN) - Size of each of above arrays, use at least the size + defined by OCI_LCR_MAX_ATTRIBUTES + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of attributes + in the requested attribute list then OCI_ERROR is returned. Parameter + num_attrs will return the suggested size. +------------------------------------------------------------------------------= +*/ +sword OCILCRAttributesGet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 *num_attrs, + oratext **attr_names, + ub2 *attr_namesl, + ub2 *attr_dtyp, + void **attr_valuesp, + OCIInd *attr_indp, + ub2 *attr_alensp, + void *lcrp, + ub2 array_size, + ub4 mode); + +/*--------------------- OCILCRWhereClauseGet ----------------------------*/ +/* + NAME + OCILCRWhereClauseGet - OCI Get Where Clause + DESCRIPTION + Gets the Where clause statement for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + wc_stmt (OUT) - Sql Statement equivalent to the + LCR has applied + wc_stmt_len (IN/OUT) - length of wc_stmt buffer + row_lcrp (IN) - row LCR to be converted to SQL + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - For now, specify OCI_DEFAULT for mode + - WHERE clause generated for INSERT lcr will have all the columns that + are being inserted. This WHERE clause could be used to identify the + inserted row after inserting. (like "returning ROWID"). + INSERT INTO TAB(COL1) VALUES (10) -> WHERE COL1=10 + - WHERE clause generated for UPDATE will have all the columns in the + old column list. However the values of the columns will be that of + new value if it exist in the new column list + of the UPDATE. If the column doesnt have new value then the old column + value will be used. + UPDATE TAB SET COL1 = 10 WHERE COL1 = 20 -> WHERE COL1 = 10 + UPDATE TAB SET COL2 = 20 WHERE COL1 = 20 -> WHERE COL1 = 20 + - WHERE clause for DELETE will use the columns and values from + old column lst + - LOB piecewise operations would use the new columns and values for + generating the WHERE clause. +*/ + +sword OCILCRWhereClauseGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *wc_stmt, + ub4 *wc_stmt_len, + void *row_lcrp, + ub4 mode); + +/*--------------------- OCILCRRowStmtGet ----------------------------*/ +/* + NAME + OCILCRRowStmtGet - OCI Get Row Statement + DESCRIPTION + Gets the SQL statement for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + row_stmt (OUT) - Sql Statement equivalent to the + LCR has applied + row_stmt_len (IN/OUT) - length of row_stmt buffer + row_lcrp (IN) - row LCR to be converted to SQL + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ +sword OCILCRRowStmtGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *row_stmt, + ub4 *row_stmt_len, + void *row_lcrp, + ub4 mode); + +/*--------------------- OCILCRWhereClauseWithBindVarGet ----------------------*/ +/* + NAME + OCILCRWhereClauseWithBindVarGet - OCI Get Where clause with binds + DESCRIPTION + Gets the where clause statement with bind variables for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + wc_stmt (OUT) - Sql Stmt equivalent to the LCR + wc_stmt_len (IN/OUT) - length of wc_stmt buffer + num_bind_var (OUT) - Number of bind variables + bind_var_dtyp (OUT) - Array of Data types of bind + variables + bind_var_valuesp (OUT) - Array of Values of bind variables + bind_var_indp (OUT) - Array of null indicators of + bind variables + bind_var_alensp (OUT) - Array of lengths of bind values + bind_var_csetidp (OUT) - Array of char set id of binds + bind_var_csetfp (OUT) - Array of char set form of binds + row_lcrp (IN) - row LCR to be converted to SQL + array_size (IN) - Size of the array of bind values + bind_var_syntax (IN) - Native syntax to be used for binds + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of columns + in the requested column list then OCI_ERROR is returned. Expected + array_size is returned through num_bind_var parameter. + - bind_var_syntax for oracle should contain ":". This will generate + positional binds such as :1, :2, :3 etc. For other non-oracle databases + they can give the string that needs to be used for binds. + - WHERE clause generated for INSERT lcr will have all the columns that + are being inserted. This WHERE clause could be used to identify the + inserted row after inserting. (like "returning ROWID"). + INSERT INTO TAB(COL1) VALUES (10) -> WHERE COL1=10 + - WHERE clause generated for UPDATE will have all the columns in the + old column list. However the values of the columns will be that of + new column value of the column if it exist in the new values + of the UPDATE. If the column appears only in the old column then + old column value will be used. + UPDATE TAB SET COL1 = 10 WHERE COL1 = 20 -> WHERE COL1 = 10 + UPDATE TAB SET COL2 = 20 WHERE COL1 = 20 -> WHERE COL1 = 20 + - WHERE clause for DELETE will use the columns and values from + old column lst + - LOB piecewise operations would use the new columns and values for + generating the WHERE clause. +*/ +sword OCILCRWhereClauseWithBindVarGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *wc_stmt, + ub4 *wc_stmt_len, + ub2 *num_bind_var, + ub2 *bind_var_dtyp, + void **bind_var_valuesp, + OCIInd *bind_var_indp, + ub2 *bind_var_alensp, + ub2 *bind_var_csetidp, + ub1 *bind_var_csetfp, + void *row_lcrp, + ub2 array_size, + oratext *bind_var_syntax, + ub4 mode); + +/*--------------------- OCILCRRowStmtWithBindVarGet ----------------------*/ +/* + NAME + OCILCRRowStmtWithBindVarGet - OCI Get Row Statement + DESCRIPTION + Gets the SQL statement with bind variables for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + row_stmt (OUT) - Sql Stmt equivalent to the LCR + row_stmt_len (IN/OUT) - length of row_stmt buffer + num_bind_var (OUT) - Number of bind variables + bind_var_dtyp (OUT) - Array of Data types of bind + variables + bind_var_valuesp (OUT) - Array of Values of bind variables + bind_var_indp (OUT) - Array of null indicators of + bind variables + bind_var_alensp (OUT) - Array of lengths od bind values + bind_var_csetidp (OUT) - Array of char set id of binds + bind_var_csetfp (OUT) - Array of char set form of binds + row_lcrp (IN) - row LCR to be converted to SQL + chunk_column_names (OUT) - Array of chunked column names in + lcr + chunk_column_namesl (OUT) - Length of chunk_column_names + chunk_column_flags (OUT) - flags of chunked columns in lcr + Possible bit values are + OCI_LCR_COLUMN_* flags listed + above. + array_size (IN) - Size of the array of bind values + bind_var_syntax (IN) - Native syntax to be used for binds + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of columns + in the requested column list then OCI_ERROR is returned. Expected + array_size is returned through num_bind_var parameter. + - bind_var_syntax for oracle should contain ":". This will generate + positional binds such as :1, :2, :3 etc. For other non-oracle databases + they can give the string that needs to be used for binds. +*/ +sword OCILCRRowStmtWithBindVarGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *row_stmt, + ub4 *row_stmt_len, + ub2 *num_bind_var, + ub2 *bind_var_dtyp, + void **bind_var_valuesp, + OCIInd *bind_var_indp, + ub2 *bind_var_alensp, + ub2 *bind_var_csetidp, + ub1 *bind_var_csetfp, + void *row_lcrp, + oratext **chunk_column_names, + ub2 *chunk_column_namesl, + oraub8 *chunk_column_flags, + ub2 array_size, + oratext *bind_var_syntax, + ub4 mode); + +/* +------------------------------------------------------------------------------- + NAME + OCILCRSCNsFromPosition - Get SCNs From Position + + DESCRIPTION + Returns the SCN and commit SCN from the given position. + PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + position (IN) - LCR position + position_len (IN) - length of position + scn (OUT) - the SCN stored in position + commit_scn (OUT) - the commit SCN stored in position + mode (IN) - Mode flags (For future extension. Not used + currently) + RETURN + OCI_SUCCESS if the conversion succeeds, OCI_ERROR otherwise. + NOTE + The user must allocate memory for the return numbers. + The input position must conform to the format generated by an XStream + server. +------------------------------------------------------------------------------- +*/ +sword OCILCRSCNsFromPosition(OCISvcCtx *svchp, + OCIError *errhp, + ub1 *position, + ub2 position_len, + OCINumber *scn, + OCINumber *commit_scn, + ub4 mode); + +/* +------------------------------------------------------------------------------- + NAME + OCILCRSCNToPosition - Converts SCN To Position + + DESCRIPTION + Converts an SCN to a position. The generated position can be passed as the + last_position to OCIXStreamOutAttach function to filter the LCRs + with commit SCN less than the given SCN and the LCR's SCN less than the + given SCN. This means the first LCR sent by the Outbound server is either + - a commit LCR at the given SCN, or + - the first LCR of the subsequent transaction with commit SCN greater + than or equal to the given SCN. + PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + position (OUT) - Result position. Must pre-allocate + OCI_LCR_MAX_POSITION_LEN bytes. + position_len (OUT) - Length of position + scn (IN) - The SCN to be stored in position + mode (IN) - Mode flags (for future extension) + RETURN + OCI_SUCCESS if the conversion succeeds, OCI_ERROR otherwise. +------------------------------------------------------------------------------- +*/ +sword OCILCRSCNToPosition(OCISvcCtx *svchp, + OCIError *errhp, + ub1 *position, + ub2 *position_len, + OCINumber *scn, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRLobInfoGet - OCI LCR GET LOB INFO +DESCRIPTION + Returns the LOB information for a given piece-wise LOB LCR. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_name (OUT) - Pointer to the LOB column name. + Optional. If specified then column_name_len must + be specified as well. + column_name_len(OUT) - Length of LOB column name without the NULL + terminator. + column_dty (OUT) - LOB column dty - either SQLT_CHR (for CLOB) or + SQLT_BIN (for BLOB). + column_flag (OUT) - LOB column flag. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + offset (OUT) - LOB operation offset in code points. Returned only + for LOB_TRIM and LOB_WRITE operations; otherwise, + a zero is returned. + This is the same as the 'soffset' parameter for + OCILobErase or the 'offset' parameter in + OCILobWrite functions. + size (OUT) - LOB operation size in code points. Returned only + for LOB_TRIM and LOB_ERASE operations; otherwise, + a zero is returned. + This is the same as the 'new_length' parameter in + OCILobTrim or the 'amtp' parameter in OCILobErase + functions. + row_lcrp (IN) - Streams Row LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRLobInfoGet(OCISvcCtx *svchp, + OCIError *errhp, + oratext **column_name, + ub2 *column_name_len, + ub2 *column_dty, + oraub8 *column_flag, + ub4 *offset, + ub4 *size, + void *row_lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRLobInfoSet - OCI LCR SET LOB INFO +DESCRIPTION + Sets the LOB information for a given piece-wise LOB LCR. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_name (IN) - Pointer to the LOB column name. + column_name_len(IN) - Length of LOB column name without the NULL + terminator. + column_dty (IN) - LOB column dty - either SQLT_CHR (for CLOB) or + SQLT_BIN (for BLOB). + column_flag (IN) - LOB column flag. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + offset (IN) - LOB operation offset in code points. Returned only + for LOB_TRIM and LOB_WRITE operations; otherwise, + a zero is returned. + This is the same as the 'soffset' parameter for + OCILobErase or the 'offset' parameter in + OCILobWrite functions. + size (IN) - LOB operation size in code points. Returned only + for LOB_TRIM and LOB_ERASE operations; otherwise, + a zero is returned. + This is the same as the 'new_length' parameter in + OCILobTrim or the 'amtp' parameter in OCILobErase + functions. + row_lcrp (IN/OUT)- Streams Row LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRLobInfoSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *column_name, + ub2 column_name_len, + ub2 column_dty, + oraub8 column_flag, + ub4 offset, + ub4 size, + void *row_lcrp, + ub4 mode); + +/*--------------------------------------------------------------------------- + STREAMS XSTREAM OUT FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------------- OCIXStreamOutAttach -----------------------------*/ +/* + NAME + OCIXStreamOutAttach - OCI Attach to XStreams Out + DESCRIPTION + Given the name of the server process, attach to the outbound server. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + server_name (IN) - Server name. + server_name_len (IN) - Length of server name. + last_position (IN) - last rcv position. (Optional) + last_position_len (IN) - Length of last_position. + mode (IN) - Mode flags (future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + Specify OCI_DEFAULT for the mode parameter. + + The name of the outbound server must be provided because multiple + outbound servers can be configured in one Oracle instance. This call + returns OCI_ERROR if it encounters any error while attaching to the + outbound server. + + The last_position parameter is used to establish the starting point + of the stream. This call returns OCI_ERROR if the specified position + is non-null and less than the server's processed low-watermark; + otherwise, LCRs with position greater than last_position will be + sent to the user. + + If last_position is null then the stream will start from the processed + low-watermark maintained in the server. +*/ + +sword OCIXStreamOutAttach (OCISvcCtx *svchp, OCIError *errhp, + oratext *server_name, ub2 server_name_len, + ub1 *last_position, + ub2 last_position_len, + ub4 mode); + +#define OCIXSTREAM_OUT_ATTACH_RESERVED_1 (0x00000001) + +/*---------------------- OCIXStreamOutProcessedLWMSet ----------------------*/ +/* + NAME + OCIXStreamOutProcessedLWMSet - Set Processed Low-Watermark + DESCRIPTION + Sets the processed low-watermark maintained at the client. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + processed_low_position (IN) - processed low position. + processed_low_position_len (IN) - processed low position length. + mode (IN) - mode for future extension. (Not used + currently). + RETURNS + OCI_SUCCESS or OCI_ERROR. + + NOTES + The processed low-watermark denotes all LCRs at or below this position + have been processed. After successfully attaching to an XStream + outbound server, a local copy of the processed low-watermark is + maintained at the client. Periodically, this watermark is sent to the + server so that archived logs containing already processed transactions + can be purged. + + The following API is used to update the local copy of the processed + low-watermark. It can be called anytime between OCIXStreamOutAttach + and OCIXStreamOutDetach calls. Clients, using the callback mechanism + to stream LCRs from the server, can invoke this API while + in the callback functions. +*/ + +sword OCIXStreamOutProcessedLWMSet (OCISvcCtx *svchp, OCIError *errhp, + ub1 *processed_low_position, + ub2 processed_low_position_len, + ub4 mode); + + +/*-------------------- OCICallbackXStreamOutLCRProcess ----------------------*/ +/* + NAME + OCICallbackXStreamOutLCRProcess - Callback to process each LCR received + DESCRIPTION + This callback is invoked during OCIXStreamOutLCRCallbackReceive + to process each LCR received from the outbound server. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context. + lcrp (IN) - Pointer to the LCR just received. + lcrtyp (IN) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, + this means the current LCR has more + chunk data. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamOutLCRCallbackReceive call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamOutLCRCallbackReceive immediately. +*/ +typedef sb4 (*OCICallbackXStreamOutLCRProcess) (void *usrctxp, void *lcrp, + ub1 lcrtyp, oraub8 flag); + + +/*-------------------- OCICallbackXStreamOutChunkProcess --------------------*/ +/* + NAME + OCICallbackXStreamOutChunkProcess - Callback to process each chunk + DESCRIPTION + This callback is invoked during OCIXStreamOutLCRCallbackReceive + to process each chunk in an LCR. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context. + column_name (IN) - Column name for the current chunk. + column_name_len (IN) - Length of column name. + column_dty (IN) - Chunk data type (SQLT_CHR or SQLT_BIN). + column_flag (IN) - LCR column flags. Possible bit values are + OCI_LCR_COLUMN_* flags listed above. + column_csid (IN) - Column character set id. Relevant only if + the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit set). + chunk_bytes (IN) - Chunk data length in bytes. + chunk_data (IN) - Chunk data buffer. + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, this means + the current LCR has more chunks. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamOutLCRCallbackReceive call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamOutLCRCallbackReceive immediately. +*/ +typedef sb4 (*OCICallbackXStreamOutChunkProcess) + (void *usrctxp, oratext *column_name, ub2 column_name_len, + ub2 column_dty, oraub8 column_flag, ub2 column_csid, + ub4 chunk_bytes, ub1 *chunk_data, oraub8 flag); + +/*-------------------- OCIXStreamOutLCRCallbackReceive ----------------------*/ +/* + NAME + OCIXStreamOutLCRCallbackReceive - OCI Receive LCR stream using Callbacks + DESCRIPTION + This API is used to get the LCR stream from the outbound server using + callbacks to gain better performance. The user must supply a callback + function to be invoked for each LCR received. If some row changes + in the stream may contain LOB/LONG/XMLType columns then the data for + those columns are returned to the user in chunks. To receive those row + changes, the user must provide a second callback to be invoked to + process each chunk data. + + If there is an LCR available in the stream, the processlcr_cb function + is invoked immediately. After the processlcr_cb function exits, if the + current LCR contains additional chunks then the processchunk_cb function + is invoked for each chunk belonging to that LCR. + + If there is no LCR in the stream when the idle timeout expires (see + OCI_ATTR_XSTREAM_IDLE_TIMEOUT), this call returns a null LCR with + OCI_SUCCESS code. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + processlcr_cb (IN) - Client callback function for each LCR. + processchunk_cb (IN) - Client callback function for each + chunk. + usrctxp (IN) - Client context. (Optional) + fetch_low_position (OUT)- Fetch low watermark. (Optional) + fetch_low_position_len (OUT)- Fetch low watermark length. + mode (IN) - mode for future extension. (Not used + currently). + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - The fetch low watermark is used to indicate all transactions + with commit position below this have been received by the XStream + outbound server. + + - If the LCR contains non-chunked column(s), the duration of that LCR is + limited to the processlcr_cb function. If the LCR contains some + chunk data then the duration of the LCR is extended until all the + chunks have been processed (that is, when the flag passing to + processchunk_cb function does not have OCI_XSTREAM_MORE_ROW_DATA flag + set). If the user wants to access the LCR data at a later time, a + copy of the LCR must be made. The client callback should not modify + or free the LCR passing to the callback. + + - The given usrctxp is passed to both callbacks. + + - An ACK interval is the interval in seconds which the outbound + server receives the processed LWM or the inbound server sends + the processed LWM. The default ACK interval is 30 seconds. This + value can be changed by setting the OCI_ATTR_XSTREAM_ACK_INTERVAL + attribute using OCIAttrSet API. This attribute is checked only + during the Attach call; thus, it must be set before invoking this API. + + - The idle timeout is the interval in seconds after which the current + call will terminate if there is no LCR in the stream. The default + idle timeout is one second. This value can be changed by setting the + OCI_ATTR_XSTREAM_IDLE_TIMEOUT attribute using OCIAttrSet API. This + attribute is checked only during the Attach call; thus, it must be + set before invoking this API. + + - The outbound server ends each call at the transaction boundary + after an ACK interval has elapsed from the start of the call + or when the idle timeout expires. This API returns the fetch + low watermark at the end of each call. +*/ +sword OCIXStreamOutLCRCallbackReceive( + OCISvcCtx *svchp, OCIError *errhp, + OCICallbackXStreamOutLCRProcess processlcr_cb, + OCICallbackXStreamOutChunkProcess processchunk_cb, void *usrctxp, + ub1 *fetch_low_position, ub2 *fetch_low_position_len, ub4 mode); + +/*---------------------- OCIXStreamOutLCRReceive -------------------------*/ +/* + NAME + OCIXStreamOutLCRReceive - Receive LCR without using callback + DESCRIPTION + This API is used to receive an LCR from an outbound stream. If there + is an LCR available, this API immediately returns that LCR. The + duration of each LCR is limited to the processlcr_cb function. + When there is no LCR available in the stream, this call returns a + null LCR after the idle timeout (see OCI_ATTR_XSTREAM_IDLE_TIMEOUT) + has expired. + + To avoid network round trip for every OCIXStreamOutLCRReceive call, + the connection is tied to this call to let the server fill up + the network buffer with LCRs so subsequent calls can quickly receive + the LCRs from the network. The server ends each call at the + transaction boundary after an ACK interval has elapsed since the start + of the call or when the idle timeout expires. See + OCI_ATTR_XSTREAM_ACK_INTERVAL & OCI_ATTR_XSTREAM_IDLE_TIMEOUT + attributes. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + lcrp (OUT) - Pointer to the LCR received from the + stream. + lcrtype (OUT) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, + it means the current LCR has more + chunk data. + fetch_low_position (OUT)- Fetch low watermark. (Optional) + fetch_low_position_len (OUT)- Fetch low watermark length. + mode (IN) - mode for future extension. (Not used + currently). + RETURNS + - OCI_STILL_EXECUTING means the current call is still in progress. The + connection associated with the specified service context handle is + still tied to this call for streaming the LCRs from the server. An + error is returned if the user attempts to use the same connection to + execute any OCI calls that require database round trip, for example, + OCIStmtExecute, OCIStmtFetch, OCILobRead, etc. OCILcr* calls are + local calls; thus, they are valid while the stream is in progress. + - OCI_SUCCESS means the current call is completed. User is free to + execute OCIStmt*, OCILob*, etc. from the same service context. + - OCI_ERROR means the current call encounters some errors. Use + OCIErrorGet to obtain information about the error. + + NOTES + This call always returns a null LCR when the return code is OCI_SUCCESS. + In addition, it returns the fetch low position to denote the outbound + server has received all transactions with commit position lower than or + equal to this value. +*/ + +sword OCIXStreamOutLCRReceive( + OCISvcCtx *svchp, OCIError *errhp, + void **lcrp, + ub1 *lcrtype, + oraub8 *flag, + ub1 *fetch_low_position, + ub2 *fetch_low_position_len, + ub4 mode); + +/*-------------------------- OCIXStreamOutChunkReceive ---------------------*/ +/* + NAME + OCIXStreamOutChunkReceive - Receive Chunk data + DESCRIPTION + Receives next chunk of LCR data from XStream Outbound server. + This API can only be called while OCIXStreamOutLCRReceive call is + in progress. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors should be reported + column_name (OUT) - Name of column for which data is retrieved. + column_name_len (OUT) - Length of column name. + column_dty (OUT) - LCR column data type. + column_flag (OUT) - LCR column flag. Possible bit values are + OCI_LCR_COLUMN_LOB_DATA + OCI_LCR_COLUMN_LONG_DATA + OCI_LCR_COLUMN_EMPTY_LOB + OCI_LCR_COLUMN_LAST_CHUNK + OCI_LCR_COLUMN_AL16UTF16 + OCI_LCR_COLUMN_ENCRYPTED + OCI_LCR_COLUMN_NCLOB + OCI_LCR_COLUMN_XML_DATA + OCI_LCR_COLUMN_XML_DIFF + column_csid (OUT) - Column character set id. This is returned only + if the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit + set). + chunk_bytes (OUT) - Number of bytes in output buffer. + chunk_data (OUT) - Pointer to the chunk data in the LCR. + Client must not de-allocate this pointer. + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, it means + the current LCR has more data coming. + mode (IN) - mode for future extension. (Not used currently). + RETURNS + OCI_SUCCESS - Check colname_len and chunk_bytes to determine the + data just read. + OCI_ERROR - Error encountered. Execute OCIErrorGet to get information + about the error. + NOTES + - If the return code is OCI_SUCCESS, client should check chunk_bytes to + determine the # of bytes read and check column_name to determine + which LCR column the data associated with. + + - All the chunks from one LOB/LONG/XMLType column are returned entirely + before the chunk value for the next LOB/LONG/XMLType column is + returned. + + - The is no fixed ordering on how the LOB/LONG/XMLType columns is + returned. Users must check the column name to determine which column. + The column_flag will have OCI_LCR_COLUMN_LAST_CHUNK bit set when this + function returns the last chunk of each column. + + - This call returns a null column name and null chunk data if it's + invoked when the current LCR contains only non-chunked columns. + + - If OCIXStreamOutLCRReceive call returns OCI_XSTREAM_MORE_ROW_DATA flag + then the user must iteratively call OCIXStreamOutChunkReceive to + retrieve all the chunks belonging to the current row change before + calling the next OCIXStreamOutLCRReceive. + +*/ +sword OCIXStreamOutChunkReceive(OCISvcCtx *svchp, OCIError *errhp, + oratext **column_name, ub2 *column_name_len, + ub2 *column_dty, oraub8 *column_flag, + ub2 *column_csid, ub4 *chunk_bytes, + ub1 **chunk_data, oraub8 *flag, ub4 mode); + +/*------------------------- OCIXStreamOutDetach -----------------------------*/ +/* + NAME + OCIXStreamOutDetach - OCI Detach from XStream Out + DESCRIPTION + Detaches from the attached XStream outbound server. This call sends the + current local processed low-watermark to the server before detaching + from the outbound server. The outbound server automatically restarts + after this call. This API returns OCI_ERROR if it is invoked while a + ReceiveLCR call is in progress. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors should be reported + mode (IN) - mode for future extension. (Not used currently). + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - The processed_low_position is passed to the server so it can update its + copy. This value if provided must be greater than or equal to the + value maintained in the server; otherwise, an error is returned. +*/ +sword OCIXStreamOutDetach (OCISvcCtx *svchp, OCIError *errhp, ub4 mode); + + +/*--------------------------------------------------------------------------- + STREAMS XSTREAM IN FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------------ OCIXStreamInAttach -------------------------------*/ +/* + NAME + OCIXStreamInAttach - OCI XStream In Attach + DESCRIPTION + Attaches to the specified XStream inbound server. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + server_name (IN) - XStream inbound server name. + server_name_len (IN) - Length of server name. + source_name (IN) - source name to identify the data src. + source_name_len (IN) - Length of source name. + last_position (OUT) - Last position received by inbound + server. Optional. If specified must + pre-allocate OCI_LCR_MAX_POSITION_LEN + bytes for return value. + last_position_len (OUT) - Length of last_position. Must be + non-NULL if last_position is non-NULL. + mode (IN) - Mode flags (For future extension. + (Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + The last_position parameter is returned to establish the starting point + to resume the inbound stream. The client should start sending LCRs with + positions greater than the last_position since the inbound server will + ignore all LCRs with positions less than or equal to this value. +*/ + +sword OCIXStreamInAttach( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *server_name, + ub2 server_name_len, + oratext *source_name, + ub2 source_name_len, + ub1 *last_position, + ub2 *last_position_len, + ub4 mode); + +/*-------------------- OCICallbackXStreamInLCRCreate ------------------------*/ +/* + NAME + OCICallbackXStreamInLCRCreate - Callback to create an LCR + DESCRIPTION + This callback is invoked during OCIXStreamInLCRCallbackSend + to create each LCR to be sent to the inbound server. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context + lcrp (OUT) - Pointer to the LCR to be sent + lcrtyp (OUT) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, + this means the current LCR has more + chunk data. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamInLCRCallbackSend call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamInLCRCallbackSend immediately. +*/ +typedef sb4 (*OCICallbackXStreamInLCRCreate)( + void *usrctxp, + void **lcrp, + ub1 *lcrtyp, + oraub8 *flag); + +/*-------------------- OCICallbackXStreamInChunkCreate --------------------*/ +/* + NAME + OCICallbackXStreamInChunkCreate - Callback to create each chunk + DESCRIPTION + This callback is invoked during OCIXStreamInLCRCallbackSend + to create each chunk to be sent to the inbound server. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context. + column_name (OUT) - Column name for the current chunk. + column_name_len (OUT) - Length of column name. + column_dty (OUT) - Chunk data type (SQLT_CHR or SQLT_BIN). + column_flag (OUT) - LCR column flags. Possible bit values are + OCI_LCR_COLUMN_* flags listed above. + column_csid (OUT) - Column character set id. Relevant only if + the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit + set). + chunk_bytes (OUT) - Chunk data length in bytes. + chunk_data (OUT) - Chunk data buffer. + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, this means + the current LCR has more chunks. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamInLCRCallbackSend call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamInLCRCallbackSend immediately. +*/ +typedef sb4 (*OCICallbackXStreamInChunkCreate)( + void *usrctxp, + oratext **column_name, + ub2 *column_name_len, + ub2 *column_dty, + oraub8 *column_flag, + ub2 *column_csid, + ub4 *chunk_bytes, + ub1 **chunk_data, + oraub8 *flag); + +/*--------------------- OCIXStreamInLCRCallbackSend ------------------------*/ +/* + NAME + OCIXStreamInLCRCallbackSend - OCI XStream In Send LCR to Inbound Server + DESCRIPTION + Sends LCR stream to XStream inbound server using callbacks. + The API invokes createlcr_cb function to obtain each LCR to send to the + server. If the return flag from the createlcr_cb function has + OCI_XSTREAM_MORE_ROW_DATA bit set, then it invokes createchunk_cb + procedure to obtain each chunk. It repeatedly calls createchunk_cb + function while the flag returned from this callback has + OCI_XSTREAM_MORE_ROW_DATA bit set. When this bit is not set, this API + cycles back to invoke createlcr_cb function to get the next LCR. + This cycle is repeated until the createlcr_cb function returns a null + LCR or when an ACK interval has elapsed since the start of the call. + See OCI_ATTR_XSTREAM_ACK_INTERVAL attribute. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + createlcr_cb (IN) - Callback function to be invoked + to generate an LCR for streaming. + Cannot be null. + createchunk_cb (IN) - Callback function to be invoked to + create each chunk. Can be null if the + user does not need to send any LCR with + LOB/LONG/XMLType columns. OCI_ERROR + will be returned if this argument is + null and the user attempts to send an + LCR with additional chunk data. + usrctxp (IN) - Client context to pass to both + callback functions. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ + +sword OCIXStreamInLCRCallbackSend( + OCISvcCtx *svchp, + OCIError *errhp, + OCICallbackXStreamInLCRCreate createlcr_cb, + OCICallbackXStreamInChunkCreate createchunk_cb, + void *userctxp, + ub4 mode); + +/*---------------------------- OCIXStreamInLCRSend --------------------------*/ +/* + NAME + OCIXStreamInLCRSend - OCI XStream In Send LCR to Inbound Server + DESCRIPTION + Sends LCR stream to XStream inbound server without using callbacks. + To avoid a network round trip for every OCIXStreamInLCRSend call, + the connection is tied to this call for at least the duration + specified by the OCI_ATTR_XSTREAM_ACK_INTERVAL attribute. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + lcrp (IN) - Pointer to the LCR to send. Cannot + be null. + lcrtype (IN) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, + it means the current LCR has more + chunk data. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + - OCI_STILL_EXECUTING means the current call is still in progress. The + connection associated with the specified service context handle is + still tied to this call for streaming the LCRs to the server. An error + is returned if the user attempts to use the same connection to + execute any OCI calls that require database round trip, for example, + OCIStmtExecute, OCIStmtFetch, OCILobRead, etc. OCILcr* calls are + local calls; thus, they are valid while this call is in progress. + - OCI_SUCCESS means the current call is completed. User is free to + execute OCIStmt*, OCILob*, etc. from the same service context. + - OCI_ERROR means this call encounters some errors. Use OCIErrorGet to + obtain information about the error. +*/ +sword OCIXStreamInLCRSend( + OCISvcCtx *svchp, + OCIError *errhp, + void *lcrp, + ub1 lcrtype, + oraub8 flag, + ub4 mode); + +/*----------------------------- OCIXStreamInChunkSend -----------------------*/ +/* + NAME + OCIXStreamInChunkSend - Send Chunk + DESCRIPTION + Sends the given chunk of column data to XStream Inbound server. + This chunk is associated with the LCR that is sent by the + most recent OCIXStreamInLCRSend call prior to this call. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors should be reported + column_name (IN) - Name of column for which data is sent. + Column names must be canonicalized and must + follow Oracle naming conventions. + column_name_len (IN) - Length of column name. + column_dty (IN) - LCR column data type (must be SQLT_CHR or + SQLT_BIN). + column_flag (IN) - LCR column flags. Possible bit values are + OCI_LCR_COLUMN_LOB_DATA + OCI_LCR_COLUMN_LONG_DATA + OCI_LCR_COLUMN_EMPTY_LOB + OCI_LCR_COLUMN_LAST_CHUNK + OCI_LCR_COLUMN_AL16UTF16 + OCI_LCR_COLUMN_ENCRYPTED + OCI_LCR_COLUMN_NCLOB + OCI_LCR_COLUMN_XML_DATA + OCI_LCR_COLUMN_XML_DIFF + column_csid (IN) - Column character set id. This is required only + if the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit set). + chunk_bytes (IN) - Chunk data length in bytes. + chunk_data (IN) - Chunk data buffer. + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, it means + the current LCR has more data coming. + mode (IN) - mode for future extension. (Not used currently). +RETURNS + OCI_SUCCESS - Successful call. + OCI_ERROR - Error encountered. Execute OCIErrorGet to get information + about the error. +NOTES + - This function must be called while OCIXStreamInLCRSend is in progress. + + - This function is valid only if the associated LCR's cmd type is + INSERT, UPDATE or LOB_WRITE. It can be invoked multiple times for the + same LCR. + + - This API is not valid for LOB_ERASE and LOB_TRIM LCRs. + + - The chunk values for different columns can not be interleaved. If a + column contains multiple chunks, this procedure must be called + consecutively using the same column name before proceeding to a new column. + The ordering in which the LOB/LONG/XMLType column values are set is + irrelevant. + + - The OCI_LCR_COLUMN_LAST_CHUNK must be specified for the last chunk of + each column. + + - Only one column can be specified for LOB_WRITE operation. + + - For NCLOB or varying width CLOB, the input buffer must be in + AL16UTF16 format. + + - For INSERT operation, each LOB/LONG/XMLType column, with value set using + OCIXStreamInChunkSend, must be included in the current LCR's NEW + column list. The value of that LOB/LONG/XMLType column must be set to + null and must have OCI_LCR_COLUMN_EMPTY_LOB flag defined. + +*/ +sword OCIXStreamInChunkSend (OCISvcCtx *svchp, OCIError *errhp, + oratext *column_name, ub2 column_name_len, + ub2 column_dty, oraub8 column_flag, + ub2 column_csid, ub4 chunk_bytes, + ub1 *chunk_data, oraub8 flag, ub4 mode); + +/*--------------------- OCIXStreamInDetach ----------------------------*/ +/* + NAME + OCIXStreamInDetach - OCI XStream In Detach from Inbound Server + DESCRIPTION + Detaches from XStream inbound server and returns the inbound server's + processed low-watermark. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + processed_low_position (OUT) - Inbound server's processed low + position. Must pre-allocate + OCI_LCR_MAX_POSITION_LEN bytes for + output buffer. + processed_low_position_len(OUT)- Processed_low_position length. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ +sword OCIXStreamInDetach( + OCISvcCtx *svchp, + OCIError *errhp, + ub1 *processed_low_position, + ub2 *processed_low_position_len, + ub4 mode); + +/*--------------------- OCIXStreamInProcessedLWMGet -------------------------*/ +/* + NAME + OCIXStreamInProcessedLWMGet - OCI XStream In Get LowWatermark + DESCRIPTION + Returns XStream inbound server's processed low watermark + cached at the client. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + processed_low_position (OUT) - Inbound server's cached processed + low position. Must pre- + allocate OCI_LCR_MAX_POSITION_LEN + bytes for output buffer. + processed_low_position_len (OUT) - Processed_low_position length. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ +sword OCIXStreamInProcessedLWMGet( + OCISvcCtx *svchp, + OCIError *errhp, + ub1 *processed_low_position, + ub2 *processed_low_position_len, + ub4 mode); + +/*-------------------------- OCIXStreamInFlush ------------------------------*/ +/* + NAME + OCIXStreamInFlush - OCI XStream In Flush network + DESCRIPTION + Flushes network and terminates any in-progress OCIXStreamInLCRSend or + OCIXStreamInLCRCallbackSend call associated with the given service handle. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + Each call will incur a database round trip to get the server's processed + low-watermark, which the user can retrieve afterward using + OCIXStreamInProcessedLWMGet API. This API should be called only when + there is no LCR to send to the server and the client wants to know the + progress of the attached inbound server. + + This call returns OCI_ERROR if it is invoked from the callback functions + of OCIXStreamInLCRCallbackSend API. + + Client must have attached to an XStream inbound server prior to calling + this API. +*/ +sword OCIXStreamInFlush( + OCISvcCtx *svchp, + OCIError *errhp, + ub4 mode); + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* OCIXSTREAM_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/odci.h b/libraries/SQLAPI/include/ora_win/odci.h new file mode 100644 index 000000000..9ff930ff1 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/odci.h @@ -0,0 +1,798 @@ +/* + * + */ + +/* Copyright (c) 1998, 2006, Oracle. All rights reserved. */ + +/* + NAME + odci.h - Oracle Data Cartridge Interface definitions + + DESCRIPTION + This file contains Oracle Data Cartridge Interface definitions. These + include the ODCI Types and Constants. + + RELATED DOCUMENTS + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + None. + + PRIVATE FUNCTION(S) + None. + + EXAMPLES + + NOTES + - The constants defined here are replica of the constants defined + in ODCIConst Package defined as part of catodci.sql. If you change + these do make the similar change in catodci.sql. + + MODIFIED (MM/DD/YY) + spsundar 09/13/07 - + yhu 06/02/06 - add callproperty for statistics + yhu 05/22/06 - add ODCI_NODATA to speed rebuild empty index or ind. + part. + srirkris 05/09/06 - change ODCIOrderByInfo_ind + srirkris 02/06/06 - add definitions for CDI query. + spsundar 02/17/06 - add fields/types for system managed domain idx + yhu 02/08/06 - add RenameCol Na d RenameTopADT + yhu 03/11/05 - add flags for rename column and rename table + spsundar 11/28/05 - add fields/types for composite domain idx + yhu 12/06/05 - mapping table for local text indexes + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + ayoaz 04/21/03 - add CursorNum to ODCIEnv + abrumm 12/30/02 - Bug #2223225: add define for + ODCI_ARG_DESC_LIST_MAXSIZE + ayoaz 10/14/02 - Add Cardinality to ODCIArgDesc + ayoaz 09/11/02 - add ODCIQueryInfo to ODCIIndexCtx + yhu 09/19/02 - add ODCI_DEBUGGING_ON for ODCIEnv.EnvFlags + hsbedi 10/10/02 - add object number into ODCIExtTableInfo + ayoaz 08/30/02 - add ODCITable2 types + tchorma 07/29/02 - Add ODCIFuncCallInfo type for WITH COLUMN CONTEXT + hsbedi 06/29/02 - External table populate + yhu 07/20/01 - add parallel degree in ODCIIndexInfo. + abrumm 02/20/01 - ODCIExtTableInfo: add AccessParmBlob attribute + abrumm 01/18/01 - ODCIExtTableInfo: add default directory + spsundar 08/24/00 - Update attrbiute positions + abrumm 08/04/00 - external tables changes: ODCIExtTableInfo, constants + tchorma 09/11/00 - Add return code ODCI_FATAL + tchorma 08/08/00 - Add Update Block References Option for Alter Index + ayoaz 08/01/00 - Add ODCI_AGGREGATE_REUSE_CTX + spsundar 06/19/00 - add ODCIEnv type + abrumm 06/27/00 - add defines for ODCIExtTable flags + abrumm 06/04/00 - external tables: ODCIExtTableInfo change; add ODCIEnv + ddas 04/28/00 - extensible optimizer enhancements for 8.2 + yhu 06/05/00 - add a bit in IndexInfoFlags for trans. tblspc + yhu 04/10/00 - add ODCIPartInfo & remove ODCIIndexPartList + abrumm 03/29/00 - external table support + spsundar 02/14/00 - update odci definitions for 8.2 + nagarwal 03/07/99 - bug# 838308 - set estimate_stats=1 + rmurthy 11/09/98 - add blocking flag + ddas 10/31/98 - add ODCI_QUERY_SORT_ASC and ODCI_QUERY_SORT_DESC + ddas 05/26/98 - fix ODCIPredInfo flag bits + rmurthy 06/03/98 - add macro for RegularCall + spsundar 05/08/98 - add constants related to ODCIIndexAlter options + rmurthy 04/30/98 - remove include s.h + rmurthy 04/20/98 - name fixes + rmurthy 04/13/98 - add C mappings for odci types + alsrivas 04/10/98 - adding defines for ODCI_INDEX1 + jsriniva 04/04/98 - Creation + +*/ + +#ifndef OCI_ORACLE +# include +#endif +#ifndef ODCI_ORACLE +# define ODCI_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* The following are short names that are only supported on IBM mainframes + * with the SLSHORTNAME defined. + * With this all subsequent long names will actually be substituted with + * the short names here + */ + +#define ODCIColInfo_ref odcicir +#define ODCIColInfoList odcicil +#define ODCIColInfoList2 odcicil2 +#define ODCIIndexInfo_ref odciiir +#define ODCIPredInfo_ref odcipir +#define ODCIRidList odcirl +#define ODCIIndexCtx_ref odciicr +#define ODCIObject_ref odcior +#define ODCIObjectList odciol +#define ODCIQueryInfo_ref odciqir +#define ODCIFuncInfo_ref odcifir +#define ODCICost_ref odcicr +#define ODCIArgDesc_ref odciadr +#define ODCIArgDescList odciadl +#define ODCIStatsOptions_ref odcisor +#define ODCIColInfo odcici +#define ODCIColInfo_ind odcicii +#define ODCIIndexInfo odciii +#define ODCIIndexInfo_ind odciiii +#define ODCIPredInfo odcipi +#define ODCIPredInfo_ind odcipii +#define ODCIIndexCtx odciic +#define ODCIIndexCtx_ind odciici +#define ODCIObject odcio +#define ODCIObject_ind odcioi +#define ODCIQueryInfo odciqi +#define ODCIQueryInfo_ind odciqii +#define ODCIFuncInfo odcifi +#define ODCIFuncInfo_infd odcifii +#define ODCICost odcic +#define ODCICost_ind odcici +#define ODCIArgDesc odciad +#define ODCIArgDesc_ind odciadi +#define ODCIStatsOptions odciso +#define ODCIStatsOptions_ind odcisoi +#define ODCIPartInfo odcipti +#define ODCIPartInfo_ind odciptii +#define ODCIPartInfo_ref odciptir +#define ODCIExtTableInfo odcixt +#define ODCIExtTableInfo_ind odcixti +#define ODCIExtTableInfo_ref odcixtr +#define ODCIExtTableQCInfo odcixq +#define ODCIExtTableQCInfo_ind odcixqi +#define ODCIExtTableQCInfo_ref odcixqr +#define ODCIFuncCallInfo odcifc +#define ODCIFuncCall_ind odcifci +#define ODCIFuncCall_ref odcifcr +#define ODCIColValList odcicvl +#define ODCIColArrayList odcical +#define ODCIFilterInfoList odciflil +#define ODCIOrderByInfoList odciobil +#define ODCIFilterInfo_ref odciflir +#define ODCIOrderByInfo_ref odciobir +#define ODCICompQueryInfo_ref odcicqir +#define ODCIFilterInfo odcifli +#define ODCIOrderByInfo odciobi +#define ODCICompQueryInfo odcicqi +#define ODCIFilterInfo_ind odciflii +#define ODCIOrderByInfo_ind odciobii +#define ODCICompQueryInfo_ind odcicqii + +#endif /* SLSHORTNAME */ + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/* Constants for Return Status */ +#define ODCI_SUCCESS 0 +#define ODCI_ERROR 1 +#define ODCI_WARNING 2 +#define ODCI_ERROR_CONTINUE 3 +#define ODCI_FATAL 4 + +/* Constants for ODCIPredInfo.Flags */ +#define ODCI_PRED_EXACT_MATCH 0x0001 +#define ODCI_PRED_PREFIX_MATCH 0x0002 +#define ODCI_PRED_INCLUDE_START 0x0004 +#define ODCI_PRED_INCLUDE_STOP 0x0008 +#define ODCI_PRED_OBJECT_FUNC 0x0010 +#define ODCI_PRED_OBJECT_PKG 0x0020 +#define ODCI_PRED_OBJECT_TYPE 0x0040 +#define ODCI_PRED_MULTI_TABLE 0x0080 +#define ODCI_PRED_NOT_EQUAL 0x0100 + +/* Constants for QueryInfo.Flags */ +#define ODCI_QUERY_FIRST_ROWS 0x01 +#define ODCI_QUERY_ALL_ROWS 0x02 +#define ODCI_QUERY_SORT_ASC 0x04 +#define ODCI_QUERY_SORT_DESC 0x08 +#define ODCI_QUERY_BLOCKING 0x10 + +/* Constants for ScnFlg(Func /w Index Context) */ +#define ODCI_CLEANUP_CALL 1 +#define ODCI_REGULAR_CALL 2 + +/* Constants for ODCIFuncInfo.Flags */ +#define ODCI_OBJECT_FUNC 0x01 +#define ODCI_OBJECT_PKG 0x02 +#define ODCI_OBJECT_TYPE 0x04 + +/* Constants for ODCIArgDesc.ArgType */ +#define ODCI_ARG_OTHER 1 +#define ODCI_ARG_COL 2 /* column */ +#define ODCI_ARG_LIT 3 /* literal */ +#define ODCI_ARG_ATTR 4 /* object attribute */ +#define ODCI_ARG_NULL 5 +#define ODCI_ARG_CURSOR 6 + +/* Maximum size of ODCIArgDescList array */ +#define ODCI_ARG_DESC_LIST_MAXSIZE 32767 + +/* Constants for ODCIStatsOptions.Options */ +#define ODCI_PERCENT_OPTION 1 +#define ODCI_ROW_OPTION 2 + +/* Constants for ODCIStatsOptions.Flags */ +#define ODCI_ESTIMATE_STATS 0x01 +#define ODCI_COMPUTE_STATS 0x02 +#define ODCI_VALIDATE 0x04 + +/* Constants for ODCIIndexAlter parameter alter_option */ +#define ODCI_ALTIDX_NONE 0 +#define ODCI_ALTIDX_RENAME 1 +#define ODCI_ALTIDX_REBUILD 2 +#define ODCI_ALTIDX_REBUILD_ONL 3 +#define ODCI_ALTIDX_MODIFY_COL 4 +#define ODCI_ALTIDX_UPDATE_BLOCK_REFS 5 +#define ODCI_ALTIDX_RENAME_COL 6 +#define ODCI_ALTIDX_RENAME_TAB 7 +#define ODCI_ALTIDX_MIGRATE 8 + +/* Constants for ODCIIndexInfo.IndexInfoFlags */ +#define ODCI_INDEX_LOCAL 0x0001 +#define ODCI_INDEX_RANGE_PARTN 0x0002 +#define ODCI_INDEX_HASH_PARTN 0x0004 +#define ODCI_INDEX_ONLINE 0x0008 +#define ODCI_INDEX_PARALLEL 0x0010 +#define ODCI_INDEX_UNUSABLE 0x0020 +#define ODCI_INDEX_ONIOT 0x0040 +#define ODCI_INDEX_TRANS_TBLSPC 0x0080 +#define ODCI_INDEX_FUNCTION_IDX 0x0100 +#define ODCI_INDEX_LIST_PARTN 0x0200 + +/* Constants for ODCIIndexInfo.IndexParaDegree */ +#define ODCI_INDEX_DEFAULT_DEGREE 32767 + +/* Constants for ODCIEnv.EnvFlags */ +#define ODCI_DEBUGGING_ON 0x01 +#define ODCI_NODATA 0x02 + +/* Constants for ODCIEnv.CallProperty */ +#define ODCI_CALL_NONE 0 +#define ODCI_CALL_FIRST 1 +#define ODCI_CALL_INTERMEDIATE 2 +#define ODCI_CALL_FINAL 3 +#define ODCI_CALL_REBUILD_INDEX 4 +#define ODCI_CALL_REBUILD_PMO 5 +#define ODCI_CALL_STATSGLOBAL 6 +#define ODCI_CALL_STATSGLOBALANDPARTITION 7 +#define ODCI_CALL_STATSPARTITION 8 + +/* Constants for ODCIExtTableInfo.OpCode */ +#define ODCI_EXTTABLE_INFO_OPCODE_FETCH 1 +#define ODCI_EXTTABLE_INFO_OPCODE_POPULATE 2 + +/* Constants (bit definitions) for ODCIExtTableInfo.Flag */ + /* sampling type: row or block */ +#define ODCI_EXTTABLE_INFO_FLAG_SAMPLE 0x00000001 +#define ODCI_EXTTABLE_INFO_FLAG_SAMPLE_BLOCK 0x00000002 + /* AccessParmClob, AccessParmBlob discriminator */ +#define ODCI_EXTTABLE_INFO_FLAG_ACCESS_PARM_CLOB 0x00000004 +#define ODCI_EXTTABLE_INFO_FLAG_ACCESS_PARM_BLOB 0x00000008 + +/* Constants for ODCIExtTableInfo.IntraSourceConcurrency */ +#define ODCI_TRUE 1 +#define ODCI_FALSE 0 + +/* Constants (bit definitions) for ODCIExtTable{Open,Fetch,Populate,Close} + * Flag argument. + */ +#define ODCI_EXTTABLE_OPEN_FLAGS_QC 0x00000001 /* caller is Query Coord */ +#define ODCI_EXTTABLE_OPEN_FLAGS_SHADOW 0x00000002 /* caller is shadow proc */ +#define ODCI_EXTTABLE_OPEN_FLAGS_SLAVE 0x00000004 /* caller is slave proc */ + +#define ODCI_EXTTABLE_FETCH_FLAGS_EOS 0x00000001 /* end-of-stream on fetch */ + +/* Constants for Flags argument to ODCIAggregateTerminate */ +#define ODCI_AGGREGATE_REUSE_CTX 1 + +/* Constants for ODCIColInfo.Flags */ +#define ODCI_COMP_FILTERBY_COL 0x0001 +#define ODCI_COMP_ORDERBY_COL 0x0002 +#define ODCI_COMP_ORDERDSC_COL 0x0004 +#define ODCI_COMP_UPDATED_COL 0x0008 +#define ODCI_COMP_RENAMED_COL 0x0010 +#define ODCI_COMP_RENAMED_TOPADT 0x0020 + +/* Constants for ODCIOrderByInfo.ExprType */ +#define ODCI_COLUMN_EXPR 1 +#define ODCI_ANCOP_EXPR 2 + +/* Constants for ODCIOrderByInfo.SortOrder */ +#define ODCI_SORT_ASC 1 +#define ODCI_SORT_DESC 2 +#define ODCI_NULLS_FIRST 4 + +/* Constants for ODCIPartInfo.PartOp */ +#define ODCI_ADD_PARTITION 1 +#define ODCI_DROP_PARTITION 2 + +/*--------------------------------------------------------------------------- + ODCI TYPES + ---------------------------------------------------------------------------*/ +/* + * These are C mappings for the OTS types defined in catodci.sql + */ + +typedef OCIRef ODCIColInfo_ref; +typedef OCIArray ODCIColInfoList; +typedef OCIArray ODCIColInfoList2; +typedef OCIRef ODCIIndexInfo_ref; +typedef OCIRef ODCIPredInfo_ref; +typedef OCIArray ODCIRidList; +typedef OCIRef ODCIIndexCtx_ref; +typedef OCIRef ODCIObject_ref; +typedef OCIArray ODCIObjectList; +typedef OCIRef ODCIQueryInfo_ref; +typedef OCIRef ODCIFuncInfo_ref; +typedef OCIRef ODCICost_ref; +typedef OCIRef ODCIArgDesc_ref; +typedef OCIArray ODCIArgDescList; +typedef OCIRef ODCIStatsOptions_ref; +typedef OCIRef ODCIPartInfo_ref; +typedef OCIRef ODCIEnv_ref; +typedef OCIRef ODCIExtTableInfo_ref; /* external table support */ +typedef OCIArray ODCIGranuleList; /* external table support */ +typedef OCIRef ODCIExtTableQCInfo_ref; /* external table support */ +typedef OCIRef ODCIFuncCallInfo_ref; +typedef OCIArray ODCINumberList; +typedef OCIArray ODCIPartInfoList; +typedef OCIArray ODCIColValList; +typedef OCIArray ODCIColArrayList; +typedef OCIArray ODCIFilterInfoList; +typedef OCIArray ODCIOrderByInfoList; +typedef OCIRef ODCIFilterInfo_ref; +typedef OCIRef ODCIOrderByInfo_ref; +typedef OCIRef ODCICompQueryInfo_ref; + +struct ODCIColInfo +{ + OCIString* TableSchema; + OCIString* TableName; + OCIString* ColName; + OCIString* ColTypName; + OCIString* ColTypSchema; + OCIString* TablePartition; + OCINumber ColFlags; + OCINumber ColOrderPos; + OCINumber TablePartitionIden; + OCINumber TablePartitionTotal; +}; +typedef struct ODCIColInfo ODCIColInfo; + +struct ODCIColInfo_ind +{ + OCIInd atomic; + OCIInd TableSchema; + OCIInd TableName; + OCIInd ColName; + OCIInd ColTypName; + OCIInd ColTypSchema; + OCIInd TablePartition; + OCIInd ColFlags; + OCIInd ColOrderPos; + OCIInd TablePartitionIden; + OCIInd TablePartitionTotal; +}; +typedef struct ODCIColInfo_ind ODCIColInfo_ind; + +struct ODCIFuncCallInfo +{ + struct ODCIColInfo ColInfo; +}; + +struct ODCIFuncCallInfo_ind +{ + struct ODCIColInfo_ind ColInfo; +}; + +struct ODCIIndexInfo +{ + OCIString* IndexSchema; + OCIString* IndexName; + ODCIColInfoList* IndexCols; + OCIString* IndexPartition; + OCINumber IndexInfoFlags; + OCINumber IndexParaDegree; + OCINumber IndexPartitionIden; + OCINumber IndexPartitionTotal; +}; +typedef struct ODCIIndexInfo ODCIIndexInfo; + +struct ODCIIndexInfo_ind +{ + OCIInd atomic; + OCIInd IndexSchema; + OCIInd IndexName; + OCIInd IndexCols; + OCIInd IndexPartition; + OCIInd IndexInfoFlags; + OCIInd IndexParaDegree; + OCIInd IndexPartitionIden; + OCIInd IndexPartitionTotal; +}; +typedef struct ODCIIndexInfo_ind ODCIIndexInfo_ind; + +struct ODCIPredInfo +{ + OCIString* ObjectSchema; + OCIString* ObjectName; + OCIString* MethodName; + OCINumber Flags; +}; +typedef struct ODCIPredInfo ODCIPredInfo; + +struct ODCIPredInfo_ind +{ + OCIInd atomic; + OCIInd ObjectSchema; + OCIInd ObjectName; + OCIInd MethodName; + OCIInd Flags; +}; +typedef struct ODCIPredInfo_ind ODCIPredInfo_ind; + +struct ODCIFilterInfo +{ + ODCIColInfo ColInfo; + OCINumber Flags; + OCIAnyData *strt; + OCIAnyData *stop; +}; +typedef struct ODCIFilterInfo ODCIFilterInfo; + +struct ODCIFilterInfo_ind +{ + OCIInd atomic; + ODCIColInfo_ind ColInfo; + OCIInd Flags; + OCIInd strt; + OCIInd stop; +}; +typedef struct ODCIFilterInfo_ind ODCIFilterInfo_ind; + + +struct ODCIOrderByInfo +{ + OCINumber ExprType; + OCIString *ObjectSchema; + OCIString *TableName; + OCIString *ExprName; + OCINumber SortOrder; +}; +typedef struct ODCIOrderByInfo ODCIOrderByInfo; + +struct ODCIOrderByInfo_ind +{ + OCIInd atomic; + OCIInd ExprType; + OCIInd ObjectSchema; + OCIInd TableName; + OCIInd ExprName; + OCIInd SortOrder; +}; +typedef struct ODCIOrderByInfo_ind ODCIOrderByInfo_ind; + + +struct ODCICompQueryInfo +{ + ODCIFilterInfoList *PredInfo; + ODCIOrderByInfoList *ObyInfo; +}; +typedef struct ODCICompQueryInfo ODCICompQueryInfo; + +struct ODCICompQueryInfo_ind +{ + OCIInd atomic; + OCIInd PredInfo; + OCIInd ObyInfo; +}; +typedef struct ODCICompQueryInfo_ind ODCICompQueryInfo_ind; + + +struct ODCIObject +{ + OCIString* ObjectSchema; + OCIString* ObjectName; +}; +typedef struct ODCIObject ODCIObject; + +struct ODCIObject_ind +{ + OCIInd atomic; + OCIInd ObjectSchema; + OCIInd ObjectName; +}; +typedef struct ODCIObject_ind ODCIObject_ind; + +struct ODCIQueryInfo +{ + OCINumber Flags; + ODCIObjectList* AncOps; + ODCICompQueryInfo CompInfo; +}; +typedef struct ODCIQueryInfo ODCIQueryInfo; + + +struct ODCIQueryInfo_ind +{ + OCIInd atomic; + OCIInd Flags; + OCIInd AncOps; + ODCICompQueryInfo_ind CompInfo; +}; +typedef struct ODCIQueryInfo_ind ODCIQueryInfo_ind; + +struct ODCIIndexCtx +{ + struct ODCIIndexInfo IndexInfo; + OCIString* Rid; + struct ODCIQueryInfo QueryInfo; +}; +typedef struct ODCIIndexCtx ODCIIndexCtx; + +struct ODCIIndexCtx_ind +{ + OCIInd atomic; + struct ODCIIndexInfo_ind IndexInfo; + OCIInd Rid; + struct ODCIQueryInfo_ind QueryInfo; +}; +typedef struct ODCIIndexCtx_ind ODCIIndexCtx_ind; + +struct ODCIFuncInfo +{ + OCIString* ObjectSchema; + OCIString* ObjectName; + OCIString* MethodName; + OCINumber Flags; +}; +typedef struct ODCIFuncInfo ODCIFuncInfo; + +struct ODCIFuncInfo_ind +{ + OCIInd atomic; + OCIInd ObjectSchema; + OCIInd ObjectName; + OCIInd MethodName; + OCIInd Flags; +}; +typedef struct ODCIFuncInfo_ind ODCIFuncInfo_ind; + +struct ODCICost +{ + OCINumber CPUcost; + OCINumber IOcost; + OCINumber NetworkCost; + OCIString* IndexCostInfo; +}; +typedef struct ODCICost ODCICost; + +struct ODCICost_ind +{ + OCIInd atomic; + OCIInd CPUcost; + OCIInd IOcost; + OCIInd NetworkCost; + OCIInd IndexCostInfo; +}; +typedef struct ODCICost_ind ODCICost_ind; + +struct ODCIArgDesc +{ + OCINumber ArgType; + OCIString* TableName; + OCIString* TableSchema; + OCIString* ColName; + OCIString* TablePartitionLower; + OCIString* TablePartitionUpper; + OCINumber Cardinality; +}; +typedef struct ODCIArgDesc ODCIArgDesc; + +struct ODCIArgDesc_ind +{ + OCIInd atomic; + OCIInd ArgType; + OCIInd TableName; + OCIInd TableSchema; + OCIInd ColName; + OCIInd TablePartitionLower; + OCIInd TablePartitionUpper; + OCIInd Cardinality; +}; +typedef struct ODCIArgDesc_ind ODCIArgDesc_ind; + +struct ODCIStatsOptions +{ + OCINumber Sample; + OCINumber Options; + OCINumber Flags; +}; +typedef struct ODCIStatsOptions ODCIStatsOptions; + +struct ODCIStatsOptions_ind +{ + OCIInd atomic; + OCIInd Sample; + OCIInd Options; + OCIInd Flags; +}; +typedef struct ODCIStatsOptions_ind ODCIStatsOptions_ind; + +struct ODCIEnv +{ + OCINumber EnvFlags; + OCINumber CallProperty; + OCINumber DebugLevel; + OCINumber CursorNum; +}; +typedef struct ODCIEnv ODCIEnv; + +struct ODCIEnv_ind +{ + OCIInd _atomic; + OCIInd EnvFlags; + OCIInd CallProperty; + OCIInd DebugLevel; + OCIInd CursorNum; +}; +typedef struct ODCIEnv_ind ODCIEnv_ind; + +struct ODCIPartInfo +{ + OCIString* TablePartition; + OCIString* IndexPartition; + OCINumber IndexPartitionIden; + OCINumber PartOp; +}; +typedef struct ODCIPartInfo ODCIPartInfo; + +struct ODCIPartInfo_ind +{ + OCIInd atomic; + OCIInd TablePartition; + OCIInd IndexPartition; + OCIInd IndexPartitionIden; + OCIInd PartOp; +}; +typedef struct ODCIPartInfo_ind ODCIPartInfo_ind; + +/*---------- External Tables ----------*/ +struct ODCIExtTableInfo +{ + OCIString* TableSchema; + OCIString* TableName; + ODCIColInfoList* RefCols; + OCIClobLocator* AccessParmClob; + OCIBlobLocator* AccessParmBlob; + ODCIArgDescList* Locations; + ODCIArgDescList* Directories; + OCIString* DefaultDirectory; + OCIString* DriverType; + OCINumber OpCode; + OCINumber AgentNum; + OCINumber GranuleSize; + OCINumber Flag; + OCINumber SamplePercent; + OCINumber MaxDoP; + OCIRaw* SharedBuf; + OCIString* MTableName; + OCIString* MTableSchema; + OCINumber TableObjNo; +}; +typedef struct ODCIExtTableInfo ODCIExtTableInfo; + +struct ODCIExtTableInfo_ind +{ + OCIInd _atomic; + OCIInd TableSchema; + OCIInd TableName; + OCIInd RefCols; + OCIInd AccessParmClob; + OCIInd AccessParmBlob; + OCIInd Locations; + OCIInd Directories; + OCIInd DefaultDirectory; + OCIInd DriverType; + OCIInd OpCode; + OCIInd AgentNum; + OCIInd GranuleSize; + OCIInd Flag; + OCIInd SamplePercent; + OCIInd MaxDoP; + OCIInd SharedBuf; + OCIInd MTableName; + OCIInd MTableSchema; + OCIInd TableObjNo; +}; +typedef struct ODCIExtTableInfo_ind ODCIExtTableInfo_ind; + +struct ODCIExtTableQCInfo +{ + OCINumber NumGranules; + OCINumber NumLocations; + ODCIGranuleList* GranuleInfo; + OCINumber IntraSourceConcurrency; + OCINumber MaxDoP; + OCIRaw* SharedBuf; +}; +typedef struct ODCIExtTableQCInfo ODCIExtTableQCInfo; + +struct ODCIExtTableQCInfo_ind +{ + OCIInd _atomic; + OCIInd NumGranules; + OCIInd NumLocations; + OCIInd GranuleInfo; + OCIInd IntraSourceConcurrency; + OCIInd MaxDoP; + OCIInd SharedBuf; +}; +typedef struct ODCIExtTableQCInfo_ind ODCIExtTableQCInfo_ind; + +/*********************************************************/ +/* Table Function Info types (used by ODCITablePrepare) */ +/*********************************************************/ + +struct ODCITabFuncInfo +{ + ODCINumberList* Attrs; + OCIType* RetType; +}; +typedef struct ODCITabFuncInfo ODCITabFuncInfo; + +struct ODCITabFuncInfo_ind +{ + OCIInd _atomic; + OCIInd Attrs; + OCIInd RetType; +}; +typedef struct ODCITabFuncInfo_ind ODCITabFuncInfo_ind; + +/*********************************************************************/ +/* Table Function Statistics types (used by ODCIStatsTableFunction) */ +/*********************************************************************/ + +struct ODCITabFuncStats +{ + OCINumber num_rows; +}; +typedef struct ODCITabFuncStats ODCITabFuncStats; + +struct ODCITabFuncStats_ind +{ + OCIInd _atomic; + OCIInd num_rows; +}; +typedef struct ODCITabFuncStats_ind ODCITabFuncStats_ind; + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#endif /* ODCI_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/oratypes.h b/libraries/SQLAPI/include/ora_win/oratypes.h new file mode 100644 index 000000000..2b1c0b25d --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/oratypes.h @@ -0,0 +1,322 @@ +/* + Copyright (c) 1982, 2008, Oracle and/or its affiliates.All rights reserved. +*/ + +/* + * $Header: oracore3/public/oratypes.h /nt/21 2009/01/01 19:48:06 sabchoud Exp $ + */ + + + +#ifndef ORATYPES +# define ORATYPES +# define SX_ORACLE +# define SX3_ORACLE + + +#ifndef ORASTDDEF +# include +# define ORASTDDEF +#endif + +#ifndef ORALIMITS +# include +# define ORALIMITS +#endif + + +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + + +#ifndef lint +typedef unsigned char ub1; +typedef signed char sb1; +#else +#define ub1 unsigned char +#define sb1 signed char +#endif + +#define UB1MAXVAL ((ub1)UCHAR_MAX) +#define UB1MINVAL ((ub1) 0) +#define SB1MAXVAL ((sb1)SCHAR_MAX) +#define SB1MINVAL ((sb1)SCHAR_MIN) +#define MINUB1MAXVAL ((ub1) 255) +#define MAXUB1MINVAL ((ub1) 0) +#define MINSB1MAXVAL ((sb1) 127) +#define MAXSB1MINVAL ((sb1) -127) + + + + +#ifndef lint +typedef unsigned short ub2; +typedef signed short sb2; +#else +#define ub2 unsigned short +#define sb2 signed short +#endif + +#define UB2MAXVAL ((ub2)USHRT_MAX) +#define UB2MINVAL ((ub2) 0) +#define SB2MAXVAL ((sb2) SHRT_MAX) +#define SB2MINVAL ((sb2) SHRT_MIN) +#define MINUB2MAXVAL ((ub2) 65535) +#define MAXUB2MINVAL ((ub2) 0) +#define MINSB2MAXVAL ((sb2) 32767) +#define MAXSB2MINVAL ((sb2)-32767) + + + + +#ifndef lint +typedef unsigned int ub4; +typedef signed int sb4; +#else +#define eb4 int +#define ub4 unsigned int +#define sb4 signed int +#endif + +#define UB4MAXVAL ((ub4)UINT_MAX) +#define UB4MINVAL ((ub4) 0) +#define SB4MAXVAL ((sb4) INT_MAX) +#define SB4MINVAL ((sb4) INT_MIN) +#define MINUB4MAXVAL ((ub4) 4294967295) +#define MAXUB4MINVAL ((ub4) 0) +#define MINSB4MAXVAL ((sb4) 2147483647) +#define MAXSB4MINVAL ((sb4)-2147483647) + + +/* --- Signed/Unsigned eight-byte scalar (orasb8/oraub8) --- */ + +#define ORAXB8_DEFINED +#ifndef lint +#ifndef __GNUC__ +#ifdef __BORLANDC__ + typedef unsigned __int64 oraub8; + typedef signed __int64 orasb8; +#else + typedef unsigned _int64 oraub8; + typedef signed _int64 orasb8; +#endif /* __BORLANDC__ */ +#else + typedef unsigned long long oraub8; + typedef signed long long orasb8; +#endif + typedef oraub8 ub8; + typedef orasb8 sb8; +#else +# define ub8 oraub8 +# define sb8 orasb8 +# define oraub8 unsigned _int64 +# define orasb8 signed _int64 +#endif /* !lint */ + +#define ORAUB8MINVAL ((oraub8)0) +#define ORAUB8MAXVAL ((oraub8)18446744073709551615) +#define ORASB8MINVAL ((orasb8)-9223372036854775808) +#define ORASB8MAXVAL ((orasb8) 9223372036854775807) + +#define MAXORAUB8MINVAL ((oraub8)0) +#define MINORAUB8MAXVAL ((oraub8)18446744073709551615) +#define MAXORASB8MINVAL ((orasb8)-9223372036854775807) +#define MINORASB8MAXVAL ((orasb8) 9223372036854775807) + + +#define UB1BITS CHAR_BIT +#define UB1MASK ((1 << ((uword)CHAR_BIT)) - 1) + + +#ifdef lint +# define oratext unsigned char +#else + typedef unsigned char oratext; +#endif + + +#ifndef lint +typedef char eb1; +typedef short eb2; +typedef int eb4; +#else +# define eb1 char +# define eb2 short +# define eb4 int +#endif + +#define EB1MAXVAL ((eb1)SCHAR_MAX) +#define EB1MINVAL ((eb1) 0) +#define MINEB1MAXVAL ((eb1) 127) +#define MAXEB1MINVAL ((eb1) 0) +#define EB2MAXVAL ((eb2) SHRT_MAX) +#define EB2MINVAL ((eb2) 0) +#define MINEB2MAXVAL ((eb2) 32767) +#define MAXEB2MINVAL ((eb2) 0) +#define EB4MAXVAL ((eb4) INT_MAX) +#define EB4MINVAL ((eb4) 0) +#define MINEB4MAXVAL ((eb4) 2147483647) +#define MAXEB4MINVAL ((eb4) 0) + + + + +#ifndef lint +typedef sb1 b1; +#else +#define b1 sb1 +#endif +#define B1MAXVAL SB1MAXVAL +#define B1MINVAL SB1MINVAL + +#ifndef lint +typedef sb2 b2; +#else +#define b2 sb2 +#endif +#define B2MAXVAL SB2MAXVAL +#define B2MINVAL SB2MINVAL + +#ifndef lint +typedef sb4 b4; +#else +#define b4 sb4 +#endif +# define B4MAXVAL SB4MAXVAL +# define B4MINVAL SB4MINVAL + + +#if !defined(LUSEMFC) +# ifdef lint +# define text unsigned char +# else + typedef oratext text; +# endif +#endif + +#ifdef lint +# define OraText unsigned char +#else + typedef oratext OraText; +#endif + +#ifndef lint +typedef int eword; +typedef unsigned int uword; +typedef signed int sword; +#else +#define eword int +#define uword unsigned int +#define sword signed int +#endif + +#define EWORDMAXVAL ((eword) INT_MAX) +#define EWORDMINVAL ((eword) 0) +#define UWORDMAXVAL ((uword)UINT_MAX) +#define UWORDMINVAL ((uword) 0) +#define SWORDMAXVAL ((sword) INT_MAX) +#define SWORDMINVAL ((sword) INT_MIN) +#define MINEWORDMAXVAL ((eword) 2147483647) +#define MAXEWORDMINVAL ((eword) 0) +#define MINUWORDMAXVAL ((uword) 4294967295) +#define MAXUWORDMINVAL ((uword) 0) +#define MINSWORDMAXVAL ((sword) 2147483647) +#define MAXSWORDMINVAL ((sword) -2147483647) + + +#ifdef _WIN64 + +#ifndef lint +#if defined(__BORLANDC__) || defined(__MINGW64__) +typedef unsigned __int64 ubig_ora; +typedef signed __int64 sbig_ora; +#else +typedef unsigned _int64 ubig_ora; +typedef signed _int64 sbig_ora; +#endif /* End of __BORLANDC__ */ +#else +#define ubig_ora unsigned _int64 +#define sbig_ora signed _int64 +#endif /* End of lint */ + +#define UBIG_ORAMAXVAL ((ubig_ora)_UI64_MAX) +#define UBIG_ORAMINVAL ((ubig_ora) 0) +#define SBIG_ORAMAXVAL ((sbig_ora) _I64_MAX) +#define SBIG_ORAMINVAL ((sbig_ora) _I64_MIN) +#define MINUBIG_ORAMAXVAL ((ubig_ora) 4294967295) +#define MAXUBIG_ORAMINVAL ((ubig_ora) 0) +#define MINSBIG_ORAMAXVAL ((sbig_ora) 2147483647) +#define MAXSBIG_ORAMINVAL ((sbig_ora)-2147483647) + +#else + +#ifndef lint +typedef unsigned long ubig_ora; +typedef signed long sbig_ora; +#else +#define ubig_ora unsigned long +#define sbig_ora signed long +#endif + +#define UBIG_ORAMAXVAL ((ubig_ora)ULONG_MAX) +#define UBIG_ORAMINVAL ((ubig_ora) 0) +#define SBIG_ORAMAXVAL ((sbig_ora) LONG_MAX) +#define SBIG_ORAMINVAL ((sbig_ora) LONG_MIN) +#define MINUBIG_ORAMAXVAL ((ubig_ora) 4294967295) +#define MAXUBIG_ORAMINVAL ((ubig_ora) 0) +#define MINSBIG_ORAMAXVAL ((sbig_ora) 2147483647) +#define MAXSBIG_ORAMINVAL ((sbig_ora)-2147483647) + +#endif /* _WIN64 */ + +#define UBIGORABITS (UB1BITS * sizeof(ubig_ora)) + + +#undef CONST +#define CONST const + + +#define dvoid void + + +typedef void (*lgenfp_t)( void ); + + + +#ifndef ORASYS_TYPES +# include +# define ORASYS_TYPES +#endif + + + +#ifndef boolean +# define boolean int +#endif + + + +#ifdef sparc +# define SIZE_TMAXVAL SB4MAXVAL +#else +# define SIZE_TMAXVAL UB4MAXVAL +#endif + +#define MINSIZE_TMAXVAL (size_t)4294967295 + + +#if !defined(MOTIF) && !defined(LISPL) && !defined(__cplusplus) && !defined(LUSEMFC) +typedef oratext *string; +#endif + +#ifndef lint +typedef unsigned short utext; +#else +#define utext unsigned short +#endif + + +#endif + diff --git a/libraries/SQLAPI/include/ora_win/ori.h b/libraries/SQLAPI/include/ora_win/ori.h new file mode 100644 index 000000000..d291f150e --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ori.h @@ -0,0 +1,2095 @@ +/* Copyright (c) 1994, 2006, Oracle. All rights reserved. */ + +/* + NAME + ORI - OCI navigational interface + + DESCRIPTION + + This section is intended to give a brief introduction to the navigational + interfaces. Readers can refer to the documents listed in the section + 'RELATED DOCUMENTS' for more information. + + PURPOSE + The Oracle Call Interface (OCI) supports navigational access of objects. + In the navigational paradigm, data is represented as a graph of objects + connected by references. Objects in the graph are reached by following + the references. + + OBJECT ENVIRONMENT + + The object environment is initialized when the OCI environment handle is + initialized with the object option. An object environment contains a + heap which buffers type instances in memory. The object environment also + contains an object cache which keeps track of the objects in the object + environment. Readers can refer to the "Functional Specification for + Programmatic Interface" for more information about the object + environment. + + INSTANCE, OBJECT AND VALUE + + An OTS instance is an occurence of a type specified by the Oracle Type + System (OTS). This section describes how an OTS instance can be + represented in OCI. In OCI, an OTS instance can be classified based on + the type, the lifetime and referencability (see the figure below): + + 1) A persistent object is an instance of an object type. A persistent + object resides in a row of a table in the server and can exist longer + than the duration of a session (connection). Persistent objects can be + identified by object references which contain the object identifiers. + A persistent object is obtained by pinning its object reference. + + 2) A transient object is an instance of an object type. A transient + object cannot exist longer than the duration of a session, and it is + used to contain temporary computing results. Transient objects can + also be identified by references which contain transient object + identifiers. + + 3) A value is an instance of an user-defined type (object type or + collection type) or any built-in OTS type. Unlike objects, values of + object types are identified by memory pointers, rather than by + references. + + A value can be standalone or embbeded. A standalone value is usually + obtained by issuing a select statement. OCI also allows the client + program to select a row of object table into a value by issuing a SQL + statement. Thus, a referenceable object (in the database) can be + represented as a value (which cannot be identified by a reference). + A standalone value can also be an out-of-line attribute in an object + (e.g varchar, raw) or an out-of-line element in a collection (e.g. + varchar, raw, object). + + An embedded value is phyiscally included in a containing instance. + An embedded value can be an in-line attribute in an object (e.g. + number, nested object) or an in-line element in a collection. + + All values are considered to be transient by OCI, e.g. OCI does not + support automatic flushing a value to the database, and the client has + to explicitly execute a SQL statement to store a value into the + database. For embedded values, they are flushed when their containing + instance are flushed. + + + OTS instance + | | + v v + object value (type) + | | + v v + persistent transient (lifetime) + + + persistent obj transient obj value + --------------------------------------------------------------- + | | | | object type, | + | type | object type | object type | built-in, | + | | | | collection | + --------------------------------------------------------------- + | maximum | until object | session | session | + | lifetime | is deleted | | | + --------------------------------------------------------------- + | referencable | yes | yes | no | + --------------------------------------------------------------- + | embeddable | no | no | yes | + --------------------------------------------------------------- + + REFERENCEABLE OBJECT, STANDALONE OBJECT, EMBEDDED OBJECT + + In the reminding of this include file, the following term will be used: + 1) The term 'object' can be generally referred to a persistent object, + a transient object, a standalone value of object type, or an embedded + value of object type. + 2) The term 'referenceable object' refers to a persistent object or a + transient object. + 3) The term 'standalone object' refers to a persistent object, a + transient object or a standalone value of object type. + 4) The term 'embedded object' referes to a embbeded value of object + type. + + META ATTRIBUTES + + There is a set of meta-attributes that are defined for standalone + objects. A meta-attribute can be transient or persistent. A + transient meta-attribute is applicable to an instance only when it is + in memory. A persistent meta-attribute can be applicable to an instance + that is in the disk. + + The set of user visible meta-attributes for persistent objects are: + 1) existent (persistent) : Does the object exist? + 2) nullness (persistent) : Null information of the instance + 3) locked (persistent) : Is the object locked? + 4) pinned (transient) : Is the object being accessed by the client? + 5) dirty (transient) : Has the object been modified? + 6) allocation duration (transient) : see below + 7) pin duration (transient) : see below + + The set of user visible meta-attributes for transient objects are: + 1) existent (transient) : Does the object exist? + 2) nullness (transient) : Null information of the instance + 3) pinned (transient) : Is the object being accessed by the client? + 4) dirty (transient) : Has the object been modified? + 4) allocation duration (transient) : see below + 5) pin duration (transient) : see below + + The set of user visible meta-attributes for standalone values of object + type or collections are: + 1) allocation duration (transient) : see below + 2) nullness (transient) : Null information of the instance + (of an object type) + + NULLNESS OF AN INSTANCE + + Each standalone object is associated with a null structure which keeps + the null information about the object. A null indicates the absence of + data. The null structure itself contains null indicators that represent: + 1) atomic nullness : a null value that pertains to the whole object + 2) null status of the individual attribute in the object + + The layout of a null structure in memory resembles that of the object, + except that the null structure has additional indicators to represent + the atomic nullness for each object. + + An non-existent object is different than an object that is atomically + null. A atomically null object is an existing object that has no data. + + MEMORY LAYOUT OF AN OBJECT + + A standalone object in memory is composed of a top level memory chunk, + a null structure and optionally, a number of secondary memory chunks. + For a DEPARTMENT object type, + + OBJECT TYPE department + { + dep_name varchar2(20), + budget number, + manager person, /o person is an object type o/ + employees collection of person + } + + Each instance of DEPARTMENT will has a top level memory chunk which + contains the top level attributes such as dep_name, budget, manager and + employees. The attributes dep_name and employees are themselves pointers + to the additional memory (the secondary memory chunks). The secondary + memory is for the out-of-line attribute (e.g. varray). + + CONSISTENCY MODEL + + Each pin operation behaves like a distinct SQL select. Thus, the object + cache does not guarantee consistency for a graph of objects. In order to + retrieve a consistent graph of objects, the user has to explicitly start + a serializable transaction or a read-only transaction. + + DURATION + In OCI, a duration is used to specify + + 1) the length of memory allocation of an instance + When each instance is allocated, it is associate with an allocation + duration. The memory occupied by the object is freed automatically + at the end of its allocation duration. The allocation duration of an + instance cannot be changed. + + 2) the length of pinning of an object + When each object is pinned, the client has to give a pin duration + which specify the length of time that the object is intended to be + used. It is an user error to specify a pin duration longer than an + allocation duration of the object. An object is completely unpinned + at the end of its pin duration (see OCIObjectUnpin()). + + An OCI program can use the allocation duration and the pin duration to + automatically free the memory of the instances: + 1) Transient objects and values are freed at the end of the allocation + duration. + 2) Persistent objects ARE freed at the end of the allocation duration. + Persistent objects CAN be freed at the end of the pin duration when + the objects are completely unpinned. The persistent objects are said + to be aged out. See OCIObjectUnpin() for more details. + + There are 3 predefined duration: session, transaction, call. The time + spans of these durations are defined based on the programming model + presented by OCI. The call duration is mapped to the transaction + duration in the client-side environment. See oro.h for the macros defined + for these 3 durations. + + A pin duration can be promoted. For example, if an object is pinned with + duration 1, and the object is later pinned with duration 2, the pin + routine will try to find a duration that is longer or equal to the + length of both duration 1 and duration 2. The pin duration of the object + is set to the that duration. The object is automatically unpinned only + after both duration 1 and duration 2 are terminated. + + RELATED DOCUMENTS + "Functional Specification for Oracle Object RDBMS" + "Functional Specification for Programmatic Interfaces" + "Functional Specification for the Oracle Type System (OTS)" + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTIONS + OCIObjectNew - OCI new a standalone instance + OCIObjectPin - OCI pin an object by reference + OCIObjectUnpin - OCI unpin a referenceable object + OCIObjectPinCountReset - OCI reset the pin count of a referenceable object + OCIObjectLock - OCI lock a persistent object + OCIObjectLockNoWait - OCI lock a persistent object + OCIObjectMarkUpdate - OCI mark a referenceable object as updated + OCIObjectUnmark - OCI unmark a dirtied referenceable object + OCIObjectUnmarkByRef - OCI unmark a dirtied object by reference + OCIObjectFree - OCI free a standalone instance + OCIObjectMarkDelete - OCI mark a referenceable object as deleted + OCIObjectMarkDeleteByRef - OCI mark a referenceable object as deleted by + giving a reference + OCIObjectFlush - OCI flush a persistent object + OCIObjectRefresh - OCI refresh a persistent object + OCIObjectCopy - OCI CoPy one object to another + OCIObjectGetTypeRef - OCI get the Type Reference of a standalone object + OCIObjectGetObjectRef - OCI get the Object's Reference + OCIObjectGetInd - OCI get Null Structure of an standalone object + OCIObjectExists - OCI get the existence of a referenceable object + OCIObjectGetProperty - get object property + OCIObjectIsLocked - OCI get the lock status of a referenceable object + OCIObjectIsDirty - OCI get the dirty status of a referenceable object + OCIObjectPinTable - OCI get Table object + OCIObjectArrayPin - OCI pin array of objects + OCIObjectGetPrimayKeyTypeRef - OCI get the Ref for the primary key OID's + type + OCIObjectMakeObjectRef - OCI Create a pk or sys generated REF + + OCIObjectGetNewOID - OCI Create a new Object ID + + OCICacheFlush - OCI flsuh the modified persistent objects in the cache + OCICacheRefresh - OCI refresh persistent objects in the cache + OCICacheUnpin - OCI unpin referenceable objects in the cache + OCICacheFree - OCI free all instances in the environment + OCICacheUnmark - OCI unmark all dirty referenceable objects in the cache + + PRIVATE FUNCTIONS + None + + EXAMPLES + + The following types will be used in the examples in this section: + + OBJECT TYPE professor + ( + varchar2 name; + number department; + number num_of_students; + ); + + OBJECT TYPE course + ( + varchar2 name; + number grade; + ); + + OBJECT TYPE student + ( + vstring name; + number department; + ref advisor; /o advisor is a professor o/ + collection courses; + ); + + EXAMPLE 1 + + Here is a set of examples to illustrate the usages of some of the + orio and oric functions. + + OCIenv *env; /o OCI environment handle o/ + OCIError *err; /o OCI error handle o/ + OCISvcCtx *svc; /o OCI service handle o/ + + void *stu_tbl; /o pointer to the student table o/ + OCIType *stu_tdo; /o student type tdo o/ + + OCIRef *stu2_ref; /o object reference to student object o/ + student *stu1; /o pointer to the student object o/ + student *stu2; /o pointer to the student object o/ + professor *pro; /o pointer to the professor object o/ + + /o Initialize the OCI environment handle, error handle and service + handle and login to the database o/ + ... + + /o CREATE A PERSISTENT OBJECT o/ + + /o get the table object of student o/ + if (OCIObjectPinTable(env, err, svc, "ORACLEU", sizeof("ORACLEU"), + "STUDENT_TABLE", sizeof("STUDENT_TABLE"), (OCIRef *)0, + OCI_DURATION_NULL, &stu_tbl) != OCI_SUCCESS) + /o error handling code o/ + + /o get type object of student o/ + if (OCITypeByName(env, err, svc, "ORACLEU", sizeof("ORACLEU"), + "STUDENT", sizeof("STUDENT"), OCI_DURATION_NULL, OCI_TYPEGET_HEADER, + &stu_tdo) != OCI_SUCCESS) + /o error handling code o/ + + /o create a persistent object 'mark' (of type student) o/ + if (OCIObjectNew(env, err, svc, OCI_TYPECODE_ADT, stu_tdo, stu_tbl, + OCI_DURATION_TRANS, (ub1)FALSE, (void **)&stu1) != OCI_SUCCESS) + /o error handling code o/ + + /o RETRIEVE OBJECTS IN PERSISTENT STORES o/ + + /o Use OCI to retrieve a reference to student object 'joe'. + o The retrieved reference is bound to the variable stu2_ref. + o/ + + /o pin/retrieve the student "joe" by reference o/ + if (OCIObjectPin(env, err, &stu2_ref, (OCIComplexObject *)0, OCI_PIN_ANY, + OCI_DURATION_TRANS, OCI_LOCK_X, &stu2) != OCI_SUCCESS) + /o error handling code o/ + + /o pin/retrieve the advisor of student "joe" by reference o/ + if (OCIObjectPin(env, err, &stu2->advisor, (OCIComplexObject *)0, + OCI_PIN_ANY, OCI_DURATION_TRANS, OCI_LOCK_X, &pro) != OCI_SUCCESS) + /o error handling code o/ + + /o MODIFY OBJECTS o/ + + /o initialize the newly created object "mark" o/ + DISCARD OCIStringAssignText(env, err, "mark", sizeof("mark"), + &stu1->name); + department = 522; + DISCARD OCINumberFromInt(err, &department, sizeof(department), + OCI_NUMBER_UNSIGNED, &stu1->department); + + /o assign advisor to student "mark" o/ + DISCARD OCIRefAssign(env, err, &stu2->advisor, &stu1->advisor); + + /o update student "joe". o/ + department = 533; + DISCARD OCINumberFromInt(err, &department, sizeof(department), + OCI_NUMBER_UNSIGNED, &stu2->department); + DISCARD OCIObjectMarkUpdate(env, err, stu2); + + /o UNPIN OBJECTS AFTER FINSIHED PROCESSING THEM o/ + + /o unpin the student object "mark" o/ + if (OCIObjectUnpin(env, err, stu1) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the student object "joe" o/ + if (OCIObjectUnpin(env, err, stu2) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the professor object o/ + if (OCIObjectUnpin(env, err, pro) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the type object o/ + if (OCIObjectUnpin(env, err, stu_tdo) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the table object o/ + if (OCIObjectUnpin(env, err, stu_tbl) != OCI_SUCCESS) + /o error handling code o/ + + /o FLUSH MODIFIED OBJECTS BACK TO PERSISTENT STORE o/ + + if (OCICacheFlush(env, err, svc, (void *)0, ((OCIRef*)(*)())0, + (OCIRef *)0) != OCI_SUCCESS) + /o error handling code o/ + + /o commit transaction o/ + + END OF EXAMPLE 1 + + NOTES + This file has been subsetted to contain only the routines that will + be in the first release. + + MODIFIED + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + aahluwal 06/03/02 - bug 2360115 + bpalaval 02/09/01 - Change text to oratext. + rkasamse 06/21/00 - add ociobjectgetnewoid + rkasamse 05/24/00 - add OCIObjectSetData + whe 09/01/99 - 976457:check __cplusplus for C++ code + smuralid 10/29/98 - add comments for OCIObjectMakeObjectRef + mkrishna 08/19/98 - change OCIGetPkTypeRef to OCIObjectGetPrimaryKeyTypeR + mkrishna 08/10/98 - add OCIObjectMakeObjectRef & OCIObjectGetPkTypeRef + rkasamse 06/22/98 - add comments for OCIDurationBegin(End) + pmitra 04/01/98 - OCIObjectLockNoWait added + pmitra 11/05/97 - [573769] OCIObjectArrayPin pos parameter cannot be NU + cxcheng 07/29/97 - fix compile for short names + skrishna 07/14/97 - add OCIObjectGetProperty + skrishna 04/30/97 - OCIObjectFlushRefresh: remove duplicate declaration + skrishna 04/24/97 - flag unsupported functions + sthakur 03/20/97 - modify flag argument to OCIObjectFree + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/19/97 - remove short names support + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + sthakur 12/20/96 - fix a typepo in OCIOBjectArrayPin + jboonleu 11/07/96 - modify comments + cxcheng 10/28/96 - more beautification changes + jboonleu 10/24/96 - add flag to OCIObjectFree + jboonleu 10/22/96 - change interface of OCICacheFlush + cxcheng 10/18/96 - rename OCIObjectPinArray to OCIObjectArrayPin + cxcheng 10/14/96 - more renaming of types + jboonleu 10/09/96 - add new interfaces + cxcheng 10/09/96 - more lint fixes + cxcheng 10/08/96 - more lint fixes + jboonleu 09/27/96 - fix lint errors + jboonleu 10/07/96 - beautify ori.h after conversion to long names + cxcheng 10/04/96 - replace short names with long names + sthakur 08/20/96 - add COR context to OCIObjectPin + mluong 07/17/96 - add back orioglk, oriogdr, oriogiv, and oriocur. + jboonleu 07/17/96 - rename refresh option to conherency option + jboonleu 07/16/96 - change comment for cache consistency + jwijaya 07/03/96 - add ANSI prototypes + jboonleu 06/12/96 - update comment + jboonleu 05/08/96 - change description of OCIDurationGetParent + jboonleu 05/01/96 - add OROOCOSFN + skrishna 04/08/96 - change ori*() to take OCIEnv* and OCIError* instead + of oroenv* + jboonleu 01/04/96 - interface change + jboonleu 10/24/95 - support of variable ref + jboonleu 02/15/95 - new interface + sthakur 01/05/95 - pass username to origrgc + skotsovo 12/07/94 - update example + jwijaya 11/15/94 - rename ORONSPTAB to ORONSPEXT + jwijaya 10/06/94 - add namespace to oriopnm() + jwijaya 10/02/94 - connection handle -> connection number + jboonleu 08/16/94 - fix lint errors + jboonleu 07/20/94 - change interface of OCICacheFlush + tanguyen 07/18/94 - add oriocpe, change OCIObjectCopy to oriocps + tcheng 07/15/94 - add init param maximum_sga_heap_size + tcheng 07/13/94 - change origini to get param string + jboonleu 07/05/94 - change sccs string from sccid to a comment + jboonleu 07/01/94 - Add examples to ORIO* and ORIC* functions + tanguyen 06/30/94 - Fix the ORI_ORACLE ifdef + skotsovo 06/27/94 - include all public functions in public functions + list at top of header file + tcheng 06/27/94 - modify comments according to new template + tanguyen 06/24/94 - fix comments for OCIObjectCopy + tcheng 06/24/94 - fix comments in origrgc() + tanguyen 06/21/94 - fix comments and format + tcheng 06/20/94 - commenting origini/trm/err/rgc/urg() functions + tanguyen 06/16/94 - fix descriptions of ref operations + tanguyen 06/16/94 - clarifies refs comparison + tanguyen 05/12/94 - adds more interfaces (OCIObjectMarkUpdate) + jwijaya 05/10/94 - fix examples, add origurg, change origcon to origrgc + tanguyen 05/03/94 - remove unnecessary 'type' argument from + 'OCIObjectCopy' + tanguyen 03/08/94 - clarifies comments + jwijaya 02/16/94 - more questions + jwijaya 02/11/94 - more comments + jwijaya 02/10/94 - identify optional arguments + jwijaya 02/07/94 - Creation +*/ + + +#ifndef ORATYPES +#include +#endif +#ifndef ORO_ORACLE +#include +#endif +#ifndef OCI_ORACLE +#include +#endif +#ifndef ORT_ORACLE +#include +#endif + +#ifndef ORI_ORACLE +#define ORI_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCIDurationBegin origbgu +#define OCIDurationEnd origedu +#define OCIDurationGetParent origpdr +#define OCICacheFlushRefresh oricfrh +#define OCICacheUnpin oricunp +#define OCICacheFree oricfre +#define OCICacheUnmark oricumk +#define OCICacheGetObjects oricgpr +#define OCICacheRegister oricscb +#define OCIObjectUnpin oriounp +#define OCIObjectPinCountReset orioupz +#define OCIObjectLock oriolck +#define OCIObjectLockNoWait oriolnw +#define OCIObjectMarkUpdate orioupd +#define OCIObjectUnmark orioumk +#define OCIObjectUnmarkByRef orioumr +#define OCIObjectAlwaysLatest oriomkl +#define OCIObjectNotAlwaysLatest oriouml +#define OCIObjectMarkDeleteByRef oriordl +#define OCIObjectMarkDelete oriopdl +#define OCIObjectFlush oriofls +#define OCIObjectFlushRefresh oriofrh +#define OCIObjectCopy oriocpy +#define OCIObjectGetTypeRef oriogtr +#define OCIObjectGetObjectRef oriogor +#define OCIObjectGetInd oriogns +#define OCIObjectExists oriogex +#define OCIObjectGetProperty oriogpr +#define OCIObjectRefresh oriorfs +#define OCIObjectPinTable oriogtb +#define OCIObjectGetPrimaryKeyTypeRef oriogpf +#define OCIObjectMakeObjectRef oriomrf + +#define OCIObjectNew orionew +#define OCIObjectPin oriopin +#define OCIObjectFree oriofre +#define OCIObjectArrayPin orioapn +#define OCIObjectIsDirty oriodrt +#define OCIObjectIsDirtied oriodrd +#define OCIObjectIsLoaded orioldd +#define OCICacheFlush oricfls +#define OCICacheRefresh oricrfs + +#endif /* SLSHORTNAME */ + +/*---------------------------------------------------------------------------*/ +/* PUBLIC TYPES AND CONSTANTS */ +/*---------------------------------------------------------------------------*/ + +/* Also see oro.h. */ + +/*---------------------------------------------------------------------------*/ +/* PUBLIC FUNCTIONS */ +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +/* OBJECT/INSTANCE OPERATIONS */ +/*---------------------------------------------------------------------------*/ + +/*--------------------------- OCIObjectNew ----------------------------------*/ +sword OCIObjectNew( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCITypeCode typecode, OCIType *tdo, void *table, + OCIDuration duration, boolean value, + void **instance ); +/* + NAME: OCIObjectNew - OCI new (create) a standalone instance + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN) - OCI service handle. + typecode (IN) - the typecode of the type of the instance. + tdo (IN, optional) - pointer to the type descriptor object. The + TDO describes the type of the instance that is to be + created. Refer to OCITypeByName() for obtaining a TDO. + The TDO is required for creating a named type (e.g. an + object or a collection). + table (IN, optional) - pointer to a table object which specifies a + table in the server. This parameter can be set to NULL + if no table is given. See the description below to find + out how the table object and the TDO are used together + to determine the kind of instances (persistent, + transient, value) to be created. Also see + OCIObjectPinTable() for retrieving a table object. + duration (IN) - this is an overloaded parameter. The use of this + parameter is based on the kind of the instance that is + to be created. + a) persistent object. This parameter specifies the + pin duration. + b) transient object. This parameter specififes the + allocation duration and pin duration. + c) value. This parameter specifies the allocation + duration. + value (IN) - specifies whether the created object is a value. + If TRUE, then a value is created. Otherwise, a + referenceable object is created. If the instance is + not an object, then this parameter is ignored. + instance (OUT) - address of the newly created instance + + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function creates a new instance of the type specified by the + typecode or the TDO. Based on the parameters 'typecode' (or 'tdo'), + 'value' and 'table', different kinds of instances can be created: + + The parameter 'table' is not NULL? + + yes no + ---------------------------------------------------------------- + | object type (value=TRUE) | value | value | + ---------------------------------------------------------------- + | object type (value=FALSE) | persistent obj | transient obj | + type ---------------------------------------------------------------- + | built-in type | value | value | + ---------------------------------------------------------------- + | collection type | value | value | + ---------------------------------------------------------------- + + This function allocates the top level memory chunk of an OTS instance. + The attributes in the top level memory are initialized (e.g. an + attribute of varchar2 is initialized to a vstring of 0 length). + + If the instance is an object, the object is marked existed but is + atomically null. + + FOR PERSISTENT OBJECTS: + The object is marked dirty and existed. The allocation duration for + the object is session. The object is pinned and the pin duration is + specified by the given parameter 'duration'. + + FOR TRANSIENT OBJECTS: + The object is pinned. The allocation duration and the pin duration are + specified by the given parameter 'duration'. + + FOR VALUES: + The allocation duration is specified by the given parameter 'duration'. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectPin ----------------------------------*/ +sword OCIObjectPin( OCIEnv *env, OCIError *err, OCIRef *object_ref, + OCIComplexObject *corhdl, OCIPinOpt pin_option, + OCIDuration pin_duration, + OCILockOpt lock_option, void **object ); +/* + NAME: OCIObjectPin - OCI pin a referenceable object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object_ref (IN) - the reference to the object. + corhdl (IN) - handle for complex object retrieval. + pin_option (IN) - See description below. + pin_duration (IN) - The duration of which the object is being accesed + by a client. The object is implicitly unpinned at + the end of the pin duration. + If OCI_DURATION_NULL is passed, there is no pin + promotion if the object is already loaded into + the cache. If the object is not yet loaded, then + the pin duration is set to OCI_DURATION_DEFAULT. + lock_option (IN) - lock option (e.g., exclusive). If a lock option + is specified, the object is locked in the server. + See 'oro.h' for description about lock option. + object (OUT) - the pointer to the pinned object. + + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + + This function pins a referenceable object instance given the object + reference. The process of pinning serves three purposes: + + 1) locate an object given its reference. This is done by the object + cache which keeps track of the objects in the object heap. + + 2) notify the object cache that an object is being in use. An object + can be pinned many times. A pinned object will remain in memory + until it is completely unpinned (see OCIObjectUnpin()). + + 3) notify the object cache that a persistent object is being in use + such that the persistent object cannot be aged out. Since a + persistent object can be loaded from the server whenever is needed, + the memory utilization can be increased if a completely unpinned + persistent object can be freed (aged out), even before the + allocation duration is expired. + + Also see OCIObjectUnpin() for more information about unpinning. + + FOR PERSISTENT OBJECTS: + + When pinning a persistent object, if it is not in the cache, the object + will be fetched from the persistent store. The allocation duration of + the object is session. If the object is already in the cache, it is + returned to the client. The object will be locked in the server if a + lock option is specified. + + This function will return an error for a non-existent object. + + A pin option is used to specify the copy of the object that is to be + retrieved: + + 1) If option is OCI_PIN_ANY (pin any), if the object is already + in the environment heap, return this object. Otherwise, the object + is retrieved from the database. This option is useful when the + client knows that he has the exclusive access to the data in a + session. + + 2) If option is OCI_PIN_LATEST (pin latest), if the object is + not cached, it is retrieved from the database. If the object is + cached, it is refreshed with the latest version. See + OCIObjectRefresh() for more information about refreshing. + + 3) If option is OCI_PIN_RECENT (pin recent), if the object is loaded + into the cache in the current transaction, the object is returned. + If the object is not loaded in the current transaction, the object + is refreshed from the server. + + FOR TRANSIENT OBJECTS: + + This function will return an error if the transient object has already + been freed. This function does not return an error if an exclusive + lock is specified in the lock option. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------------ OCIObjectUnpin -----------------------------*/ +sword OCIObjectUnpin( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectUnpin - OCI unpin a referenceable object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to an object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function unpins an object. An object is completely unpinned when + 1) the object was unpinned N times after it has been pinned N times + (by calling OCIObjectPin()). + 2) it is the end of the pin duration + 3) the function OCIObjectPinCountReset() is called + + There is a pin count associated with each object which is incremented + whenever an object is pinned. When the pin count of the object is zero, + the object is said to be completely unpinned. An unpinned object can + be freed without error. + + FOR PERSISTENT OBJECTS: + When a persistent object is completely unpinned, it becomes a candidate + for aging. The memory of an object is freed when it is aged out. Aging + is used to maximize the utilization of memory. An dirty object cannot + be aged out unless it is flushed. + + FOR TRANSIENT OBJECTS: + The pin count of the object is decremented. A transient can be freed + only at the end of its allocation duration or when it is explicitly + deleted by calling OCIObjectFree(). + + FOR VALUE: + This function will return an error for value. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectPinCountReset -----------------------*/ +sword OCIObjectPinCountReset( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectPinCountReset - OCI resets the pin count of a referenceable + object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to an object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function completely unpins an object. When an object is + completely unpinned, it can be freed without error. + + FOR PERSISTENT OBJECTS: + When a persistent object is completely unpinned, it becomes a candidate + for aging. The memory of an object is freed when it is aged out. Aging + is used to maximize the utilization of memory. An dirty object cannot + be aged out unless it is flushed. + + FOR TRANSIENT OBJECTS: + The pin count of the object is decremented. A transient can be freed + only at the end of its allocation duration or when it is explicitly + freed by calling OCIObjectFree(). + + FOR VALUE: + This function will return an error for value. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectLock ---------------------------------*/ +sword OCIObjectLock( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectLock - OCI lock a persistent object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function locks a persistent object at the server. Unlike + OCIObjectLockNoWait() this function waits if another user currently + holds a lock on the desired object. This function + returns an error if: + 1) the object is non-existent. + + This function will return an error for transient objects and values. + The lock of an object is released at the end of a transaction. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*------------------------ OCIObjectLockNoWait ------------------------------*/ +sword OCIObjectLockNoWait( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectLockNoWait - OCI lock a persistent object, do not wait for + the lock, return error if lock not available + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function locks a persistent object at the server. Unlike + OCIObjectLock() this function will not wait if another user holds + the lock on the desired object. This function returns an error if: + 1) the object is non-existent. + 2) the object is currently locked by another user in which + case this function returns with an error. + + This function will return an error for transient objects and values. + The lock of an object is released at the end of a transaction. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*--------------------------- OCIObjectMarkUpdate ---------------------------*/ +sword OCIObjectMarkUpdate( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectMarkUpdate - OCI marks an object as updated + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + FOR PERSISTENT OBJECTS: + This function marks the specified persistent object as updated. The + persistent objects will be written to the server when the object cache + is flushed. The object is not locked or flushed by this function. It + is an error to update a deleted object. + + After an object is marked updated and flushed, this function must be + called again to mark the object as updated if it has been dirtied + after it is being flushed. + + FOR TRANSIENT OBJECTS: + This function marks the specified transient object as updated. The + transient objects will NOT be written to the server. It is an error + to update a deleted object. + + FOR VALUES: + It is an no-op for values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*----------------------------- OCIObjectUnmark -----------------------------*/ +sword OCIObjectUnmark( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectUnmark - OCI unmarks an object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + FOR PERSISTENT OBJECTS AND TRANSIENT OBJECTS: + This function unmarks the specified persistent object as dirty. Changes + that are made to the object will not be written to the server. If the + object is marked locked, it remains marked locked. The changes that + have already made to the object will not be undone implicitly. + + FOR VALUES: + It is an no-op for values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*----------------------------- OCIObjectUnmarkByRef ------------------------*/ +sword OCIObjectUnmarkByRef( OCIEnv *env, OCIError *err, OCIRef *ref ); +/* + NAME: OCIObjectUnmarkByRef - OCI unmarks an object by Ref + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + ref (IN) - reference of the object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + FOR PERSISTENT OBJECTS AND TRANSIENT OBJECTS: + This function unmarks the specified persistent object as dirty. Changes + that are made to the object will not be written to the server. If the + object is marked locked, it remains marked locked. The changes that + have already made to the object will not be undone implicitly. + + FOR VALUES: + It is an no-op for values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectFree ---------------------------------*/ +sword OCIObjectFree( OCIEnv *env, OCIError *err, void *instance, + ub2 flags ); +/* + NAME: OCIObjectFree - OCI free (and unpin) an standalone instance + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to a standalone instance. + flags (IN) - If OCI_OBJECT_FREE_FORCE is set, free the object + even if it is pinned or dirty. + If OCI_OBJECT_FREE_NONULL is set, the null + structure will not be freed. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance to be freed must be standalone. + - If the instance is a referenceable object, the object must be pinned. + DESCRIPTION: + This function deallocates all the memory allocated for an OTS instance, + including the null structure. + + FOR PERSISTENT OBJECTS: + This function will return an error if the client is attempting to free + a dirty persistent object that has not been flushed. The client should + either flush the persistent object or set the parameter 'flag' to + OCI_OBJECT_FREE_FORCE. + + This function will call OCIObjectUnpin() once to check if the object + can be completely unpin. If it succeeds, the rest of the function will + proceed to free the object. If it fails, then an error is returned + unless the parameter 'flag' is set to OCI_OBJECT_FREE_FORCE. + + Freeing a persistent object in memory will not change the persistent + state of that object at the server. For example, the object will + remain locked after the object is freed. + + FOR TRANSIENT OBJECTS: + + This function will call OCIObjectUnpin() once to check if the object + can be completely unpin. If it succeeds, the rest of the function will + proceed to free the object. If it fails, then an error is returned + unless the parameter 'flag' is set to OCI_OBJECT_FREE_FORCE. + + FOR VALUES: + The memory of the object is freed immediately. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*----------------------- OCIObjectMarkDeleteByRef --------------------------*/ +sword OCIObjectMarkDeleteByRef( OCIEnv *env, OCIError *err, + OCIRef *object_ref); +/* + NAME: OCIObjectMarkDeleteByRef - OCI "delete" (and unpin) an object given + a reference + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object_ref (IN) - ref of the object to be deleted + + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function marks the object designated by 'object_ref' as deleted. + + FOR PERSISTENT OBJECTS: + If the object is not loaded, then a temporary object is created and is + marked deleted. Otherwise, the object is marked deleted. + + The object is deleted in the server when the object is flushed. + + FOR TRANSIENT OBJECTS: + The object is marked deleted. The object is not freed until it is + unpinned. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectMarkDelete ---------------------------*/ +sword OCIObjectMarkDelete( OCIEnv *env, OCIError *err, void *instance ); +/* + NAME: OCIObjectMarkDelete - OCI "delete" an instance given a Pointer + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to the instance + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - If the instance is a referenceable object, then it must be pinned. + DESCRIPTION: + + FOR PERSISTENT OBJECTS: + The object is marked deleted. The memory of the object is not freed. + The object is deleted in the server when the object is flushed. + + FOR TRANSIENT OBJECTS: + The object is marked deleted. The memory of the object is not freed. + + FOR VALUES: + This function frees a value immediately. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectFlush -------------------------------*/ +sword OCIObjectFlush( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectFlush - OCI flush a persistent object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function flushes a modified persistent object to the server. + An exclusive lock is obtained implicitly for the object when flushed. + + When the object is written to the server, triggers may be fired. + Objects can be modified by the triggers at the server. To keep the + objects in the object cache being coherent with the database, the + clients can free or refresh the objects in the cache. + + This function will return an error for transient objects and values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------ OCIObjectRefresh ---------------------------------*/ +sword OCIObjectRefresh( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectRefresh - OCI refresh a persistent object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function refreshes an unmarked object with data retrieved from the + latest snapshot in the server. An object should be refreshed when the + objects in the cache are inconsistent with the objects at + the server: + 1) When an object is flushed to the server, triggers can be fired to + modify more objects in the server. The same objects (modified by + the triggers) in the object cache become obsolete. + 2) When the user issues a SQL or executes a PL/SQL procedure to modify + any object in the server, the same object in the cache becomes + obsolete. + + The object that is refreshed will be 'replaced-in-place'. When an + object is 'replaced-in-place', the top level memory of the object will + be reused so that new data can be loaded into the same memory address. + The top level memory of the null structre is also reused. Unlike the + top level memory chunk, the secondary memory chunks may be resized and + reallocated. The client should be careful when holding onto a pointer + to the secondary memory chunk (e.g. assigning the address of a + secondary memory to a local variable), since this pointer can become + invalid after the object is refreshed. + + The object state will be modified as followed after being refreshed: + - existent : set to appropriate value + - pinned : unchanged + - allocation duration : unchanged + - pin duration : unchanged + + This function is an no-op for transient objects or values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectCopy --------------------------------*/ +sword OCIObjectCopy( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + void *source, void *null_source, + void *target, void *null_target, OCIType *tdo, + OCIDuration duration, ub1 option ); +/* + NAME: OCIObjectCopy - OCI copy one instance to another + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - OCI service context handle + source (IN) - pointer to the source instance + null_source (IN) - pointer to the null structure of the source + target (IN) - pointer to the target instance + null_target (IN) - pointer to the null structure of the target + tdo (IN) - the TDO for both source and target + duration (IN) - allocation duration of the target memory + option (IN) - specify the copy option: + OROOCOSFN - Set Reference to Null. All references + in the source will not be copied to the target. The + references in the target are set to null. + REQUIRES: + - a valid OCI environment handle must be given. + - If source or target is referenceable, it must be pinned. + - The target or the containing instance of the target must be already + be instantiated (e.g. created by OCIObjectNew()). + - The source and target instances must be of the same type. If the + source and target are located in a different databases, then the + same type must exist in both databases. + DESCRIPTION: + This function copies the contents of the 'source' instance to the + 'target' instance. This function performs a deep-copy such that the + data that is copied/duplicated include: + a) all the top level attributes (see the exceptions below) + b) all the secondary memory (of the source) that is reachable from the + top level attributes. + c) the null structure of the instance + + Memory is allocated with the specified allocation duration. + + Certain data items are not copied: + a) If the option OCI_OBJECTCOPY_NOREF is specified, then all references + in the source are not copied. Instead, the references in the target + are set to null. + b) If the attribute is a LOB, then it is set to null. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectGetTypeRef --------------------------*/ +sword OCIObjectGetTypeRef( OCIEnv *env, OCIError *err, void *instance, + OCIRef *type_ref ); +/* + NAME: OCIObjectGetTypeRef - get the type reference of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to an standalone instance + type_ref (OUT) - reference to the type of the object. The reference + must already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - If the object is referenceable, the specified object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function returns a reference to the TDO of a standalone instance. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectGetObjectRef -------------------------*/ +sword OCIObjectGetObjectRef( OCIEnv *env, OCIError *err, void *object, + OCIRef *object_ref ); +/* + NAME: OCIObjectGetObjectRef - OCI get the object reference of an + referenceable object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object (IN) - pointer to a persistent object + object_ref (OUT) - reference of the given object. The reference must + already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function returns a reference to the given object. It returns an + error for values. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectMakeObjectRef -----------------------*/ +sword OCIObjectMakeObjectRef( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, void * table, + void **values, ub4 array_len, + OCIRef *object_ref ); +/* + NAME: OCIObjectMakeObjectRef - OCI Create an object reference to a + referenceable object. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - the service context + table (IN) - A pointer to the table object (must be pinned) + attrlist (IN) - A list of values (OCI type values) from which + the ref is to be created. + attrcnt (IN) - The length of the attrlist array. + object_ref (OUT) - reference of the given object. The reference must + already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The specified table object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function creates a reference given the values that make up the + reference and also a pointer to the table object. + Based on the table's OID property, whether it is a pk based OID or + a system generated OID, the function creates a sys-generated REF or + a pk based REF. + In case of system generated REFs pass in a OCIRaw which is 16 bytes + long contatining the sys generated OID. + In case of PK refs pass in the OCI equivalent for numbers, chars etc.. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectGetPrimaryKeyTypeRef --------------- */ +sword OCIObjectGetPrimaryKeyTypeRef( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, void *table, + OCIRef *type_ref ); +/* + NAME: OCIObjectGetPrimaryKeyTypeRef - OCI get the REF to the pk OID type + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - the service context + table (IN) - pointer to the table object + type_ref (OUT) - reference of the pk type. The reference must + already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The specified table object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function returns a reference to the pk type. It returns an + error for values. If the table is not a Pk oid table/view, then + it returns error. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*-------------------------- OCIObjectGetInd --------------------------------*/ +sword OCIObjectGetInd( OCIEnv *env, OCIError *err, void *instance, + void **null_struct ); +/* + NAME: OCIObjectGetInd - OCI get the null structure of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to the instance + null_struct (OUT) - null structure + REQUIRES: + - a valid OCI environment handle must be given. + - The object must be standalone. + - If the object is referenceable, the specified object must be pinned. + DESCRIPTION: + This function returns the null structure of an instance. This function + will allocate the top level memory of the null structure if it is not + already allocated. If an null structure cannot be allocated for the + instance, then an error is returned. This function only works for + ADT or row type instance. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectExists --------------------------------*/ +sword OCIObjectExists(OCIEnv *env, OCIError *err, void *ins, boolean *exist); +/* + NAME: OCIObjectExist - OCI checks if the object exists + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ins (IN) - pointer to an instance + exist (OUT) - return TRUE if the object exists + REQUIRES: + - a valid OCI environment handle must be given. + - The object must be standalone. + - if object is a referenceable, it must be pinned. + DESCRIPTION: + This function returns the existence of an instance. If the instance + is a value, this function always returns TRUE. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectGetProperty ---------------------------*/ +sword OCIObjectGetProperty(OCIEnv *envh, OCIError *errh, const void *obj, + OCIObjectPropId propertyId, + void *property, ub4 *size ); +/* + NAME: OCIObjectGetProperty - OCIObject Get Property of given object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + obj (IN) - object whose property is returned + propertyId (IN) - id which identifies the desired property + property (OUT) - buffer into which the desired property is + copied + size (IN/OUT) - on input specifies the size of the property buffer + passed by caller, on output will contain the + size in bytes of the property returned. + This parameter is required for string type + properties only (e.g OCI_OBJECTPROP_SCHEMA, + OCI_OBJECTPROP_TABLE). For non-string + properties this parameter is ignored since + the size is fixed. + DESCRIPTION: + This function returns the specified property of the object. + The desired property is identified by 'propertyId'. The property + value is copied into 'property' and for string typed properties + the string size is returned via 'size'. + + Objects are classified as persistent, transient and value + depending upon the lifetime and referenceability of the object. + Some of the properties are applicable only to persistent + objects and some others only apply to persistent and + transient objects. An error is returned if the user tries to + get a property which in not applicable to the given object. + To avoid such an error, the user should first check whether + the object is persistent or transient or value + (OCI_OBJECTPROP_LIFETIME property) and then appropriately + query for other properties. + + The different property ids and the corresponding type of + 'property' argument is given below. + + OCI_OBJECTPROP_LIFETIME + This identifies whether the given object is a persistent + object (OCI_OBJECT_PERSISTENT) or a + transient object (OCI_OBJECT_TRANSIENT) or a + value instance (OCI_OBJECT_VALUE). + 'property' argument must be a pointer to a variable of + type OCIObjectLifetime. + + OCI_OBJECTPROP_SCHEMA + This returns the schema name of the table in which the + object exists. An error is returned if the given object + points to a transient instance or a value. If the input + buffer is not big enough to hold the schema name an error + is returned, the error message will communicate the + required size. Upon success, the size of the returned + schema name in bytes is returned via 'size'. + 'property' argument must be an array of type text and 'size' + should be set to size of array in bytes by the caller. + + OCI_OBJECTPROP_TABLE + This returns the table name in which the object exists. An + error is returned if the given object points to a + transient instance or a value. If the input buffer is not + big enough to hold the table name an error is returned, + the error message will communicate the required size. Upon + success, the size of the returned table name in bytes is + returned via 'size'. 'property' argument must be an array + of type text and 'size' should be set to size of array in + bytes by the caller. + + OCI_OBJECTPROP_PIN_DURATION + This returns the pin duration of the object. + An error is returned if the given object points to a value + instance. Valid pin durations are: OCI_DURATION_SESSION and + OCI_DURATION_TRANS. + 'property' argument must be a pointer to a variable of type + OCIDuration. + + OCI_OBJECTPROP_ALLOC_DURATION + This returns the allocation duration of the object. + Valid allocation durations are: OCI_DURATION_SESSION and + OCI_DURATION_TRANS. + 'property' argument must be a pointer to a variable of type + OCIDuration. + + OCI_OBJECTPROP_LOCK + This returns the lock status of the + object. The possible lock status is enumerated by OCILockOpt. + An error is returned if the given object points to a transient + or value instance. + 'property' argument must be a pointer to a variable of + type OCILockOpt. + Note, the lock status of an object can also be retrieved by + calling OCIObjectIsLocked(). + + OCI_OBJECTPROP_MARKSTATUS + This returns the status flag which indicates whether the + object is a new object, updated object and/or deleted object. + The following macros can be used to test the mark status + flag: + + OCI_OBJECT_IS_UPDATED(flag) + OCI_OBJECT_IS_DELETED(flag) + OCI_OBJECT_IS_NEW(flag) + OCI_OBJECT_IS_DIRTY(flag) + + An object is dirty if it is a new object or marked deleted or + marked updated. + An error is returned if the given object points to a transient + or value instance. 'property' argument must be of type + OCIObjectMarkStatus. + + OCI_OBJECTPROP_VIEW + This identifies whether the specified object is a view object + or not. If property value returned is TRUE, it indicates the + object is a view otherwise it is not. + 'property' argument must be of type boolean. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. Possible errors are TBD + */ + +/*---------------------------- OCIObjectIsLocked --------------------------*/ +sword OCIObjectIsLocked( OCIEnv *env, OCIError *err, void *ins, + boolean *lock); +/* + NAME: OCIObjectIsLocked - OCI get the lock status of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ins (IN) - pointer to an instance + lock (OUT) - return value for the lock status. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - If the object is referenceable, the specified object must be pinned. + DESCRIPTION: + This function returns the lock status of an instance. If the instance + is a value, this function always returns FALSE. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectIsDirty ------------------------------*/ +sword OCIObjectIsDirty( OCIEnv *env, OCIError *err, void *ins, + boolean *dirty); +/* + NAME: OCIObjectIsDirty - OCI get the dirty status of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ins (IN) - pointer to an instance + dirty (OUT) - return value for the dirty status. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - if instance is an object, the instance must be pinned. + DESCRIPTION: + This function returns the dirty status of an instance. If the instance + is a value, this function always returns FALSE. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectPinTable -----------------------------*/ +sword OCIObjectPinTable( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + const oratext *schema_name, + ub4 s_n_length, const oratext *object_name, ub4 o_n_length, + const OCIRef *scope_obj_ref, OCIDuration pin_duration, + void ** object ); +/* + NAME: OCIObjectPinTable - OCI get table object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - OCI service context handle + schema_name (IN, optional) - schema name of the table + s_n_length (IN, optional) - length of the schema name + object_name (IN) - name of the table + o_n_length (IN) - length of the table name + scope_obj_ref (IN, optional) - reference of the scoping object + pin_duration (IN) - pin duration. See description in OCIObjectPin(). + object (OUT) - the pinned table object + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function pin a table object with the specified pin duration. + The client can unpin the object by calling OCIObjectUnpin(). See + OCIObjectPin() and OCIObjectUnpin() for more information about pinning + and unpinning. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectArrayPin -------------------------------*/ +sword OCIObjectArrayPin(OCIEnv *env, OCIError *err, OCIRef **ref_array, + ub4 array_size, OCIComplexObject **cor_array, + ub4 cor_array_size, OCIPinOpt pin_option, + OCIDuration pin_duration, OCILockOpt lock, + void **obj_array, ub4 *pos ); +/* + NAME: OCIObjectArrayPin - ORIO array pin + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ref_array (IN) - array of references to be pinned + array_size (IN) - number of elements in the array of references + pin_option (IN) - pin option. See OCIObjectPin(). + pin_duration (IN) - pin duration. See OCIObjectPin(). + lock_option (IN) - lock option. See OCIObjectPin(). + obj_array (OUT) - If this argument is not NULL, the pinned objects + will be returned in the array. The user must + allocate this array with element type being + 'void *'. The size of this array is identical to + 'array'. + pos (OUT) - If there is an error, this argument will contain + the element that is causing the error. Note that + this argument is set to 1 for the first element in + the ref_array. + REQUIRE: + - a valid OCI environment handle must be given. + - If 'obj_array' is not NULL, then it must already be allocated and + the size of 'obj_array' is 'array_size'. + DESCRIPTION: + This function pin an array of references. All the pinned objects are + retrieved from the database in one network roundtrip. If the user + specifies an output array ('obj_array'), then the address of the + pinned objects will be assigned to the elements in the array. See + OCIObjectPin() for more information about pinning. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------------------------------------------------------*/ +/* HEAP/CACHE OPERATIONS */ +/*---------------------------------------------------------------------------*/ + +/*--------------------------- OCICacheFlush ---------------------------------*/ +sword OCICacheFlush( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + void *context, OCIRef *(*get)(void *context, ub1 *last), + OCIRef **ref ); +/* + NAME: OCICacheFlush - OCI flush persistent objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the dirty objects in all connections + will be flushed. + context (IN) [optional] - specifies an user context that is an + argument to the client callback function 'get'. This + parameter is set to NULL if there is no user context. + get (IN) [optional] - an client-defined function which acts an + iterator to retrieve a batch of dirty objects that need + to be flushed. If the function is not NULL, this function + will be called to get a reference of a dirty object. + This is repeated until a null reference is returned by + the client function or the parameter 'last' is set to + TRUE. The parameter 'context' is passed to get() + for each invocation of the client function. This + parameter should be NULL if user callback is not given. + If the object that is returned by the client function is + not a dirtied persistent object, the object is ignored. + All the objects that are returned from the client + function must be from newed or pinned the same service + context, otherwise, an error is signalled. Note that the + returned objects are flushed in the order in which they + are marked dirty. + ref (OUT) [optional] - if there is an error in flushing the + objects, (*ref) will point to the object that + is causing the error. If 'ref' is NULL, then the object + will not be returned. If '*ref' is NULL, then a + reference will be allocated and set to point to the + object. If '*ref' is not NULL, then the reference of + the object is copied into the given space. If the + error is not caused by any of the dirtied object, + the given ref is initalized to be a NULL reference + (OCIRefIsNull(*ref) is TRUE). + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function flushes the modified persistent objects from the + environment heap to the server. The objects are flushed in the order + that they are marked updated or deleted. + + See OCIObjectFlush() for more information about flushing. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCICacheRefresh -------------------------------*/ +sword OCICacheRefresh(OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCIRefreshOpt option, void *context, + OCIRef *(*get)(void *context), OCIRef **ref); +/* + NAME: OCICacheRefresh - OCI ReFreSh persistent objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the persistent objects in all connections + will be refreshed. + option (IN) [optional] - if OCI_REFRESH_LOAD is specified, all + objects that is loaded within the transaction are + refreshed. If the option is OCI_REFERSH_LOAD and the + parameter 'get' is not NULL, this function will ignore + the parameter. + context (IN) [optional] - specifies an user context that is an + argument to the client callback function 'get'. This + parameter is set to NULL if there is no user context. + get (IN) [optional] - an client-defined function which acts an + iterator to retrieve a batch of objects that need to be + refreshed. If the function is not NULL, this function + will be called to get a reference of an object. If + the reference is not NULL, then the object will be + refreshed. These steps are repeated until a null + reference is returned by this function. The parameter + 'context' is passed to get() for each invocation of the + client function. This parameter should be NULL if user + callback is not given. + ref (OUT) [optional] - if there is an error in refreshing the + objects, (*ref) will point to the object that + is causing the error. If 'ref' is NULL, then the object + will not be returned. If '*ref' is NULL, then a + reference will be allocated and set to point to the + object. If '*ref' is not NULL, then the reference of + the object is copied into the given space. If the + error is not caused by any of the object, + the given ref is initalized to be a NULL reference + (OCIRefIsNull(*ref) is TRUE). + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function refreshes all pinned persistent objects. All unpinned + persistent objects are freed. See OCIObjectRefresh() for more + information about refreshing. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCICacheUnpin --------------------------------*/ +sword OCICacheUnpin( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); +/* + NAME: OCICacheUnpin - OCI UNPin objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the objects in all connections + will be unpinned. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + If a connection is specified, this function completely unpins the + persistent objects in that connection. Otherwise, all persistent + objects in the heap are completely unpinned. All transient objects in + the heap are also completely unpinned. See OCIObjectUnpin() for more + information about unpinning. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*----------------------------- OCICacheFree --------------------------------*/ +sword OCICacheFree( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); +/* + NAME: OCICacheFree - OCI FREe instances + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the objects in all connections + will be freed. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + If a connection is specified, this function frees the persistent + objects, transient objects and values allocated for that connection. + Otherwise, all persistent objects, transient objects and values in the + heap are freed. Objects are freed regardless of their pin count. See + OCIObjectFree() for more information about freeing an instance. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*---------------------------- OCICacheUnmark -------------------------------*/ +sword OCICacheUnmark( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); +/* + NAME: OCICacheUnmark - OCI Unmark all dirty objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the objects in all connections + will be unmarked. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + If a connection is specified, this function unmarks all dirty objects + in that connection. Otherwise, all dirty objects in the cache are + unmarked. See OCIObjectUnmark() for more information about unmarking + an object. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + + +sword OCIDurationBegin( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCIDuration parent, OCIDuration *dur ); +/* + NAME: OCIDurationBegin - OCI DURATION BEGIN + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + This should be passed NULL, when cartridge services + are to be used. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN/OUT) - OCI service handle. + parent (IN) - parent for the duration to be started. + dur (OUT) - newly created user duration + REQUIRES: + - a valid OCI environment handle must be given for non-cartridge + services. + - For cartridge services, NULL should be given for environment handle + - A valid service handle must be given in all cases. + DESCRIPTION: + This function starts a new user duration. A user can have multiple + active user durations simultaneously. The user durations do not have + to be nested. + + The object subsystem predefines 3 durations : + 1) session - memory allocated with session duration comes from + the UGA heap (OCI_DURATION_SESSION). A session + duration terminates at the end of the user session. + 2) transaction - memory allocated with transaction duration comes + from the UGA heap (OCI_DURATION_TRANS). A trans- + action duration terminates at the end of the user + transaction. + 3) call - memory allocated with call duration comes from PGA + heap (OCI_DURATION_CALL). A call duration terminates + at the end of the user call. + + Each user duration has a parent duration. A parent duration can be a + predefined duration or another user duration. The relationship between + a user duration and its parent duration (child duration) are: + + 1) An user duration is nested within the parent duration. When its + parent duration terminates, the user duration will also terminate. + 2) The memory allocated with an user duration comes from the heap of + its parent duration. For example, if the parent duration of an + user duration is call, then the memory allocated with the user + duration will also come from the PGA heap. + + This function can be used as both part of cartridge services as well + as without cartridge services. + The difference in the function in the case of cartridge and + non-cartridge services is: + In case of cartridge services, as descibed above a new user + duration is created as a child of the "parent" duration. + But when used for non-cartridge purposes, when a pre-defined + duration is passed in as parent, it is mapped to the cache duration + for that connection (which is created if not already present) and + the new user duration will be child of the cache duration. + + RETURNS: + if environment handle and service handle is null or if error + handle is null return OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + + +sword OCIDurationEnd( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCIDuration duration ); +/* + NAME: OCIDurationEnd - OCI DURATION END + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + This should be passed NULL, when cartridge services + are to be used. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN/OUT) - OCI service handle. + dur (OUT) - a previously created user duration using + OCIDurationBegin() + REQUIRES: + - a valid OCI environment handle must be given for non-cartridge + services. + - For cartridge services, NULL should be given for environment handle + - A valid service handle must be given in all cases. + DESCRIPTION: + This function terminates a user duration. All memory allocated for + this duration is freed. + + This function can be used as both part of cartridge services as well + as without cartridge services. In both cased, the heap duration + is freed and all the allocated memory for that duration is freed. + The difference in the function in the case of cartridge and + non-cartridge services is: + In case of non-cartridge services, if the duration is pre- + defined, the associated cache duration (see OCIDurationBegin()) + is also terminated and the following is done. + 1) The child durations are terminated. + 2) All objects pinned for this duration are unpinned. + 3) All instances allocated for this duration are freed. + + In case of cartridge services, only the heap duration is + freed. All the context entries allocated for that duration are + freed from the context hash table.. + + RETURNS: + if environment handle and service handle is null or if error + handle is null return OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/****************************************************************************** +** DO NOT USE THE FUNCTIONS BELOW! ** +** UNSUPPORTED INTERFACE ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ + +sword OCIDurationGetParent( OCIEnv *env, OCIError *err, + OCIDuration duration, OCIDuration *parent ); + +sword OCIObjectAlwaysLatest( OCIEnv *env, OCIError *err, void *object ); + +sword OCIObjectNotAlwaysLatest( OCIEnv *env, OCIError *err, + void *object ); + +sword OCIObjectFlushRefresh( OCIEnv *env, OCIError *err, void *object); + +sword OCIObjectIsLoaded( OCIEnv *env, OCIError *err, void *ins, + boolean *load); + +sword OCIObjectIsDirtied( OCIEnv *env, OCIError *err, void *ins, + boolean *dirty); + +sword OCICacheGetObjects( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, + OCIObjectProperty property, + void *client_context, + void (*client_callback)( + void *client_context, + void *object )); + +sword OCICacheRegister( OCIEnv *env, OCIError *err, + OCIObjectEvent event, + void *client_context, + void (*client_callback)( + void *client_context, + OCIObjectEvent event, + void *object)); + +sword OCICacheFlushRefresh( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, void *context, + OCIRef *(*get)(void *context, ub1 *last), + OCIRef **ref ); + +sword OCIObjectSetData(OCIEnv *env, OCIError *err, void *obj_hdr, + void *data); + +sword OCIObjectGetNewOID(OCIEnv *env, OCIError *err, OCISvcCtx *svc, + ub1 *oid); + + +#endif /* ORI_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/orid.h b/libraries/SQLAPI/include/ora_win/orid.h new file mode 100644 index 000000000..c1c664292 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/orid.h @@ -0,0 +1,373 @@ +/* Copyright (c) 1994, 2006, Oracle. All rights reserved. */ + +/* + Author: Tin Nguyen + Date: 02/07/94 + Source documents: "Functional Specification for C Object Interface, Object + Management Subsystem", "Oracle C Coding Standards + version 2.2", and the header file template + Rule sets: the generic and .h file rule sets + Quality status: not exited + Identification tag: [ one or more letters to identify the .h file ] + Revision code: [ date of the last revision of the .h file ] + + Note to the user of this header file: + + Anything in this header file that is marked private is not supported and + must not be used. Private sections are included in the header file to + improve internal maintenance. + + NAME + + ORID - Oracle Object Interface for Dynamic Data Access + + DESCRIPTION + + This file contains declarations for C object interface functions including + the dynamic object data access operations that allow callers to dynamically + access and manipulate objects; these operations include getting and setting + attributes of an object. These dynamic object operations are for accessing + and manipulation objects whose types are not known at compile-time. + + RELATED DOCUMENTS + + Functional Specification for C Object Interface / Object Management System + + PUBLIC FUNCTIONS + + OCIObjectSetAttr - ORID SET attribute value + OCIObjectGetAttr - ORID GET attribute value + + PRIVATE FUNCTIONS + + None + + EXAMPLES + + EXAMPLE 1 + + /o + o This example illustrates how an interative program can use the dynamic + o attribute access to display and modify attributes of an ADT instance. + o The interactive program does not know the type of the object at + o compile time. + o/ + + void display(adt_ref, object, null_struct, names, names_count, + names_length, indexes, indexes_count) + { + /o Pin the ADT o/ + if (OCIObjectPin(env, &adt_ref, OROOPOCUR, OROOPDTRA, OROOLMNON, &adt) + != OROSTASUC) + /o error handling code o/ + + /o + o Call the type manager to obtain all the attributes in the object. + o Display the content of each attribute in the ADT instance. If the + o attribute is an array, display each element of the array. If the + o attribute is an ADT instance, recursively call this routine to + o display the embedded ADT instance. + o/ + numAttrs = OCITypeAttrs(env, adt); + for (i= 1; i <= numAttrs; i++) + { + /o get attribute descriptor o/ + if (ortgabp(env, adt, i, &ado_ref, &ado) != OROSTASUC) + /o error handling code o/ + + /o get attribute name o/ + names[names_count] = OCITypeElemName(env, ado, + &names_length[names_count]); + + /o dynamically get the attr o/ + if (OCIObjectGetAttr(env, object, null_struct, 0, adt_ref, names, + names_length, names_count+1, indexes, indexes_count, 0, + &null, &null_info, &attr) != OROSTASUC) + /o error handling code o/ + + /o check if attribute is null o/ + if (null) continue; + + /o get typecode of attribute o/ + typecode = OCITypeElemTypeCode(env, ado); + + /o if attribute is a varray, display each element in varray o/ + if (typecode == OCI_TYPECODE_VARRAY) + { + /o get the reference to the type of the element of the array o/ + if (OCITypeElemParameterizedTyper(env, ado, &attr_type_ref) + != OROSTASUC) + /o error handling code o/ + + /o get the size of array o/ + if (orlasiz(env, &attr_type_ref, (orlva *)attr, + &numElm) != OROSTASUC) + /o error handling code o/ + + /o get the typecode of the element of the array o/ + if (ortty2r(env, attr_type_ref, &typecode) != OROSTASUC) + /o error handling code o/ + + /o iterate the array o/ + for (j=0; j < numElm; j++) + { + /o get an element in the array o/ + if (OCIObjectGetAttr(env, attr, null_info, j+1, attr_type_ref, + names, names_length, 0, indexes, 0, 0, &null, &null_info, + &element) != OROSTASUC) + /o error handling code o/ + + /o check if element is null o/ + if (null) continue; + + /o if attr is an ADT instance, recursively call this routine o/ + if (typecode == OCI_TYPECODE_ADT || typecode == + OCI_TYPECODE_UNNAMEDADT) + { + /o display the element as an adt o/ + display(attr_type_ref, element, null_info, names, lengths, + 0, indexes, 0); + } + + /o if attribute is scalar, print the value to the screen o/ + else output_to_screen(element, typecode); + } + } + + /o if attribute is an ADT instance, recursively call this routine o/ + else if (typecode == OCI_TYPECODE_ADT || typecode == + OCI_TYPECODE_UNNAMEDADT) + { + /o get the type ref of the attribute o/ + if (ortgarf(env, ado, &attr_type_ref) != OROSTASUC) + /o error handling code o/ + + display(attr_type_ref, attr, null_info, 0, names, 0, names_length, + indexes, 0); + } + + /o if attribute is scalar, print the value to the screen o/ + else output_to_screen(attr, typecode); + } + } + + /o ******** main routine *********** o/ + .... + + /o + o Allocate the arrays for storing the path expression + o/ + + /o get the tdo of type 'long' o/ + if (orttypget(&env, con, "SYS", sizeof("SYS"), "SINT32", sizeof("SINT32"), + OROOPDSES, &long_ref, &long_tdo) != OROSTASUC) + /o error handling code o/ + + /o get the tdo of type 'varchar' o/ + if (orttypget(&env, con, "SYS", sizeof("SYS"), "SQL_VARCHAR2", + sizeof("SQL_VARCHAR2"), OROOPDSES, &vchar_ref, &vchar_tdo) + != OROSTASUC) + /o error handling code o/ + + /o allocate the varrays for the path expression o/ + if (orlalloc(env, &vchar_ref, MAX_ARR_SIZE, &attr_names) != OROSTASUC) + /o error handling code o/ + + if (orlalloc(env, &long_ref, MAX_ARR_SIZE, &attr_name_lengths) + != OROSTASUC) + /o error handling code o/ + + if (orlalloc(env, &long_ref, MAX_ARR_SIZE, &attr_name_indexes) + != OROSTASUC) + /o error handling code o/ + + /o + o Get an ADT instance. The ref to the ADT instance can be obtained + o by through ORI or OSCI. + o/ + if (OCIObjectPin(env, &obj_ref, OROOPOCUR, OROOPDTRA, OROOLMUPD, &object) + != OROSTASUC) + /o error handling code o/ + + /o get the null structure of the ADT instance o/ + if (OCIObjectGetInd(gp, object, &null_struct) != OROSTASUC) + /o error handling code o/ + + /o + o Get the type of the ADT instance + o/ + + /o find out the type of the ADT instance o/ + if (oriogto(env, object, &adt_ref) != OROSTASUC) + /o error handling code o/ + + /o display the object o/ + display(adt_ref, object, null_struct, attr_names, 0, attr_names_lengths, + attr_names_indexes, 0); + + /o After the object is displayed, the program waits for the user to + o respond. The user modifies the values of an attribute and the + o program generates a path expression for the attribute and calls + o OCIObjectSetAttr() to set the value. + o/ + + if (OCIObjectSetAttr(env, object, null_struct, adt_ref, + (text **)attr_names, (ub4 *)attr_name_lengths, + attr_names_count, (ub4 *)attr_array_indexes, + attr_array_indexes_count, + (void *)0, FALSE, (void *)value) != OROSTASUC) + /o error handling code o/ + + END OF EXAMPLE 1 + + NOTES + + This file has been subsetted to contain only the routines that will + be in the first release. + + MODIFIED + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + aahluwal 06/03/02 - bug 2360115 + bpalaval 02/09/01 - Change text to oratext. + whe 09/01/99 - 976457:check __cplusplus for C++ code + sthakur 09/18/97 - collection indexing not supported + cxcheng 08/05/97 - fix compile with short names + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + cxcheng 10/17/96 - final renaming of functions + jboonleu 10/07/96 - beautify with OCI long names + cxcheng 10/07/96 - change short names to long names for readability + jboonleu 09/27/96 - fix lint + jwijaya 07/03/96 - add ANSI prototypes + jboonleu 04/13/95 - new interface + jwijaya 10/11/94 - fix the sccs header and add namespace + tanguyen 08/22/94 - fix example + tanguyen 08/09/94 - remove Sccsid declaration + tanguyen 07/20/94 - fix OCIObjectSetAttr and OCIObjectGetAttr to + use position descriptor + tanguyen 07/18/94 - change 'object' type to become ptr to object + tanguyen 06/30/94 - Fix the ORID_ORACLE ifdef + tanguyen 06/27/94 - update to template format + skotsovo 05/12/94 - replace ado with attribute position + jweisz 05/11/94 - test new checkin facility + jwijaya 05/05/94 - orienv/ref/typ -> oroenv/ref/typ + jwijaya 02/07/94 - Creation + +*/ + +#ifndef ORATYPES +#include +#endif +#ifndef ORO_ORACLE +#include +#endif +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORID_ORACLE +#define ORID_ORACLE + +#ifdef SLSHORTNAME + +#define OCIObjectSetAttr oridset +#define OCIObjectGetAttr oridget + +#endif /* SLSHORTNAME */ + +/*---------------------------------------------------------------------------*/ +/* PUBLIC FUNCTIONS */ +/*---------------------------------------------------------------------------*/ + +/*-------------------------- OCIObjectSetAttr ----------------------------*/ +sword OCIObjectSetAttr( OCIEnv *env, OCIError *err, void *instance, + void *null_struct, struct OCIType *tdo, + const oratext **names, const ub4 *lengths, + const ub4 name_count, const ub4 *indexes, + const ub4 index_count, const OCIInd null_status, + const void *attr_null_struct, const void *attr_value ); +/* + NAME: OCIObjectSetAttr - ORID SET value + PARAMETERS: + env (IN) - OCI environment handle initialized in object mode + err (IN) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + instance (IN) - pointer to an ADT instance + null_struct (IN) - the null structure of the ADT instance or array + tdo (IN) - pointer to the TDO + names (IN) - array of attribute names. This is used to specify + the names of the attributes in the path expression. + lengths (IN) - array of lengths of attribute names. + name_count (IN) - number of element in the array 'names'. + indexes (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4 *)0. + index_count (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4)0. + attr_null_status (IN) - the null status of the attribute if the type of + attribute is primitive. + attr_null_struct (IN) - the null structure of an ADT or collection + attribute. + attr_value (IN) - pointer to the attribute value. + REQUIRES: + DESCRIPTION: + This function set the attribute of the given object with the given + value. The position of the attribute is specified as a path + expression which is an array of names and an array of indexes. + RETURNS: + one of OROSTA* + EXAMPLES: + For path expression stanford.cs.stu[5].addr, the arrays will look like + names = {"stanford", "cs", "stu", "addr"} + lengths = {8, 2, 3, 4} + indexes = {5} + + Also see the above example. + */ + +/*-------------------------- OCIObjectGetAttr ----------------------------*/ +sword OCIObjectGetAttr( OCIEnv *env, OCIError *err, void *instance, + void *null_struct, struct OCIType *tdo, + const oratext **names, const ub4 *lengths, + const ub4 name_count, const ub4 *indexes, + const ub4 index_count, OCIInd *attr_null_status, + void **attr_null_struct, void **attr_value, + struct OCIType **attr_tdo ); +/* + NAME: OCIObjectGetAttr - ORID GET value + PARAMETERS: + env (IN) - OCI environment handle initialized in object mode + err (IN) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + instance (IN) - pointer to an ADT instance + null_struct (IN) - the null structure of the ADT instance or array + tdo (IN) - pointer to the TDO + names (IN) - array of attribute names. This is used to specify + the names of the attributes in the path expression. + lengths (IN) - array of lengths of attribute names. + name_count (IN) - number of element in the array 'names'. + indexes (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4 *)0. + index_count (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4)0. + attr_null_status (OUT) - the null status of the attribute if the type + of attribute is primitive. + attr_null_struct (OUT) - the null structure of an ADT or collection + attribute. + attr_value (OUT) - pointer to the attribute value. + attr_tdo (OUT) - pointer to the TDO of the attribute. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function gets a value from an ADT instance or from an array. + If the parameter 'instance' points to an ADT instance, then the path + expression specifies the location of the attribute in the ADT. + It is assumed that the object is pinned and that the value returned + is valid until the object is unpinned. + RETURNS: + one of OROSTA* + EXAMPLES: + See example in OCIObjectSetAttr(). Also see the above example. + */ + +#endif /* ORID_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/orl.h b/libraries/SQLAPI/include/ora_win/orl.h new file mode 100644 index 000000000..61b0267eb --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/orl.h @@ -0,0 +1,3633 @@ +/* Copyright (c) 1993, 2006, Oracle. All rights reserved. */ + +/* + Author: Srinath Krishnaswamy + Date: 11/24/93 + Source documents: "Functional Specification for C Language Mapping of + OTS Types, Object Management Subsystem", "Oracle C + Coding Standards version 2.2", and the header file + template + Rule sets: the generic and .h file rule sets + Quality status: not exited + Identification tag: [ one or more letters to identify the .h file ] + Revision code: 11/24/93 + + NAME + + ORL - ORacle's external C Language interface to primitive OTS types + + DESCRIPTION + + This header file contains C langauge interface to the OTS primitive + types. The interface includes C mapping of OTS primitive types and + the prototype of the pre-defined operations on the primitive types. + + *********************************************************************** + *** NOTE: The OCI functions for objects requires the *** + *** application to be running in OBJECT mode. That is, during *** + *** process initialization OCIInitialize(), the mode *** + *** specified should be OBJECT mode. *** + ** OCIInitialize(OCI_OBJECT, ..); *** + *********************************************************************** + + RELATED DOCUMENTS + + [1] Krishnaswamy, Srinath and Nguyen, Tin A., "Functional Specification + for C Language Mapping of OTS Types, Object Management Subsystem", + March 1994. + [2] Nguyen, Tin A., "The Open Type System", Oracle Corporation, + February 1994. + [3] Klein, Jonathan D., "Large Field Management", Oracle Corporation, + October 1993. + + PUBLIC FUNCTIONS + + OCI - OCI functions to manipulate Oracle Number, float and decimal + ARITHMETIC + OCINumberInc - OCINumber INCrement (optimized) + OCINumberDec - OCINumber DECrement (optimized) + OCINumberAdd - OCINumber ADD numbers + OCINumberSub - OCINumber SUBtract numbers + OCINumberMul - OCINumber MULtiply numbers + OCINumberDiv - OCINumber DIVide numbers + OCINumberMod - OCINumber MODulo division + OCINumberIntPower - OCINumber integer PoWeR + OCINumberShift - OCINumber decimal ShiFT number + OCINumberNeg - OCINumber NEGate number + OCINumberAbs - OCINumber ABSolute value + OCINumberCeil - OCINumber CEiling of number + OCINumberFloor - OCINumber FLooR of number + OCINumberSqrt - OCINumber SQuare Root of number + OCINumberSign - OCINumber get SIGN of number + NATIVE TYPE CONVERSION + OCINumberToInt - OCINumber convert number TO machine-format Integer + OCINumberFromInt - OCINumber convert machine-format Integer TO Number + OCINumberToReal - OCINumber convert number TO machine-format Real + OCINumberToRealArray - OCINumber convert array of numbers TO + machine-format Real + OCINumberFromReal - OCINumber convert machine-format Real TO Number + TEXT STRING CONVERSION + OCINumberToText - OCINumber convert number TO String + OCINumberFromText - OCINumber convert String TO Number + COMPARISON + OCINumberCmp - OCINumber CoMPare numbers + OCINumberIsZero - OCINumber comparison with ZERo + OCINumberIsInt - OCINumber Is an Integer + ASSIGNMENT + OCINumberAssign - OCINumber ASsiGn number + OCINumberSetZero - OCINumber Set number to Zero value + OCINumberSetPi - OCINumber Set number to Pi + ROUNDING + OCINumberTrunc - OCINumber TRUncate an Oracle number + OCINumberRound - OCINumber ROUnd number + OCINumberPrec - OCINumber round to Precision digits + TRANSCENDENTAL + OCINumberSin - OCINumber SINe + OCINumberArcSin - OCINumber Arc SINe + OCINumberHypSin - OCINumber SiNe Hyperbolic + OCINumberCos - OCINumber COSine + OCINumberArcCos - OCINumber Arc COSine + OCINumberHypCos - OCINumber CoSine Hyperbolic + OCINumberTan - OCINumber TANgent + OCINumberArcTan - OCINumber Arc TANgent + OCINumberArcTan2 - OCINumber Arc TaNgent 2 + OCINumberHypTan - OCINumber TaNgent Hyperbolic + OCINumberPower - OCINumber arbitrary Base EXponentiation + OCINumberExp - OCINumber EXPonentiation to base e + OCINumberLn - OCINumber Logarithm Natural + OCINumberLog - OCINumber LOGarithm to arbitrary base + + OCIDate - OCI functions to manipulate OCI Date + OCIDateToExternal - OCIDate convert date to external form + OCIDateFromExternal - OCIDate convert external form of date into OCIDate + OCIDateAssign - OCIDate Assignment + OCIDateToText - OCIDate convert date TO String + OCIDateFromText - OCIDate convert String TO Date + OCIDateZoneToZone - OCIDate convert date from one time + Zone TO another Zone + OCIDateCompare - OCIDate CoMPare dates + OCIDateAddMonths - OCIDate ADd or subtract Months + OCIDateAddDays - OCIDate ADd or subtract Days + OCIDateLastDay - OCIDate get date of LaST day of month + OCIDateDaysBetween - OCIDate get number of days BeTWeen two dates + OCIDateNextDay - OCIDate get date of Next DaY + OCIDateCheck - OCIDate CHecK if the given date is valid + OCIDateSysDate - OCIDate get current SYStem date and time + + OCIString - OCI String functions to manipulate Variable-length string + OCIStringAssign - OCIString Assign string to string + OCIStringAssignText - OCIString Assign Text string to string + OCIStringResize - OCIString ReSiZe string + OCIStringSize - OCIString get String Size + OCIStringPtr - OCIString get String PoinTeR + OCIStringAllocSize - OCIString get Allocated SiZe + + OCIRaw - OCI Raw functions to manipulate variable-length raW + OCIRawAssignRaw - OCIRaw Assign Raw (of type OCIRaw*) to raw + (of type OCIRaw*) + OCIRawResize - OCIRaw Resize raw + OCIRawSize - OCIRaw get Raw Size + OCIRawPtr - OCIRaw get Raw data Pointer + OCIRawAllocSize - OCIRaw get Allocated Size + + OCIColl - OCI Collection generic functions. These functions can be + used to manipulate both variable-length array (varray) and + nested table. + OCICollSize - OCIColl return current SIZe of the given collection + (in number of elements) + OCICollMax - OCIColl return the MAXimum number of elements in the + collection (i.e. upper-bound) + OCICollGetElem - OCIColl GET pointer to the element at the given + position + OCICollAssignElem - OCIColl assign to element at given index + OCICollAssign - OCIColl ASsiGn collection; perform deep-copy of source + collection to target collection + OCICollAppend - OCIColl aPPend the given element to the end of the + collection + OCICollTrim - OCIColl trim (delete) the given number of elements + from the end of the collection + OCICollIsLocator - OCIColl indicates whether a collection is locator + based or not. + OCIIterCreate - OCIColl Create an ITerator to scan the collection + elements + OCIIterDelete - OCIColl Delete ITerator + OCIIterInit - OCIColl Initialize ITerator to scan the given collection + OCIIterGetCurrent - OCIColl Iterator based, get CURrent + collection element + OCIIterNext - OCIColl Iterator based, get NeXT collection element + OCIIterPrev - OCIColl Iterator based, get PReVious collection element + + OCITable - OCI functions to manipulate nested Table. The OCIColl*() and + OCITable*() functions can be used to manipulate nested table + OCITableDelete(i) - OCITable if element(i) exists then the element is + marked as deleted else the function returns false. So + delete's create "holes". + OCITableExists(i) - OCITable return true iff an element at + position i EXIsts + OCITableFirst - OCITable return the smallest value of i for which + exists(i) is true. + OCITableLast - OCITable return the largest value of i for which + exists(i) is true. + OCITableNext(i) - OCITable return pointer to the smallest position j, + greater than i, such that OCITableExists(j) is true + OCITablePrev(i) - OCITable return pointer to the largest position j, + less than i, such that OCITableExists(j) is true + OCITableSize - OCITable return current SIZe of the given nested table not + including deleted elements + + OCIRef - OCI functions to manipulate object Reference + OCIRefClear - OCIRef CLeaR or nullify a ref + OCIRefAssign - OCIRef ASsiGn a ref to another + OCIRefIsEqual - OCIRef compare two refs for EQUality + OCIRefIsNull - OCIRef test if a ref is NULl + OCIRefFromHex - OCIRef convert a Hexadecimal string TO a Ref + OCIRefToHex - OCIRef convert a ref to a Hexadecimal string + OCIRefHexSize - OCIRef get size of buffer in bytes to store hexadecimal + string + + OBSOLETE: to be replaced by functions from oci.h: + + ORLL - ORL functions to manipulate lob Locators + orllasg - ORLL AsiGn one locator to another + orllequ - ORLL compare two locators for EQUality + orlliini - ORLL Is the locator INItialized? + orllgsz - ORLL Get locator SiZe + orllgcid - ORLL Get Character set ID + + NOTE: The following are specific to FILE lobs: + + orllsnm - ORLL Set directory alias and file NaMe in the locator + orllgnm - ORLL Get directory alias and file NaMe from the locator + + EXAMPLES + + Examples are given in the description of each function where + relevant. + + NOTES + + This file has been subsetted to contain ONLY the routines that will + be in the first release. + + QUESTIONS + + MODIFIED + bkhaladk 08/01/05 - add defn for OCIBinXmlReposCtx + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + rpingte 11/21/02 - Add OCICollGetElemArray and OCINumberToRealArray + aahluwal 06/03/02 - bug 2360115 + gayyappa 02/01/02 - fix 2210776 : change Dom to DOM + whe 09/25/01 - add OCIXMLType & OCIDomDocument opaque types + bpalaval 02/09/01 - Change text to oratext. + rkasamse 09/20/99 - lint changes + whe 09/01/99 - 976457:check __cplusplus for C++ code + hsbedi 08/11/99 - Add macro + rxgovind 10/14/98 - make non exposed calls (OCIRowType etc) private + rxgovind 06/09/98 - update OCIRowTypeCreate + nmantrav 05/11/98 - add OCIRowTypeGetCount + rxgovind 03/29/98 - add OCIRowType and OCIRowData interfaces + jwijaya 05/06/98 - add OCICollIsLocator + rxgovind 03/18/98 - opaque types: move to kolo.h + etucker 02/02/98 - add comments for Dec and Inc + etucker 01/29/98 - Finish core5 integration + rxgovind 11/11/97 - opaque types + etucker 10/28/97 - add ORLN functions for SDK + cxcheng 07/28/97 - remove OCILobLocator #define + skmishra 05/13/97 - stdcc compatibility changes + skrishna 04/25/97 - rename OCINumber*(): Exp Power TanHyp Zero Init + TanToArc Sqr Truncate and Compare + skotsovo 03/31/97 - remove OCILobLocatorSize + skrishna 03/25/97 - remove orld2i and orldi2d + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + skrishna 01/06/97 - update OCITableSize() comments + skrishna 12/27/96 - fix OCIDateGet/OCIDateSet + skrishna 12/12/96 - update OCICollGelElem comments + skrishna 11/07/96 - OCICollGetElem: interface change + skrishna 11/05/96 - add OCIDate Get/Set and OCIDateAssign + cxcheng 10/31/96 - change OCINumberTanHyp to OCINumberHypTan + cxcheng 10/30/96 - #define orll short names to long names + dchatter 10/26/96 - fix some OCI file long names + cxcheng 10/24/96 - remove unnecessary comment in front + cxcheng 10/14/96 - disable long name mapping for LOB functions + skrishna 10/13/96 - continue beautification + skotsovo 10/16/96 - update ocilob names + cxcheng 10/09/96 - add structure members in #define for date/time + cxcheng 10/09/96 - more lint fixes + skrishna 10/09/96 - continue beautification + cxcheng 10/09/96 - more fixes + skrishna 10/09/96 - change fixed-char rep. to orlvstr* + jwijaya 10/08/96 - continue beautification + jwijaya 10/07/96 - beautify + cxcheng 10/07/96 - more changes + cxcheng 10/04/96 - replace short names with long names + skrishna 10/01/96 - orlcsiz, orltsiz: change prototype to take errhdl + skrishna 09/23/96 - fix lint errors + skotsovo 09/23/96 - remove orllmkcur(). + jwijaya 09/17/96 - comments on null ref + skrishna 09/19/96 - change orlraw format + skotsovo 09/19/96 - add orlliini and remove orllnul + skrishna 08/14/96 - orlvstr: change format to ub4 followed by text + jboonleu 08/06/96 - update comment + skotsovo 08/08/96 - revert to locators instead of descriptors as input t + jboonleu 07/23/96 - remove orlrcur + skrishna 07/06/96 - add orltsiz + skrishna 07/05/96 - add orld2i and orldi2d + jwijaya 07/03/96 - add ANSI prototypes + skrishna 06/27/96 - document default string format in orlds2d & orld2s + skrishna 06/25/96 - change max date value + skrishna 06/18/96 - modify orld2s() comments + skotsovo 06/13/96 - orll functions take lob descriptors instead of locat + rxgovind 06/05/96 - change prototype of orlrcur to take ocienvh + skrishna 05/30/96 - support collection trimming + skrishna 05/30/96 - remove orlralo/fre and orllalo/fre instead use + orionew/fre + skrishna 05/28/96 - add orlt*() and modify orla*() + skotsovo 05/23/96 - add orlbl typedefs for pro*c + jboonleu 05/14/96 - add orlrcur + rxgovind 05/08/96 - changes for 3gl callbacks + skotsovo 05/01/96 - in orllasg, no need to alloc orlbl* + skrishna 04/21/96 - merge changes from 960418 object branch into big + skrishna 04/17/96 - rename orlrcpy to orlrasg + skrishna 04/12/96 - add orlr2h and orlrh2r functions + skotsovo 04/15/96 - add fnt to make the lob locator current + skrishna 04/08/96 - change orl*() to take ocienvh* and ocierrh* instead + of oroenv* + skotsovo 03/22/96 - add locator functions + skotsovo 03/22/96 - add locator functions + skrishna 02/27/96 - remove mlslabel interface + skotsovo 02/20/96 - remove orlbty and use dty type instead. + skotsovo 02/14/96 - add text file lobs. + skrishna 01/31/96 - update comments of orln2r, orldchk, orlds2d & orld2s + skrishna 01/31/96 - change orld2s() and orln2s() to return string length + skrishna 01/21/96 - remove old raw interface + skrishna 12/14/95 - add raw interface + skotsovo 01/03/96 - change LOB offsets and lengths from ub4 to ubig_ora + to support 64 bit machines. + skotsovo 10/30/95 - add orlblsiz() to get lob locator size + skrishna 10/24/95 - move ref functions from ori and update the ref + functions to support variable-length ref + cxcheng 10/20/95 - add more comments on number versions + cxcheng 10/13/95 - add more number functions + cxcheng 08/29/95 - Support for segmented varrays + cxcheng 08/18/95 - modifiy orlmls structure + skrishna 06/06/95 - rename orln, orld, orlvs and orlva to orlnum, + orldat, orlvstr and orlvary respectively + skrishna 11/15/94 - remove orlnget() function + skrishna 09/20/94 - modify orldbtw() to return number of days only + skrishna 08/24/94 - change format string length type from ub4 to ub1 + skrishna 07/19/94 - Rename orln2c & orlnc2n to orln2s & orlns2n + skrishna 06/29/94 - Add blob interface; add examples + skrishna 06/23/94 - Update comments and format + skrishna 05/19/94 - update varray append comments + skrishna 05/05/94 - Subsetting + skrishna 11/24/93 - Creation +*/ + +#ifndef ORATYPES +#include +#endif + +#ifndef ORO_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#include +#endif + +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORL_ORACLE +#define ORL_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCIArray orlvary +#define OCIColl orlcol +#define OCICollAppend orlcapp +#define OCICollAssign orlcasg +#define OCICollAssignElem orlcase +#define OCICollGetElem orlcget +#define OCICollGetElemArray orlcgeta +#define OCICollMax orlcmax +#define OCICollSize orlcsiz +#define OCICollTrim orlctrm +#define OCICollIsLocator orlcilc +#define OCIDate orldat +#define OCIDateAddDays orldadd +#define OCIDateAddMonths orldadm +#define OCIDateCheck orldchk +#define OCIDateCompare orldcmp +#define OCIDateDD day_orldat +#define OCIDateDaysBetween orldbtw +#define OCIDateFromText orlds2d +#define OCIDateLastDay orldlst +#define OCIDateMM mon_orldat +#define OCIDateNextDay orldndy +#define OCIDateSysDate orldsys +#define OCIDateTime time_orldat +#define OCIDateYYYY gye_orldat +#define OCIDateZoneToZone orldz2z +#define OCIIter orlcitr +#define OCIIterCreate orlccit +#define OCIIterDelete orlcdit +#define OCIIterGetCurrent orlcicur +#define OCIIterInit orlciit +#define OCIIterNext orlcinxt +#define OCIIterPrev orlciprv +#define OCINumber orlnum +#define OCINumberAbs orlnabs +#define OCINumberAdd orlnadd +#define OCINumberArcCos orlnacos +#define OCINumberArcSin orlnasin +#define OCINumberArcTan orlnatan +#define OCINumberAssign orlnasg +#define OCINumberCeil orlncel +#define OCINumberCos orlncos +#define OCINumberDiv orlndiv +#define OCINumberPower orlnbex +#define OCINumberFloor orlnflr +#define OCINumberFromInt orlni2n +#define OCINumberFromReal orlnr2n +#define OCINumberFromText orlns2n +#define OCINumberHypCos orlncsh +#define OCINumberHypSin orlnsnh +#define OCINumberSetZero orlnini +#define OCINumberSetPi orlnspi +#define OCINumberInc orlninc +#define OCINumberDec orlndec +#define OCINumberIntPower orlnpwr +#define OCINumberLn orlnln +#define OCINumberLog orlnlog +#define OCINumberMod orlnmod +#define OCINumberMul orlnmul +#define OCINumberNeg orlnneg +#define OCINumberPart orlnpart +#define OCINumberExp orlnexp +#define OCINumberRound orlnrou +#define OCINumberPrec orlnpre +#define OCINumberShift orlnsft +#define OCINumberSign orlnsgn +#define OCINumberSin orlnsin +#define OCINumberSqrt orlnsqr +#define OCINumberSub orlnsub +#define OCINumberTan orlntan +#define OCINumberHypTan orlntnh +#define OCINumberArcTan2 orlnatn2 +#define OCINumberToInt orln2i +#define OCINumberToReal orln2r +#define OCINumberToRealArray orln2ra +#define OCINumberToText orln2s +#define OCINumberTrunc orlntru +#define OCINumberCmp orlncmp +#define OCINumberIsZero orlnzer +#define OCINumberIsInt orlnint +#define OCIRaw orlraw +#define OCIRawAllocSize orlwasz +#define OCIRawAssignBytes orlwabr +#define OCIRawAssignRaw orlwarr +#define OCIRawPtr orlwgrp +#define OCIRawResize orlwrsz +#define OCIRawSize orlwgsz +#define OCIRefAssign orlrasg +#define OCIRefClear orlrclr +#define OCIRefFromHex orlrh2r +#define OCIRefHexSize orlrhsz +#define OCIRefIsEqual orlrequ +#define OCIRefIsNull orlrnul +#define OCIRefToHex orlr2h +#define OCIString orlvstr +#define OCIStringAllocSize orlvasz +#define OCIStringAssign orlvass +#define OCIStringAssignText orlvats +#define OCIStringPtr orlvgsp +#define OCIStringResize orlvrsz +#define OCIStringSize orlvgsz +#define OCITable orltbl +#define OCITableDelete orltdel +#define OCITableExists orltexi +#define OCITableFirst orltfst +#define OCITableLast orltlst +#define OCITableNext orltnxt +#define OCITablePrev orltprv +#define OCITableSize orltsiz +#define OCITime orldtm +#define OCITimeHH orldtmhh +#define OCITimeMI orldtmmm +#define OCITimeSS orldtmss +#define OCI_LOBMODE_READONLY ORLBMORO +#define OCI_LOBMODE_READWRITE ORLBMORW + +#endif /* SLSHORTNAME */ + +/*****************************************************************************/ +/* NUMBER/FLOAT/DECIMAL TYPE */ +/*****************************************************************************/ + +#define OCI_NUMBER_SIZE 22 +struct OCINumber +{ + ub1 OCINumberPart[OCI_NUMBER_SIZE]; +}; +typedef struct OCINumber OCINumber; + +/* + * OCINumber - OCI Number mapping in c + * + * The OTS types: NUMBER, NUMERIC, INT, SHORTINT, REAL, DOUBLE PRECISION, + * FLOAT and DECIMAL are represented by OCINumber. + * The contents of OCINumber is opaque to clients. + * + * For binding variables of type OCINumber in OCI calls (OCIBindByName(), + * OCIBindByPos(), and OCIDefineByPos()) use the type code SQLT_VNU. + */ + +/* + EXAMPLE + + The following example shows how to manipulate an attribute of type + oracle number. + + struct person + { + OCINumber sal; + }; + typedef struct person person; + + OCIError *err; + person* joe; + person* tom; + person* debbie; + OCINumber *joesal; + OCINumber *tomsal; + OCINumber *debsal; + sword status; + int inum; + double dnum; + OCINumber ornum; + char buffer[21]; + ub4 buflen; + sword result; + + /o See oci.h for an example of how to initialize OCIError. + o For this example, assume the OCIEnv and OCIError has been + o initialized. + o/ + + /o Pin joe, tom and debbie person objects in the object cache. See ori.h + o for an example on pinning objects. For this example, assume that + o joe, tom and debbie are pointing to pinned objects. + o/ + joesal = &joe->sal; + tomsal = &tom->sal; + debsal = &debbie->sal; + + /o initialize joe's salary to be $12,000 o/ + inum = 12000; + status = OCINumberFromInt(err, &inum, sizeof(inum), OCI_NUMBER_SIGNED, + joesal); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromInt o/; + + /o initialize tom's salary to be same as joe o/ + OCINumberAssign(err, joesal, tomsal); + + /o initialize debbie's salary to be 20% more than joe's o/ + dnum = 1.2; + status = OCINumberFromReal(err, &dnum, sizeof(double), &ornum); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromReal o/; + status = OCINumberMul(err, joesal, &ornum, debsal); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberMul o/; + + /o give tom a 50% raise o/ + dnum = 1.5; + status = OCINumberFromReal(err, &dnum, sizeof(double), &ornum); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromReal o/; + status = OCINumberMul(err, tomsal, &ornum, tomsal); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberMul o/; + + /o double joe's salary o/ + status = OCINumberAdd(err, joesal, joesal, joesal); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberAdd o/; + + /o get joe's salary in integer o/ + status = OCINumberToInt(err, joesal, sizeof(inum), OCI_NUMBER_SIGNED, + &inum); + if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToInt o/; + /o inum is set to 24000 o/ + + /o get debbie's salary in double o/ + status = OCINumberToReal(err, debsal, sizeof(dnum), &dnum); + if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToReal o/; + /o dnum is set to 14400 o/ + + /o print tom's salary as DEM0001`8000.00 o/ + buflen = sizeof(buffer); + status = OCINumberToText(err, tomsal, "C0999G9999D99", 13, + "NLS_NUMERIC_CHARACTERS='.`' NLS_ISO_CURRENCY='Germany'", 54, + &buflen, buffer); + if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToText o/; + printf("tom's salary = %s\n", buffer); + + /o compare joe and tom's salary o/ + status = OCINumberCmp(err, joesal, tomsal, &result); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberCmp o/; + /o result is positive o/ + + /o read debbie's new salary from string o/ + status = OCINumberFromText(err, "48`000.00", 9, "99G999D99", 9, + "NLS_NUMERIC_CHARACTERS='.`'", 27, debsal); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromText o/; + /o debbie's salary is now 48000.00 o/ + +*/ + +/*----------------------------- OCINumberInc --------------------------------*/ + +sword OCINumberInc( OCIError *err, OCINumber *number ); +/* + NAME: OCINumberInc - OCINumber INCrement numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN/OUT) a positive Oracle number to be incremented + DESCRIPTION: + Increment Oracle number in place. It is assumed that the input is + an integer between 0 and 100^21-2. If the is input too large, it will + be treated as 0 - the result will be an Oracle number 1. If the input + is not a positive integer, the result will be unpredictable. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberDec --------------------------------*/ + +sword OCINumberDec( OCIError *err, OCINumber *number ); +/* + NAME: OCINumberDec - OCINumber DECrement numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN/OUT) - a positive Oracle number to be decremented + DESCRIPTION: + Decrement Oracle number in place. It is assumed that the input is an + integer between 1 and 100^21-2. If the input is too large, it will be + treated as 1 - the result will be an Oracle number 0. If the input is + not a positive integer, the result will be unpredictable. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberSetZero -------------------------------*/ + +void OCINumberSetZero( OCIError *err, OCINumber *num ); +/* + NAME: OCINumberSetZero - OCINumber Set number to Zero value + PARAMETERS: + err (IN/OUT) - pointer to OCI error handle + num (OUT) - set to zero value + DESCRIPTION: + Initialize the given number to value 0. + */ + +/*--------------------------- OCINumberSetPi --------------------------------*/ + +void OCINumberSetPi( OCIError *err, OCINumber *num ); +/* + NAME: OCINumberSetPi - OCINumber Set number to Pi + err (IN/OUT) - pointer to OCI error handle + num (OUT) - set to zero value + DESCRIPTION: + Initialize the given number to value Pi. + */ + +/*----------------------------- OCINumberAdd --------------------------------*/ + +sword OCINumberAdd( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberAdd - OCINumber ADD numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - numbers to be added + result (OUT) - result of adding 'number1' with 'number2' + DESCRIPTION: + Add 'number1' with 'number2' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberSub --------------------------------*/ + +sword OCINumberSub( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberSub - OCINumber SUBtract numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - 'number2' subtracted from 'number1' + result (OUT) - subtraction result + DESCRIPTION: + Subtract 'number2' from 'number1' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberMul --------------------------------*/ + +sword OCINumberMul( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberMul - OCINumber MULtiply numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - numbers to be multiplied + result (OUT) - multiplication result + DESCRIPTION: + Multiply 'number1' with 'number2' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberDiv --------------------------------*/ + +sword OCINumberDiv( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberDiv - OCINumber DIVide numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1 (IN) - pointer to the numerator + number2 (IN) - pointer to the denominator + result (OUT) - division result + DESCRIPTION: + Divide 'number1' by 'number2' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + underflow errorr + overflow errorr + divide by zero errorr + */ + +/*----------------------------- OCINumberMod --------------------------------*/ + +sword OCINumberMod( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberMod - OCINumber MODulous + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1 (IN) - pointer to the numerator + number2 (IN) - pointer to the denominator + result (OUT) - remainder of the result + DESCRIPTION: + Finds the remainder of the division of two Oracle numbers. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + divide by zero errorr + */ + +/*------------------------ OCINumberIntPower --------------------------------*/ + +sword OCINumberIntPower( OCIError *err, const OCINumber *base, + const sword exp, OCINumber *result ); +/* + NAME: OCINumberIntPower - OCINumber takes an arbitary base to an arbitary + integer PoWeR + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + base (IN) - base of the exponentiation + exp (IN) - exponent to which the base is to be raised + result (OUT) - output of exponentiation + DESCRIPTION: + Takes an arbitary base to an arbitary integer power. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberShift ---------------------------------*/ + +sword OCINumberShift( OCIError *err, const OCINumber *number, + const sword nDig, OCINumber *result ); +/* + NAME: OCINumberShift - OCINumber multiplies by a power of 10. + + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - Oracle Number to be shifted. + nDig (IN) - number of decimal places to shift. + result (OUT) - shift result. + DESCRIPTION: + Multiplies number by 10^NDig and sets product to the result. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberNeg --------------------------------*/ + +sword OCINumberNeg( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberNeg - OCINumber NEGate number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be negated + result (OUT) - will contain negated value of 'number' + DESCRIPTION: + Negates an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*------------------------- OCINumberToText ---------------------------------*/ + +sword OCINumberToText( OCIError *err, const OCINumber *number, + const oratext *fmt, ub4 fmt_length, + const oratext *nls_params, ub4 nls_p_length, + ub4 *buf_size, oratext *buf ); +/* + NAME: OCINumberToText - OCINumber convert number TO String + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - Oracle number to be converted + fmt (IN) - conversion format + fmt_length (IN) - length of the 'fmt' parameter + nls_params (IN) - nls format specification, if null string + i.e. (oratext *)0, then the default parameters for the + session is used + nls_p_length (IN) - length of the 'nls_params' parameter + buf_size (IN/OUT) - size of the buffer must be passed as input by + the caller, this function will return the length of the + resulting string in bytes via this parameter. The length + does not include the terminating null ('\0'). + buf (OUT) - buffer into which the converted string is placed. The + resulting string is null terminated. + DESCRIPTION: + Converts the given number to a character string + according to the specified format. Refer to "TO_NUMBER" conversion + function described in "Oracle SQL Language Reference Manual" for a + description of format and NLS parameters. + The converted number string is stored in the buffer 'buf', up to + a max of '*buf_size' bytes. Length of the resulting string is + returned via 'buf_size'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'buf' is null + buffer too small + invalid format + invalid nls format + number to text translation for the given format causes overflow + */ + +/*-------------------------- OCINumberFromText ------------------------------*/ + +sword OCINumberFromText( OCIError *err, const oratext *str, + ub4 str_length, const oratext *fmt, ub4 fmt_length, + const oratext *nls_params, ub4 nls_p_length, + OCINumber *number ); +/* + NAME: OCINumberFromText - OCINumber convert String TO Number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + str (IN) - input string to be converted to Oracle number + str_length (IN) - size of the input string + fmt (IN) - conversion format + fmt_length (IN) - length of the 'fmt' parameter + nls_params (IN) - nls format specification, if null string + i.e. (oratext *)0, then the default parameters for the + session is used + nls_p_length (IN) - length of the 'nls_params' parameter + number (OUT) - given string converted to number + DESCRIPTION: + Converts the given string to a number + according to the specified format. Refer to "TO_NUMBER" conversion + function described in "Oracle SQL Language Reference Manual" for a + description of format and NLS parameters. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'str' is null + 'str_length' is 0 + invalid format + invalid nls format + invalid input string + */ + +/*-------------------------- OCINumberToInt ---------------------------------*/ + +#define OCI_NUMBER_UNSIGNED 0 /* Unsigned type -- ubX */ +#define OCI_NUMBER_SIGNED 2 /* Signed type -- sbX */ + +sword OCINumberToInt( OCIError *err, const OCINumber *number, + uword rsl_length, uword rsl_flag, void *rsl ); +/* + NAME: OCINumberToInt - OCINumber convert number TO Integer + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be converted + rsl_length (IN) - size of the desired result + rsl_s_flag (IN) - flag denoting the desired sign of the output; valid + values are OCI_NUMBER_UNSIGNED, OCI_NUMBER_SIGNED + rsl (OUT) - pointer to space for the result + DESCRIPTION: + Native type conversion function. + Converts the given Oracle number into an xbx (e.g. ub2, ub4, sb2 etc.) + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rsl' is null + integer value of 'number' is too big -- overflow + integer value of 'number' is too small -- underflow + invalid sign flag value ('rsl_s_flag') + */ + +/*--------------------------- OCINumberFromInt ------------------------------*/ + +sword OCINumberFromInt( OCIError *err, const void *inum, uword inum_length, + uword inum_s_flag, OCINumber *number ); +/* + NAME: OCINumberFromInt - OCINumber convert Integer TO Number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inum (IN) - pointer to the integer to be converted + inum_length (IN) - size of the integer + inum_s_flag (IN) - flag that designates the sign of the integer; valid + values are OCI_NUMBER_UNSIGNED, OCI_NUMBER_SIGNED + number (OUT) - given integer converted to Oracle number + DESCRIPTION: + Native type conversion function. Converts any Oracle standard + machine-native integer type (xbx) to an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'inum' is null + integer too BIG -- the number is too large to fit into an Oracle + number + invalid sign flag value ('inum_s_flag') + */ + +/*------------------------- OCINumberToReal ---------------------------------*/ + +sword OCINumberToReal( OCIError *err, const OCINumber *number, + uword rsl_length, void *rsl ); +/* + NAME: OCINumberToReal - OCINumber convert number TO Real + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be converted + rsl_length (IN) - is the size of the desired result, + sizeof( float | double | long double) + rsl (OUT) - pointer to space for storing the result + DESCRIPTION: + Native type conversion function. Converts an Oracle number into a + machine-native real type. This function only converts numbers up to + LDBL_DIG, DBL_DIG, or FLT_DIG digits of precision and removes + trailing zeroes. The above constants are defined in float.h + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rsl' is null + 'rsl_length' is 0 + */ + +/*------------------------- OCINumberToRealArray ----------------------------*/ + +sword OCINumberToRealArray( OCIError *err, const OCINumber **number, + uword elems, uword rsl_length, void *rsl ); +/* + NAME: OCINumberToRealArray - OCINumber convert array of numbers TO Real + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - Pointer to array of number to be converted + elems (IN) - Upper bound of number array + rsl_length (IN) - is the size of the desired result, + sizeof( float | double | long double) + rsl (OUT) - pointer to array of space for storing the result + DESCRIPTION: + Native type conversion function. Converts an Oracle number into a + machine-native real type. This function only converts numbers up to + LDBL_DIG, DBL_DIG, or FLT_DIG digits of precision and removes + trailing zeroes. The above constants are defined in float.h + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rsl' is null + 'rsl_length' is 0 + */ + +/*-------------------------- OCINumberFromReal ------------------------------*/ + +sword OCINumberFromReal( OCIError *err, const void *rnum, + uword rnum_length, OCINumber *number ); +/* + NAME: OCINumberFromReal - OCINumber convert Real TO Number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rnum (IN) - pointer to the floating point number to be converted + rnum_length (IN) - size of the desired result, i.e. + sizeof({float | double | long double}) + number (OUT) - given float converted to Oracle number + DESCRIPTION: + Native type conversion function. Converts a machine-native floating + point type to an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rnum' is null + 'rnum_length' is 0 + */ + +/*----------------------------- OCINumberCmp --------------------------------*/ + +sword OCINumberCmp( OCIError *err, const OCINumber *number1, + const OCINumber *number2, sword *result ); +/* + NAME: OCINumberCmp - OCINumber CoMPare numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - numbers to be compared + result (OUT) - 0 if equal, negative if number1 < number2, + positive if number1 > number2 + DESCRIPTION: + The function OCINumberCmp compares two numbers. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number1' or 'number2' or 'result' is null + */ + +/*---------------------------- OCINumberSign --------------------------------*/ + +sword OCINumberSign( OCIError *err, const OCINumber *number, + sword *result ); +/* + NAME: OCINumberSign - OCINumber obtains SiGN of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number whose sign is returned + result (OUT) - 0 if number == 0, -1 if number < 0, + 1 if number > 0 + DESCRIPTION: + Obtains sign of an Oracle number + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'result' is null + */ + +/*---------------------------- OCINumberIsZero ------------------------------*/ + +sword OCINumberIsZero( OCIError *err, const OCINumber *number, + boolean *result ); +/* + NAME: OCINumberIsZero - OCINumber comparison with ZERo + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - numbers to be compared + result (OUT) - set to TRUE if equal to zero else FALSE + DESCRIPTION: + Test if the given number is equal to zero. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'result' is null + */ + +/*---------------------------- OCINumberIsInt -------------------------------*/ + +sword OCINumberIsInt( OCIError *err, const OCINumber *number, + boolean *result ); +/* + NAME: OCINumberIsInt - OCINumber Is Integer value. + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be tested + result (OUT) - set to TRUE if integer value else FALSE + DESCRIPTION: + Test if the given number is an integer value. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'result' is null + */ + +/*-------------------------- OCINumberAssign --------------------------------*/ + +sword OCINumberAssign( OCIError *err, const OCINumber *from, + OCINumber *to ); +/* + NAME: OCINumberAssign - OCINumber ASsiGn number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + from (IN) - number to be assigned + to (OUT) - number copied into + DESCRIPTION: + Assign number 'from' to 'to'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'from' or 'to' is null + */ + +/*----------------------------- OCINumberAbs --------------------------------*/ + +sword OCINumberAbs( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberAbs - OCINumber compute ABSolute value + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the absolue value of the + input number + DESCRIPTION: + Computes the absolute value of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*---------------------------- OCINumberCeil --------------------------------*/ + +sword OCINumberCeil( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberCeil - OCINumber compute the CEiL value of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the ceil value of the + input number + DESCRIPTION: + Computes the ceil value of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*--------------------------- OCINumberFloor --------------------------------*/ + +sword OCINumberFloor( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberFloor - OCINumber compute the FLooR value of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the floor value of the + input number + DESCRIPTION: + Computes the floor value of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberSqrt -------------------------------*/ + +sword OCINumberSqrt( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberSqrt - OCINumber compute the SQuare Root of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the square root of the + input number + DESCRIPTION: + Computes the square root of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is negative + */ + +/*--------------------------- OCINumberTrunc --------------------------------*/ + +sword OCINumberTrunc( OCIError *err, const OCINumber *number, + sword decplace, OCINumber *result ); +/* + NAME: OCINumberTrunc - OCINumber TRUncate an Oracle number at a + specified decimal place + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + decplace (IN) - number of decimal digits to the right of the + decimal point to truncate at. Negative values are allowed. + result (OUT) - output of truncation + DESCRIPTION: + Truncate an Oracle number at a specified decimal place + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberPower ------------------------------*/ + +sword OCINumberPower( OCIError *err, const OCINumber *base, + const OCINumber *number, OCINumber *result ); +/* + NAME: OCINumberPower - OCINumber takes an arbitary Base to an + arbitary Power + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + base (IN) - base of the exponentiation + number (IN) - exponent to which the base is to be raised + result (OUT) - output of exponentiation + DESCRIPTION: + Takes an arbitary base to an arbitary power. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*--------------------------- OCINumberRound --------------------------------*/ + +sword OCINumberRound( OCIError *err, const OCINumber *number, + sword decplace, OCINumber *result ); +/* + NAME: OCINumberRound - OCINumber ROUnds an Oracle number to a specified + decimal place + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - round this number and return result in 'result' + decplace (IN) - number of decimal digits to the right of the + decimal point to round to. Negative values are allowed. + result (OUT) - output of rounding + DESCRIPTION: + Rounds an Oracle number to a specified decimal place + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*--------------------------- OCINumberPrec ---------------------------------*/ + +sword OCINumberPrec( OCIError *err, const OCINumber *number, + sword nDigs, OCINumber *result ); +/* + NAME: OCINumberPrec - Rounds an Oracle number to a specified number of + decimal digits. + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number for which to set precision. + nDig (IN) - number of decimal digits desired in the result. + result (OUT) - result. + DESCRIPTION: + Performs a floating point round with respect to the number + of digits. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberSin --------------------------------*/ + +sword OCINumberSin( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberSin - OCINumber takes the SINe of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the sine in radians + result (OUT) - result of the sine + DESCRIPTION: + Takes the sine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberArcSin --------------------------------*/ + +sword OCINumberArcSin( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberArcSin - OCINumber takes the Arc SINe of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the arc sine + result (OUT) - result of the arc sine in radians + DESCRIPTION: + Takes the arc sine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is < -1 or 'number' is > 1. + */ + +/*-------------------------- OCINumberHypSin --------------------------------*/ + +sword OCINumberHypSin( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberHypSin - OCINumber takes the SiNe Hyperbolic of an + Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the sine hyperbolic + result (OUT) - result of the sine hyperbolic + DESCRIPTION: + Takes the hyperbolic sine of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + NOTES: + An Oracle number overflow causes an unpredictable result value. + */ + +/*----------------------------- OCINumberCos --------------------------------*/ + +sword OCINumberCos( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberCos - OCINumber takes the COSine of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the cosine in radians + result (OUT) - result of the cosine + DESCRIPTION: + Takes the cosine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberArcCos --------------------------------*/ + +sword OCINumberArcCos( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberArcCos - OCINumber takes the Arc COSine of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the arc cosine + result (OUT) - result of the arc cosine in radians + DESCRIPTION: + Takes the arc cosine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is < -1 or 'number' is > 1. + */ + +/*-------------------------- OCINumberHypCos --------------------------------*/ + +sword OCINumberHypCos( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberHypCos - OCINumber takes the CoSine Hyperbolic of an + Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the cosine hyperbolic + result (OUT) - result of the cosine hyperbolic + DESCRIPTION: + Takes the hyperbolic cosine of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + NOTES: + An Oracle number overflow causes an unpredictable result value. + */ + +/*----------------------------- OCINumberTan --------------------------------*/ + +sword OCINumberTan( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberTan - OCINumber takes the TANgent of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the tangent in radians + result (OUT) - result of the tangent + DESCRIPTION: + Takes the tangent in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberArcTan --------------------------------*/ + +sword OCINumberArcTan( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberArcTan - OCINumber takes the Arc TANgent of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the arc tangent + result (OUT) - result of the arc tangent in radians + DESCRIPTION: + Takes the arc tangent in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*------------------------ OCINumberArcTan2 ---------------------------------*/ + +sword OCINumberArcTan2( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberArcTan2 - OCINumber takes the ATan2 of 2 Oracle numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1 (IN) - first argument of atan2(y,x) function which + corresponds to 'y' parameter in the function + number2 (IN) - second argument of atan2(y,x) function which + corresponds to 'x' parameter in the function + result (OUT) - result of the atan2() in radians + DESCRIPTION: + Takes the atan2(number1, number2). + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number2' is 0 + */ + +/*----------------------------- OCINumberHypTan -----------------------------*/ + +sword OCINumberHypTan( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberHypTan - OCINumber takes the TaNgent Hyperbolic of an Oracle + number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the tangent hyperbolic + result (OUT) - result of the tangent hyperbolic + DESCRIPTION: + Takes the hyperbolic tangent of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + NOTES: + An Oracle number overflow causes an unpredictable result value. + */ + +/*--------------------------- OCINumberExp ----------------------------------*/ + +sword OCINumberExp( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberExp - OCINumber EXPonential + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - e raised to this Oracle number power + result (OUT) - output of exponentiation + DESCRIPTION: + Raises e to the specified Oracle number power + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberLn ---------------------------------*/ + +sword OCINumberLn( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberLn - OCINumber Logarithm Natural + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - logarithm of this number is computed + result (OUT) - logarithm result + DESCRIPTION: + Takes the logarithm of the given Oracle number with respect + to the given base. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is <= 0 + */ + +/*----------------------------- OCINumberLog --------------------------------*/ + +sword OCINumberLog( OCIError *err, const OCINumber *base, + const OCINumber *number, OCINumber *result ); +/* + NAME: OCINumberLog - OCINumber LOGarithm any base + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + base (IN) - base of the logarithm + number (IN) - opearnd + result (OUT) - logarithm result + DESCRIPTION: + Takes the logarithm with the specified base of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is <= 0 + 'base' is <= 0 + */ + +/*****************************************************************************/ +/* ORACLE DATE TYPE */ +/*****************************************************************************/ + +struct OCITime +{ + ub1 OCITimeHH; /* hours; range is 0 <= hours <=23 */ + ub1 OCITimeMI; /* minutes; range is 0 <= minutes <= 59 */ + ub1 OCITimeSS; /* seconds; range is 0 <= seconds <= 59 */ +}; +typedef struct OCITime OCITime; + +/* + * OCITime - OCI TiMe portion of date + * + * This structure should be treated as an opaque structure as the format + * of this structure may change. Use OCIDateGetTime/OCIDateSetTime + * to manipulate time portion of OCIDate. + */ + +struct OCIDate +{ + sb2 OCIDateYYYY; /* gregorian year; range is -4712 <= year <= 9999 */ + ub1 OCIDateMM; /* month; range is 1 <= month < 12 */ + ub1 OCIDateDD; /* day; range is 1 <= day <= 31 */ + OCITime OCIDateTime; /* time */ +}; +typedef struct OCIDate OCIDate; + +/* + * OCIDate - OCI oracle Date representation in C + * + * OCIDate represents the C mapping of Oracle date. + * + * This structure should be treated as an opaque structure as the format + * of this structure may change. Use OCIDateGetDate/OCIDateSetDate + * to access/initialize OCIDate. + * + * For binding variables of type OCIDate in OCI calls (OCIBindByName(), + * OCIBindByPos(), and OCIDefineByPos()) use the type code SQLT_ODT. + */ + +/* + EXAMPLE + + The following example shows how to manipulate an attribute of type + oracle date. + + #define FMT "Month dd, YYYY, HH:MI A.M." + #define LANG "American" + + struct person + { + OCIDate start_date; + }; + typedef struct person person; + + OCIError *err; + person *joe; + sword status; /o error status o/ + + /o See oci.h for an example of how to initialize OCIError. + o For this example, assume the OCIEnv and OCIError has been + o initialized. + o/ + + /o Pin joe person object in the object cache. See ori.h + o for an example on pinning objects. For this example, assume that + o joe is pointing to the pinned object. + o/ + + /o set the start date of joe o/ + OCIDateSetTime(&joe->start_date, 8, 0, 0); + OCIDateSetDate(&joe->start_date, 1990, 10, 5); + + /o check if the date is valid o/ + uword invalid; + if (OCIDateCheck(err, &joe->start_date, &invalid) != OCI_SUCCESS) + /o error handling code o/ + if (invalid) + /o error handling code o/ + + /o convert date for display purposes o/ + char str[100]; + ub4 strlen = sizeof(str); + if (OCIDateToText(err, &joe->start_date, FMT, sizeof(FMT)-1, LANG, + sizeof(LANG)-1, &strlen, str) != OCI_SUCCESS) + /o error handling code o/ + + */ + +/*--------------------------- OCIDateGetTime --------------------------------*/ +/* void OCIDateGetTime(/o_ const OCIDate *date, ub1 *hour, ub1 *min, + ub1 *sec _o/); */ +#define OCIDateGetTime(date, hour, min, sec) \ + { \ + *hour = (date)->OCIDateTime.OCITimeHH; \ + *min = (date)->OCIDateTime.OCITimeMI; \ + *sec = (date)->OCIDateTime.OCITimeSS; \ + } +/* + NAME: OCIDateGetTime - OCIDate Get Time portion of date + PARAMETERS: + date (IN) - Oracle date whose time data is retrieved + hour (OUT) - hour value returned + min (OUT) - minute value returned + sec (OUT) - second value returned + DESCRIPTION: + Return time inforamtion stored in the given date. The time + information returned is: hour, minute and seconds. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateGetDate --------------------------------*/ +/* void OCIDateGetDate(/o_ const OCIDate *date, sb2 *year, ub1 *month, + ub1 *day _o/); */ +#define OCIDateGetDate(date, year, month, day) \ + { \ + *year = (date)->OCIDateYYYY; \ + *month = (date)->OCIDateMM; \ + *day = (date)->OCIDateDD; \ + } +/* + NAME: OCIDateGetDate - OCIDate Get Date (year, month, day) portion of date + PARAMETERS: + date (IN) - Oracle date whose year, month, day data is retrieved + year (OUT) - year value returned + month (OUT) - month value returned + day (OUT) - day value returned + DESCRIPTION: + Return year, month, day inforamtion stored in the given date. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateSetTime --------------------------------*/ +/* void OCIDateSetTime(/o_ OCIDate *date, ub1 hour, ub1 min, + ub1 sec _o/); */ +#define OCIDateSetTime(date, hour, min, sec) \ + { \ + (date)->OCIDateTime.OCITimeHH = hour; \ + (date)->OCIDateTime.OCITimeMI = min; \ + (date)->OCIDateTime.OCITimeSS = sec; \ + } +/* + NAME: OCIDateSetTime - OCIDate Set Time portion of date + PARAMETERS: + date (OUT) - Oracle date whose time data is set + hour (IN) - hour value to be set + min (IN) - minute value to be set + sec (IN) - second value to be set + DESCRIPTION: + Set the date with the given time inforamtion. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateSetDate --------------------------------*/ +/* void OCIDateSetDate(/o_ OCIDate *date, sb2 year, ub1 month, ub1 day _o/); */ +#define OCIDateSetDate(date, year, month, day) \ + { \ + (date)->OCIDateYYYY = year; \ + (date)->OCIDateMM = month; \ + (date)->OCIDateDD = day; \ + } +/* + NAME: OCIDateSetDate - OCIDate Set Date (year, month, day) portion of date + PARAMETERS: + date (IN) - Oracle date whose year, month, day data is set + year (OUT) - year value to be set + month (OUT) - month value to be set + day (OUT) - day value to be set + DESCRIPTION: + Set the date with the given year, month, day inforamtion. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateAssign ---------------------------------*/ + +sword OCIDateAssign( OCIError *err, const OCIDate *from, + OCIDate *to ); +/* + NAME: OCIDateAssign - OCIDate Assignment + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + from (IN) - date to be assigned + to (OUT) - lhs of assignment + DESCRIPTION: + Performs date assignment. + RETURNS: + OCI_SUCCESS + */ + +/*--------------------------- OCIDateToText ---------------------------------*/ + +sword OCIDateToText( OCIError *err, const OCIDate *date, + const oratext *fmt, ub1 fmt_length, + const oratext *lang_name, ub4 lang_length, + ub4 *buf_size, oratext *buf ); +/* + NAME: OCIDateToText - OCIDate convert date TO String + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - Oracle date to be converted + fmt (IN) - conversion format, if null string pointer (oratext*)0, then + the date is converted to a character string in the + date format "DD-MON-YY". + fmt_length (IN) - length of the 'fmt' parameter + lang_name (IN) - specifies the language in which the names and + abbreviations of months and days are returned; + default language of session is used if 'lang_name' + is null i.e. (oratext *)0 + lang_length (IN) - length of the 'nls_params' parameter + buf_size (IN/OUT) - size of the buffer; size of the resulting string + is returned via this parameter + buf (OUT) - buffer into which the converted string is placed + DESCRIPTION: + Converts the given date to a string according to the specified format. + Refer to "TO_DATE" conversion function described in + "Oracle SQL Language Reference Manual" for a description of format + and NLS arguments. The converted null-terminated date string is + stored in the buffer 'buf'. + + An error is reported upon overflow, e.g. trying to convert a number + of value 10 using format '9' causes an overflow. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + invalid format + unknown language + overflow error + */ + +/*---------------------------- OCIDateFromText ------------------------------*/ + +sword OCIDateFromText( OCIError *err, const oratext *date_str, + ub4 d_str_length, const oratext *fmt, ub1 fmt_length, + const oratext *lang_name, ub4 lang_length, + OCIDate *date ); +/* + NAME: OCIDateFromText - OCIDate convert String TO Date + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date_str (IN) - input string to be converted to Oracle date + d_str_length (IN) - size of the input string, if the length is -1 + then 'date_str' is treated as a null terminated string + fmt (IN) - conversion format; if 'fmt' is a null pointer, then + the string is expected to be in 'DD-MON-YY' format. + fmt_length (IN) - length of the 'fmt' parameter + lang_name (IN) - language in which the names and abbreviations of + days and months are specified, if null i.e. (oratext *)0, + the default language of session is used, + lang_length (IN) - length of the 'lang_name' parameter + date (OUT) - given string converted to date + DESCRIPTION: + Converts the given string to Oracle date + according to the specified format. Refer to "TO_DATE" conversion + function described in "Oracle SQL Language Reference Manual" for a + description of format. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid format + unknown language + invalid input string + + */ + +/*----------------------------- OCIDateCompare ------------------------------*/ + +sword OCIDateCompare( OCIError *err, const OCIDate *date1, + const OCIDate *date2, sword *result ); +/* + NAME: OCIDateCompare - OCIDate CoMPare dates + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date1, date2 (IN) - dates to be compared + result (OUT) - comparison result, 0 if equal, -1 if date1 < date2, + 1 if date1 > date2 + DESCRIPTION: + The function OCIDateCompare compares two dates. It returns -1 if date1 + is smaller than date2, 0 if they are equal, and 1 if date1 is greater + than date2. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*------------------------- OCIDateAddMonths --------------------------------*/ + +sword OCIDateAddMonths( OCIError *err, const OCIDate *date, sb4 num_months, + OCIDate *result ); +/* + NAME: OCIDateAddMonths - OCIDate ADd or subtract Months + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - 'num_months' added or subtracted from 'date' + num_months (IN) - number of months to be added or subtracted + (a negative value will be subtracted) + result (IN/OUT) - result of adding or subtracting to 'date' + DESCRIPTION: + The function OCIDateAddDays adds or subtracts num_months from the + date 'date'. + If the input 'date' is the last day of a month, then + appropriate adjustments are made to ensure that the output date is + also the last day of the month. For example, Feb. 28 + 1 month = + March 31, and November 30 - 3 months = August 31. Otherwise the + 'result' date has the same day component as 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*--------------------------- OCIDateAddDays --------------------------------*/ + +sword OCIDateAddDays( OCIError *err, const OCIDate *date, sb4 num_days, + OCIDate *result ); +/* + NAME: OCIDateAddDays - OCIDate ADd or subtract Days + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - 'num_days' added or subtracted from 'date' + num_days (IN) - number of days to be added or subtracted + (a negative value will be subtracted) + result (IN/OUT) - result of adding or subtracting to 'date' + DESCRIPTION: + The function OCIDateAddDays adds or subtracts num_days from the + date 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*--------------------------- OCIDateLastDay --------------------------------*/ + +sword OCIDateLastDay( OCIError *err, const OCIDate *date, + OCIDate *last_day ); +/* + NAME: OCIDateLastDay - OCIDate get date of the LaST day of the month + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - input date + last_day (OUT) - last day of the month in date 'date' + DESCRIPTION: + The function OCIDateLastDay returns the date of the last day of the + month in date 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*----------------------- OCIDateDaysBetween --------------------------------*/ + +sword OCIDateDaysBetween( OCIError *err, const OCIDate *date1, + const OCIDate *date2, sb4 *num_days ); +/* + NAME: OCIDateDaysBetween - OCIDate get number of days BeTWeen two dates + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date1, date2 (IN) - input dates + num_days (OUT) - number of days between date1 and date2 + DESCRIPTION: + The function OCIDateDaysBetween returns the number of days between + date1 and date2. The time is ignored in this computation. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*------------------------ OCIDateZoneToZone --------------------------------*/ + +sword OCIDateZoneToZone( OCIError *err, const OCIDate *date1, + const oratext *zon1, + ub4 zon1_length, const oratext *zon2, + ub4 zon2_length, OCIDate *date2 ); +/* + NAME: OCIDateZoneToZone - OCIDate convert date from one Zone TO another Zone + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date1 (IN) - date to be converted + zon1 (IN) - zone of input date + zon1_length (IN) - length in bytes of string 'zon1' + zon2 (IN) - zone to be converted to + zon2_length (IN) - length in bytes of string 'zon2' + date2 (OUT) - converted date (in 'zon2') + DESCRIPTION: + Converts date from one time zone to another. Given date 'date1' + in time zone 'zon1' returns date 'date2' in time zone 'zon2'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invlid date + invald input time zone + invald output time zone + + */ + +/*--------------------------- OCIDateNextDay --------------------------------*/ + +sword OCIDateNextDay( OCIError *err, const OCIDate *date, + const oratext *day_p, ub4 day_length, + OCIDate *next_day ); +/* + NAME: OCIDateNextDay - OCIDate get date of Next DaY + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - returned date should be later than this date + day (IN) - first day of week named by this is returned + day_length (IN) - length in bytes of string 'day' + next_day (OUT) - first day of the week named by 'day' later than 'date' + DESCRIPTION: + Returns the date of the first day of the + week named by 'day' that is later than date 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + invalid day + + */ + +/*----------------------------- OCIDateCheck --------------------------------*/ + +/* Listing of error bits used by OCIDateCheck() */ +#define OCI_DATE_INVALID_DAY 0x1 /* Bad DAy */ +#define OCI_DATE_DAY_BELOW_VALID 0x2 /* Bad DAy Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_MONTH 0x4 /* Bad MOnth */ +#define OCI_DATE_MONTH_BELOW_VALID 0x8 /* Bad MOnth Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_YEAR 0x10 /* Bad YeaR */ +#define OCI_DATE_YEAR_BELOW_VALID 0x20 /* Bad YeaR Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_HOUR 0x40 /* Bad HouR */ +#define OCI_DATE_HOUR_BELOW_VALID 0x80 /* Bad HouR Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_MINUTE 0x100 /* Bad MiNute */ +#define OCI_DATE_MINUTE_BELOW_VALID 0x200 + /* Bad MiNute Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_SECOND 0x400 /* Bad SeCond */ +#define OCI_DATE_SECOND_BELOW_VALID 0x800 + /* bad second Low/high bit (1=low)*/ +#define OCI_DATE_DAY_MISSING_FROM_1582 0x1000 + /* Day is one of those "missing" from 1582 */ +#define OCI_DATE_YEAR_ZERO 0x2000 /* Year may not equal zero */ +#define OCI_DATE_INVALID_FORMAT 0x8000 /* Bad date format input */ + +sword OCIDateCheck( OCIError *err, const OCIDate *date, uword *valid ); +/* + NAME: OCIDateCheck - OCIDate CHecK if the given date is valid + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - date to be checked + valid (OUT) - returns zero for a valid date, otherwise + the ORed combination of all error bits specified below: + + Macro name Bit number Error + ---------- ---------- ----- + OCI_DATE_INVALID_DAY 0x1 Bad day + OCI_DATE_DAY_BELOW_VALID 0x2 Bad DAy Low/high bit (1=low) + OCI_DATE_INVALID_MONTH 0x4 Bad MOnth + OCI_DATE_MONTH_BELOW_VALID 0x8 Bad MOnth Low/high bit (1=low) + OCI_DATE_INVALID_YEAR 0x10 Bad YeaR + OCI_DATE_YEAR_BELOW_VALID 0x20 Bad YeaR Low/high bit (1=low) + OCI_DATE_INVALID_HOUR 0x40 Bad HouR + OCI_DATE_HOUR_BELOW_VALID 0x80 Bad HouR Low/high bit (1=low) + OCI_DATE_INVALID_MINUTE 0x100 Bad MiNute + OCI_DATE_MINUTE_BELOW_VALID 0x200 Bad MiNute Low/high bit (1=low) + OCI_DATE_INVALID_SECOND 0x400 Bad SeCond + OCI_DATE_SECOND_BELOW_VALID 0x800 bad second Low/high bit (1=low) + OCI_DATE_DAY_MISSING_FROM_1582 0x1000 Day is one of those "missing" + from 1582 + OCI_DATE_YEAR_ZERO 0x2000 Year may not equal zero + OCI_DATE_INVALID_FORMAT 0x8000 Bad date format input + + So, for example, if the date passed in was 2/0/1990 25:61:10 in + (month/day/year hours:minutes:seconds format), the erroor returned + would be OCI_DATE_INVALID_DAY | OCI_DATE_DAY_BELOW_VALID | + OCI_DATE_INVALID_HOUR | OCI_DATE_INVALID_MINUTE + + DESCRIPTION: + Check if the given date is valid. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'date' and 'valid' pointers are NULL pointers + */ + +/*--------------------------- OCIDateSysDate --------------------------------*/ + +sword OCIDateSysDate( OCIError *err, OCIDate *sys_date ); +/* + NAME: OCIDateSysDate - OCIDate get current SYStem date and time + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + sys_date (OUT) - current system date and time + DESCRIPTION: + Returns the current system date and time. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + + */ + +/*****************************************************************************/ +/* FIXED-LENGTH STRING - CHAR (N) */ +/*****************************************************************************/ + +/* + * An ADT attribute declared as "x CHAR(n)" is mapped to "OCIString *x;". + * The representation of OCIString * is shown below. + */ + +/*****************************************************************************/ +/* VARIABLE-LENGTH STRING */ +/*****************************************************************************/ + +/* + * The variable-length string is represented in C as a pointer to OCIString + * structure. The OCIString structure is opaque to the user. Functions are + * provided to allow the user to manipulate a variable-length string. + * + * A variable-length string can be declared as: + * + * OCIString *vstr; + * + * For binding variables of type OCIString* in OCI calls (OCIBindByName(), + * OCIBindByPos() and OCIDefineByPos()) use the external type code SQLT_VST. + */ +typedef struct OCIString OCIString; + +/*-------------------------- OCIStringAssign --------------------------------*/ + +sword OCIStringAssign( OCIEnv *env, OCIError *err, const OCIString *rhs, + OCIString **lhs ); +/* + NAME: OCIStringAssign - OCIString Assign String to String + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is also OCIString + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' string to 'lhs' string. The 'lhs' string may be + resized depending upon the size of the 'rhs'. The assigned string is + null-terminated. The 'length' field will not include the extra byte + needed for null termination. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*---------------------- OCIStringAssignText --------------------------------*/ + +sword OCIStringAssignText( OCIEnv *env, OCIError *err, const oratext *rhs, + ub4 rhs_len, OCIString **lhs ); +/* + NAME: OCIStringAssignText - OCIString Assign Text string to String + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is a text string + rhs_len (IN) - length of the 'rhs' string + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' string to 'lhs' string. The 'lhs' string may be + resized depending upon the size of the 'rhs'. The assigned string is + null-terminated. The 'length' field will not include the extra byte + needed for null termination. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*-------------------------- OCIStringResize --------------------------------*/ + +sword OCIStringResize( OCIEnv *env, OCIError *err, ub4 new_size, + OCIString **str ); +/* + NAME: OCIStringResize - OCIString ReSiZe string memory + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + new_size (IN) - new memory size of the string in bytes + str (IN/OUT) - allocated memory for the string is freed from the + OOCI heap + DESCRIPTION: + This function resizes the memory of the given variable-length string in + the object cache. The contents of the string are NOT preserved. + This function may allocate the string in a new memory region in + which case the original memory occupied by the given string will + be freed. If the input string is null (str == NULL), then this + function will allocate memory for the string. + + If the new_size is 0, then this function frees the memory occupied + by 'str' and a null pointer value is returned. + + NOTE: The caller must compute 'new_size' taking into account space + for the null character ('\0'). + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*---------------------------- OCIStringSize --------------------------------*/ + +ub4 OCIStringSize( OCIEnv *env, const OCIString *vs ); +/* + NAME: OCIStringSize - OCIString Get String siZe + PARAMETERS: + env(IN) - pointer to OCI environment handle + vs (IN) - string whose size is returned + DESCRIPTION: + Return the size of the given string. + RETURNS: + size of the string in bytes is returned + */ + +/*----------------------------- OCIStringPtr --------------------------------*/ + +oratext *OCIStringPtr( OCIEnv *env, const OCIString *vs ); +/* + NAME: OCIStringPtr - OCIString Get String Pointer + PARAMETERS: + env(IN) - pointer to OCI environment handle + vs (IN) - pointer to the text of this string is returned + DESCRIPTION: + Return the pointer to the text of the given string. + RETURNS: + pointer to the text of the string is returned + */ + +/*----------------------- OCIStringAllocSize --------------------------------*/ + +sword OCIStringAllocSize( OCIEnv *env, OCIError *err, const OCIString *vs, + ub4 *allocsize ); +/* + NAME: OCIStringAllocSize - OCIString get Allocated SiZe of string memory + in bytes + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + vs (IN) - string whose allocated size in bytes is returned + allocsize (OUT) - allocated size of string memory in bytes is returned + DESCRIPTION: + Return the allocated size of the string memory in bytes. The + allocated size is >= actual string size. + REQUIRES: + vs is a non-null pointer + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR on error + */ + +/*****************************************************************************/ +/* VARIABLE-LENGTH RAW */ +/*****************************************************************************/ + +/* + * The variable-length raw is represented in C as a pointer to OCIRaw + * structure. The OCIRaw structure is opaque to the user. Functions are + * provided to allow the user to manipulate a variable-length raw. + * + * A variable-length raw can be declared as: + * + * OCIRaw *raw; + * + * For binding variables of type OCIRaw* in OCI calls (OCIBindByName(), + * OCIBindByPos() and OCIDefineByPos()) use the external type code SQLT_LVB. + */ +typedef struct OCIRaw OCIRaw; + +/*-------------------------- OCIRawAssignRaw --------------------------------*/ + +sword OCIRawAssignRaw( OCIEnv *env, OCIError *err, const OCIRaw *rhs, + OCIRaw **lhs ); +/* + NAME: OCIRawAssignRaw - OCIRaw Assign Raw (of type OCIRaw*) to + Raw (of type OCIRaw*) + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is also OCIRaw + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' raw to 'lhs' raw. The 'lhs' raw may be + resized depending upon the size of the 'rhs'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*------------------------ OCIRawAssignBytes --------------------------------*/ + +sword OCIRawAssignBytes( OCIEnv *env, OCIError *err, const ub1 *rhs, + ub4 rhs_len, OCIRaw **lhs ); +/* + NAME: OCIRawAssignBytes - OCIRaw Assign raw Bytes (of type ub1*) to Raw + (of type OCIRaw*) + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is ub1 * + rhs_len (IN) - length of the 'rhs' raw + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' raw to 'lhs' raw. The 'lhs' raw may be + resized depending upon the size of the 'rhs'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*---------------------------- OCIRawResize ---------------------------------*/ + +sword OCIRawResize( OCIEnv *env, OCIError *err, ub4 new_size, + OCIRaw **raw ); +/* + NAME: OCIRawResize - OCIRaw ReSiZe memory of variable-length raw + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + new_size (IN) - new size of the raw data in bytes + raw (IN) - variable-length raw pointer; the raw is + resized to 'new_size' + DESCRIPTION: + This function resizes the memory of the given variable-length raw in + the object cache. + The previous contents of the raw are NOT preserved. + This function may allocate the raw in a new memory region in + which case the original memory occupied by the given raw will + be freed. If the input raw is null (raw == NULL), then this + function will allocate memory for the raw data. + + If the new_size is 0, then this function frees the memory occupied + by 'raw' and a null pointer value is returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*------------------------------- OCIRawSize --------------------------------*/ + +ub4 OCIRawSize( OCIEnv * env, const OCIRaw *raw ); +/* + NAME: OCIRawSize - OCIRaw Get Raw siZe + PARAMETERS: + env (IN) - pointer to OCI environment handle + raw (INT) - raw whose size is returned + DESCRIPTION: + Return the size of the given raw. + RETURNS: + size of the raw in bytes is returned + */ + +/*--------------------------------- OCIRawPtr -------------------------------*/ +ub1 *OCIRawPtr( OCIEnv * env, const OCIRaw *raw ); +/* + NAME: OCIRawPtr - OCIRaw Get Raw data Pointer + PARAMETERS: + env (IN) - pointer to OCI environment handle + raw (IN) - pointer to the data of this raw is returned + DESCRIPTION: + Return the pointer to the data of the given raw. + RETURNS: + pointer to the data of the raw is returned + */ + +/*------------------------------ OCIRawAllocSize ----------------------------*/ + +sword OCIRawAllocSize( OCIEnv *env, OCIError *err, const OCIRaw *raw, + ub4 *allocsize ); +/* + NAME: OCIRawAllocSize - OCIRaw get Allocated SiZe of raw memory in bytes + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + raw (IN) - raw whose allocated size in bytes is returned + allocsize (OUT) - allocated size of raw memory in bytes is returned + DESCRIPTION: + Return the allocated size of the raw memory in bytes. The + allocated size is >= actual raw size. + REQUIRES: + raw is a non-null pointer + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR upon error + */ + +/*****************************************************************************/ +/* OBJECT REFERENCE OPERATIONS */ +/*****************************************************************************/ + +/* + * See the definition of OCIRef in oro.h. + * + * For binding variables of type OCIRef* in OCI calls (OCIBindByName(), + * OCIBindByPos() and OCIDefineByPos()) use the code SQLT_REF. + * + */ + +/*---------------------------- OCIRefClear ----------------------------------*/ +void OCIRefClear( OCIEnv *env, OCIRef *ref ); +/* + NAME: OCIRefClear - OCIRef CLeaR or nullify a ref + PARAMETERS: + env (IN) - pointer to OCI environment handle + ref (IN/OUT) - ref to clear + DESCRIPTION: + Clear or nullify the given ref. A ref is considered to be a null ref + if it does not contain a valid OID (and thus doesn't point to an + object). Logically, a null ref is a dangling ref. + + Note that a null ref is still a valid SQL value and is not SQL-ly null. + It can be used as a valid non-null constant ref value for NOT NULL + column or attribute of a row in a table. + + If a null pointer value is passed as a ref, + then this function is a no-op. + */ + +/*--------------------------- OCIRefAssign ----------------------------------*/ +sword OCIRefAssign( OCIEnv *env, OCIError *err, const OCIRef *source, + OCIRef **target ); +/* + NAME: OCIRefAssign - OCIRef CoPY a ref to another + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + source (IN) - ref to copy from + target (IN/OUT) - ref to copy to + DESCRIPTION: + Copy 'source' ref to 'target' ref; both then reference the same + object. If the target ref pointer is null (i.e. *target == NULL) + then the copy function will allocate memory for the target ref + in OOCI heap prior to the copy. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + 1) out of memory + */ + +/*-------------------------- OCIRefIsEqual ----------------------------------*/ +boolean OCIRefIsEqual( OCIEnv *env, const OCIRef *x, const OCIRef *y ); +/* + NAME: OCIRefIsEqual - OCIRef compare two refs for EQUality + PARAMETERS: + env (IN) - pointer to OCI environment handle + x (IN) - ref to compare + y (IN) - ref to compare + DESCRIPTION: + Compare the given refs for equality. + Two refs are equal if and only if: + - they are both referencing the same persistent object, or + - they are both referencing the same transient object. + + NOTE THAT TWO NULL REFS ARE CONSIDERED NOT EQUAL BY THIS FUNCTION. + RETURNS: + TRUE if the two refs are equal + FALSE if the two refs are not equal, or X is NULL, or Y is NULL + */ + +/*--------------------------- OCIRefIsNull ----------------------------------*/ +boolean OCIRefIsNull( OCIEnv *env, const OCIRef *ref ); +/* + NAME: OCIRefIsNull - OCIRef test if a ref is NULl + PARAMETERS: + env (IN) - pointer to OCI environment handle + ref (IN) - ref to test for null + DESCRIPTION: + Return TRUE if the given ref is null; otherwise, return FALSE. + A ref is null if and only if: + - it is supposed to be referencing a persistent object, but + its OID is null, or + - it is supposed to be referencing a transient object, but it is + currently not pointing to an object. + A ref is a dangling ref if the object that it points to does not + exist. + RETURNS: + TRUE if the given ref is NULL + FALSE if the given ref is not NULL + */ + +/*-------------------------- OCIRefHexSize ----------------------------------*/ +ub4 OCIRefHexSize( OCIEnv *env, const OCIRef *ref ); +/* + NAME: OCIRefHexSize - OCIRef Hexadecimal buffer SiZe in bytes + PARAMETERS: + env (IN) - pointer to OCI environment handle + ref (IN) - ref whose size in hexadecimal representation in bytes is + returned + DESCRIPTION: + Return the size of the buffer in bytes required for the hexadecimal + representation of the ref. A buffer of at-least this size must be + passed to ref-to-hex (OCIRefToHex) conversion function. + RETURNS: + size of hexadecimal representation of ref + */ + +/*-------------------------- OCIRefFromHex ---------------------------------*/ +sword OCIRefFromHex( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + const oratext *hex, ub4 length, OCIRef **ref ); +/* + NAME: + OCIRefFromHex - OCIRef convert a Hexadecimal string TO a Ref + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + svc (IN) - OCI service context handle; if the resulting ref is + initialized with this service context + hex (IN) - hexadecimal string (that was produced by 'OCIRefToHex()" + previously) to be convert into a ref + length (IN) - length of the hexadecimal string + ref (IN/OUT) - ref is initialized with the given value ('hex'). + If *ref is null, then space for the ref is allocated in the + object cache, otherwise the memory occupied by the given ref + is re-used. + DESCRIPTION: + Convert the given hexadecimal string into a ref. This function + ensures that the resulting ref is well formed. It does NOT ensure + that the object pointed to by the resulting ref exists or not. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + */ + +/*--------------------------- OCIRefToHex -----------------------------------*/ +sword OCIRefToHex( OCIEnv *env, OCIError *err, const OCIRef *ref, + oratext *hex, ub4 *hex_length ); +/* + NAME: + OCIRefToHex - OCIRef convert ref to a Hexadecimal string + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + ref (IN) - ref to be converted into a hexadecimal string; if the + ref is a null ref (i.e. OCIRefIsNull(ref) == TRUE) then + a zero hex_length value is returned + hex (OUT) - buffer that is large enough to contain the resulting + hexadecimal string; the contents of the string is opaque + to the caller + hex_length (IN/OUT) - on input specifies the size of the 'hex' buffer, + on output specifies the actual size of the hexadecimal + string being returned in 'hex' + DESCRIPTION: + Convert the given ref into a hexadecimal string, and return the length + of the string. The resulting string is opaque to the caller. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + the given buffer is not big enough to hold the resulting string + */ + + +/*****************************************************************************/ +/* COLLECTION FUNCTIONS */ +/*****************************************************************************/ + +/* + The generic collection is represented by the type 'OCIColl'. The following + operations OCIColl*() are provided on a generic collection: + - get current size of collection + - get upper bound of collection + - get pointer to an element given its index + - set element at given index (assign element) + - append an element + - trim the given number of elements from the end of the collection + - collection assignment + + The following iterator based scanning functions are also provided on a + generic collection. These functions make use of an iterator which is + defined to be of type OCIIter. + + - create an iterator for scanning collection + - destroy iterator + - reset iterator to the beginning of collection + - get pointer to current element pointed by iterator + - get pointer to next element + - get pointer to previous element + + The collections variable-length array (varray) and nested table + are sub-types of generic collection. This means that the OCIColl*() + functions can also be used to manipulate varray and nested table. + + The varray is represented by OCIArray type and nested table by OCITable. + Besides OCIColl*() functions no additional functions are provided for + manipulating varrays. The OCIColl*() functions are a complete set of + functions to manipulate varrays. + + Besides OCIColl*() functions, the following functions OCITable*() can be + used to manipulate nested table. The OCITable*() functions operate on + nested tables only and should not be used on a varray. + + - delete an element at index i. Note that the position + ordinals of the remaining elements of the table is not changed by the + delete operation. So delete creates "holes" in the table. + - check if an element exists at the given index i + - return the smallest value of i for which exists(i) is true + - return the largest value of i for which exists(i) is true + - return pointer to the smallest position j, greater than i, such that + OCITableExists(j) is true + - return pointer to the largest position j, less than i, such that + OCITableExists(j) is true + + For binding variables of type OCIColl* or OCITable* in OCI calls + (OCIBindByName(), OCIBindByPos() and OCIDefineByPos()) use the external + type code SQLT_NTY. + */ + +/* OCIColl - generic collection type */ +typedef struct OCIColl OCIColl; + +/* OCIArray - varray collection type */ +typedef OCIColl OCIArray; + +/* OCITable - nested table collection type */ +typedef OCIColl OCITable; + +/* OCIIter - collection iterator */ +typedef struct OCIIter OCIIter; + +/*----------------------------- OCICollSize ---------------------------------*/ + +sword OCICollSize( OCIEnv *env, OCIError *err, const OCIColl *coll, + sb4 *size ); +/* + NAME: OCICollSize - OCIColl return current SIZe of the given collection + PARAMETERS: + env(IN) - pointer to OCI environment handle + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection whose number of elements is returned + size (OUT) - current number of elements in the collection + DESCRIPTION: + Returns the current number of elements in the given collection. + + For collections of type nested table wherein 'delete element' + operation is allowed, the count returned by OCICollSize() will + NOT be decremented upon deleting elements. For example: + + OCICollSize(...); + // assume 'size' returned is equal to 5 + OCITableDelete(...); // delete one element + OCICollSize(...); + // 'size' returned will still be 5 + + To get the count minus the deleted elements use OCITableSize(). + Continuing the above example, + + OCITableSize(...) + // 'size' returned will be equal to 4 + + Note, a trim operation (OCICollTrim) will decrement the count + by the number of trimmed elements. Continuing the above example, + + OCICollTrim(..,1..); // trim one element + OCICollSize(...); + // 'size' returned will be equal to 4 + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + error during loading of collection into object cache + any of the input parameters is null + */ + +/*------------------------------ OCICollMax ---------------------------------*/ + +sb4 OCICollMax( OCIEnv *env, const OCIColl *coll ); +/* + NAME: OCICollMax - OCIColl return MAXimum size (upper-bound) of the + given collection (in number of elements) + PARAMETERS: + env(IN) - pointer to OCI environment handle + coll (IN) - collection whose upper-bound in number of elements + is returned + DESCRIPTION: + Returns the max number of elements that the given collection can hold. + A value 0 indicates that the collection has no upper-bound. + REQUIRES: + coll must point to a valid collection descriptor + RETURNS: + upper-bound of the given collection + */ + +/*-------------------------- OCICollGetElem ---------------------------------*/ + +sword OCICollGetElem( OCIEnv *env, OCIError *err, const OCIColl *coll, + sb4 index, boolean *exists, void **elem, + void **elemind ); +/* + NAME: OCICollGetElem - OCIColl GET pointer to the element at the given index + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - pointer to the element in this collection is returned + index (IN) - index of the element whose pointer is returned + exists (OUT) - set to FALSE if element at the specified index does + not exist else TRUE + elem (OUT) - address of the desired element is returned + elemind (OUT) [optional] - address of the null indicator information + is returned; if (elemind == NULL) then the null indicator + information will NOT be returned + DESCRIPTION: + Get the address of the element at the given position. Optionally + this function also returns the address of the element's null indicator + information. + + The following table describes for each collection element type + what the corresponding element pointer type is. The element pointer + is returned via the 'elem' parameter of OCICollGetElem(). + + Element Type *elem is set to + ----------------------- --------------- + Oracle Number (OCINumber) OCINumber* + Date (OCIDate) OCIDate* + Variable-length string (OCIString*) OCIString** + Variable-length raw (OCIRaw*) OCIRaw** + object reference (OCIRef*) OCIRef** + lob locator (OCILobLocator*) OCILobLocator** + object type (e.g. person) person* + + The element pointer returned by OCICollGetElem() is in a form + such that it can not only be used to access the + element data but also is in a form that can be used as the target + (i.e left-hand-side) of an assignment statement. + + For example, assume the user is iterating over the elements of + a collection whose element type is object reference (OCIRef*). A call + to OCICollGetElem() returns pointer to a reference handle + (i.e. OCIRef**). After getting, the pointer to the collection + element, the user may wish to modify it by assigning a new reference. + This can be accomplished via the ref assignment function shown below: + + sword OCIRefAssign( OCIEnv *env, OCIError *err, const OCIRef *source, + OCIRef **target ); + + Note that the 'target' parameter of OCIRefAssign() is of type + 'OCIRef**'. Hence OCICollGetElem() returns 'OCIRef**'. + If '*target == NULL' a new ref will be allocated by OCIRefAssign() + and returned via the 'target' parameter. + + Similarly, if the collection element was of type string (OCIString*), + OCICollGetElem() returns pointer to string handle + (i.e. OCIString**). If a new string is assigned, via + OCIStringAssign() or OCIStringAssignText() the type of the target + must be 'OCIString **'. + + If the collection element is of type Oracle number, OCICollGetElem() + returns OCINumber*. The prototype of OCINumberAssign() is shown below: + + sword OCINumberAssign(OCIError *err, const OCINumber *from, + OCINumber *to); + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------- OCICollGetElemArray -----------------------------*/ + +sword OCICollGetElemArray( OCIEnv *env, OCIError *err, const OCIColl *coll, + sb4 index, boolean *exists, void **elem, + void **elemind, uword *nelems); +/* + NAME: OCICollGetElemArray - OCIColl GET pointers to elements from given index + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - pointers to the elements in this collection is returned + index (IN) - starting index of the element + exists (OUT) - set to FALSE if element at the specified index does + not exist else TRUE + elem (OUT) - address of the desired elements is returned + elemind (OUT) [optional] - address of the null indicators information + is returned; if (elemind == NULL) then the null indicator + information will NOT be returned + nelems(IN/OUT) - Upper bound of elem and/or elemind array + DESCRIPTION: + Get the address of the elements from the given position. Optionally + this function also returns the address of the element's null indicator + information. + + The following table describes for each collection element type + what the corresponding element pointer type is. The element pointer + is returned via the 'elem' parameter of OCICollGetElem(). + + Element Type *elem is set to + ----------------------- --------------- + Oracle Number (OCINumber) OCINumber* + Date (OCIDate) OCIDate* + Variable-length string (OCIString*) OCIString** + Variable-length raw (OCIRaw*) OCIRaw** + object reference (OCIRef*) OCIRef** + lob locator (OCILobLocator*) OCILobLocator** + object type (e.g. person) person* + + The element pointer returned by OCICollGetElem() is in a form + such that it can not only be used to access the + element data but also is in a form that can be used as the target + (i.e left-hand-side) of an assignment statement. + + For example, assume the user is iterating over the elements of + a collection whose element type is object reference (OCIRef*). A call + to OCICollGetElem() returns pointer to a reference handle + (i.e. OCIRef**). After getting, the pointer to the collection + element, the user may wish to modify it by assigning a new reference. + This can be accomplished via the ref assignment function shown below: + + sword OCIRefAssign( OCIEnv *env, OCIError *err, const OCIRef *source, + OCIRef **target ); + + Note that the 'target' parameter of OCIRefAssign() is of type + 'OCIRef**'. Hence OCICollGetElem() returns 'OCIRef**'. + If '*target == NULL' a new ref will be allocated by OCIRefAssign() + and returned via the 'target' parameter. + + Similarly, if the collection element was of type string (OCIString*), + OCICollGetElem() returns pointer to string handle + (i.e. OCIString**). If a new string is assigned, via + OCIStringAssign() or OCIStringAssignText() the type of the target + must be 'OCIString **'. + + If the collection element is of type Oracle number, OCICollGetElem() + returns OCINumber*. The prototype of OCINumberAssign() is shown below: + + sword OCINumberAssign(OCIError *err, const OCINumber *from, + OCINumber *to); + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*----------------------- OCICollAssignElem ---------------------------------*/ + +sword OCICollAssignElem( OCIEnv *env, OCIError *err, sb4 index, + const void *elem, + const void *elemind, OCIColl *coll ); +/* + NAME: OCICollAssignElem - OCIColl ASsign Element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - index of the element whose is assigned to + elem (IN) - element which is assigned from (source element) + elemind (IN) [optional] - pointer to the element's null indicator + information; if (elemind == NULL) then the null indicator + information of the assigned element will be set to non-null. + coll (IN/OUT) - collection to be updated + DESCRIPTION: + Assign the given element value 'elem' to the element at coll[index]. + If the collection is of type nested table, the element at the given + index may not exist (i.e. may have been deleted). In this case, the + given element is inserted at index 'index'. + Otherwise, the element at index 'index' is updated with the value + of 'elem'. + + Note that the given element is deep-copied and + 'elem' is strictly an input parameter. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + given index is out of bounds of the given collection + */ + +/*--------------------------- OCICollAssign ---------------------------------*/ + +sword OCICollAssign( OCIEnv *env, OCIError *err, const OCIColl *rhs, + OCIColl *lhs ); +/* + NAME: OCICollAssign - OCIColl ASsiGn collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - collection to be assigned from + lhs (OUT) - collection to be assigned to + DESCRIPTION: + Assign 'rhs' to 'lhs'. The 'lhs' collection may be decreased or + increased depending upon the size of 'rhs'. If the 'lhs' contains + any elements then the elements will be deleted prior to the + assignment. This function performs a deep-copy. The memory for the + elements comes from the object cache. + + An error is returned if the element types of the lhs and rhs + collections do not match. Also, an error is returned if the + upper-bound of the lhs collection is less than the current number of + elements in the rhs collection. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + type mis-match of lhs and rhs collections + upper-bound of lhs collection is less than the current number of + elements in the rhs collection + */ + +/*--------------------------- OCICollAppend ---------------------------------*/ + +sword OCICollAppend( OCIEnv *env, OCIError *err, const void *elem, + const void *elemind, OCIColl *coll ); +/* + NAME: OCICollAppend - OCIColl APPend collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the element which is appended to the end + of the given collection + elemind (IN) [optional] - pointer to the element's null indicator + information; if (elemind == NULL) then the null indicator + information of the appended element will be set to non-null. + coll (IN/OUT) - updated collection + DESCRIPTION: + Append the given element to the end of the given collection. + Appending an element is equivalent to: + - increasing the size of the collection by 1 element + - updating (deep-copying) the last element's data with the given + element's data + + Note that the pointer to the given element 'elem' will not be saved + by this function. So 'elem' is strictly an input parameter. + An error is returned if the current size of the collection + is equal to the max size (upper-bound) of the collection prior to + appending the element. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + current size of collection == max size of the collection + */ + +/*----------------------------- OCICollTrim ---------------------------------*/ + +sword OCICollTrim( OCIEnv *env, OCIError *err, sb4 trim_num, + OCIColl *coll ); +/* + NAME: OCICollTrim - OCIColl Trim elements from the end of the collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + trim_num (IN) - number of elements to trim + coll (IN/OUT) - 'trim_num' of elements are removed (freed) from the + end of the collection + DESCRIPTION: + Trim the collection by the given number of elements. The elements are + removed from the end of the collection. + + An error is returned if the 'trim_num' is greater than the current + size of the collection. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + 'trim_num' is greater than the current size of the collection. + */ + +/*--------------------------- OCICollIsLocator ------------------------------*/ + +sword OCICollIsLocator(OCIEnv *env, OCIError *err, const OCIColl *coll, + boolean *result ); +/* +Name: OCICollIsLocator - OCIColl indicates whether a collection is locator + based or not. +Parameters: + env(IN) - pointer to OCI environment handle + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection item. + result (OUT) - TRUE if the collection item is a locator, FALSE + otherwise +Description: + Returns TRUE in the result OUT parameter if the collection item is a + locator, otherwise returns FALSE. +Returns: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. +*/ + +/*---------------------------- OCIIterCreate --------------------------------*/ + +sword OCIIterCreate( OCIEnv *env, OCIError *err, const OCIColl *coll, + OCIIter **itr ); +/* + NAME: OCIIterCreate - OCIColl Create an ITerator to scan the collection + elements + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection which will be scanned; the different + collection types are varray and nested table + itr (OUT) - address to the allocated collection iterator is + returned by this function + DESCRIPTION: + Create an iterator to scan the elements of the collection. The + iterator is created in the object cache. The iterator is initialized + to point to the beginning of the collection. + + If the next function (OCIIterNext) is called immediately + after creating the iterator then the first element of the collection + is returned. + If the previous function (OCIIterPrev) is called immediately after + creating the iterator then "at beginning of collection" error is + returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + */ + +/*----------------------------- OCIIterDelete ------------------------------*/ + +sword OCIIterDelete( OCIEnv *env, OCIError *err, OCIIter **itr ); +/* + NAME: OCIIterDelete - OCIColl Delete ITerator + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN/OUT) - the allocated collection iterator is destroyed and + the 'itr' is set to NULL prior to returning + DESCRIPTION: + Delete the iterator which was previously created by a call to + OCIIterCreate. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + to be discovered + */ + +/*----------------------------- OCIIterInit ---------------------------------*/ + +sword OCIIterInit( OCIEnv *env, OCIError *err, const OCIColl *coll, + OCIIter *itr ); +/* + NAME: OCIIterInit - OCIColl Initialize ITerator to scan the given + collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection which will be scanned; the different + collection types are varray and nested table + itr (IN/OUT) - pointer to an allocated collection iterator + DESCRIPTION: + Initializes the given iterator to point to the beginning of the + given collection. This function can be used to: + + a. reset an iterator to point back to the beginning of the collection + b. reuse an allocated iterator to scan a different collection + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------ OCIIterGetCurrent --------------------------------*/ + +sword OCIIterGetCurrent( OCIEnv *env, OCIError *err, const OCIIter *itr, + void **elem, void **elemind ); +/* + NAME: OCIIterGetCurrent - OCIColl Iterator based, get CURrent collection + element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN) - iterator which points to the current element + elem (OUT) - address of the element pointed by the iterator is returned + elemind (OUT) [optional] - address of the element's null indicator + information is returned; if (elemind == NULL) then the null + indicator information will NOT be returned + DESCRIPTION: + Returns pointer to the current element and its corresponding null + information. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------------ OCIIterNext --------------------------------*/ + +sword OCIIterNext( OCIEnv *env, OCIError *err, OCIIter *itr, + void **elem, void **elemind, boolean *eoc ); +/* + NAME: OCIIterNext - OCIColl Iterator based, get NeXT collection element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN/OUT) - iterator is updated to point to the next element + elem (OUT) - after updating the iterator to point to the next element, + address of the element is returned + elemind (OUT) [optional] - address of the element's null indicator + information is returned; if (elemind == NULL) then the null + indicator information will NOT be returned + eoc (OUT) - TRUE if iterator is at End Of Collection (i.e. next + element does not exist) else FALSE + DESCRIPTION: + Returns pointer to the next element and its corresponding null + information. The iterator is updated to point to the next element. + + If the iterator is pointing to the last element of the collection + prior to executing this function, then calling this function will + set eoc flag to TRUE. The iterator will be left unchanged in this + situation. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------------ OCIIterPrev --------------------------------*/ + +sword OCIIterPrev( OCIEnv *env, OCIError *err, OCIIter *itr, + void **elem, void **elemind, boolean *boc ); +/* + NAME: OCIIterPrev - OCIColl Iterator based, get PReVious collection element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN/OUT) - iterator is updated to point to the previous + element + elem (OUT) - after updating the iterator to point to the previous + element, address of the element is returned + elemind (OUT) [optional] - address of the element's null indicator + information is returned; if (elemind == NULL) then the null + indicator information will NOT be returned + boc (OUT) - TRUE if iterator is at Beginning Of Collection (i.e. + previous element does not exist) else FALSE. + DESCRIPTION: + Returns pointer to the previous element and its corresponding null + information. The iterator is updated to point to the previous element. + + If the iterator is pointing to the first element of the collection + prior to executing this function, then calling this function will + set 'boc' to TRUE. The iterator will be left unchanged in this + situation. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*****************************************************************************/ +/* FUNCTIONS WHICH OPERATE ONLY ON NESTED TABLE OCITable*() */ +/*****************************************************************************/ + +/*---------------------------- OCITableSize ---------------------------------*/ + +sword OCITableSize( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 *size); +/* + NAME: OCITableSize - OCITable return current SIZe of the given + nested table (not including deleted elements) + PARAMETERS: + env(IN) - pointer to OCI environment handle + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - nested table whose number of elements is returned + size (OUT) - current number of elements in the nested table. The count + does not include deleted elements. + DESCRIPTION: + Returns the count of elements in the given nested table. + + The count returned by OCITableSize() will be decremented upon + deleting elements from the nested table. So, this count DOES NOT + includes any "holes" created by deleting elements. + For example: + + OCITableSize(...); + // assume 'size' returned is equal to 5 + OCITableDelete(...); // delete one element + OCITableSize(...); + // 'size' returned will be equal to 4 + + To get the count plus the count of deleted elements use + OCICollSize(). Continuing the above example, + + OCICollSize(...) + // 'size' returned will still be equal to 5 + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + error during loading of nested table into object cache + any of the input parameters is null + */ + +/*---------------------- OCITableExists ---------------------------------*/ + +sword OCITableExists( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 index, boolean *exists ); +/* + NAME: OCITableExists - OCITable test whether element at the given index + EXIsts + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - table in which the given index is checked + index (IN) - index of the element which is checked for existence + exists (OUT) - set to TRUE if element at given 'index' exists + else set to FALSE + DESCRIPTION: + Test whether an element exists at the given 'index'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*--------------------------- OCITableDelete -------------------------------*/ + +sword OCITableDelete( OCIEnv *env, OCIError *err, sb4 index, + OCITable *tbl ); +/* + NAME: OCITableDelete - OCITable DELete element at the specified index + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - index of the element which must be deleted + tbl (IN) - table whose element is deleted + DESCRIPTION: + Delete the element at the given 'index'. Note that the position + ordinals of the remaining elements of the table is not changed by the + delete operation. So delete creates "holes" in the table. + + An error is returned if the element at the specified 'index' has + been previously deleted. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + given index is not valid + */ + +/*--------------------------- OCITableFirst ---------------------------------*/ + +sword OCITableFirst( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 *index ); +/* + NAME: OCITableFirst - OCITable return FirST index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - table which is scanned + index (OUT) - first index of the element which exists in the given + table is returned + DESCRIPTION: + Return the first index of the element which exists in the given + table. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + table is empty + */ + +/*---------------------------- OCITableLast ---------------------------------*/ + +sword OCITableLast( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 *index ); +/* + NAME: OCITableFirst - OCITable return LaST index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - table which is scanned + index (OUT) - last index of the element which exists in the given + table is returned + DESCRIPTION: + Return the last index of the element which exists in the given + table. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + table is empty + */ + +/*---------------------------- OCITableNext ---------------------------------*/ + +sword OCITableNext( OCIEnv *env, OCIError *err, sb4 index, + const OCITable *tbl, sb4 *next_index, + boolean *exists ); +/* + NAME: OCITableNext - OCITable return NeXT available index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - starting at 'index' the index of the next element + which exists is returned + tbl (IN) - table which is scanned + next_index (OUT) - index of the next element which exists + is returned + exists (OUT) - FALSE if no next index available else TRUE + DESCRIPTION: + Return the smallest position j, greater than 'index', such that + exists(j) is TRUE. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + no next index available + */ + +/*---------------------------- OCITablePrev ---------------------------------*/ + +sword OCITablePrev( OCIEnv *env, OCIError *err, sb4 index, + const OCITable *tbl, sb4 *prev_index, + boolean *exists ); +/* + NAME: OCITablePrev - OCITable return PReVious available index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - starting at 'index' the index of the previous element + which exists is returned + tbl (IN) - table which is scanned + prev_index (OUT) - index of the previous element which exists + is returned + exists (OUT) - FALSE if no next index available else TRUE + DESCRIPTION: + Return the largest position j, less than 'index', such that + exists(j) is TRUE. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + no previous index available + */ + +/*------------------------ OCINumberToLnx -----------------------------------*/ +/* void OCINumberToLnx(/o_ OCINumber *num _o/); */ + +#define OCINumberToLnx(num) ((lnxnum_t *)num) + +/* + NAME: OCINumberToLnx + PARAMETERS: + num (IN) - OCINumber to convert ; + DESCRIPTION: + Converts OCINumber to its internal lnx format + This is not to be used in Public interfaces , but + has been provided due to special requirements from + SQLPLUS development group as they require to call + Core funtions directly . +*/ + +/* OCI representation of XMLType */ +typedef struct OCIXMLType OCIXMLType; + +/* OCI representation of OCIDomDocument */ +typedef struct OCIDOMDocument OCIDOMDocument; + +/* OCI representation for the Binary XML repository context */ +typedef struct OCIBinXmlReposCtx OCIBinXmlReposCtx; + +#endif /* ORL_ORACLE */ diff --git a/libraries/SQLAPI/include/ora_win/oro.h b/libraries/SQLAPI/include/ora_win/oro.h new file mode 100644 index 000000000..bf1e8f85f --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/oro.h @@ -0,0 +1,883 @@ +/* Copyright (c) 1994, 2003, Oracle Corporation. All rights reserved. */ + +/* + NAME + OCI - Oracle Object Interface for External/Internal/Kernel Clients + + DESCRIPTION + This header file contains Oracle object interface definitions which + can be included by external user applications, tools, as well as + the kernel. It defines types and constants that are common to all + object interface which is being defined in several other header files + (e.g., ori.h, ort.h, and orl.h). + + RELATED DOCUMENTS + TBD + + INSPECTION STATUS [[ deletable if no inspection ]] + Inspection date: [[ date of the last logging meeting ]] + Inspection status: [[ exited, not exited, or N/A if exit is not a goal ]] + Estimated increasing cost defects per page: + Rule sets: [[ rule sets inspected against or planned to be + inspected against ]] + + ACCEPTANCE REVIEW STATUS [[ deletable if no approval review ]] + Review date: [[ date of the meeting where issues were logged and the + approval status was decided ]] + Review status: [[ current status: accepted, conditionally accepted, + major revision required, rejected ]] + Reviewers: [[ names of the members on the review team ]] + + PUBLIC FUNCTIONS + + EXAMPLES + Examples are given in the description of each function or macro where + relevant. + + MODIFIED + mnanal 06/09/03 - backout of fix 2836388 + mnanal 05/14/03 - bug-2836388 + srseshad 11/27/02 - Change OCI_TYPECODE_BFLOAT/BDOUBLE codes + rxgovind 10/09/02 - add OCI_TYPECODE_UROWID + mxyang 09/17/02 - grabtrans 'mmorsi_obj_float' + srseshad 09/11/02 - + srseshad 09/01/02 - + aahluwal 06/03/02 - bug 2360115 + celsbern 10/19/01 - merge LOG to MAIN + rxgovind 10/16/01 - update typecodes + rxgovind 09/19/01 - add typecodes + rkasamse 08/15/01 - add OCI_DURATION_USER_CALLBACK + jchai 09/24/01 - add type code for PLS_INTEGER + porangas 08/22/01 - Fix bug#1776434 + schatter 04/09/01 - merge 1456235: define OCI_DURATION_INVALID + rdani 10/12/00 - 1449943 NOCOPY and PIPELINE + ciyer 05/26/00 - short names for abstract, overriding + rkasamse 05/25/00 - OCCI enhancements + smuralid 05/11/00 - OCITypeMethodFlags - add NOT INSTANTIABLE, OVERRIDING + rxgovind 05/09/00 - add OCI_TYPECODE_NONE + tnbui 07/28/99 - Remove OCI_TYPECODE_TIMESTAMP_ITZ + tnbui 07/21/99 - TS LOCAL TZ + thoang 06/21/99 - Add OCI_TYPECODE_TIMESTAMP_ITZ + thoang 03/04/99 - Add datetime datatypes + rkasamse 10/20/98 - add OCI_ATTR_CACHE_ARRAYFLUSH + rkasamse 10/29/98 - add OCI_DURATION_CALLOUT + rkasamse 04/28/98 - OCI_OBJECT_DETECTCHANGE -> OCI_ATTR_OBJECT_DETECTCHAN + rkasamse 04/28/98 - OCI_OBJECT_NEWNOTNULL -> OCI_ATTR_OBJECT_NEWNOTNULL + rkasamse 04/23/98 - add OCI_OBJECT_DETECTCHANGE + rkasamse 04/03/98 - add OCI_OBJECT_NEWNOTNULL + pmitra 04/01/98 - OCI_LOCK_X_NOWAIT added + rxgovind 02/18/98 - add OCI_TYPECODE_OPAQUE + rkasamse 02/13/98 - Add OCI_DURATION_PROCESS + cxcheng 07/28/97 - fix compile with SLSHORTNAME + skrishna 07/14/97 - add OCIObjectGetProperty + cxcheng 04/30/97 - make OCITypeParamMode values consistent with PL/SQL + skrishna 04/28/97 - undocument OCIObjectProperty & OCIObjectEvent + cxcheng 03/29/97 - remove all remaining short names + sthakur 03/20/97 - add casts to constants + cxcheng 02/21/97 - temporarily put SLSHORTNAME for PL/SQL + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + lchidamb 01/20/97 - update OCIRef comments + sgollapu 11/19/96 - Add OCI type codes for BOOL,REC,and TAB + cxcheng 11/19/96 - more typecode changes + cxcheng 11/13/96 - add #include for ocidfn.h + cxcheng 11/13/96 - add OCI_TYPECODE_ADT for compatibility + cxcheng 11/12/96 - add SQLT_NCO for named collection + cxcheng 11/11/96 - more changes to typecodes + cxcheng 11/07/96 - #define OCI_TYPECODE_MLSLABEL to SQLT_LAB + cxcheng 11/06/96 - fix #define omission for OROTCNAT + cxcheng 10/30/96 - move OCI_TYPECODE_* to ocidfn.h as SQLT_* + cxcheng 10/28/96 - more beautification changes + jboonleu 10/29/96 - add flags for freeing object + dchatter 10/26/96 - delete redef of OCISvcCtx, OCIError, OCIEnv + cxcheng 10/15/96 - more changes + cxcheng 10/14/96 - more final fixes to constants + mluong 10/11/96 - + mluong 10/11/96 - KOCON and KONSP are in lowercase + mluong 10/11/96 - add some define per Calvin + cxcheng 10/09/96 - add #define for OROOCOSFN to OCI_COPY_NOREF + jboonleu 10/08/96 - change OROOCOSFN to OCICopyFlag + jboonleu 10/07/96 - use new OCI names for cache options + cxcheng 10/07/96 - add OROTCS02 for KOTTCBRI and OROTCS03 as spare + cxcheng 10/07/96 - more lint fixes + cxcheng 10/02/96 - move oronsp to ko.h as konsp + cxcheng 10/01/96 - add long names for readability + cxcheng 10/01/96 - remove orotty and orotal + rjenkins 09/28/96 - 2k char 4k varchar2 + jboonleu 09/27/96 - add macro used only in beta2 + cxcheng 09/27/96 - move oroenv to oroenv.h + cxcheng 09/24/96 - remove unnecessary orotyp + cxcheng 09/25/96 - add typecode OROTCS01 as placeholder for lob pointer + cxcheng 09/20/96 - add TDO load option orotgo + jboonleu 09/18/96 - add OROOPOREC + jboonleu 09/10/96 - add OROOPODFL + jweisz 08/27/96 - add SQL internal typecode OROTCS00 + cxcheng 08/02/96 - add PLSQL internal typecodes OROTCP.. + cxcheng 08/01/96 - add OROTCFAR to fill up space left by OROTCCAR + jboonleu 07/16/96 - new pin option + cxcheng 06/18/96 - add casts to OROTNOPRE and OROTNOSCL + cxcheng 05/29/96 - change OROTCNPT back to OROTCDOM + vkrishna 05/27/96 - add OROTCCAR + cxcheng 05/17/96 - replace OROTCFAR with OROTCCAR + cxcheng 05/08/96 - change orotmf from ub1 to ub2 + cxcheng 05/07/96 - fix public defines for method types + cxcheng 04/30/96 - change OROTCDOM to OROTCNPT + cxcheng 04/15/96 - remove obsolete OROTTYICT + jboonleu 04/12/96 - add new pin option + sthakur 04/12/96 - add indicator type and indicator status + cxcheng 04/10/96 - add function parameter codes for ORT/KOT + cxcheng 04/03/96 - replace OROTCFAR as OROTCCAR + jwijaya 03/29/96 - add OROTTCCAR + jwijaya 03/27/96 - better comments for orotc + cxcheng 02/23/96 - add typecodes for SMALLINT and VARCHAR2 + skrishna 02/22/96 - add oroind - null indicator type + cxcheng 02/21/96 - change lob character codes to OROTCCLB, OROTCBLB... + jboonleu 02/06/96 - new value for predefined duration + cxcheng 01/12/96 - add OROTCCLO, OROTCBLO, OROTCFIL to orotc + cxcheng 12/05/95 - add OROTCDOM and OROTCAAT to orotc + skotsovo 10/30/95 - reserve space for internal 'oid' type + jwijaya 10/20/95 - support variable-length ref + cxcheng 10/03/95 - add OROTMFOR for ordering function to orotmf + cxcheng 10/03/95 - Adding the ordering function type to orotmf + jboonleu 09/28/95 - set OROODTPRE + jboonleu 09/25/95 - add oroodt + skotsovo 03/10/95 - update to only include release 1 + jboonleu 02/15/95 - add OROOPOREC, remove orocro, oroolo + skotsovo 01/30/95 - add default max lengths for varrays and vstrings + skotsovo 01/24/95 - categorize sint32, double, and real as number types + (with precision and scale) instead of scalar types. + skotsovo 12/20/94 - add release 1 types + skotsovo 12/12/94 - update according to new ots doc + skotsovo 12/01/94 - add default precision and scale + jwijaya 11/15/94 - rename ORONSPTAB to ORONSPEXT + jwijaya 10/25/94 - tint + jwijaya 10/06/94 - add namespace + jwijaya 10/02/94 - connection handle -> connection number + skotsovo 09/12/94 - keep 0 as uninitialized value for ORT consts + skotsovo 08/24/94 - fix orotec + skotsovo 08/17/94 - modify type code names + skotsovo 08/12/94 - fix 141 lint errors + skotsovo 07/25/94 - modify categorization of complex types (orotc) + skotsovo 07/07/94 - change typecode enum values & add decimal type + skotsovo 07/01/94 - change order of typecodes + jwijaya 06/15/94 - review + jboonleu 06/13/94 - add comments for the object cache options + jwijaya 06/13/94 - adhere to the header file template + skotsovo 06/09/94 - make ots scalar type names consistent with the ots + document + jwijaya 06/07/94 - include oratypes.h instead of s.h + skotsovo 05/24/94 - change typecodes + jwijaya 05/23/94 - fix comments of ororef + skotsovo 05/19/94 - remove type composition + skotsovo 05/09/94 - modified orotc according to new OTS document + jwijaya 05/03/94 - oroid and ororef + jwijaya 01/26/94 - Creation +*/ + + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN_ORACLE +#include +#endif + +#ifndef ORO_ORACLE +#define ORO_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCIDuration oroodt +#define OCIInd oroind +#define OCILockOpt oroolm +#define OCIMarkOpt oroomo +#define OCIObjectEvent orocev +#define OCIObjectProperty oroopr +#define OCIPinOpt oroopo +#define OCIRef ororef +#define OCIRefreshOpt orooro +#define OCITypeCode orotc +#define OCITypeEncap orotec +#define OCITypeGetOpt orotgo +#define OCITypeMethodFlag orotmf +#define OCITypeParamMode orotpm +#define OCIObjectPropId oroopi +#define OCIObjectLifetime oroolft +#define OCIObjectMarkstatus oroomst +#define OCI_LOCK_NONE OROOLMNUL +#define OCI_LOCK_X OROOLMX +#define OCI_LOCK_X_NOWAIT OROOLMXNW +#define OCI_MARK_DEFAULT OROOMODFL +#define OCI_MARK_NONE OROOMONON +#define OCI_MARK_UPDATE OROOMOUPD +#define OCI_OBJECTEVENT_AFTER_FLUSH OROCEVAFL +#define OCI_OBJECTEVENT_AFTER_REFRESH OROCEVARF +#define OCI_OBJECTEVENT_BEFORE_FLUSH OROCEVBFL +#define OCI_OBJECTEVENT_BEFORE_REFRESH OROCEVBRF +#define OCI_OBJECTEVENT_WHEN_LOCK OROCEVWLK +#define OCI_OBJECTEVENT_WHEN_MARK_DELETED OROCEVWDL +#define OCI_OBJECTEVENT_WHEN_MARK_UPDATED OROCEVWUP +#define OCI_OBJECTEVENT_WHEN_UNMARK OROCEVWUM +#define OCI_OBJECTPROP_DIRTIED OROOPRDRT +#define OCI_OBJECTPROP_LOADED OROOPRLOD +#define OCI_OBJECTPROP_LOCKED OROOPRLCK +#define OCI_PIN_ANY OROOPOANY +#define OCI_PIN_DEFAULT OROOPODFL +#define OCI_PIN_LATEST OROOPOLST +#define OCI_PIN_RECENT OROOPOREC +#define OCI_REFRESH_LOADED OROOROLOD +#define OCI_TYPEENCAP_PRIVATE OROTECPVT +#define OCI_TYPEENCAP_PUBLIC OROTECPUB +#define OCI_TYPEGET_ALL OROTGOALL +#define OCI_TYPEGET_HEADER OROTGOHDR +#define OCI_TYPEMETHOD_CONSTANT OROTMCON +#define OCI_TYPEMETHOD_CONSTRUCTOR OROTMCSTR +#define OCI_TYPEMETHOD_DESTRUCTOR OROTMDSTR +#define OCI_TYPEMETHOD_INLINE OROTMINL +#define OCI_TYPEMETHOD_MAP OROTMMAP +#define OCI_TYPEMETHOD_OPERATOR OROTMOP +#define OCI_TYPEMETHOD_ORDER OROTMOR +#define OCI_TYPEMETHOD_RNDS OROTMRDS +#define OCI_TYPEMETHOD_RNPS OROTMRPS +#define OCI_TYPEMETHOD_SELFISH OROTMSLF +#define OCI_TYPEMETHOD_VIRTUAL OROTMVRT +#define OCI_TYPEMETHOD_WNDS OROTMWDS +#define OCI_TYPEMETHOD_WNPS OROTMWPS +#define OCI_TYPEMETHOD_ABSTRACT OROTMABSTRACT +#define OCI_TYPEMETHOD_OVERRIDING OROTMOVERRIDING +#define OCI_TYPEMETHOD_PIPELINED OROTMPIPELINED +#define OCI_TYPEPARAM_BYREF OROTPMREF +#define OCI_TYPEPARAM_IN OROTPMIN +#define OCI_TYPEPARAM_INOUT OROTPMIO +#define OCI_TYPEPARAM_OUT OROTPMOUT +#define OCI_TYPEPARAM_OUTNCPY OROTPMOUTNCPY +#define OCI_TYPEPARAM_INOUTNCPY OROTPMIONCPY + +#endif /* SLSHORTNAME */ + + +/*---------------------------------------------------------------------------*/ +/* PUBLIC TYPES, CONSTANTS AND MACROS */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* GENERAL OBJECT TYPES, CONSTANTS, MACROS */ +/*---------------------------------------------------------------------------*/ + +/*------------------------- OBJECT REFERENCE (REF) --------------------------*/ + +typedef struct OCIRef OCIRef; +/* + * OCIRef - OCI object REFerence + * + * In the Oracle object runtime environment, an object is identified by an + * object reference (ref) which contains the object identifier plus other + * runtime information. The contents of a ref is opaque to clients. Use + * OCIObjectNew() to construct a ref. + */ + + +/*--------------------------- OBJECT INDICATOR ------------------------------*/ + +typedef sb2 OCIInd; +/* + * OCIInd -- a variable of this type contains (null) indicator information + */ + +#define OCI_IND_NOTNULL (OCIInd)0 /* not NULL */ +#define OCI_IND_NULL (OCIInd)(-1) /* NULL */ +#define OCI_IND_BADNULL (OCIInd)(-2) /* BAD NULL */ +#define OCI_IND_NOTNULLABLE (OCIInd)(-3) /* not NULLable */ + +/*---------------------------------------------------------------------------*/ +/* OBJECT CACHE */ +/*---------------------------------------------------------------------------*/ + +/* To enable object change detection mode, set this to TRUE */ +#define OCI_ATTR_OBJECT_DETECTCHANGE 0x00000020 + +/* To enable object creation with non-NULL attributes by default, set the + following to TRUE. + By default, object is created with NULL attributes +*/ +#define OCI_ATTR_OBJECT_NEWNOTNULL 0x00000010 + +/* To enable sorting of the objects that belong to the same table + before being flushed through OCICacheFlush. + Please note that by enabling this object cache will not be flushing + the objects in the same order they were dirtied */ +#define OCI_ATTR_CACHE_ARRAYFLUSH 0x00000040 + +/*--------------------------- OBJECT PIN OPTION -----------------------------*/ + +enum OCIPinOpt +{ + /* 0 = uninitialized */ + OCI_PIN_DEFAULT = 1, /* default pin option */ + OCI_PIN_ANY = 3, /* pin any copy of the object */ + OCI_PIN_RECENT = 4, /* pin recent copy of the object */ + OCI_PIN_LATEST = 5 /* pin latest copy of the object */ +}; +typedef enum OCIPinOpt OCIPinOpt; + +/* + * OCIPinOpt - OCI object Pin Option + * + * In the Oracle object runtime environment, the program has the option to + * specify which copy of the object to pin. + * + * OCI_PINOPT_DEFAULT pins an object using the default pin option. The default + * pin option can be set as an attribute of the OCI environment handle + * (OCI_ATTR_PINTOPTION). The value of the default pin option can be + * OCI_PINOPT_ANY, OCI_PINOPT_RECENT, or OCI_PIN_LATEST. The default option + * is initialized to OCI_PINOPT_ANY. + * + * OCI_PIN_ANY pins any copy of the object. The object is pinned + * using the following criteria: + * If the object copy is not loaded, load it from the persistent store. + * Otherwise, the loaded object copy is returned to the program. + * + * OCI_PIN_RECENT pins the latest copy of an object. The object is + * pinned using the following criteria: + * If the object is not loaded, load the object from the persistent store + * from the latest version. + * If the object is not loaded in the current transaction and it is not + * dirtied, the object is refreshed from the latest version. + * Otherwise, the loaded object copy is returned to the program. + * + * OCI_PINOPT_LATEST pins the latest copy of an object. The object copy is + * pinned using the following criteria: + * If the object copy is not loaded, load it from the persistent store. + * If the object copy is loaded and dirtied, it is returned to the program. + * Otherwise, the loaded object copy is refreshed from the persistent store. + */ + + + +/*--------------------------- OBJECT LOCK OPTION ----------------------------*/ + +enum OCILockOpt +{ + /* 0 = uninitialized */ + OCI_LOCK_NONE = 1, /* null (same as no lock) */ + OCI_LOCK_X = 2, /* exclusive lock */ + OCI_LOCK_X_NOWAIT = 3 /* exclusive lock, do not wait */ +}; +typedef enum OCILockOpt OCILockOpt; +/* + * OCILockOpt - OCI object LOCK Option + * + * This option is used to specify the locking preferences when an object is + * loaded from the server. + */ + + +/*------------------------- OBJECT MODIFYING OPTION -------------------------*/ + +enum OCIMarkOpt +{ + /* 0 = uninitialized */ + OCI_MARK_DEFAULT = 1, /* default (the same as OCI_MARK_NONE) */ + OCI_MARK_NONE = OCI_MARK_DEFAULT, /* object has not been modified */ + OCI_MARK_UPDATE /* object is to be updated */ +}; +typedef enum OCIMarkOpt OCIMarkOpt; +/* + * OCIMarkOpt - OCI object Mark option + * + * When the object is marked updated, the client has to specify how the + * object is intended to be changed. + */ + +/*-------------------------- OBJECT Duration --------------------------------*/ + +typedef ub2 OCIDuration; + +#define OCI_DURATION_INVALID 0xFFFF /* Invalid duration */ +#define OCI_DURATION_BEGIN (OCIDuration)10 + /* beginning sequence of duration */ +#define OCI_DURATION_NULL (OCIDuration)(OCI_DURATION_BEGIN-1) + /* null duration */ +#define OCI_DURATION_DEFAULT (OCIDuration)(OCI_DURATION_BEGIN-2) /* default */ +#define OCI_DURATION_USER_CALLBACK (OCIDuration)(OCI_DURATION_BEGIN-3) +#define OCI_DURATION_NEXT (OCIDuration)(OCI_DURATION_BEGIN-4) + /* next special duration */ +#define OCI_DURATION_SESSION (OCIDuration)(OCI_DURATION_BEGIN) + /* the end of user session */ +#define OCI_DURATION_TRANS (OCIDuration)(OCI_DURATION_BEGIN+1) + /* the end of user transaction */ +/****************************************************************************** +** DO NOT USE OCI_DURATION_CALL. IT IS UNSUPPORTED ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ +#define OCI_DURATION_CALL (OCIDuration)(OCI_DURATION_BEGIN+2) + /* the end of user client/server call */ +#define OCI_DURATION_STATEMENT (OCIDuration)(OCI_DURATION_BEGIN+3) + +/* This is to be used only during callouts. It is similar to that +of OCI_DURATION_CALL, but lasts only for the duration of a callout. +Its heap is from PGA */ +#define OCI_DURATION_CALLOUT (OCIDuration)(OCI_DURATION_BEGIN+4) + +#define OCI_DURATION_LAST OCI_DURATION_CALLOUT + /* last of predefined durations */ + +/* This is not being treated as other predefined durations such as + SESSION, CALL etc, because this would not have an entry in the duration + table and its functionality is primitive such that only allocate, free, + resize memory are allowed, but one cannot create subduration out of this +*/ +#define OCI_DURATION_PROCESS (OCIDuration)(OCI_DURATION_BEGIN-5) + +/* + * OCIDuration - OCI object duration + * + * A client can specify the duration of which an object is pinned (pin + * duration) and the duration of which the object is in memory (allocation + * duration). If the objects are still pinned at the end of the pin duration, + * the object cache manager will automatically unpin the objects for the + * client. If the objects still exist at the end of the allocation duration, + * the object cache manager will automatically free the objects for the client. + * + * Objects that are pinned with the option OCI_DURATION_TRANS will get unpinned + * automatically at the end of the current transaction. + * + * Objects that are pinned with the option OCI_DURATION_SESSION will get + * unpinned automatically at the end of the current session (connection). + * + * The option OCI_DURATION_NULL is used when the client does not want to set + * the pin duration. If the object is already loaded into the cache, then the + * pin duration will remain the same. If the object is not yet loaded, the + * pin duration of the object will be set to OCI_DURATION_DEFAULT. + */ + +/*----------------------------- OBJECT PROPERTY -----------------------------*/ + +/****************************************************************************** +** DO NOT USE OCIObjectProperty. IT IS UNSUPPORTED ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ +enum OCIObjectProperty +{ + /* 0 = uninitialized */ + OCI_OBJECTPROP_DIRTIED = 1, /* dirty objects */ + OCI_OBJECTPROP_LOADED, /* objects loaded in the transaction */ + OCI_OBJECTPROP_LOCKED /* locked objects */ +}; +typedef enum OCIObjectProperty OCIObjectProperty; +/* + * OCIObjectProperty -- OCI Object Property + * This specifies the properties of objects in the object cache. + */ + +/*------------------------- CACHE REFRESH OPTION ---------------------------*/ + +enum OCIRefreshOpt +{ + /* 0 = uninitialized */ + OCI_REFRESH_LOADED = 1 /* refresh objects loaded in the transaction */ +}; +typedef enum OCIRefreshOpt OCIRefreshOpt; +/* + * OCIRefreshOpt - OCI cache Refresh Option + * This option is used to specify the set of objects to be refreshed. + * + * OCI_REFRESH_LOAD refreshes the objects that are loaded in the current + * transaction. + */ + +/*-------------------------------- OBJECT EVENT -----------------------------*/ + +/****************************************************************************** +** DO NOT USE OCIObjectEvent. IT IS UNSUPPORTED ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ +enum OCIObjectEvent +{ + /* 0 = uninitialized */ + OCI_OBJECTEVENT_BEFORE_FLUSH = 1, /* before flushing the cache */ + OCI_OBJECTEVENT_AFTER_FLUSH, /* after flushing the cache */ + OCI_OBJECTEVENT_BEFORE_REFRESH, /* before refreshing the cache */ + OCI_OBJECTEVENT_AFTER_REFRESH, /* after refreshing the cache */ + OCI_OBJECTEVENT_WHEN_MARK_UPDATED, /* when an object is marked updated */ + OCI_OBJECTEVENT_WHEN_MARK_DELETED, /* when an object is marked deleted */ + OCI_OBJECTEVENT_WHEN_UNMARK, /* when an object is being unmarked */ + OCI_OBJECTEVENT_WHEN_LOCK /* when an object is being locked */ +}; +typedef enum OCIObjectEvent OCIObjectEvent; +/* + * OCIObjectEvent -- OCI Object Event + * This specifies the kind of event that is supported by the object + * cache. The program can register a callback that is invoked when the + * specified event occurs. + */ + +/*----------------------------- OBJECT COPY OPTION --------------------------*/ +#define OCI_OBJECTCOPY_NOREF (ub1)0x01 +/* + * OCIObjectCopyFlag - Object copy flag + * + * If OCI_OBJECTCOPY_NOREF is specified when copying an instance, the + * reference and lob will not be copied to the target instance. + */ + +/*----------------------------- OBJECT FREE OPTION --------------------------*/ +#define OCI_OBJECTFREE_FORCE (ub2)0x0001 +#define OCI_OBJECTFREE_NONULL (ub2)0x0002 +#define OCI_OBJECTFREE_HEADER (ub2)0x0004 +/* + * OCIObjectFreeFlag - Object free flag + * + * If OCI_OBJECTCOPY_FORCE is specified when freeing an instance, the instance + * is freed regardless it is pinned or diritied. + * If OCI_OBJECTCOPY_NONULL is specified when freeing an instance, the null + * structure is not freed. + */ + +/*----------------------- OBJECT PROPERTY ID -------------------------------*/ + +typedef ub1 OCIObjectPropId; +#define OCI_OBJECTPROP_LIFETIME 1 /* persistent or transient or value */ +#define OCI_OBJECTPROP_SCHEMA 2 /* schema name of table containing object */ +#define OCI_OBJECTPROP_TABLE 3 /* table name of table containing object */ +#define OCI_OBJECTPROP_PIN_DURATION 4 /* pin duartion of object */ +#define OCI_OBJECTPROP_ALLOC_DURATION 5 /* alloc duartion of object */ +#define OCI_OBJECTPROP_LOCK 6 /* lock status of object */ +#define OCI_OBJECTPROP_MARKSTATUS 7 /* mark status of object */ +#define OCI_OBJECTPROP_VIEW 8 /* is object a view object or not? */ + +/* + * OCIObjectPropId - OCI Object Property Id + * Identifies the different properties of objects. + */ + +/*----------------------- OBJECT LIFETIME ----------------------------------*/ + +enum OCIObjectLifetime +{ + /* 0 = uninitialized */ + OCI_OBJECT_PERSISTENT = 1, /* persistent object */ + OCI_OBJECT_TRANSIENT, /* transient object */ + OCI_OBJECT_VALUE /* value object */ +}; +typedef enum OCIObjectLifetime OCIObjectLifetime; +/* + * OCIObjectLifetime - OCI Object Lifetime + * Classifies objects depending upon the lifetime and referenceability + * of the object. + */ + +/*----------------------- OBJECT MARK STATUS -------------------------------*/ + +typedef uword OCIObjectMarkStatus; +#define OCI_OBJECT_NEW 0x0001 /* new object */ +#define OCI_OBJECT_DELETED 0x0002 /* object marked deleted */ +#define OCI_OBJECT_UPDATED 0x0004 /* object marked updated */ +/* + * OCIObjectMarkStatus - OCI Object Mark Status + * Status of the object - new or updated or deleted + */ + +/* macros to test the object mark status */ +#define OCI_OBJECT_IS_UPDATED(flag) bit((flag), OCI_OBJECT_UPDATED) +#define OCI_OBJECT_IS_DELETED(flag) bit((flag), OCI_OBJECT_DELETED) +#define OCI_OBJECT_IS_NEW(flag) bit((flag), OCI_OBJECT_NEW) +#define OCI_OBJECT_IS_DIRTY(flag) \ + bit((flag), OCI_OBJECT_UPDATED|OCI_OBJECT_NEW|OCI_OBJECT_DELETED) + +/*---------------------------------------------------------------------------*/ +/* TYPE MANAGER */ +/*---------------------------------------------------------------------------*/ + +/*------------------------------ TYPE CODE ----------------------------------*/ + +/* + * Type manager typecodes + * + * These are typecodes designed to be used with the type manager; + * they also include longer, more readable versions of existing SQLT names. + * Those types that are directly related to existing SQLT types are #define'd + * to their SQLT equivalents. + * + * The type manager typecodes are designed to be useable for all OCI calls. + * They are in the range from 192 to 320 for typecodes, so as not to conflict + * with existing OCI SQLT typecodes (see ocidfn.h). + */ + +#define OCI_TYPECODE_REF SQLT_REF /* SQL/OTS OBJECT REFERENCE */ +#define OCI_TYPECODE_DATE SQLT_DAT /* SQL DATE OTS DATE */ +#define OCI_TYPECODE_SIGNED8 27 /* SQL SIGNED INTEGER(8) OTS SINT8 */ +#define OCI_TYPECODE_SIGNED16 28 /* SQL SIGNED INTEGER(16) OTS SINT16 */ +#define OCI_TYPECODE_SIGNED32 29 /* SQL SIGNED INTEGER(32) OTS SINT32 */ +#define OCI_TYPECODE_REAL 21 /* SQL REAL OTS SQL_REAL */ +#define OCI_TYPECODE_DOUBLE 22 /* SQL DOUBLE PRECISION OTS SQL_DOUBLE */ +#define OCI_TYPECODE_BFLOAT SQLT_IBFLOAT /* Binary float */ +#define OCI_TYPECODE_BDOUBLE SQLT_IBDOUBLE /* Binary double */ +#define OCI_TYPECODE_FLOAT SQLT_FLT /* SQL FLOAT(P) OTS FLOAT(P) */ +#define OCI_TYPECODE_NUMBER SQLT_NUM/* SQL NUMBER(P S) OTS NUMBER(P S) */ +#define OCI_TYPECODE_DECIMAL SQLT_PDN + /* SQL DECIMAL(P S) OTS DECIMAL(P S) */ +#define OCI_TYPECODE_UNSIGNED8 SQLT_BIN + /* SQL UNSIGNED INTEGER(8) OTS UINT8 */ +#define OCI_TYPECODE_UNSIGNED16 25 /* SQL UNSIGNED INTEGER(16) OTS UINT16 */ +#define OCI_TYPECODE_UNSIGNED32 26 /* SQL UNSIGNED INTEGER(32) OTS UINT32 */ +#define OCI_TYPECODE_OCTET 245 /* SQL ??? OTS OCTET */ +#define OCI_TYPECODE_SMALLINT 246 /* SQL SMALLINT OTS SMALLINT */ +#define OCI_TYPECODE_INTEGER SQLT_INT /* SQL INTEGER OTS INTEGER */ +#define OCI_TYPECODE_RAW SQLT_LVB /* SQL RAW(N) OTS RAW(N) */ +#define OCI_TYPECODE_PTR 32 /* SQL POINTER OTS POINTER */ +#define OCI_TYPECODE_VARCHAR2 SQLT_VCS + /* SQL VARCHAR2(N) OTS SQL_VARCHAR2(N) */ +#define OCI_TYPECODE_CHAR SQLT_AFC /* SQL CHAR(N) OTS SQL_CHAR(N) */ +#define OCI_TYPECODE_VARCHAR SQLT_CHR + /* SQL VARCHAR(N) OTS SQL_VARCHAR(N) */ +#define OCI_TYPECODE_MLSLABEL SQLT_LAB /* OTS MLSLABEL */ +#define OCI_TYPECODE_VARRAY 247 /* SQL VARRAY OTS PAGED VARRAY */ +#define OCI_TYPECODE_TABLE 248 /* SQL TABLE OTS MULTISET */ +#define OCI_TYPECODE_OBJECT SQLT_NTY /* SQL/OTS NAMED OBJECT TYPE */ +#define OCI_TYPECODE_OPAQUE 58 /* SQL/OTS Opaque Types */ +#define OCI_TYPECODE_NAMEDCOLLECTION SQLT_NCO + /* SQL/OTS NAMED COLLECTION TYPE */ +#define OCI_TYPECODE_BLOB SQLT_BLOB /* SQL/OTS BINARY LARGE OBJECT */ +#define OCI_TYPECODE_BFILE SQLT_BFILE /* SQL/OTS BINARY FILE OBJECT */ +#define OCI_TYPECODE_CLOB SQLT_CLOB /* SQL/OTS CHARACTER LARGE OBJECT */ +#define OCI_TYPECODE_CFILE SQLT_CFILE /* SQL/OTS CHARACTER FILE OBJECT */ + +/* the following are ANSI datetime datatypes added in 8.1 */ +#define OCI_TYPECODE_TIME SQLT_TIME /* SQL/OTS TIME */ +#define OCI_TYPECODE_TIME_TZ SQLT_TIME_TZ /* SQL/OTS TIME_TZ */ +#define OCI_TYPECODE_TIMESTAMP SQLT_TIMESTAMP /* SQL/OTS TIMESTAMP */ +#define OCI_TYPECODE_TIMESTAMP_TZ SQLT_TIMESTAMP_TZ /* SQL/OTS TIMESTAMP_TZ */ + +#define OCI_TYPECODE_TIMESTAMP_LTZ SQLT_TIMESTAMP_LTZ /* TIMESTAMP_LTZ */ + +#define OCI_TYPECODE_INTERVAL_YM SQLT_INTERVAL_YM /* SQL/OTS INTRVL YR-MON */ +#define OCI_TYPECODE_INTERVAL_DS SQLT_INTERVAL_DS /* SQL/OTS INTRVL DAY-SEC */ +#define OCI_TYPECODE_UROWID SQLT_RDD /* Urowid type */ + + +#define OCI_TYPECODE_OTMFIRST 228 /* first Open Type Manager typecode */ +#define OCI_TYPECODE_OTMLAST 320 /* last OTM typecode */ +#define OCI_TYPECODE_SYSFIRST 228 /* first OTM system type (internal) */ +#define OCI_TYPECODE_SYSLAST 235 /* last OTM system type (internal) */ +#define OCI_TYPECODE_PLS_INTEGER 266 /* type code for PLS_INTEGER */ + +/* the following are PL/SQL-only internal. They should not be used */ +#define OCI_TYPECODE_ITABLE SQLT_TAB /* PLSQL indexed table */ +#define OCI_TYPECODE_RECORD SQLT_REC /* PLSQL record */ +#define OCI_TYPECODE_BOOLEAN SQLT_BOL /* PLSQL boolean */ + +/* NOTE : The following NCHAR related codes are just short forms for saying + OCI_TYPECODE_VARCHAR2 with a charset form of SQLCS_NCHAR. These codes are + intended for use in the OCIAnyData API only and nowhere else. */ +#define OCI_TYPECODE_NCHAR 286 +#define OCI_TYPECODE_NVARCHAR2 287 +#define OCI_TYPECODE_NCLOB 288 + + +/* To indicate absence of typecode being specified */ +#define OCI_TYPECODE_NONE 0 +/* To indicate error has to be taken from error handle - reserved for + sqlplus use */ +#define OCI_TYPECODE_ERRHP 283 + +/* The OCITypeCode type is interchangeable with the existing SQLT type + which is a ub2 */ +typedef ub2 OCITypeCode; + + +/*----------------------- GET OPTIONS FOR TDO ------------------------------*/ + +enum OCITypeGetOpt +{ + OCI_TYPEGET_HEADER, + /* load only the header portion of the TDO when getting type */ + OCI_TYPEGET_ALL /* load all attribute and method descriptors as well */ +}; +typedef enum OCITypeGetOpt OCITypeGetOpt; + +/* + * OCITypeGetOpt + * + * This is the flag passed to OCIGetTypeArray() to indicate how the TDO is + * going to be loaded into the object cache. + * OCI_TYPEGET_HEADER implies that only the header portion is to be loaded + * initially, with the rest loaded in on a 'lazy' basis. Only the header is + * needed for PL/SQL and OCI operations. OCI_TYPEGET_ALL implies that ALL + * the attributes and methods belonging to a TDO will be loaded into the + * object cache in one round trip. Hence it will take much longer to execute, + * but will ensure that no more loading needs to be done when pinning ADOs + * etc. This is only needed if your code needs to examine and manipulate + * attribute and method information. + * + * The default is OCI_TYPEGET_HEADER. + */ + + +/*------------------------ TYPE ENCAPSULTATION LEVEL ------------------------*/ + +enum OCITypeEncap +{ + /* 0 = uninitialized */ + OCI_TYPEENCAP_PRIVATE, /* private: only internally visible */ + OCI_TYPEENCAP_PUBLIC /* public: visible to both internally and externally */ +}; +typedef enum OCITypeEncap OCITypeEncap; +/* + * OCITypeEncap - OCI Encapsulation Level + */ + + +/*---------------------------- TYPE METHOD FLAGS ----------------------------*/ + +enum OCITypeMethodFlag +{ + OCI_TYPEMETHOD_INLINE = 0x0001, /* inline */ + OCI_TYPEMETHOD_CONSTANT = 0x0002, /* constant */ + OCI_TYPEMETHOD_VIRTUAL = 0x0004, /* virtual */ + OCI_TYPEMETHOD_CONSTRUCTOR = 0x0008, /* constructor */ + OCI_TYPEMETHOD_DESTRUCTOR = 0x0010, /* destructor */ + OCI_TYPEMETHOD_OPERATOR = 0x0020, /* operator */ + OCI_TYPEMETHOD_SELFISH = 0x0040, /* selfish method (generic otherwise) */ + + OCI_TYPEMETHOD_MAP = 0x0080, /* map (relative ordering) */ + OCI_TYPEMETHOD_ORDER = 0x0100, /* order (relative ordering) */ + /* OCI_TYPEMETHOD_MAP and OCI_TYPEMETHOD_ORDER are mutually exclusive */ + + OCI_TYPEMETHOD_RNDS= 0x0200, /* Read no Data State (default) */ + OCI_TYPEMETHOD_WNDS= 0x0400, /* Write no Data State */ + OCI_TYPEMETHOD_RNPS= 0x0800, /* Read no Process State */ + OCI_TYPEMETHOD_WNPS= 0x1000, /* Write no Process State */ + OCI_TYPEMETHOD_ABSTRACT = 0x2000, /* abstract (not instantiable) method */ + OCI_TYPEMETHOD_OVERRIDING = 0x4000, /* overriding method */ + OCI_TYPEMETHOD_PIPELINED = 0x8000 /* method is pipelined */ +}; +typedef enum OCITypeMethodFlag OCITypeMethodFlag; + +/* macros to test the type method flags */ +#define OCI_METHOD_IS_INLINE(flag) bit((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_METHOD_IS_CONSTANT(flag) bit((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_METHOD_IS_VIRTUAL(flag) bit((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_METHOD_IS_CONSTRUCTOR(flag) bit((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_METHOD_IS_DESTRUCTOR(flag) bit((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_METHOD_IS_OPERATOR(flag) bit((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_METHOD_IS_SELFISH(flag) bit((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_METHOD_IS_MAP(flag) bit((flag), OCI_TYPEMETHOD_MAP) +#define OCI_METHOD_IS_ORDER(flag) bit((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_METHOD_IS_RNDS(flag) bit((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_METHOD_IS_WNDS(flag) bit((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_METHOD_IS_RNPS(flag) bit((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_METHOD_IS_WNPS(flag) bit((flag), OCI_TYPEMETHOD_WNPS) +#define OCI_METHOD_IS_ABSTRACT(flag) bit((flag), OCI_TYPEMETHOD_ABSTRACT) +#define OCI_METHOD_IS_OVERRIDING(flag) bit((flag), OCI_TYPEMETHOD_OVERRIDING) +#define OCI_METHOD_IS_PIPELINED(flag) bit((flag), OCI_TYPEMETHOD_PIPELINED) + +#define OCI_TYPEMETHOD_IS_INLINE(flag) bit((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_TYPEMETHOD_IS_CONSTANT(flag) bit((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_TYPEMETHOD_IS_VIRTUAL(flag) bit((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_TYPEMETHOD_IS_CONSTRUCTOR(flag) \ + bit((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_TYPEMETHOD_IS_DESTRUCTOR(flag) \ + bit((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_TYPEMETHOD_IS_OPERATOR(flag) bit((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_TYPEMETHOD_IS_SELFISH(flag) bit((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_TYPEMETHOD_IS_MAP(flag) bit((flag), OCI_TYPEMETHOD_MAP) +#define OCI_TYPEMETHOD_IS_ORDER(flag) bit((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_TYPEMETHOD_IS_RNDS(flag) bit((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_TYPEMETHOD_IS_WNDS(flag) bit((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_TYPEMETHOD_IS_RNPS(flag) bit((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_TYPEMETHOD_IS_WNPS(flag) bit((flag), OCI_TYPEMETHOD_WNPS) +#define OCI_TYPEMETHOD_IS_ABSTRACT(flag) bit((flag), OCI_TYPEMETHOD_ABSTRACT) +#define OCI_TYPEMETHOD_IS_OVERRIDING(flag) \ + bit((flag), OCI_TYPEMETHOD_OVERRIDING) +#define OCI_TYPEMETHOD_IS_PIPELINED(flag) bit((flag), OCI_TYPEMETHOD_PIPELINED) + +/* macros to set the type method flags */ +#define OCI_TYPEMETHOD_SET_INLINE(flag) bis((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_TYPEMETHOD_SET_CONSTANT(flag) bis((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_TYPEMETHOD_SET_VIRTUAL(flag) bis((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_TYPEMETHOD_SET_CONSTRUCTOR(flag) \ + bis((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_TYPEMETHOD_SET_DESTRUCTOR(flag) \ + bis((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_TYPEMETHOD_SET_OPERATOR(flag) bis((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_TYPEMETHOD_SET_SELFISH(flag) bis((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_TYPEMETHOD_SET_MAP(flag) bis((flag), OCI_TYPEMETHOD_MAP) +#define OCI_TYPEMETHOD_SET_ORDER(flag) bis((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_TYPEMETHOD_SET_RNDS(flag) bis((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_TYPEMETHOD_SET_WNDS(flag) bis((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_TYPEMETHOD_SET_RNPS(flag) bis((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_TYPEMETHOD_SET_WNPS(flag) bis((flag), OCI_TYPEMETHOD_WNPS) + +/* macros to clear the type method flags */ +#define OCI_TYPEMETHOD_CLEAR_INLINE(flag) bic((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_TYPEMETHOD_CLEAR_CONSTANT(flag) \ + bic((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_TYPEMETHOD_CLEAR_VIRTUAL(flag) bic((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_TYPEMETHOD_CLEAR_CONSTRUCTOR(flag) \ + bic((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_TYPEMETHOD_CLEAR_DESTRUCTOR(flag) \ + bic((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_TYPEMETHOD_CLEAR_OPERATOR(flag) \ + bic((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_TYPEMETHOD_CLEAR_SELFISH(flag) bic((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_TYPEMETHOD_CLEAR_MAP(flag) bic((flag), OCI_TYPEMETHOD_MAP) +#define OCI_TYPEMETHOD_CLEAR_ORDER(flag) bic((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_TYPEMETHOD_CLEAR_RNDS(flag) bic((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_TYPEMETHOD_CLEAR_WNDS(flag) bic((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_TYPEMETHOD_CLEAR_RNPS(flag) bic((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_TYPEMETHOD_CLEAR_WNPS(flag) bic((flag), OCI_TYPEMETHOD_WNPS) + +/*--------------------------- TYPE PARAMETER MODE ---------------------------*/ + +enum OCITypeParamMode +{ + /* PL/SQL starts this from 0 */ + OCI_TYPEPARAM_IN = 0, /* in */ + OCI_TYPEPARAM_OUT, /* out */ + OCI_TYPEPARAM_INOUT, /* in-out */ + OCI_TYPEPARAM_BYREF, /* call by reference (implicitly in-out) */ + OCI_TYPEPARAM_OUTNCPY, /* OUT with NOCOPY modifier */ + OCI_TYPEPARAM_INOUTNCPY /* IN OUT with NOCOPY modifier */ +}; +typedef enum OCITypeParamMode OCITypeParamMode; + + +/*-------------------------------- DEFAULTS ---------------------------------*/ + +/* default binary and decimal precision and scale */ + +#define OCI_NUMBER_DEFAULTPREC ((ub1)0) /* no precision specified */ +#define OCI_NUMBER_DEFAULTSCALE ((sb1)MAXSB1MINVAL) + /* no binary/decimal scale specified */ + +/* default maximum length for varrays and vstrings (used in sql.bsq) */ + +#define OCI_VARRAY_MAXSIZE 4000 + /* default maximum number of elements for a varray */ +#define OCI_STRING_MAXLEN 4000 /* default maximum length of a vstring */ + +/*---------------------------------------------------------------------------*/ +/* This set of macro is used only in beta2. They should be removed as soon as + * PLSQL has made the changes of not using these macros. + */ + +/* Special duration for allocating memory only. No instance can be allocated + * given these durations. + */ +#define OCICoherency OCIRefreshOpt +#define OCI_COHERENCY_NONE (OCIRefreshOpt)2 +#define OCI_COHERENCY_NULL (OCIRefreshOpt)4 +#define OCI_COHERENCY_ALWAYS (OCIRefreshOpt)5 + +#endif /* ORO_ORACLE */ + diff --git a/libraries/SQLAPI/include/ora_win/ort.h b/libraries/SQLAPI/include/ora_win/ort.h new file mode 100644 index 000000000..36b283dbb --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/ort.h @@ -0,0 +1,2594 @@ +/* @(#)ort.h 1.44 95/07/07 */ + +/* Copyright (c) 1994, 2005, Oracle. All rights reserved. */ + +/* + NAME + + ORT - ORacle's external open Type interface to the open type manager (OTM) + + DESCRIPTION + + The open type manager interface includes dynamic type operations to + create, delete, update, and access types. See the "Functional + Specification for Oracle Object Call Interface (Objects Project), + Version 1.0" for a user level description of the OTM. For a more + detailed description, see the "Component Document for the Open Type + Manager, Version 1.0". + + NOTE: MOST Of the functions in this header file are being desupported. + Please use the OCIDescribeAny interface as described in oci.h + instead. + The OCIType, OCITypeElem, OCITypeMethod abstract types continue + to be supported. The only two functions that remain to be documented + are OCITypeArrayByName and OCITypeArrayByRef. + All obsolete types/functions are marked accordingly below. + + RELATED DOCUMENTS + + For the functional specification for the OTM, see: + [1] Kotsovolos, Susan, "Functional Specification for Oracle Object + Call Interface (Objects Project), Version 1.0", Oracle + Corporation, February 1995. + For the internal design of the OTM, see the following: + [2] Kotsovolos, Susan, "Component Document for the Open Type Manager", + Oracle Corporation, November 1994. + [3] Kotsovolos, Susan, "Design for The Open Type Manager, Oracle + Object Management Subsystem Version 1.0", Oracle Corporation, + March 1994. + [4] Kotsovolos, Susan and Tin A. Nguyen, "The Open Type Manager", + Oracle Corporation, March 1994. + [5] Kotsovolos, Susan and Tin A. Nguyen, "Schema Evolution", + Oracle Corporation, March 1994. + For a description of the types the OTM must support, see: + [6] Nguyen, Tin A., "The Open Type System", Oracle Corporation, + February 1994. + + INSPECTION STATUS + + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + + Review date: + Review status: + Reviewers: + + + **** ALL OBSOLETE FUNCTIONS/TYPES ARE MARKED ACCORDINGLY *** + + EXPORT FUNCTIONS + + None + + PUBLIC DATA STRUCTURES + + OCIType - type descriptor in the object cache + OCITypeElem - type element descriptor in the object cache + (used for attributes and paramters) + OCITypeCode - Open Type System type code. + OCITypeMethod - method descriptor in the object cache + OCITypeParamMode - parameter modes (ie. IN, IN-OUT etc) + + PUBLIC FUNCTIONS + + ITERATOR (for OCITypeAttrNext and OCITypeMethodNext) + + OCITypeIterNew - ** OBSOLETE ** Create new instance of an iteraton. + OCITypeIterSet - ** OBSOLETE ** Initialize iterator. + OCITypeIterFree - ** OBSOLETE ** Free instance of iterator. + + TYPE GET + + OCITypeByName - ** OBSOLETE ** Get a type by name. + OCITypeArrayByName - Get an array of types by their names. + OCITypeByRef - ** OBSOLETE ** Get a type by its CREF. + OCITypeArrayByRef - Get an array of types by their CREFs. + + TYPE ACCESSORS + + OCITypeName - ** OBSOLETE ** OCI Get a type's name. + OCITypeSchema - ** OBSOLETE ** OCI Get a type's schema name. + OCITypeTypeCode - ** OBSOLETE ** OCI Get a type's type code. + OCITypeVersion - ** OBSOLETE ** OCI Get a Type's user-readable Version. + OCITypeAttrs - ** OBSOLETE ** OCI Get a Type's Number of Attributes. + OCITypeMethods - ** OBSOLETE ** OCI Get a Type's Number of Methods. + + TYPE ELEMENT ACCESSORS (they represent attributes/parameters/results) + + OCITypeElemName - ** OBSOLETE ** Get a type element's (only for + attributes) name. + OCITypeElemType - ** OBSOLETE ** Get a type element's type + descriptor. + OCITypeElemTypeCode - ** OBSOLETE ** Get a type element's typecode. + OCITypeElemParameterizedType - ** OBSOLETE ** Get a type element's + parameterized type's type descriptor. + OCITypeElemNumPrec - ** OBSOLETE ** Get a number's precision. + OCITypeElemNumScale - ** OBSOLETE ** Get a decimal or oracle Number's + Scale + OCITypeElemCharSetID - ** OBSOLETE ** Get a fixed or variable length + string's character set ID. + OCITypeElemCharSetForm - ** OBSOLETE ** Get a fixed or variable length + string's character set form (how + character set information has + been specified). + OCITypeElemLength - ** OBSOLETE ** Get a raw, fixed or variable + length string's length. + OCITypeElemParamMode - ** OBSOLETE ** Get element's parameter's mode + (only valid for parameter). + OCITypeElemDefaultValue - ** OBSOLETE ** Get element's Default Value. + + ATTRIBUTE ACCESSORS + + OCITypeAttrByName - ** OBSOLETE ** Get an Attribute by Name. + OCITypeAttrNext - ** OBSOLETE ** Get an Attribute by Iteration. + + COLLECTION ACCESSORS + + OCITypeCollTypeCode - ** OBSOLETE ** Get a named collection's typecode. + OCITypeCollElem - ** OBSOLETE ** Get a named collection's element's + type element information. + OCITypeCollSize - ** OBSOLETE ** Get a named collection's size in + number of elements. + + METHOD ACCESSORS + + OCITypeMethodOverload - ** OBSOLETE ** Get number of overloaded methods + with the given method name. + (no direct equivalent for + OCIDescribe interface) + OCITypeMethodByName - ** OBSOLETE ** Get one or more methods by name. + OCITypeMethodNext - ** OBSOLETE ** Iterate to the next method to + retrieve. + OCITypeMethodName - ** OBSOLETE ** Get method's name. + OCITypeMethodEncap - ** OBSOLETE ** Get method's encapsulation level. + OCITypeMethodFlags - ** OBSOLETE ** et method's flags. + OCITypeMethodMap - ** OBSOLETE ** Get type's map function. + OCITypeMethodOrder - ** OBSOLETE ** Get type's order function. + OCITypeMethodParams - ** OBSOLETE ** Get a method's number of + parameters. + + RESULT ACCESSORS + + OCITypeResult - ** OBSOLETE ** OCI Get a method's Result. + + See also ATTRIBUTE/PARAMETER/RESULT TYPE ACCESSORS. + + PARAMETER ACCESSORS + + OCITypeParamByPos - ** OBSOLETE ** Get a Parameter in a method By + Position. + OCITypeParamByName - ** OBSOLETE ** Get a Parameter in a method By Name. + OCITypeParamPos - ** OBSOLETE ** Get a Parameter's PoSition in a + method. + + CALL GRAPHS: + + Only type accessors are supported for 8.0. + ** OBSOLETE ** please use OCIDescribe interface + + TYPE ACCESSOR EXAMPLE + + CREATE TYPE CAR + ( + name vstring, + age number, + number car_age; /o Oracle number o/ + weight car_weight; /o abstract type o/ + + PUBLIC: + + /o methods o/ + car(orlvs a_name, number an_age, WEIGHT a_weight); + ~car(); + inline number get_age() const; + + /o relative ordering (map) functions o/ + number car_map + ); + + /o the following code accesses the type created above o/ + + ub1 meth_flags; + ub4 i, j; + ub4 text_len, position; + ub4 count; + ub4 length; + OCITypeCode typecode; + OCIRef *attr_ref; + OCIRef *param_ref; + OCIType *tdo, new_tdo, final_tdo; + OCITypeElem *elem; + OCITypeIter *iterator_ort; + oratext (*names)[]; + ub4 lengths[]; + ub4 *positions; + oratext *name; + oratext name_buffer[M_IDEN]; + + /o initialize the references o/ + DISCARD orlrini(env, err, (dvoid *)&attr_ref); + DISCARD orlrini(env, err, (dvoid *)¶m_ref); + + /o ----------------- GET INFORMATION ABOUT A TYPE ----------------- o/ + + /o start a transaction o/ + + /o Pin the type until the end of the transaction. Pinning the type is + o required before using any type accessors. + o/ + if (OCITypeByName(env, err, svc, (oratext *)0, 0, "CAR", strlen("CAR"), + OCI_DURATION_TRANS, &car_ref, &car_tdo) != OCI_SUCCESS) + /o error o/ ; + + /o get the type's name o/ + if (!memcmp(OCITypeName(env, err, car_tdo, &text_len), "person", + text_len)) + /o do something o/ ; + + /o get the type's schema name o/ + if (!memcmp(OCITypeSchema(env, err, car_tdo, &text_len), "john", + text_len)) + /o do something o/ ; + + /o get the type code of the type o/ + if (OCITypeTypeCode(env, err, car_tdo) == OCI_TYPECODE_ADT) + /o do something o/ ; + + /o get the type version o/ + if (!memcmp(OCITypeVersion(env, err, car_tdo, &text_len), "1", text_len)) + /o do something o/ ; + + /o ------- GET FLATTENED POSITION OF AN ATTRIBUTES IN A TYPE ------- o/ + + names = malloc(sizeof(oratext *) * 2); + names[0] = malloc(strlen("car_weight")); + names[1] = malloc(strlen("ounces")); + memcpy(names[0], "car_weight", strlen("car_weight")); + memcpy(names[1], "ounces", strlen("ounces")); + + lengths = malloc(sizeof(ub4) * 2); + lengths[0] = strlen("car_weight"); + lengths[1] = strlen("ounces"); + + /o ---------- GET IMMEDIATE ATTRIBUTES IN A TYPE ---------- o/ + + /o loop through all attributes in the type with iterator o/ + if (OCITypeIterNew(env, err, car_tdo, &iterator_ort) != OCI_SUCCESS) + /o do something o/ + + while (OCITypeAttrNext(env, err, iterator_ort, &ado) != OCI_NO_DATA) + { + /o get the attribute's name o/ + if (!memcmp(OCITypeElemName(env, err, ado, &text_len), + "tiger", text_len)) + /o do something o/ ; + + /o get the attribute's type descriptor o/ + if (OCITypeElemType(env, err, ado, &tdo) != OCI_SUCCESS) + /o error o/ ; + + /o get the attribute's type code o/ + typecode = OCITypeElemTypeCode(env, err, ado); + + switch (typecode) + { + /o scalar types o/ + case OCI_TYPECODE_DATE: /o date o/ + case OCI_TYPECODE_SIGNED8: /o byte o/ + case OCI_TYPECODE_SIGNED16: /o short o/ + case OCI_TYPECODE_UNSIGNED8: /o unsigned byte o/ + case OCI_TYPECODE_UNSIGNED16: /o unsigned short o/ + case OCI_TYPECODE_OCTET: /o octet o/ + case OCI_TYPECODE_TABLE: /o nested table o/ + case OCI_TYPECODE_CLOB: /o character lob o/ + case OCI_TYPECODE_BLOB: /o binary lob o/ + case OCI_TYPECODE_CFILE: /o character file object o/ + case OCI_TYPECODE_BFILE: /o binary file object o/ + + /o do something o/ + break; + + /o number types o/ + case OCI_TYPECODE_NUMBER: /o oracle number o/ + case OCI_TYPECODE_DECIMAL: /o decimal o/ + { + /o get the scale of the number o/ + if (OCITypeElemNumScale(env, err, ado) == 3) + /o do something o/ ; + } + /o fall through to get the precision o/ + + case OCI_TYPECODE_FLOAT: /o float o/ + case OCI_TYPECODE_SIGNED32: /o long o/ + case OCI_TYPECODE_UNSIGNED32: /o unsigned long o/ + case OCI_TYPECODE_REAL: /o real o/ + case OCI_TYPECODE_DOUBLE: /o double o/ + { + /o get the precision of the number o/ + if (OCITypeElemNumPrec(env, err, ado) == 2) + /o do something o/ ; + } + break; + + /o string types o/ + case OCI_TYPECODE_CHAR: /o fixed length string o/ + case OCI_TYPECODE_VARCHAR2: /o variable length string o/ + case OCI_TYPECODE_RAW: /o raw o/ + { + /o get the length of the fixed or variable length string o/ + if (OCITypeElemLength(env, err, ado) < 100) + /o do something o/ + } + break; + + /o parameterized types o/ + case OCI_TYPECODE_REF: /o reference o/ + case OCI_TYPECODE_PTR: /o pointer o/ + { + /o get the type stored in the parameterized type o/ + if (OCITypeElemParameterizedType(env, err, ado, &tdo) + != OCI_SUCCESS) + /o error o/ ; + + /o do something o/ + if (OCI_TYPEELEM_IS_REF(OCITypeElemFlags(env, err, ado)))... + } + break; + + /o domain type o/ + case OCI_TYPECODE_NAMEDCOLLECTION: + switch (OCITypeCollTypeCode(env, err, tdo)) + { + case OCI_TYPECODE_VARRAY: /o variable array o/ + ub4 num_elems; + OCIType *element_type; + + /o get the number of elements in the farray or the maximum number + o of elements in the varray. + o/ + OCITypeCollSize(env, err, tdo, &num_elems); + + /o get the type of the array o/ + OCITypeElemType(env, err, tdo, &element_type); + } + break; + + case OCI_TYPECODE_TABLE: /o multiset o/ + { + OCIType *table_type; + + /o get the type of the multiset o/ + OCITypeElemType(env, err, tdo, &table_type); + + /o do something o/ + } + } + + /o abstract type o/ + case OCI_TYPECODE_ADT: /o abstract data type o/ + { + /o get the adt information o/ + if (OCITypeElemType(env, err, ado, &tdo) != OCI_SUCCESS) + /o error o/ ; + + /o do something o/ + } + break; + + default: + DISCARD printf("Error: invalid type code\n"); + + } /o end of typecode switch o/ + + } /o end of loop through all attributes in a type o/ + + + /o ------------ GET THE IMMEDIATE METHODS OF A TYPE ------------ o/ + + /o loop through all methods in the type by reusing iterator o/ + if (OCITypeIterSet(env, err, car_tdo, iterator_ort) != OCI_SUCCESS) + /o do something o/ + + while (OCITypeMethodNext(env, err, iterator_ort) != OCI_NO_DATA) + { + /o get the method's name o/ + if (!memcmp(OCITypeMethodName(env, err, mdo, &text_len), "car", + text_len)) + /o do something o/ ; + + /o get the method's encapsulation o/ + if (OCITypeMethodEncap(env, err, mdo) == OCI_TYPEENCAP_PUBLIC) + /o do something o/ ; + + /o get the method's flags o/ + meth_flags = OCITypeMethodFlags(env, err, mdo); + if (meth_flags & OCI_TYPEMETHOD_VIRTUAL) + /o do something o/ ; + + + /o ------------ GET THE PARAMETERS IN A METHOD ------------ o/ + + /o loop through all parameters in the method o/ + count = OCITypeMethodParams(env, err, mdo); + for (j = 1; j <= count; j++) + { + /o get the parameter information by position o/ + if (OCITypeParamByPos(env, err, mdo, i, &elem) != OCI_SUCCESS) + /o error o/ ; + + /o get the parameter's name o/ + if (!memcmp(OCITypeElemName(env, err, elem, &text_len), "an_age", + text_len)) + /o do something o/ ; + + /o get the parameter's mode o/ + if (OCITypeElemMode(env, err, elem) == OCI_PARAM_OUT) + /o do something o/ ; + + /o get the parameter's required flag o/ + if (ortgprq(env, err, elem)) + /o do something o/ ; + } + } + + /o get a method by name o/ + if (OCITypeMethodByName(env, err, car_tdo, "car_constructor", + strlen("car_constructor"), NULLP(OCIRef), &mdo) + != OCI_SUCCESS) + /o error o/ ; + + /o get a parameter in a method by name o/ + if (OCITypeParamByName(env, err, mdo, "an_age", strlen("an_age"), &elem) + != OCI_SUCCESS) + /o error o/ ; + + /o get a parameter's typecode o/ + typecode = OCITypeElemTypeCode(env, err, elem); + + /o get a parameter's type object o/ + if (OCITypeElemType(env, err, elem, &tdo)) != OCI_SUCCESS) + /o error o/ ; + + /o get a parameter's position in a method o/ + if (ortgpps(env, err, mdo, "an_age", strlen("an_age"), + &position, NULLP(OCIRef), NULLP(OCITypeElem)) != OCI_SUCCESS) + /o error o/ ; + + /o ------------ GET THE METHOD's RESULT ------------ o/ + + /o get a method by name o/ + if (OCITypeMethodByName(env, err, car_tdo, "get_age", strlen("get_age"), + &mdo) != OCI_SUCCESS) + /o error o/ ; + + /o get the typecode of the method's result o/ + typecode = OCITypeElemTypeCode(env, err, mdo); + + + /o ----------------- END ---------------- o/ + + /o free the references implicitly allocated o/ + DISCARD orlrfre(env, err, (dvoid *)&attr_ref); + DISCARD orlrfre(env, err, (dvoid *)¶m_ref); + + NOTES + + MODIFIED + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + aahluwal 06/03/02 - bug 2360115 + skabraha 04/16/02 - fix compiler warnings + rkasamse 03/02/01 - do not use iterator : keyword in MSVB + bpalaval 02/09/01 - Change text to oratext. + rxgovind 01/31/00 - add OCIType interfaces for transient types + whe 09/01/99 - 976457:check __cplusplus for C++ code + cxcheng 05/06/97 - make OCI_TYPE?? test macros return either 1 or 0 + cxcheng 04/22/97 - add comment on desupporting OCIType functions + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/26/97 - fix lint problem with oro names + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + cxcheng 01/15/97 - change prototype of OCITypeElemParameterizedType() + cxcheng 01/03/97 - replace bit in OCI_TYPEPARAM_IS_REQUIRED with bitwis + cxcheng 12/31/96 - replace OCI_PARAM_IS_REQUIRED with OCI_TYPEPARAM_IS_ + cxcheng 12/09/96 - add prototype for OCITypeElemExtTypeCode and OCIType + cxcheng 11/25/96 - add schema name parameter to OCITypeVTInsert() + cxcheng 11/20/96 - fix prototype for OCITypeByName() + cxcheng 11/11/96 - fix prototype for OCITypeByName() + cxcheng 11/05/96 - remove OCITypeElemExtTypeCode and OCITypeCollExtType + dchatter 10/28/96 - change ortgatyp to be OCITypeArrayByName + cxcheng 10/25/96 - fix problem with ortgatyp at end + cxcheng 10/22/96 - add OCITypeByRef and OCITypeArrayByRef + cxcheng 10/20/96 - remove ortgtyp() from #define section at end + cxcheng 10/18/96 - rename OCITypeGetArray to OCITypeArrayByName + cxcheng 10/17/96 - final change to prototype for OCI_TYPEPARAM_IS_REQUI + cxcheng 10/15/96 - rename OCIEncapLevel and OCIMethodFlag + cxcheng 10/14/96 - change prototype of OCITypeResult + mluong 10/11/96 - fix compile error + jwijaya 10/10/96 - fix bug on OCI_PARAM_IS_REQUIRED + cxcheng 10/09/96 - more lint and link fixes + cxcheng 10/08/96 - more lint fixes + cxcheng 10/07/96 - more changes + cxcheng 10/04/96 - replace short names with long names + cxcheng 10/01/96 - change to long names for readability + cxcheng 09/27/96 - rename ortgatyp() to ortgtya() for lint + cxcheng 09/20/96 - add ortgatyp() for array get type + cxcheng 09/18/96 - add array pin and iterator functions + cxcheng 08/09/96 - add version table calls + cxcheng 07/22/96 - add OCITypeElemType() to top + jwijaya 07/03/96 - add ANSI prototypes + cxcheng 06/28/96 - add OCITypeElemCharSetForm() + cxcheng 06/26/96 - fix comment on OCITypeParamByPos()/ortgpps() + cxcheng 06/18/96 - fix comments on OCITypeResult() + cxcheng 06/17/96 - improve comments + skrishna 06/03/96 - change OCITypeCollElem() prototype + vkrishna 05/29/96 - replace OROTCFAR with OROTCCAR + cxcheng 05/28/96 - fix comments, remove non-beta1 functions + cxcheng 05/02/96 - fix prototype bugs + cxcheng 04/29/96 - rename OCITypeElemm() to ortanct() + cxcheng 04/26/96 - add ortgrbp and ortftyi, + fix comments and examples + cxcheng 04/22/96 - big merge to main branch + cxcheng 04/17/96 - fix syntax + cxcheng 04/08/96 - change prototype to ortaty() + skrishna 04/08/96 - change ort*() to take OCIEnv* and OCIError* instead + of oroenv* + cxcheng 03/28/96 - add ortslob(), change ortsstr() prototype + cxcheng 03/13/96 - change alter type interface + cxcheng 03/11/96 - ORT interface changes + cxcheng 02/27/96 - correct comments + jboonleu 02/09/96 - rename oroopd to OCIDuration + cxcheng 01/19/96 - change ORTCTYVAL to ORTCTYEMB for embedded ADT + cxcheng 02/14/96 - add more comments + jboonleu 02/09/96 - rename oroopd to OCIDuration + cxcheng 02/07/96 - fix comments and examples + cxcheng 01/19/96 - new ORT interface without korfc's + cxcheng 01/08/96 - consolidate collection functions + cxcheng 12/14/95 - remove obsolete ortgcol() and ortrelease() + jweisz 12/12/95 - merge screwup: ortdth twice + cxcheng 12/05/95 - change multiset interface for new standard + skotsovo 12/01/95 - merge from /vobs/rdbms/public/ort.h@@/main/ + st_rdbms_big_dev/st_rdbms_obj/ + st_rdbms_jwijaya_variable_ref + cxcheng 11/13/95 - add ortaty()/orteaty() + cxcheng 11/13/95 - add new collection type accessors + skotsovo 10/30/95 - add 'oid' type b/c extent type uses it. + skotsovo 10/24/95 - update according to new variable length ref + cxcheng 10/05/95 - add null support, change prototypes to calls + cxcheng 10/03/95 - add OCITypeMethodOrder() to get ORDER method + cxcheng 09/28/95 - add OCITypeElemm() for collection types support + skotsovo 06/05/95 - add adt_type parameter to ortsab() + skotsovo 05/10/95 - ifdef'd out ortgafp() + skotsovo 03/07/95 - update interface to only include release 1 + skotsovo 02/22/95 - add multiset accessors + skotsovo 02/09/95 - update according to new ots doc + skotsovo 01/31/95 - add rest of release 1 types + skotsovo 01/24/95 - categorize sint32, double, and real as number types + (with precision and scale) instead of scalar types. + skotsovo 01/12/95 - remove dependency from ortdty interface + skotsovo 01/03/95 - remove orotyp accessors + skotsovo 12/12/94 - update comments + skotsovo 12/05/94 - change OCITypeElemParameterizedTyper interface + skotsovo 10/26/94 - add type version table + skotsovo 10/17/94 - fix ortgafp() comments + skotsovo 10/14/94 - modify ortgafp() parameters + skotsovo 10/14/94 - add examples + skotsovo 10/13/94 - add a few new routines + jwijaya 10/07/94 - add namespace to pin by name + jwijaya 10/02/94 - connection handle -> connection number + skotsovo 09/13/94 - modify example to use updated oririni interface + skotsovo 08/25/94 - change scale to sb1 from sb2 + skotsovo 07/28/94 - add ortbeg() and ortend() + skotsovo 07/14/94 - add decimal type & call graph + skotsovo 06/28/94 - subset by removing miscellaneous functions + skotsovo 06/28/94 - consistently put comments before typedefs + skotsovo 06/27/94 - modify according to new header file template, add + more examples, and change ortcty() to return a + reference to the type + skotsovo 06/24/94 - add functions to get type information from orotyp + skotsovo 06/20/94 - finish modifying according to header template + skotsovo 06/09/94 - modify according to header file template + skotsovo 06/08/94 - replace s.h with oratypes.h + skotsovo 05/24/94 - modify comments & update example + skotsovo 05/23/94 - modify fnt names for create, alter and drop type + skotsovo 05/18/94 - remove ortdme() -- delete a method + skotsovo 05/17/94 - add tdo parameter to all type modifiers + skotsovo 05/11/94 - return text* instead of including it in arglist + skotsovo 11/16/93 - creation + +*/ + +#ifndef ORATYPES +#include +#endif +#ifndef ORO_ORACLE +#include +#endif +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#define ORT_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCITypeArrayByName ortgatyp +#define OCITypeAttrByName ortgabn +#define OCITypeAttrNext ortgabi +#define OCITypeAttrs ortgtna +#define OCITypeByRef ortgtbrf +#define OCITypeCollElem ortgcel +#define OCITypeCollExtTypeCode ortgcsqt +#define OCITypeCollSize ortgcne +#define OCITypeCollTypeCode ortgdttc +#define OCITypeElem ortado +#define OCITypeElemCharSetForm ortgscform +#define OCITypeElemCharSetID ortgscid +#define OCITypeElemDefaultValue ortgpdv +#define OCITypeElemExtTypeCode ortgasqt +#define OCITypeElemLength ortgsl +#define OCITypeElemName ortganm +#define OCITypeElemNumPrec ortgnp +#define OCITypeElemNumScale ortgns +#define OCITypeElemParamMode ortgpmo +#define OCITypeElemParameterizedType ortgpa +#define OCITypeElemType ortgaty +#define OCITypeElemTypeCode ortgatc +#define OCITypeIter ortitr +#define OCITypeIterFree ortifre +#define OCITypeIterNew ortinew +#define OCITypeIterSet ortiset +#define OCITypeMethod ortmdo +#define OCITypeMethodByName ortgmbn +#define OCITypeMethodEncap ortgmen +#define OCITypeMethodFlags ortgmfl +#define OCITypeMethodMap ortgmmap +#define OCITypeMethodName ortgmnm +#define OCITypeMethodNext ortgmbi +#define OCITypeMethodOrder ortgmor +#define OCITypeMethodOverload ortgmno +#define OCITypeMethodParams ortgmnp +#define OCITypeMethods ortgtnm +#define OCITypeName ortgtme +#define OCITypeParamByName ortgpbn +#define OCITypeParamPos ortgpps +#define OCITypeSchema ortgtsch +#define OCITypeTypeCode ortgttc +#define OCITypeVTInit ortvini +#define OCITypeVTInsert ortvins +#define OCITypeVTSelect ortvsel +#define OCITypeVersion ortgtvn + +#endif /* SLSHORTNAME */ + + +/*============================*/ +/* PUBLIC TYPES AND CONSTANTS */ +/*============================*/ + +/*----------------------------- TYPE DESCRIPTION ----------------------------*/ + +/* + * OCIType - OCI Type Description Object + * + * The contents of an 'OCIType' is private/opaque to clients. Clients just + * need to declare and pass 'OCIType' pointers in to the type manage + * functions. + * The pointer points to the type in the object cache. Thus, clients don't + * need to allocate space for this type and must NEVER free the pointer to the + * 'OCIType'. + */ + +typedef struct OCIType OCIType; + +/*------------------------- TYPE ELEMENT DESCRIPTION ------------------------*/ + + +/* + * OCITypeElem - OCI Type Element object + * + * The contents of an 'OCITypeElem' is private/opaque to clients. Clients just + * need to declare and pass 'OCITypeElem' pointers in to the type manager + * functions. + * + * 'OCITypeElem' objects contains type element information such as the numeric + * precision for example, for number objects, and the number of elements for + * arrays. + * They ARE used to describe type attributes, collection elements, + * method parameters, and method results. Hence they are pass in or returned + * by attribute, collection, and method parameter/result accessors. + */ + +typedef struct OCITypeElem OCITypeElem; + + +/*--------------------------- METHOD DESCRIPTION ---------------------------*/ + + +/* + * OCITypeMethod - OCI Method Description object + * + * The contents of an 'OCITypeMethod' is private/opaque to clients. Clients + * just need to declare and pass 'OCITypeMethod' pointers in to the type + * manager functions. + * The pointer points to the method in the object cache. Thus, clients don't + * need to allocate space for this type and must NEVER free the pointer to + * the 'OCITypeMethod'. + */ + +typedef struct OCITypeMethod OCITypeMethod; + + +/*--------------------------- TYPE ACCESS ITERATOR --------------------------*/ + +/* + * OCITypeIter- OCI Type Iterator + * + * The contents of an 'orti' is private/opaque to clients. Clients just + * need to declare and pass 'orti' pointers in to the type manager functions. + * The iterator is used to retreive MDO's and ADO's that belong to the TDO + * one at a time. It needs to be allocated by the 'OCITypeIterNew()' function + * call and deallocated with the 'OCITypeIterFree()' function call. + */ + +typedef struct OCITypeIter OCITypeIter; + + +/*==================*/ +/* PUBLIC FUNCTIONS */ +/*==================*/ + +/*--------------------------------------------------------------------------*/ +/* ITERATOR */ +/*--------------------------------------------------------------------------*/ + +/*-----------------------_- OCITypeIterNew ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeIterNew( OCIEnv *env, OCIError *err, OCIType *tdo, + OCITypeIter **iterator_ort ); + +/* + NAME: OCITypeIterNew - OCI Iterator NEW + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the pinned type in the object cache to + initialize the iterator with + iterator_ort (OUT) - pointer to the pointer to the new iterator created + DESCRIPTION: + Create a new instance of a method/attribute iterator and initalize + it's values. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) error while allocating space for the iterator. +*/ + +/*------------------------ OCITypeIterSet ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeIterSet( OCIEnv *env, OCIError *err, OCIType *tdo, + OCITypeIter *iterator_ort ); + +/* + NAME: OCITypeIterSet - OCI Iterator SET + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the pinned type in the object cache to + initialize the iterator with + iterator_ort (IN/OUT) - pointer to the iterator to set + DESCRIPTION: + Initializes the iterator. This is used to reset the state of the + iterator. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. +*/ + +/*------------------------ OCITypeIterFree ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeIterFree( OCIEnv *env, OCIError *err, OCITypeIter + *iterator_ort ); + +/* + NAME: OCITypeIterFree - OCI Iterator FREe + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + iterator_ort (IN/OUT) - pointer to the iterator to free + DESCRIPTION: + Free space allocated for the iterator. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) error while freeing the iterator, probably bad iterator pointer. +*/ + + +/*--------------------------------------------------------------------------*/ +/* TYPE GET */ +/*--------------------------------------------------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeByName( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + const oratext *schema_name, ub4 s_length, + const oratext *type_name, ub4 t_length, + const oratext *version_name, ub4 v_length, + OCIDuration pin_duration, OCITypeGetOpt get_option, + OCIType **tdo ); +/* + NAME: OCITypeByName - OCI Get the most current version of an existing TYPe + by name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN) - OCI service handle + schema_name (IN, optional) - name of schema associated with the + type. By default, the user's schema name is used. + s_length (IN) - length of the 'schema_name' parameter + type_name (IN) - name of the type to get + t_length (IN) - length of the 'type_name' parameter + version_name (IN, optional) - user readable version of the type. + Pass (oratext *)0 for the most current version. + v_length (IN) - length of version_name in bytes. Should be 0 if + the most current version is to be retrieved. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction). See 'oro.h' for a description of + each option. + get_option (IN) - options for loading the types. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - pointer to the pinned type in the object cache + DESCRIPTION: + Get a pointer to a version of the existing type associated + with schema/type name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) the adt type associated with schema/type name does not exist. + NOTE: + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. +*/ + +sword OCITypeArrayByName( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + ub4 array_len, + const oratext *schema_name[], ub4 s_length[], + const oratext *type_name[], ub4 t_length[], + const oratext *version_name[], ub4 v_length[], + OCIDuration pin_duration, + OCITypeGetOpt get_option, OCIType **tdo ); + +/* + NAME: OCITypeArrayByName - OCI Get array of TYPes by name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN) - OCI service handle + array_len (IN) - number of schema_name/type_name/version_name entries to + be retrieved. + schema_name (IN, optional) - array of schema names associated with the + types to be retrieved. The array must have array_len + elements if specified. + If 0 is supplied, the default schema is assumed, otherwise + it MUST have array_len number of elements. + 0 can be supplied for one or more of the entries to indicate + that the default schema is desired for those entries. + s_length (IN) - array of schema_name lengths with each entry + corresponding to the length of the corresponding schema_name + entry in the schema_name array in bytes. + The array must either have array_len number of elements or + it MUST be 0 if schema_name is not specified. + type_name (IN) - array of the names of the types to retrieve. This + MUST have array_len number of elements. + t_length (IN) - array of the lengths of type names in the type_name + array in bytes. + version_name (IN) - array of the version names of the types to retrieve + corresponding. This can be 0 to indicate retrieval of the + most current versions, or it MUST have array_len number of + elements. + If 0 is supplied, the most current version is assumed, + otherwise it MUST have array_len number of elements. + 0 can be supplied for one or more of the entries to indicate + that the current version is desired for those entries. + v_length (IN) - array of the lengths of version names in the + version_name array in bytes. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction) for the types retreieve. See 'oro.h' for a + description of each option. + get_option (IN) - options for loading the types. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - output array for the pointers to each pinned type in the + object cache. It must have space for array_len pointers. + Use OCIObjectGetObjectRef() to obtain the CREF to each + pinned type descriptor. + DESCRIPTION: + Get pointers to the existing types associated with the schema/type name + array. This is similar to OCITypeByName() except that all the TDO's are + retreived via a single network roundtrip. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) one or more adt types associated with a schema/type name entry + does not exist. +*/ + +sword OCITypeByRef( OCIEnv *env, OCIError *err, + const OCIRef *type_ref, OCIDuration pin_duration, + OCITypeGetOpt get_option, OCIType **tdo ); + +/* + NAME: OCITypeArrayByRef - OCI Get array of TYPes by REF. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + type_ref (IN) - OCIRef * pointing to the particular version of + the type descriptor object to obtain. + The array must have array_len elements if specified. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction) for the type to retreieve. See 'oro.h' for a + description of each option. + get_option (IN) - options for loading the type. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - pointer to the pinned type in the object cache + DESCRIPTION: + Get pointers to the + with the schema/type name array. This is similar to OCITypeByName() + except that all the TDO's are retreived via a single network roundtrip. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) one or more adt types associated with a schema/type name entry + does not exist. +*/ + +sword OCITypeArrayByRef( OCIEnv *env, OCIError *err, + ub4 array_len, const OCIRef **type_ref, + OCIDuration pin_duration, + OCITypeGetOpt get_option, OCIType **tdo ); + +/* + NAME: OCITypeArrayByRef - OCI Get array of TYPes by REF. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + array_len (IN) - number of schema_name/type_name/version_name entries to + be retrieved. + type_ref (IN) - array of OCIRef * pointing to the particular version of + the type descriptor object to obtain. + The array must have array_len elements if specified. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction) for the types retreieve. See 'oro.h' for a + description of each option. + get_option (IN) - options for loading the types. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - output array for the pointers to each pinned type in the + object cache. It must have space for array_len pointers. + Use OCIObjectGetObjectRef() to obtain the CREF to each + pinned type descriptor. + DESCRIPTION: + Get pointers to the + with the schema/type name array. This is similar to OCITypeByName() + except that all the TDO's are retreived via a single network roundtrip. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) one or more adt types associated with a schema/type name entry + does not exist. +*/ + + +/*--------------------------------------------------------------------------*/ +/* TYPE ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*---------------------------- OCITypeName ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeName( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *n_length ); +/* + NAME: OCITypeName - ORT Get a Type's naME. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + n_length (OUT) - length (in bytes) of the returned type name. The + caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'n_length' must point to an allocated ub4. + DESCRIPTION: + Get the name of the type. + RETURNS: + the name of the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------ OCITypeSchema ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeSchema( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *n_length ); +/* + NAME: OCITypeSchema - ORT Get a Type's SCHema name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + n_length (OUT) - length (in bytes) of the returned schema name. The + caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'n_length' must point to an allocated ub4. + DESCRIPTION: + Get the schema name of the type. + RETURNS: + the schema name of the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------ OCITypeTypeCode ---------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeTypeCode( OCIEnv *env, OCIError *err, + const OCIType *tdo ); +/* + NAME: OCITypeTypeCode - OCI Get a Type's Type Code. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the type code of the type. + RETURNS: + The type code of the type. + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*----------------------- OCITypeCollTypeCode -------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeCollTypeCode( OCIEnv *env, OCIError *err, + const OCIType *tdo ); +/* + NAME: OCITypeCollTypeCode - OCI Get a Domain Type's Type Code. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'tdo' MUST point to a named collection type. + DESCRIPTION: + Get the type code of the named collection type. For V8.0, named + collection types can only be variable length arrays and nested tables. + RETURNS: + OCI_TYPECODE_VARRAY for variable length array, and + OCI_TYPECODE_TABLE for nested tables. + NOTES: + The type descriptor, 'tdo', should be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------- OCITypeVersion ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeVersion( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *v_length ); +/* + NAME: OCITypeVersion - OCI Get a Type's user-readable VersioN. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + v_length (OUT) - length (in bytes) of the returned user-readable + version. The caller must allocate space for the ub4 before + calling this routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'v_length' must point to an allocated ub4. + DESCRIPTION: + Get the user-readable version of the type. + RETURNS: + The user-readable version of the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*--------------------------- OCITypeAttrs ---------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeAttrs( OCIEnv *env, OCIError *err, const OCIType *tdo ); +/* + NAME: OCITypeAttrs - OCI Get a Type's Number of Attributes. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the number of attributes in the type. + RETURNS: + The number of attributes in the type. 0 for ALL non-ADTs. + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------- OCITypeMethods ---------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeMethods( OCIEnv *env, OCIError *err, const OCIType *tdo ); +/* + NAME: OCITypeMethods - OCI Get a Type's Number of Methods. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the number of methods in a type. + RETURNS: + The number of methods in the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* TYPE ELEMENT INFORMATION ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeElemName ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeElemName( OCIEnv *env, OCIError *err, + const OCITypeElem *elem, ub4 *n_length ); +/* + NAME: OCITypeElemName - OCI Get an Attribute's NaMe. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + n_length (OUT) - length (in bytes) of the returned attribute name. + The caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'n_length' must point to an allocated ub4. + DESCRIPTION: + Get the name of the attribute. + RETURNS: + the name of the attribute and the length in n_length + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeElemTypeCode ------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeElemTypeCode( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemTypeCode - OCI Get an Attribute's TypeCode. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the typecode of an attribute's type. + RETURNS: + the typecode of the attribute's type. If this is a scalar type, the + typecode sufficiently describes the scalar type and no further calls + need to be made. Valid scalar types include: OCI_TYPECODE_SIGNED8, + OCI_TYPECODE_UNSIGNED8, OCI_TYPECODE_SIGNED16, OCI_TYPECODE_UNSIGNED16, + OCI_TYPECODE_SIGNED32, OCI_TYPECODE_UNSIGNED32, OCI_TYPECODE_REAL, + OCI_TYPECODE_DOUBLE, OCI_TYPECODE_DATE, + OCI_TYPECODE_MLSLABEL, OROTCOID, OCI_TYPECODE_OCTET, or OROTCLOB. + This function converts the CREF (stored in the attribute) into a + typecode. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeElemType ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeElemType( OCIEnv *env, OCIError *err, const OCITypeElem *elem, + OCIType **elem_tdo ); +/* + PARAMETERS + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + elem_tdo (OUT) - If the function completes successfully, 'elem_tdo' + points to the type descriptor (in the object cache) of the type of + the element. + + REQUIRES + 1) All type accessors require that the type be pinned before calling + any accessor. This can be done by calling 'OCITypeByName()'. + 2) if 'elem' is not null, it must point to a valid type element descriptor + in the object cache. + + DESCRIPTION + Get the type tdo of the type of this element. + RETURNS + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + + NOTES + The type must be unpinned when the accessed information is no + longer needed. This can be done by calling 'OCIObjectUnpin()'. + */ + +/*------------------------- OCITypeElemFlags -------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeElemFlags( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemFlags - OCI Get a Elem's FLags + (inline, constant, virtual, constructor, + destructor). + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the flags of a type element (attribute, parameter). + RETURNS: + The flags of the type element. + NOTES: + The flag bits are not externally documented. Use only the macros + in the last section (ie. OCI_TYPEPARAM_IS_REQUIRED, and + OCI_TYPEELEM_IS_REF) to test for them only. The type must be unpinned + when the accessed information is no longer needed. + */ + +/*------------------------ OCITypeElemNumPrec ------------------------------*/ + +/* ** OBSOLETE ** */ +ub1 OCITypeElemNumPrec( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemNumPrec - Get a Number's Precision. This includes float, + decimal, real, double, and oracle number. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the precision of a float, decimal, long, unsigned long, real, + double, or Oracle number type. + RETURNS: + the precision of the float, decimal, long, unsigned long, real, double, + or Oracle number + */ + +/*------------------------- OCITypeElemNumScale -----------------------------*/ + +/* ** OBSOLETE ** */ +sb1 OCITypeElemNumScale( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemNumScale - Get a decimal or oracle Number's Scale + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the scale of a decimal, or Oracle number type. + RETURNS: + the scale of the decimal, or Oracle number + */ + +/*------------------------ OCITypeElemLength -------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeElemLength( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemLength - Get a raw, fixed or variable length String's + length in bytes. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the length of a raw, fixed or variable length string type. + RETURNS: + length of the raw, fixed or variable length string + */ + +/*----------------------- OCITypeElemCharSetID -----------------------------*/ + +/* ** OBSOLETE ** */ +ub2 OCITypeElemCharSetID( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemCharSetID - Get a fixed or variable length String's + character set ID + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the character set ID of a fixed or variable length string type. + RETURNS: + character set ID of the fixed or variable length string + */ + +/*---------------------- OCITypeElemCharSetForm ----------------------------*/ + +/* ** OBSOLETE ** */ +ub2 OCITypeElemCharSetForm( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemCharSetForm - Get a fixed or variable length String's + character set specification form. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the attribute information in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the character form of a fixed or variable length string type. + The character form is an enumerated value that can be one of the + 4 values below: + SQLCS_IMPLICIT for CHAR, VARCHAR2, CLOB w/o a specified set + SQLCS_NCHAR for NCHAR, NCHAR VARYING, NCLOB + SQLCS_EXPLICIT for CHAR, etc, with "CHARACTER SET ..." syntax + SQLCS_FLEXIBLE for PL/SQL "flexible" parameters + RETURNS: + character form of the fixed or variable string + */ + +/*--------------------- OCITypeElemParameterizedType ------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeElemParameterizedType( OCIEnv *env, OCIError *err, + const OCITypeElem *elem, + OCIType **type_stored ); +/* + NAME: OCITypeElemParameterizedType + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + type_stored (OUT) - If the function completes successfully, + and the parameterized type is complex, 'type_stored' is NULL. + Otherwise, 'type_stored' points to the type descriptor (in the + object cache) of the type that is stored in the parameterized + type. The caller must allocate space for the OCIType* + before calling this routine and must not write into the space. + REQUIRES: + All input parameters must be valid. + DESCRIPTION: + Get a descriptor to the parameter type of a parameterized type. + Parameterized types are types of the form: + REF T + VARRAY (n) OF T + etc, where T is the parameter in the parameterized type. + Additionally is_ref is set if the parameter is a PTR or REF. + For example, it is set for REF T or VARRAY(n) OF REF T. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) 'type_stored' is not NULL but points to NULL data. + NOTES: + Complex parameterized types will be in a future release (once + typedefs are supported. When setting the parameterized type + information, the user must typedef the contents if it's a + complex parameterized type. Ex. for varray>, use + 'typedef varray varcar' and then use varray. + */ + +/*----------------------- OCITypeElemExtTypeCode ----------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeElemExtTypeCode( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemExtTypeCode - OCI Get an element's SQLT constant. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the internal Oracle typecode associated with an attribute's type. + This is the actual typecode for the attribute when it gets mapped + to a column in the Oracle database. + RETURNS: + The Oracle typecode associated with the attribute's type. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*--------------------------------------------------------------------------*/ +/* ATTRIBUTE ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeAttrByName -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeAttrByName( OCIEnv *env, OCIError *err, const OCIType *tdo, + const oratext *name, ub4 n_length, + OCITypeElem **elem ); +/* + NAME: OCITypeAttrByName - OCI Get an Attribute By Name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + name (IN) - the attribute's name + n_length (IN) - length (in bytes) of the 'name' parameter + elem (OUT) - If this function completes successfully, 'elem' points to + the selected type element descriptor pertaining to the + attributein the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Get an attribute given its name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) the type does not contain an attribute with the input 'name'. + 3) 'name' is NULL. + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. + */ + +/*------------------------ OCITypeAttrNext ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeAttrNext( OCIEnv *env, OCIError *err, + OCITypeIter *iterator_ort, OCITypeElem **elem ); + +/* + NAME: OCITypeAttrNext - OCI Get an Attribute By Iteration. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + iterator_ort (IN/OUT) - iterator for retrieving the next attribute; + see OCITypeIterNew() to initialize iterator. + elem (OUT) - If this function completes successfully, 'elem' points to + the selected type element descriptor pertaining to the + attributein the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Iterate to the next attribute to retrieve. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_NO_DATA if there are no more attributes to iterate on; use + OCITypeIterSet() to reset the iterator if necessary. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*--------------------------------------------------------------------------*/ +/* COLLECTION ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeCollElem ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeCollElem( OCIEnv *env, OCIError *err, const OCIType *tdo, + OCITypeElem **element ); +/* + NAME: OCITypeCollElem + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the type descriptor in the object cache + element (IN/OUT) - If the function completes successfully, this + points to the descriptor for the collection's element. + It is stored in the same format as an ADT attribute's + descriptor. + If *element is NULL, OCITypeCollElem() implicitly allocates a + new instance of OCITypeElem in the object cache. This instance + will be + automatically freed at the end of the session, and does not have + to be freed explicitly. + If *element is not NULL, OCITypeCollElem() assumes that it + points to a valid OCITypeElem descriptor and will copy the + results into it. + REQUIRES: + All input parameters must be valid. + DESCRIPTION: + Get a pointer to the descriptor (OCITypeElem) of the element of an + array or the rowtype of a nested table. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) the type TDO does not point to a valid collection's type. + NOTES: + Complex parameterized types will be in a future release (once + typedefs are supported. When setting the parameterized type + information, the user must typedef the contents if it's a + complex parameterized type. Ex. for varray>, use + 'typedef varray varcar' and then use varray. + */ + +/*------------------------ OCITypeCollSize ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeCollSize( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *num_elems ); +/* + NAME: OCITypeCollSize - OCI Get a Collection's Number of Elements. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the type descriptor in the object cache + num_elems (OUT) - number of elements in collection + REQUIRES: + All input parameters must be valid. tdo points to an array type + defined as a domain. + DESCRIPTION: + Get the number of elements stored in a fixed array or the maximum + number of elements in a variable array. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) 'tdo' does not point to a domain with a collection type. + NOTES: + Complex parameterized types will be in a future release (once + typedefs are supported. When setting the parameterized type + information, the user must typedef the contents if it's a + complex parameterized type. Ex. for varray>, use + 'typedef varray varcar' and then use varray. + */ + +/*------------------------ OCITypeCollExtTypeCode ---------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeCollExtTypeCode( OCIEnv *env, OCIError *err, + const OCIType *tdo, OCITypeCode *sqt_code ); +/* + NAME: ortcsqt - OCI Get a Collection element's DTY constant. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the type descriptor in the object cache + sqt_code (OUT) - SQLT code of type element. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the SQLT constant associated with an domain's element type. + The SQLT codes are defined in and are needed for OCI/OOCI + use. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) 'tdo' does not point to a domain with a collection type. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* METHOD ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------- OCITypeMethodOverload --------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeMethodOverload( OCIEnv *env, OCIError *err, const OCIType *tdo, + const oratext *method_name, ub4 m_length ); +/* + NAME: OCITypeMethodOverload - OCI Get type's Number of Overloaded names + for the given method name. + PARAMETERS: + gp (IN/OUT) - pga environment handle. Any errors are recorded here. + tdo (IN) - pointer to to the type descriptor in the object cache + method_name (IN) - the method's name + m_length (IN) - length (in bytes) of the 'method_name' parameter + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Overloading of methods implies that more than one method may have the + same method name. This routine returns the number of methods that + have the given method name. If there are no methods with the input + method name, 'num_methods' is 0. The caller uses this information when + allocating space for the array of mdo and/or position pointers before + calling 'OCITypeMethodByName()' or 'ortgmps()'. + RETURNS: + The number of methods with the given name. 0 if none contains the + name. + NOTES: + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. + */ + +/*------------------------ OCITypeMethodByName ------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodByName( OCIEnv *env, OCIError *err, const OCIType *tdo, + const oratext *method_name, ub4 m_length, + OCITypeMethod **mdos ); +/* + NAME: OCITypeMethodByName - OCI Get one or more Methods with Name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + method_name (IN) - the methods' name + m_length (IN) - length (in bytes) of the 'name' parameter + mdos (OUT) - If this function completes successfully, 'mdos' points to + the selected methods in the object cache. The caller must + allocate space for the array of OCITypeMethod pointers before + calling this routine and must not write into the space. + The number of OCITypeMethod pointers that will be returned can + be obtained by calling 'OCITypeMethodOverload()'. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Get one or more methods given the name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) No methods in type has name 'name'. + 3) 'mdos' is not NULL but points to NULL data. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. + */ + +/*------------------------ OCITypeMethodNext --------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodNext( OCIEnv *env, OCIError *err, + OCITypeIter *iterator_ort, + OCITypeMethod **mdo ); + +/* + NAME: OCITypeMethodNext - OCI Get a Method By Iteration. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + iterator_ort (IN/OUT) - iterator for retrieving the next method; + see OCITypeIterNew() to set iterator. + mdo (OUT) - If this function completes successfully, 'mdo' points to + the selected method descriptor in the object cache. Positions + start at 1. The caller must allocate space for the + OCITypeMethod* before calling this routine and must not write + nto the space. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Iterate to the next method to retrieve. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_NO_DATA if there are no more attributes to iterate on; use + OCITypeIterSet() to reset the iterator if necessary. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) 'mdo' is not NULL but points to NULL data. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodName --------------------------------*/ + +/* ** OBSOLETE ** */ +oratext *OCITypeMethodName( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, ub4 *n_length ); +/* + NAME: OCITypeMethodName - OCI Get a Method's NaMe. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + n_length (OUT) - length (in bytes) of the 'name' parameter. The caller + must allocate space for the ub4 before calling this routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the (non-unique) real name of the method. + RETURNS: + the non-unique name of the method or NULL if there is an error. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodEncap -------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeEncap OCITypeMethodEncap( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo ); +/* + NAME: OCITypeMethodEncap - Get a Method's ENcapsulation (private/public). + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the encapsulation (private, or public) of a method. + RETURNS: + the encapsulation (private, or public) of the method + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodFlags -------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeMethodFlag OCITypeMethodFlags( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo ); +/* + NAME: OCITypeMethodFlags - OCI Get a Method's FLags + (inline, constant, virtual, constructor, + destructor). + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the flags (inline, constant, virutal, constructor, destructor) of + a method. + RETURNS: + the flags (inline, constant, virutal, constructor, destructor) of + the method + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodMap ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodMap( OCIEnv *env, OCIError *err, const OCIType *tdo, + OCITypeMethod **mdo ); +/* + NAME: OCITypeMethodMap - OCI Get the Method's MAP function. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + mdo (OUT) - If this function completes successfully, and there is a + map function for this type, 'mdo' points to the selected method + descriptor in the object cache. Otherwise, 'mdo' is null. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All required input parameters must not be NULL and must be valid. + DESCRIPTION: + A type may have only one map function. 'OCITypeMethodMap()' finds + this function, if it exists, and returns a reference and a pointer to + the method descriptor in the object cache. If the type does not have a + map (relative ordering) function, then 'mdo_ref' and 'mdo' are set + to null and an error is returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + the type does not contain a map function. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodOrder -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodOrder( OCIEnv *env, OCIError *err, const OCIType *tdo, + OCITypeMethod **mdo ); +/* + NAME: OCITypeMethodOrder - OCI Get the Method's ORder function. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + mdo (OUT) - If this function completes successfully, and there is a + map function for this type, 'mdo' points to the selected method + descriptor in the object cache. Otherwise, 'mdo' is null. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All required input parameters must not be NULL and must be valid. + DESCRIPTION: + A type may have only one ORder or MAP function. 'OCITypeMethodOrder()' + finds this function, if it exists, and returns a ref and a pointer + to the method descriptor in the object cache. If the type does not + have a map (relative ordering) function, then 'mdo_ref' and 'mdo' are + set to null and an error is returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + the type does not contain a map function. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodParams ------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeMethodParams( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo ); +/* + NAME: OCITypeMethodParams - OCI Get a Method's Number of Parameters. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the number of parameters in a method. + RETURNS: + the number of parameters in the method + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* RESULT ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*-------------------------- OCITypeResult ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeResult( OCIEnv *env, OCIError *err, const OCITypeMethod *mdo, + OCITypeElem **elem ); +/* + NAME: OCITypeResult - OCI Get a method's result type descriptor. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + elem (OUT) - If this function completes successfully, 'rdo' points to + the selected result (parameter) descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) 'elem' MUST be the address of an OCITypeElem pointer. + DESCRIPTION: + Get the result of a method. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) method returns no results. + NOTES: + The method must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* PARAMETER ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeParamByPos -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeParamByPos( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, ub4 position, + OCITypeElem **elem ); +/* + NAME: OCITypeParamByPos - OCI Get a Parameter in a method By Position. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + position (IN) - the parameter's position. Positions start at 1. + elem (OUT) - If this function completes successfully, 'elem' points to + the selected parameter descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + DESCRIPTION: + Get a parameter given its position in the method. Positions start + at 1. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) 'position' is not >= 1 and <= the number of parameters in the + method. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeParamByName -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeParamByName( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, + const oratext *name, ub4 n_length, + OCITypeElem **elem ); +/* + NAME: OCITypeParamByName - OCI Get a Parameter in a method By Name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + name (IN) - the parameter's name + n_length (IN) - length (in bytes) of the 'name' parameter + elem (OUT) - If this function completes successfully, 'elem' points to + the selected parameter descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'mdo' is not null, it must point to a valid method descriptor + in the object cache. + DESCRIPTION: + Get a parameter given its name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) the method does not contain a parameter with the input 'name'. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeParamPos ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeParamPos( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, + const oratext *name, ub4 n_length, ub4 *position, + OCITypeElem **elem ); +/* + NAME: OCITypeParamPos - OCI Get a parameter's position in a method + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + name (IN) - the parameter's name + n_length (IN) - length (in bytes) of the 'name' parameter + position (OUT) - If this function completes successfully, 'position' + points to the position of the parameter in the method starting + at position 1. position MUST point to space for a ub4. + elem (OUT) - If this function completes successfully, and + the input 'elem' is not NULL, 'elem' points to the selected + parameter descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'mdo' is not null, it must point to a valid method descriptor + in the object cache. + DESCRIPTION: + Get the position of a parameter in a method. Positions start at 1. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) the method does not contain a parameter with the input 'name'. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeParamElemMode -----------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeParamMode OCITypeElemParamMode( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemParamMode - OCI Get a parameter's mode + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the parameter descriptor in the object cache + (represented by an OCITypeElem) + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the mode (in, out, or in/out) of the parameter. + RETURNS: + the mode (in, out, or in/out) of the parameter + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------- OCITypeElemDefaultValue -------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeElemDefaultValue( OCIEnv *env, OCIError *err, + const OCITypeElem *elem, + ub4 *d_v_length ); +/* + NAME: OCITypeElemDefaultValue - OCI Get the element's Default Value. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the parameter descriptor in the object cache + (represented by an OCITypeElem) + d_v_length (OUT) - length (in bytes) of the returned default value. + The caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the default value in text form (PL/SQL) of an element. For V8.0, + this only makes sense for a method parameter. + RETURNS: + The default value (text) of the parameter. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* TYPE VERSION TABLE */ +/*--------------------------------------------------------------------------*/ + +/* For V8.0, the type version table is meant to be an internal data structure + only for Oracle clients for type version maintanence purposes. A more + general version of the API may be made public in subsequent releases. */ + + +/*--------------------------- OCITypeVTInit --------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeVTInit( OCIEnv *env, OCIError *err ); +/* + NAME: OCITypeVTInit - OCI type Version table INItialize + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + REQUIRES: + none + DESCRIPTION: + Allocate space for and initialize the type version table and the type + version table's index. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if internal errors occurrs during initialization. + */ + +/*--------------------------- OCITypeVTInsert -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeVTInsert( OCIEnv *env, OCIError *err, + const oratext *schema_name, ub4 s_n_length, + const oratext *type_name, ub4 t_n_length, + const oratext *user_version, ub4 u_v_length ); +/* + NAME: OCITypeVTInsert - OCI type Version table INSert entry. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + schema_name (IN, optional) - name of schema associated with the + type. By default, the user's schema name is used. + s_n_length (IN) - length of the 'schema_name' parameter + type_name (IN) - type name to insert + t_n_length (IN) - length (in bytes) of the 'type_name' parameter + user_version (IN) - user readable version of the type + u_v_length (IN) - length (in bytes) of the 'user_version' parameter + REQUIRES: + none + DESCRIPTION: + Insert an entry into the type version table and the type version + table's index. The entry's type name and user readable version + fields are updated with the input values. All other fields are + initialized to null. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is invalid. + 2) an entry for 'type_name' has already been registered in the + type version table. + */ + +/*------------------------------ OCITypeVTSelect ----------------------------*/ + +/* OCITypeVTSelect - OCI type VERSion table SELECT entry */ +/* ** OBSOLETE ** */ +sword OCITypeVTSelect( OCIEnv *env, OCIError *err, + const oratext *schema_name, ub4 s_n_length, + const oratext *type_name, ub4 t_n_length, + oratext **user_version, ub4 *u_v_length, + ub2 *version ); +/* + NAME: OCITypeVTSelect - OCI type Version table SELect entry. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + schema_name (IN, optional) - name of schema associated with the + type. By default, the user's schema name is used. + s_n_length (IN) - length of the 'schema_name' parameter + type_name (IN) - type name to select + t_n_length (IN) - length (in bytes) of the 'type_name' parameter + user_version (OUT, optional) - pointer to user readable version of the + type + u_v_length (OUT, optional) - length (in bytes) of the 'user_version' + parameter + version (OUT, optional) - internal type version + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Select an entry in the type version table by name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is invalid. + 2) an entry with 'type_name' does not exist. + */ + +/* Compatibility function - following function prototype retained for + compatibility only */ +sword ortgcty( OCIEnv *env, OCIError *err, OCIType *coll_tdo, + OCIType **collelem_tdo ); + +/*---------------------------------------------------------------------------*/ +/* Transient Type Construction functions */ +/*---------------------------------------------------------------------------*/ + +sword OCITypeBeginCreate(OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, + OCIDuration dur, OCIType **type); +/* + NAME: OCITypeBeginCreate - OCI Type Begin Creation of a transient type. + REMARKS + Begins the construction process for a transient type. The type will be + anonymous (no name). To create a persistent named type, the CREATE TYPE + statement should be used from SQL. Transient types have no identity. + They are pure values. + PARAMETERS: + svchp (IN) - The OCI Service Context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + tc - The TypeCode for the type. The Typecode could + correspond to a User Defined Type or a Built-in type. + Currently, the permissible values for User Defined + Types are OCI_TYPECODE_OBJECT for an Object Type + (structured), OCI_TYPECODE_VARRAY for a VARRAY + collection type or OCI_TYPECODE_TABLE for a nested + table collection type. For Object types, + OCITypeAddAttr() needs to be called to add each of + the attribute types. For Collection types, + OCITypeSetCollection() needs to be called. + Subsequently, OCITypeEndCreate() needs to be called + to finish the creation process. + The permissible values for Built-in type codes are + specified in the user manual. Additional information + on built-ins if any (like precision, scale for + numbers, character set info for VARCHAR2s etc.) must + be set with a subsequent call to OCITypeSetBuiltin(). + Subsequently OCITypeEndCreate() needs to be called + to finish the creation process. + dur - The allocation duration for the Type. Could be a + predefined or a user defined duration. + type(OUT) - The OCIType (Type Descriptor) that is being + constructed. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + + +sword OCITypeSetCollection(OCISvcCtx *svchp, OCIError *errhp, OCIType *type, + OCIParam *collelem_info, ub4 coll_count); +/* + NAME: OCITypeSetCollection - OCI Type Set Collection information + REMARKS : + Set Collection type information. This call can be called only if the + OCIType has been constructed with a collection typecode. + PARAMETERS: + svchp (IN) - The OCI Service Context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type(IN OUT) - The OCIType (Type Descriptor) that is being + constructed. + collelem_info - collelem_info provides information on the collection + element. It is obtained by allocating an OCIParam + (parameter handle) and setting type information in + the OCIParam using OCIAttrSet() calls. + coll_count - The count of elements in the collection. Pass 0 for + a nested table (unbounded). + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +sword OCITypeSetBuiltin(OCISvcCtx *svchp, OCIError *errhp, OCIType *type, + OCIParam *builtin_info); +/* + NAME: OCITypeSetBuiltin - OCI Type Set Builtin information. + REMARKS: + Set Built-in type information. This call can be called only if the + OCIType has been constructed with a built-in typecode + (OCI_TYPECODE_NUMBER etc.). + PARAMETERS: + svchp (IN) - The OCI Service Context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type(IN OUT) - The OCIType (Type Descriptor) that is being + constructed. + builtin_info - builtin_info provides information on the built-in + (like precision, scale, charater set etc.). It is + obtained by allocating an OCIParam (parameter handle) + and setting type information in the OCIParam using + OCIAttrSet() calls. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +sword OCITypeAddAttr(OCISvcCtx *svchp, OCIError *errhp, OCIType *type, + const oratext *a_name, ub4 a_length, + OCIParam *attr_info); +/* + NAME: OCITypeAddAttr - OCI Type Add Attribute to an Object Type. + REMARKS: + Adds an attribute to an Object type (that was constructed earlier with + typecode OCI_TYPECODE_OBJECT). + PARAMETERS: + svchp (IN) - The OCI Service Context + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type (IN/OUT) - The Type description that is being constructed. + a_name(IN) - Optional. gives the name of the attribute. + a_length - Optional. gives length of attribute name. + attr_info - Information on the attribute. It is obtained by + allocating an OCIParam (parameter handle) and setting + type information in the OCIParam using OCIAttrSet() + calls. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +sword OCITypeEndCreate(OCISvcCtx *svchp, OCIError *errhp, OCIType *type); +/* + NAME: OCITypeEndCreate - OCI Type End Creation + REMARKS: + Finishes construction of a type description.Subsequently, only access + will be allowed. + PARAMETERS: + svchp (IN) - The OCI Service Context + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type (IN/OUT) - The Type description that is being constructed. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +/*=========================*/ +/* PUBLIC MACROS AND FLAGS */ +/*=========================*/ + +/*--------------------------------------------------------------------------*/ +/* TYPE ELEMENT FLAGS */ +/*--------------------------------------------------------------------------*/ + +#define OCI_TYPEELEM_REF 0x8000 /* element is a REF */ +#define OCI_TYPEPARAM_REQUIRED 0x0800 /* parameter is required */ + +/* macros to test flags */ +#define OCI_TYPEELEM_IS_REF(elem_flag) \ + (((elem_flag) & OCI_TYPEELEM_REF)!=0) +#define OCI_TYPEPARAM_IS_REQUIRED(param_flag) \ + (((param_flag) & OCI_TYPEPARAM_REQUIRED)!=0) + + +#endif /* ORT_ORACLE */ + diff --git a/libraries/SQLAPI/include/ora_win/xa.h b/libraries/SQLAPI/include/ora_win/xa.h new file mode 100644 index 000000000..eb637e1c9 --- /dev/null +++ b/libraries/SQLAPI/include/ora_win/xa.h @@ -0,0 +1,200 @@ +/* Copyright (c) 1992, 2006, Oracle. All rights reserved. */ + +/* + NAME + xa.h - + DESCRIPTION + + PUBLIC FUNCTION(S) + + PRIVATE FUNCTION(S) + + RETURNS + + NOTES + + + This is the public XA .h file + + MODIFIED (MM/DD/YY) + yohu 08/27/06 - XA/RAC project changes: XAER_AFFINITY + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + whe 09/01/99 - 976457:check __cplusplus for C++ code + ntang 10/20/98 - Remove TMCACHE & TMFORCL + abhide 08/04/97 - implement xaoforcl + abhide 07/23/97 - XA OTS project changes + schandra 02/20/96 - lint + abhide 04/07/94 - merge changes from branch 1.1.710.1 + abhide 02/14/94 - Creation + abhide 02/10/94 - Creation + abhide 02/10/94 - Creation +*/ +/* + * xa.h header + * Typed in from X/Open doc of March 13, 1990 + * Updated to Parsippany II draft, March, 1991 + * Updated to Co Review draft, 19 Sep 1991 + */ + +#ifndef XA_H +#define XA_H + + +/* + * Transaction branch identification: XID and NULLXID: + */ + + +#define XIDDATASIZE 128 /* size in bytes */ +#define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ +#define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ +struct xid_t { + long formatID; /* format identifier */ + long gtrid_length; /* value from 1 through 64 */ + long bqual_length; /* value from 1 through 64 */ + char data[XIDDATASIZE]; +}; +typedef struct xid_t XID; + +/* + * A value of -1 in formatID means that the XID is null. + */ +/* + * Declarations of routines by which RMs call TMs: + */ + +int ax_reg(int, XID *, long); +int ax_unreg(int, long); +/* + * XA Switch Data Structure + */ +#define RMNAMESZ 32 /* length of resource manager name, */ + /* including the null terminator */ +#define MAXINFOSIZE 256 /* maximum size in bytes of xa_info strings, */ + /* including the null terminator */ +struct xa_switch_t { + char name[RMNAMESZ]; /* name of resource manager */ + long flags; /* resource manager specific options */ + long version; /* must be 0 */ + + int (*xa_open_entry)(char *, int, long); /*xa_open function pointer*/ + int (*xa_close_entry)(char *, int, long); /*xa_close function pointer*/ + int (*xa_start_entry)(XID *, int, long); /*xa_start function pointer*/ + int (*xa_end_entry)(XID *, int, long); /*xa_end function pointer*/ + int (*xa_rollback_entry)(XID *, int, long); + /*xa_rollback function pointer*/ + int (*xa_prepare_entry)(XID *, int, long); /*xa_prepare function pointer*/ + int (*xa_commit_entry)(XID *, int, long); /*xa_commit function pointer*/ + int (*xa_recover_entry)(XID *, long, int, long); + /*xa_recover function pointer*/ + int (*xa_forget_entry)(XID *, int, long); /*xa_forget function pointer*/ + int (*xa_complete_entry)(int *, int *, int, long); +}; + +/* + * Flag definition for the RM switch + */ +#define TMNOFLAGS 0x00000000L /* no resource manager features + selected */ +#define TMREGISTER 0x00000001L /* resource manager dynamically + registers */ +#define TMNOMIGRATE 0x00000002L /* resource manager does not support + association migration */ +#define TMUSEASYNC 0x00000004L /* resource manager supports + asynchronous operations */ +/* + * Flag definitions for xa_ and ax_ routines + */ +/* Use TMNOFLAGS, defined above, when not specifying other flags */ +#define TMASYNC 0x80000000L /* perform routine asynchronously */ +#define TMONEPHASE 0x40000000L /* caller is using one-phase commit + optimisation */ +#define TMFAIL 0x20000000L /* dissociates caller and marks + transaction branch rollback-only */ +#define TMNOWAIT 0x10000000L /* return if blocking condition + exists */ +#define TMRESUME 0x08000000L /* caller is resuming association + with suspended transaction branch */ +#define TMSUCCESS 0x04000000L /* dissociate caller from transaction + branch */ +#define TMSUSPEND 0x02000000L /* caller is suspending, not ending, + association */ +#define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ +#define TMENDRSCAN 0x00800000L /* end a recovery scan */ +#define TMMULTIPLE 0x00400000L /* wait for any asynchronous + operation */ +#define TMJOIN 0x00200000L /* caller is joining existing + transaction branch */ +#define TMMIGRATE 0x00100000L /* caller intends to perform + migration */ + +/* + * ax_() return codes (transaction manager reports to resource manager) + */ +#define TM_JOIN 2 /* caller is joining existing transaction + branch */ +#define TM_RESUME 1 /* caller is resuming association with + suspended transaction branch */ +#define TM_OK 0 /* normal execution */ +#define TMER_TMERR -1 /* an error occurred in the transaction + manager */ +#define TMER_INVAL -2 /* invalid arguments were given */ +#define TMER_PROTO -3 /* routine invoked in an improper context */ + +/* + * xa_() return codes (resource manager reports to transaction manager) + */ +#define XA_RBBASE 100 /* The inclusive lower bound of the + rollback codes */ +#define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an + unspecified reason */ +#define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a + communication failure */ +#define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */ +#define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the + integrity of the resources was + detected */ +#define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the + transaction for a reason not on this + list */ +#define XA_RBPROTO XA_RBBASE+5 /* A protocal error occurred in the + resource manager */ +#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long*/ +#define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */ +#define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the + rollback codes */ + +#define XA_NOMIGRATE 9 /* resumption must occur where + suspension occurred */ +#define XA_HEURHAZ 8 /* the transaction branch may have been + heuristically completed */ +#define XA_HEURCOM 7 /* the transaction branch has been + heuristically comitted */ +#define XA_HEURRB 6 /* the transaction branch has been + heuristically rolled back */ +#define XA_HEURMIX 5 /* the transaction branch has been + heuristically committed and rolled + back */ +#define XA_RETRY 4 /* routine returned with no effect + and may be re-issued */ +#define XA_RDONLY 3 /* the transaction was read-only + and has been committed */ +#define XA_OK 0 /* normal execution */ +#define XAER_ASYNC -2 /* asynchronous operation already + outstanding */ +#define XAER_RMERR -3 /* a resource manager error occurred + in the transaction branch */ +#define XAER_NOTA -4 /* the XID is not valid */ +#define XAER_INVAL -5 /* invalid arguments were given */ +#define XAER_PROTO -6 /* routine invoked in an improper + context */ +#define XAER_RMFAIL -7 /* resource manager unavailable */ +#define XAER_DUPID -8 /* the XID already exists */ +#define XAER_OUTSIDE -9 /* resource manager doing work */ + /* outside global transaction */ + +#define XAER_AFFINITY -10 /* XA on RAC: resumption must occur on + RAC instance where the transaction + branch was created */ + +#endif /* ifndef XA_H */ diff --git a/libraries/SQLAPI/include/pgAPI.h b/libraries/SQLAPI/include/pgAPI.h new file mode 100644 index 000000000..c723308da --- /dev/null +++ b/libraries/SQLAPI/include/pgAPI.h @@ -0,0 +1,290 @@ +// pgAPI.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__PGAPI_H__) +#define __PGAPI_H__ + +#include "SQLAPI.h" + +// API header(s) +#include +#include + +extern void AddPostgreSQLSupport(const SAConnection *pCon); +extern void ReleasePostgreSQLSupport(); + +typedef PGconn* (*PQconnectStart_t)(const char *conninfo); +typedef PostgresPollingStatusType (*PQconnectPoll_t)(PGconn *conn); +typedef PGconn* (*PQconnectdb_t)(const char *conninfo); +typedef PGconn* (*PQsetdbLogin_t)(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, + const char *dbName, + const char *login, const char *pwd); +typedef void (*PQfinish_t)(PGconn *conn); +typedef PQconninfoOption* (*PQconndefaults_t)(void); +typedef void (*PQconninfoFree_t)(PQconninfoOption *connOptions); +typedef int (*PQresetStart_t)(PGconn *conn); +typedef PostgresPollingStatusType (*PQresetPoll_t)(PGconn *conn); +typedef void (*PQreset_t)(PGconn *conn); +typedef int (*PQrequestCancel_t)(PGconn *conn); +typedef PGcancel* (*PQgetCancel_t)(PGconn *conn); +typedef void (*PQfreeCancel_t)(PGcancel *cancel); +typedef int (*PQcancel_t)(PGcancel *cancel, char *errbuf, int errbufsize); +typedef int (*PQserverVersion_t)(const PGconn *conn); +typedef char* (*PQdb_t)(const PGconn *conn); +typedef char* (*PQuser_t)(const PGconn *conn); +typedef char* (*PQpass_t)(const PGconn *conn); +typedef char* (*PQhost_t)(const PGconn *conn); +typedef char* (*PQport_t)(const PGconn *conn); +typedef char* (*PQtty_t)(const PGconn *conn); +typedef char* (*PQoptions_t)(const PGconn *conn); +typedef ConnStatusType (*PQstatus_t)(const PGconn *conn); +typedef char* (*PQerrorMessage_t)(const PGconn *conn); +typedef int (*PQsocket_t)(const PGconn *conn); +typedef int (*PQbackendPID_t)(const PGconn *conn); +typedef int (*PQclientEncoding_t)(const PGconn *conn); +typedef int (*PQsetClientEncoding_t)(PGconn *conn, const char *encoding); +#ifdef USE_SSL +typedef SSL* (*PQgetssl_t)(PGconn *conn); +#endif +typedef void (*PQtrace_t)(PGconn *conn, FILE *debug_port); +typedef void (*PQuntrace_t)(PGconn *conn); +typedef PQnoticeProcessor (*PQsetNoticeProcessor_t)(PGconn *conn, PQnoticeProcessor proc, void *arg); +typedef PGresult* (*PQexec_t)(PGconn *conn, const char *query); +typedef PGnotify* (*PQnotifies_t)(PGconn *conn); +typedef int (*PQsendQuery_t)(PGconn *conn, const char *query); +typedef PGresult* (*PQgetResult_t)(PGconn *conn); +typedef int (*PQisBusy_t)(PGconn *conn); +typedef int (*PQconsumeInput_t)(PGconn *conn); +typedef int (*PQgetline_t)(PGconn *conn, char *string, int length); +typedef int (*PQputline_t)(PGconn *conn, const char *string); +typedef int (*PQgetlineAsync_t)(PGconn *conn, char *buffer, int bufsize); +typedef int (*PQputnbytes_t)(PGconn *conn, const char *buffer, int nbytes); +typedef int (*PQendcopy_t)(PGconn *conn); +typedef int (*PQsetnonblocking_t)(PGconn *conn, int arg); +typedef int (*PQisnonblocking_t)(const PGconn *conn); +typedef int (*PQflush_t)(PGconn *conn); +typedef PGresult* (*PQfn_t)(PGconn *conn, int fnid, + int *result_buf, + int *result_len, + int result_is_int, + const PQArgBlock *args, + int nargs); +typedef ExecStatusType (*PQresultStatus_t)(const PGresult *res); +typedef char* (*PQresStatus_t)(ExecStatusType status); +typedef char* (*PQresultErrorMessage_t)(const PGresult *res); +typedef int (*PQntuples_t)(const PGresult *res); +typedef int (*PQnfields_t)(const PGresult *res); +typedef int (*PQbinaryTuples_t)(const PGresult *res); +typedef char* (*PQfname_t)(const PGresult *res, int field_num); +typedef int (*PQfnumber_t)(const PGresult *res, const char *field_name); +typedef int (*PQfformat_t)(const PGresult *res, int field_num); +typedef Oid (*PQftype_t)(const PGresult *res, int field_num); +typedef int (*PQfsize_t)(const PGresult *res, int field_num); +typedef int (*PQfmod_t)(const PGresult *res, int field_num); +typedef char* (*PQcmdStatus_t)(PGresult *res); +typedef char* (*PQoidStatus_t)(const PGresult *res); /* old and ugly */ +typedef Oid (*PQoidValue_t)(const PGresult *res); /* new and improved */ +typedef char* (*PQcmdTuples_t)(PGresult *res); +typedef char* (*PQgetvalue_t)(const PGresult *res, int tup_num, int field_num); +typedef int (*PQgetlength_t)(const PGresult *res, int tup_num, int field_num); +typedef int (*PQgetisnull_t)(const PGresult *res, int tup_num, int field_num); +typedef void (*PQclear_t)(PGresult *res); +typedef PGresult* (*PQmakeEmptyPGresult_t)(PGconn *conn, ExecStatusType status); +typedef void (*PQprint_t)(FILE *fout, /* output stream */ + const PGresult *res, + const PQprintOpt *ps); /* option structure */ +typedef void (*PQdisplayTuples_t)(const PGresult *res, + FILE *fp, /* where to send the + * output */ + int fillAlign, /* pad the fields with + * spaces */ + const char *fieldSep, /* field separator */ + int printHeader, /* display headers? */ + int quiet); +typedef void (*PQprintTuples_t)(const PGresult *res, + FILE *fout, /* output stream */ + int printAttName, /* print attribute names */ + int terseOutput, /* delimiter bars */ + int width); /* width of column, if + * 0, use variable width */ +typedef int (*lo_open_t)(PGconn *conn, Oid lobjId, int mode); +typedef int (*lo_close_t)(PGconn *conn, int fd); +typedef int (*lo_read_t)(PGconn *conn, int fd, char *buf, size_t len); +typedef int (*lo_write_t)(PGconn *conn, int fd, char *buf, size_t len); +typedef int (*lo_lseek_t)(PGconn *conn, int fd, int offset, int whence); +typedef Oid (*lo_creat_t)(PGconn *conn, int mode); +typedef int (*lo_tell_t)(PGconn *conn, int fd); +typedef int (*lo_unlink_t)(PGconn *conn, Oid lobjId); +typedef Oid (*lo_import_t)(PGconn *conn, const char *filename); +typedef int (*lo_export_t)(PGconn *conn, Oid lobjId, const char *filename); +typedef int (*PQmblen_t)(const unsigned char *s, int encoding); +typedef int (*PQenv2encoding_t)(void); + +// new +typedef PGVerbosity (*PQsetErrorVerbosity_t)(PGconn *conn, PGVerbosity verbosity); +typedef char* (*PQresultErrorField_t)(const PGresult *res, int fieldcode); + +// escape +typedef size_t (*PQescapeStringConn_t)(PGconn *conn, + char *to, const char *from, size_t length, + int *error); +typedef unsigned char* (*PQescapeByteaConn_t)(PGconn *conn, + const unsigned char *from, size_t from_length, + size_t *to_length); +typedef unsigned char* (*PQunescapeBytea_t)(const unsigned char *strtext, + size_t *retbuflen); + +/* These forms are deprecated! */ +typedef size_t (*PQescapeString_t)(char *to, const char *from, size_t length); +typedef char* (*PQescapeBytea_t)(const unsigned char *from, size_t from_length, + size_t *to_length); + +typedef void (*PQfreemem_t)(void *ptr); + +typedef int (*PQputCopyData_t)(PGconn *conn, const char *buffer, int nbytes); +typedef int (*PQputCopyEnd_t)(PGconn *conn, const char *errormsg); +typedef int (*PQgetCopyData_t)(PGconn *conn, char **buffer, int async); + +typedef PGPing (*PQping_t)(const char *conninfo); +typedef PGPing (*PQpingParams_t)(const char **keywords, + const char **values, int expand_dbname); + +typedef const char* (*pg_encoding_to_char_t)(int encoding); + +// API declarations +class SQLAPI_API pgAPI : public saAPI +{ +public: + pgAPI(); + + PQconnectStart_t PQconnectStart; + PQconnectPoll_t PQconnectPoll; + PQconnectdb_t PQconnectdb; + PQsetdbLogin_t PQsetdbLogin; + PQfinish_t PQfinish; + PQconndefaults_t PQconndefaults; + PQconninfoFree_t PQconninfoFree; + PQresetStart_t PQresetStart; + PQresetPoll_t PQresetPoll; + PQreset_t PQreset; + PQrequestCancel_t PQrequestCancel; + PQgetCancel_t PQgetCancel; + PQfreeCancel_t PQfreeCancel; + PQcancel_t PQcancel; + PQserverVersion_t PQserverVersion; + PQdb_t PQdb; + PQuser_t PQuser; + PQpass_t PQpass; + PQhost_t PQhost; + PQport_t PQport; + PQtty_t PQtty; + PQoptions_t PQoptions; + PQstatus_t PQstatus; + PQerrorMessage_t PQerrorMessage; + PQsocket_t PQsocket; + PQbackendPID_t PQbackendPID; + PQclientEncoding_t PQclientEncoding; + PQsetClientEncoding_t PQsetClientEncoding; +#ifdef USE_SSL + PQgetssl_t PQgetssl; +#endif + PQtrace_t PQtrace; + PQuntrace_t PQuntrace; + PQsetNoticeProcessor_t PQsetNoticeProcessor; + PQexec_t PQexec; + PQnotifies_t PQnotifies; + PQsendQuery_t PQsendQuery; + PQgetResult_t PQgetResult; + PQisBusy_t PQisBusy; + PQconsumeInput_t PQconsumeInput; + PQgetline_t PQgetline; + PQputline_t PQputline; + PQgetlineAsync_t PQgetlineAsync; + PQputnbytes_t PQputnbytes; + PQendcopy_t PQendcopy; + PQsetnonblocking_t PQsetnonblocking; + PQisnonblocking_t PQisnonblocking; + PQflush_t PQflush; + PQfn_t PQfn; + PQresultStatus_t PQresultStatus; + PQresStatus_t PQresStatus; + PQresultErrorMessage_t PQresultErrorMessage; + PQntuples_t PQntuples; + PQnfields_t PQnfields; + PQbinaryTuples_t PQbinaryTuples; + PQfname_t PQfname; + PQfnumber_t PQfnumber; + PQfformat_t PQfformat; + PQftype_t PQftype; + PQfsize_t PQfsize; + PQfmod_t PQfmod; + PQcmdStatus_t PQcmdStatus; + PQoidStatus_t PQoidStatus; + PQoidValue_t PQoidValue; + PQcmdTuples_t PQcmdTuples; + PQgetvalue_t PQgetvalue; + PQgetlength_t PQgetlength; + PQgetisnull_t PQgetisnull; + PQclear_t PQclear; + PQmakeEmptyPGresult_t PQmakeEmptyPGresult; + PQprint_t PQprint; + PQdisplayTuples_t PQdisplayTuples; + PQprintTuples_t PQprintTuples; + lo_open_t lo_open; + lo_close_t lo_close; + lo_read_t lo_read; + lo_write_t lo_write; + lo_lseek_t lo_lseek; + lo_creat_t lo_creat; + lo_tell_t lo_tell; + lo_unlink_t lo_unlink; + lo_import_t lo_import; + lo_export_t lo_export; + PQmblen_t PQmblen; + PQenv2encoding_t PQenv2encoding; + + // new 3.7.12 + PQsetErrorVerbosity_t PQsetErrorVerbosity; + PQresultErrorField_t PQresultErrorField; + + // escape + PQescapeStringConn_t PQescapeStringConn; + PQescapeByteaConn_t PQescapeByteaConn; + PQunescapeBytea_t PQunescapeBytea; + + // These forms are deprecated! + PQescapeString_t PQescapeString; + PQescapeBytea_t PQescapeBytea; + + PQfreemem_t PQfreemem; + + PQputCopyData_t PQputCopyData; + PQputCopyEnd_t PQputCopyEnd; + PQgetCopyData_t PQgetCopyData; + + PQping_t PQping; + PQpingParams_t PQpingParams; + + pg_encoding_to_char_t pg_encoding_to_char; +}; + +class SQLAPI_API pgConnectionHandles : public saConnectionHandles +{ +public: + pgConnectionHandles(); + + PGconn *conn; // PostgreSQL connection struct +}; + +class SQLAPI_API pgCommandHandles : public saCommandHandles +{ +public: + pgCommandHandles(); + + PGresult *res; // PostgreSQL result struct +}; + +extern pgAPI g_pgAPI; + +#endif // !defined(__PGAPI_H__) diff --git a/libraries/SQLAPI/include/pgsql/libpq-fe.h b/libraries/SQLAPI/include/pgsql/libpq-fe.h new file mode 100644 index 000000000..09b0caa13 --- /dev/null +++ b/libraries/SQLAPI/include/pgsql/libpq-fe.h @@ -0,0 +1,587 @@ +/*------------------------------------------------------------------------- + * + * libpq-fe.h + * This file contains definitions for structures and + * externs for functions used by frontend postgres applications. + * + * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/interfaces/libpq/libpq-fe.h + * + *------------------------------------------------------------------------- + */ + +#ifndef LIBPQ_FE_H +#define LIBPQ_FE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +/* + * postgres_ext.h defines the backend's externally visible types, + * such as Oid. + */ +#include "postgres_ext.h" + +/* + * Option flags for PQcopyResult + */ +#define PG_COPYRES_ATTRS 0x01 +#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */ +#define PG_COPYRES_EVENTS 0x04 +#define PG_COPYRES_NOTICEHOOKS 0x08 + +/* Application-visible enum types */ + +/* + * Although it is okay to add to these lists, values which become unused + * should never be removed, nor should constants be redefined - that would + * break compatibility with existing code. + */ + +typedef enum +{ + CONNECTION_OK, + CONNECTION_BAD, + /* Non-blocking mode only below here */ + + /* + * The existence of these should never be relied upon - they should only + * be used for user feedback or similar purposes. + */ + CONNECTION_STARTED, /* Waiting for connection to be made. */ + CONNECTION_MADE, /* Connection OK; waiting to send. */ + CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the + * postmaster. */ + CONNECTION_AUTH_OK, /* Received authentication; waiting for + * backend startup. */ + CONNECTION_SETENV, /* Negotiating environment. */ + CONNECTION_SSL_STARTUP, /* Negotiating SSL. */ + CONNECTION_NEEDED /* Internal state: connect() needed */ +} ConnStatusType; + +typedef enum +{ + PGRES_POLLING_FAILED = 0, + PGRES_POLLING_READING, /* These two indicate that one may */ + PGRES_POLLING_WRITING, /* use select before polling again. */ + PGRES_POLLING_OK, + PGRES_POLLING_ACTIVE /* unused; keep for awhile for backwards + * compatibility */ +} PostgresPollingStatusType; + +typedef enum +{ + PGRES_EMPTY_QUERY = 0, /* empty query string was executed */ + PGRES_COMMAND_OK, /* a query command that doesn't return + * anything was executed properly by the + * backend */ + PGRES_TUPLES_OK, /* a query command that returns tuples was + * executed properly by the backend, PGresult + * contains the result tuples */ + PGRES_COPY_OUT, /* Copy Out data transfer in progress */ + PGRES_COPY_IN, /* Copy In data transfer in progress */ + PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the + * backend */ + PGRES_NONFATAL_ERROR, /* notice or warning message */ + PGRES_FATAL_ERROR, /* query failed */ + PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */ + PGRES_SINGLE_TUPLE /* single tuple from larger resultset */ +} ExecStatusType; + +typedef enum +{ + PQTRANS_IDLE, /* connection idle */ + PQTRANS_ACTIVE, /* command in progress */ + PQTRANS_INTRANS, /* idle, within transaction block */ + PQTRANS_INERROR, /* idle, within failed transaction */ + PQTRANS_UNKNOWN /* cannot determine status */ +} PGTransactionStatusType; + +typedef enum +{ + PQERRORS_TERSE, /* single-line error messages */ + PQERRORS_DEFAULT, /* recommended style */ + PQERRORS_VERBOSE /* all the facts, ma'am */ +} PGVerbosity; + +/* + * PGPing - The ordering of this enum should not be altered because the + * values are exposed externally via pg_isready. + */ + +typedef enum +{ + PQPING_OK, /* server is accepting connections */ + PQPING_REJECT, /* server is alive but rejecting connections */ + PQPING_NO_RESPONSE, /* could not establish connection */ + PQPING_NO_ATTEMPT /* connection not attempted (bad params) */ +} PGPing; + +/* PGconn encapsulates a connection to the backend. + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_conn PGconn; + +/* PGresult encapsulates the result of a query (or more precisely, of a single + * SQL command --- a query string given to PQsendQuery can contain multiple + * commands and thus return multiple PGresult objects). + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_result PGresult; + +/* PGcancel encapsulates the information needed to cancel a running + * query on an existing connection. + * The contents of this struct are not supposed to be known to applications. + */ +typedef struct pg_cancel PGcancel; + +/* PGnotify represents the occurrence of a NOTIFY message. + * Ideally this would be an opaque typedef, but it's so simple that it's + * unlikely to change. + * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's, + * whereas in earlier versions it was always your own backend's PID. + */ +typedef struct pgNotify +{ + char *relname; /* notification condition name */ + int be_pid; /* process ID of notifying server process */ + char *extra; /* notification parameter */ + /* Fields below here are private to libpq; apps should not use 'em */ + struct pgNotify *next; /* list link */ +} PGnotify; + +/* Function types for notice-handling callbacks */ +typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res); +typedef void (*PQnoticeProcessor) (void *arg, const char *message); + +/* Print options for PQprint() */ +typedef char pqbool; + +typedef struct _PQprintOpt +{ + pqbool header; /* print output field headings and row count */ + pqbool align; /* fill align the fields */ + pqbool standard; /* old brain dead format */ + pqbool html3; /* output html tables */ + pqbool expanded; /* expand tables */ + pqbool pager; /* use pager for output if needed */ + char *fieldSep; /* field separator */ + char *tableOpt; /* insert to HTML */ + char *caption; /* HTML
*/ + char **fieldName; /* null terminated array of replacement field + * names */ +} PQprintOpt; + +/* ---------------- + * Structure for the conninfo parameter definitions returned by PQconndefaults + * or PQconninfoParse. + * + * All fields except "val" point at static strings which must not be altered. + * "val" is either NULL or a malloc'd current-value string. PQconninfoFree() + * will release both the val strings and the PQconninfoOption array itself. + * ---------------- + */ +typedef struct _PQconninfoOption +{ + char *keyword; /* The keyword of the option */ + char *envvar; /* Fallback environment variable name */ + char *compiled; /* Fallback compiled in default value */ + char *val; /* Option's current value, or NULL */ + char *label; /* Label for field in connect dialog */ + char *dispchar; /* Indicates how to display this field in a + * connect dialog. Values are: "" Display + * entered value as is "*" Password field - + * hide value "D" Debug option - don't show + * by default */ + int dispsize; /* Field size in characters for dialog */ +} PQconninfoOption; + +/* ---------------- + * PQArgBlock -- structure for PQfn() arguments + * ---------------- + */ +typedef struct +{ + int len; + int isint; + union + { + int *ptr; /* can't use void (dec compiler barfs) */ + int integer; + } u; +} PQArgBlock; + +/* ---------------- + * PGresAttDesc -- Data about a single attribute (column) of a query result + * ---------------- + */ +typedef struct pgresAttDesc +{ + char *name; /* column name */ + Oid tableid; /* source table, if known */ + int columnid; /* source column, if known */ + int format; /* format code for value (text/binary) */ + Oid typid; /* type id */ + int typlen; /* type size */ + int atttypmod; /* type-specific modifier info */ +} PGresAttDesc; + +/* ---------------- + * Exported functions of libpq + * ---------------- + */ + +/* === in fe-connect.c === */ + +/* make a new client connection to the backend */ +/* Asynchronous (non-blocking) */ +extern PGconn *PQconnectStart(const char *conninfo); +extern PGconn *PQconnectStartParams(const char *const * keywords, + const char *const * values, int expand_dbname); +extern PostgresPollingStatusType PQconnectPoll(PGconn *conn); + +/* Synchronous (blocking) */ +extern PGconn *PQconnectdb(const char *conninfo); +extern PGconn *PQconnectdbParams(const char *const * keywords, + const char *const * values, int expand_dbname); +extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, + const char *pgoptions, const char *pgtty, + const char *dbName, + const char *login, const char *pwd); + +#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \ + PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) + +/* close the current connection and free the PGconn data structure */ +extern void PQfinish(PGconn *conn); + +/* get info about connection options known to PQconnectdb */ +extern PQconninfoOption *PQconndefaults(void); + +/* parse connection options in same way as PQconnectdb */ +extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg); + +/* return the connection options used by a live connection */ +extern PQconninfoOption *PQconninfo(PGconn *conn); + +/* free the data structure returned by PQconndefaults() or PQconninfoParse() */ +extern void PQconninfoFree(PQconninfoOption *connOptions); + +/* + * close the current connection and restablish a new one with the same + * parameters + */ +/* Asynchronous (non-blocking) */ +extern int PQresetStart(PGconn *conn); +extern PostgresPollingStatusType PQresetPoll(PGconn *conn); + +/* Synchronous (blocking) */ +extern void PQreset(PGconn *conn); + +/* request a cancel structure */ +extern PGcancel *PQgetCancel(PGconn *conn); + +/* free a cancel structure */ +extern void PQfreeCancel(PGcancel *cancel); + +/* issue a cancel request */ +extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize); + +/* backwards compatible version of PQcancel; not thread-safe */ +extern int PQrequestCancel(PGconn *conn); + +/* Accessor functions for PGconn objects */ +extern char *PQdb(const PGconn *conn); +extern char *PQuser(const PGconn *conn); +extern char *PQpass(const PGconn *conn); +extern char *PQhost(const PGconn *conn); +extern char *PQport(const PGconn *conn); +extern char *PQtty(const PGconn *conn); +extern char *PQoptions(const PGconn *conn); +extern ConnStatusType PQstatus(const PGconn *conn); +extern PGTransactionStatusType PQtransactionStatus(const PGconn *conn); +extern const char *PQparameterStatus(const PGconn *conn, + const char *paramName); +extern int PQprotocolVersion(const PGconn *conn); +extern int PQserverVersion(const PGconn *conn); +extern char *PQerrorMessage(const PGconn *conn); +extern int PQsocket(const PGconn *conn); +extern int PQbackendPID(const PGconn *conn); +extern int PQconnectionNeedsPassword(const PGconn *conn); +extern int PQconnectionUsedPassword(const PGconn *conn); +extern int PQclientEncoding(const PGconn *conn); +extern int PQsetClientEncoding(PGconn *conn, const char *encoding); + +/* Get the OpenSSL structure associated with a connection. Returns NULL for + * unencrypted connections or if any other TLS library is in use. */ +extern void *PQgetssl(PGconn *conn); + +/* Tell libpq whether it needs to initialize OpenSSL */ +extern void PQinitSSL(int do_init); + +/* More detailed way to tell libpq whether it needs to initialize OpenSSL */ +extern void PQinitOpenSSL(int do_ssl, int do_crypto); + +/* Set verbosity for PQerrorMessage and PQresultErrorMessage */ +extern PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity); + +/* Enable/disable tracing */ +extern void PQtrace(PGconn *conn, FILE *debug_port); +extern void PQuntrace(PGconn *conn); + +/* Override default notice handling routines */ +extern PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, + PQnoticeReceiver proc, + void *arg); +extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, + PQnoticeProcessor proc, + void *arg); + +/* + * Used to set callback that prevents concurrent access to + * non-thread safe functions that libpq needs. + * The default implementation uses a libpq internal mutex. + * Only required for multithreaded apps that use kerberos + * both within their app and for postgresql connections. + */ +typedef void (*pgthreadlock_t) (int acquire); + +extern pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler); + +/* === in fe-exec.c === */ + +/* Simple synchronous query */ +extern PGresult *PQexec(PGconn *conn, const char *query); +extern PGresult *PQexecParams(PGconn *conn, + const char *command, + int nParams, + const Oid *paramTypes, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); +extern PGresult *PQprepare(PGconn *conn, const char *stmtName, + const char *query, int nParams, + const Oid *paramTypes); +extern PGresult *PQexecPrepared(PGconn *conn, + const char *stmtName, + int nParams, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); + +/* Interface for multiple-result or asynchronous queries */ +extern int PQsendQuery(PGconn *conn, const char *query); +extern int PQsendQueryParams(PGconn *conn, + const char *command, + int nParams, + const Oid *paramTypes, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); +extern int PQsendPrepare(PGconn *conn, const char *stmtName, + const char *query, int nParams, + const Oid *paramTypes); +extern int PQsendQueryPrepared(PGconn *conn, + const char *stmtName, + int nParams, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); +extern int PQsetSingleRowMode(PGconn *conn); +extern PGresult *PQgetResult(PGconn *conn); + +/* Routines for managing an asynchronous query */ +extern int PQisBusy(PGconn *conn); +extern int PQconsumeInput(PGconn *conn); + +/* LISTEN/NOTIFY support */ +extern PGnotify *PQnotifies(PGconn *conn); + +/* Routines for copy in/out */ +extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes); +extern int PQputCopyEnd(PGconn *conn, const char *errormsg); +extern int PQgetCopyData(PGconn *conn, char **buffer, int async); + +/* Deprecated routines for copy in/out */ +extern int PQgetline(PGconn *conn, char *string, int length); +extern int PQputline(PGconn *conn, const char *string); +extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); +extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes); +extern int PQendcopy(PGconn *conn); + +/* Set blocking/nonblocking connection to the backend */ +extern int PQsetnonblocking(PGconn *conn, int arg); +extern int PQisnonblocking(const PGconn *conn); +extern int PQisthreadsafe(void); +extern PGPing PQping(const char *conninfo); +extern PGPing PQpingParams(const char *const * keywords, + const char *const * values, int expand_dbname); + +/* Force the write buffer to be written (or at least try) */ +extern int PQflush(PGconn *conn); + +/* + * "Fast path" interface --- not really recommended for application + * use + */ +extern PGresult *PQfn(PGconn *conn, + int fnid, + int *result_buf, + int *result_len, + int result_is_int, + const PQArgBlock *args, + int nargs); + +/* Accessor functions for PGresult objects */ +extern ExecStatusType PQresultStatus(const PGresult *res); +extern char *PQresStatus(ExecStatusType status); +extern char *PQresultErrorMessage(const PGresult *res); +extern char *PQresultErrorField(const PGresult *res, int fieldcode); +extern int PQntuples(const PGresult *res); +extern int PQnfields(const PGresult *res); +extern int PQbinaryTuples(const PGresult *res); +extern char *PQfname(const PGresult *res, int field_num); +extern int PQfnumber(const PGresult *res, const char *field_name); +extern Oid PQftable(const PGresult *res, int field_num); +extern int PQftablecol(const PGresult *res, int field_num); +extern int PQfformat(const PGresult *res, int field_num); +extern Oid PQftype(const PGresult *res, int field_num); +extern int PQfsize(const PGresult *res, int field_num); +extern int PQfmod(const PGresult *res, int field_num); +extern char *PQcmdStatus(PGresult *res); +extern char *PQoidStatus(const PGresult *res); /* old and ugly */ +extern Oid PQoidValue(const PGresult *res); /* new and improved */ +extern char *PQcmdTuples(PGresult *res); +extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); +extern int PQgetlength(const PGresult *res, int tup_num, int field_num); +extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); +extern int PQnparams(const PGresult *res); +extern Oid PQparamtype(const PGresult *res, int param_num); + +/* Describe prepared statements and portals */ +extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt); +extern PGresult *PQdescribePortal(PGconn *conn, const char *portal); +extern int PQsendDescribePrepared(PGconn *conn, const char *stmt); +extern int PQsendDescribePortal(PGconn *conn, const char *portal); + +/* Delete a PGresult */ +extern void PQclear(PGresult *res); + +/* For freeing other alloc'd results, such as PGnotify structs */ +extern void PQfreemem(void *ptr); + +/* Exists for backward compatibility. bjm 2003-03-24 */ +#define PQfreeNotify(ptr) PQfreemem(ptr) + +/* Error when no password was given. */ +/* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */ +#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n" + +/* Create and manipulate PGresults */ +extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); +extern PGresult *PQcopyResult(const PGresult *src, int flags); +extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs); +extern void *PQresultAlloc(PGresult *res, size_t nBytes); +extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len); + +/* Quoting strings before inclusion in queries. */ +extern size_t PQescapeStringConn(PGconn *conn, + char *to, const char *from, size_t length, + int *error); +extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len); +extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len); +extern unsigned char *PQescapeByteaConn(PGconn *conn, + const unsigned char *from, size_t from_length, + size_t *to_length); +extern unsigned char *PQunescapeBytea(const unsigned char *strtext, + size_t *retbuflen); + +/* These forms are deprecated! */ +extern size_t PQescapeString(char *to, const char *from, size_t length); +extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, + size_t *to_length); + + + +/* === in fe-print.c === */ + +extern void PQprint(FILE *fout, /* output stream */ + const PGresult *res, + const PQprintOpt *ps); /* option structure */ + +/* + * really old printing routines + */ +extern void PQdisplayTuples(const PGresult *res, + FILE *fp, /* where to send the output */ + int fillAlign, /* pad the fields with spaces */ + const char *fieldSep, /* field separator */ + int printHeader, /* display headers? */ + int quiet); + +extern void PQprintTuples(const PGresult *res, + FILE *fout, /* output stream */ + int printAttName, /* print attribute names */ + int terseOutput, /* delimiter bars */ + int width); /* width of column, if 0, use variable width */ + + +/* === in fe-lobj.c === */ + +/* Large-object access routines */ +extern int lo_open(PGconn *conn, Oid lobjId, int mode); +extern int lo_close(PGconn *conn, int fd); +extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); +extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len); +extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); +extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence); +extern Oid lo_creat(PGconn *conn, int mode); +extern Oid lo_create(PGconn *conn, Oid lobjId); +extern int lo_tell(PGconn *conn, int fd); +extern pg_int64 lo_tell64(PGconn *conn, int fd); +extern int lo_truncate(PGconn *conn, int fd, size_t len); +extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len); +extern int lo_unlink(PGconn *conn, Oid lobjId); +extern Oid lo_import(PGconn *conn, const char *filename); +extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId); +extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); + +/* === in fe-misc.c === */ + +/* Get the version of the libpq library in use */ +extern int PQlibVersion(void); + +/* Determine length of multibyte encoded char at *s */ +extern int PQmblen(const char *s, int encoding); + +/* Determine display length of multibyte encoded char at *s */ +extern int PQdsplen(const char *s, int encoding); + +/* Get encoding id from environment variable PGCLIENTENCODING */ +extern int PQenv2encoding(void); + +/* === in fe-auth.c === */ + +extern char *PQencryptPassword(const char *passwd, const char *user); + +/* === in encnames.c === */ + +extern int pg_char_to_encoding(const char *name); +extern const char *pg_encoding_to_char(int encoding); +extern int pg_valid_server_encoding_id(int encoding); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBPQ_FE_H */ diff --git a/libraries/SQLAPI/include/pgsql/libpq-fs.h b/libraries/SQLAPI/include/pgsql/libpq-fs.h new file mode 100644 index 000000000..52166cf49 --- /dev/null +++ b/libraries/SQLAPI/include/pgsql/libpq-fs.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * libpq-fs.h + * definitions for using Inversion file system routines (ie, large objects) + * + * + * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-fs.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_FS_H +#define LIBPQ_FS_H + +/* + * Read/write mode flags for inversion (large object) calls + */ + +#define INV_WRITE 0x00020000 +#define INV_READ 0x00040000 + +#endif /* LIBPQ_FS_H */ diff --git a/libraries/SQLAPI/include/pgsql/pg_config_ext.h b/libraries/SQLAPI/include/pgsql/pg_config_ext.h new file mode 100644 index 000000000..059169a36 --- /dev/null +++ b/libraries/SQLAPI/include/pgsql/pg_config_ext.h @@ -0,0 +1,11 @@ +/* + * src/include/pg_config_ext.h.win32. This is generated manually, not by + * autoheader, since we want to limit which symbols get defined here. + */ + +/* Define to the name of a signed 64-bit integer type. */ +#ifdef SQLAPI_WINDOWS +#define PG_INT64_TYPE __int64 +#else +#define PG_INT64_TYPE long long int +#endif diff --git a/libraries/SQLAPI/include/pgsql/postgres_ext.h b/libraries/SQLAPI/include/pgsql/postgres_ext.h new file mode 100644 index 000000000..74c344c70 --- /dev/null +++ b/libraries/SQLAPI/include/pgsql/postgres_ext.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * postgres_ext.h + * + * This file contains declarations of things that are visible everywhere + * in PostgreSQL *and* are visible to clients of frontend interface libraries. + * For example, the Oid type is part of the API of libpq and other libraries. + * + * Declarations which are specific to a particular interface should + * go in the header file for that interface (such as libpq-fe.h). This + * file is only for fundamental Postgres declarations. + * + * User-written C functions don't count as "external to Postgres." + * Those function much as local modifications to the backend itself, and + * use header files that are otherwise internal to Postgres to interface + * with the backend. + * + * src/include/postgres_ext.h + * + *------------------------------------------------------------------------- + */ + +#ifndef POSTGRES_EXT_H +#define POSTGRES_EXT_H + +#include "pg_config_ext.h" + +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +#ifdef __cplusplus +#define InvalidOid (Oid(0)) +#else +#define InvalidOid ((Oid) 0) +#endif + +#define OID_MAX UINT_MAX +/* you will need to include to use the above #define */ + +/* Define a signed 64-bit integer type for use in client API declarations. */ +typedef PG_INT64_TYPE pg_int64; + + +/* + * Identifiers of error message fields. Kept here to keep common + * between frontend and backend, and also to export them to libpq + * applications. + */ +#define PG_DIAG_SEVERITY 'S' +#define PG_DIAG_SQLSTATE 'C' +#define PG_DIAG_MESSAGE_PRIMARY 'M' +#define PG_DIAG_MESSAGE_DETAIL 'D' +#define PG_DIAG_MESSAGE_HINT 'H' +#define PG_DIAG_STATEMENT_POSITION 'P' +#define PG_DIAG_INTERNAL_POSITION 'p' +#define PG_DIAG_INTERNAL_QUERY 'q' +#define PG_DIAG_CONTEXT 'W' +#define PG_DIAG_SCHEMA_NAME 's' +#define PG_DIAG_TABLE_NAME 't' +#define PG_DIAG_COLUMN_NAME 'c' +#define PG_DIAG_DATATYPE_NAME 'd' +#define PG_DIAG_CONSTRAINT_NAME 'n' +#define PG_DIAG_SOURCE_FILE 'F' +#define PG_DIAG_SOURCE_LINE 'L' +#define PG_DIAG_SOURCE_FUNCTION 'R' + +#endif /* POSTGRES_EXT_H */ diff --git a/libraries/SQLAPI/include/samisc.h b/libraries/SQLAPI/include/samisc.h new file mode 100644 index 000000000..a2037b8f7 --- /dev/null +++ b/libraries/SQLAPI/include/samisc.h @@ -0,0 +1,144 @@ +// samisc.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__SAMISC_H__) +#define __SAMISC_H__ + +#define sa_min(x, y) ((x) < (y)? (x) : (y)) +#define sa_max(x, y) ((x) > (y)? (x) : (y)) + +#if defined(SA_UNICODE) +#define sa_strcpy(x, y) wcscpy(x, y) +#define sa_strlen(x) wcslen(x) +#define sa_strstr(x, y) wcsstr(x, y) +#define sa_strchr(x, y) wcschr(x, y) +#define sa_isspace(x) iswspace(x) +#define sa_isdigit(x) iswdigit(x) +#define sa_isalpha(x) iswalpha(x) +#define sa_strcmp(x, y) wcscmp(x, y) +#define sa_strncmp(x, y, z) wcsncmp(x, y, z) +#define sa_tolower(x) towlower(x) +#define sa_toupper(x) towupper(x) +#define sa_strcoll(x, y) wcscoll(x, y) +#define sa_strpbrk(x, y) wcspbrk(x, y) +#define sa_strrchr(x, y) wcsrchr(x, y) +#define sa_strtol(x, y, z) wcstol(x, y, z) +#define sa_strtoul(x, y, z) wcstoul(x, y, z) +#define sa_strtod(x, y) wcstod(x, y) +#define sa_toi(x) (int)wcstol(x, NULL, 10) +#define sa_tol(x) wcstol(x, NULL, 10) +#define sa_sscanf swscanf +#define sa_printf wprintf +#define sa_scanf wscanf +#define sa_getchar getwchar +#ifdef SQLAPI_WINDOWS +#define sa_snprintf _snwprintf +#define sa_vsnprintf(x, y, z, j) _vsnwprintf(x, y, z, j) +#define sa_stricmp(x, y) _wcsicmp(x, y) +#else +#define sa_vsnprintf(x, y, z, j) vswprintf(x, y, z, j) +#define sa_snprintf swprintf +#define sa_stricmp(x, y) wcscasecmp(x, y) +#endif // ! SQLAPI_WINDOWS +#define sa_csinc(x) (++(x)) +#define sa_clen(x) (1) +#else +#define sa_strcpy(x, y) strcpy(x, y) +#define sa_strlen(x) strlen(x) +#define sa_strstr(x, y) strstr(x, y) +#define sa_strchr(x, y) strchr(x, y) +#define sa_isspace(x) isspace((unsigned char)x) +#define sa_isdigit(x) isdigit((unsigned char)x) +#define sa_isalpha(x) isalpha((unsigned char)x) +#define sa_strcmp(x, y) strcmp(x, y) +#define sa_strncmp(x, y, z) strncmp(x, y, z) +#define sa_tolower(x) tolower((unsigned char)x) +#define sa_toupper(x) toupper((unsigned char)x) +#define sa_strcoll(x, y) strcoll(x, y) +#define sa_strpbrk(x, y) strpbrk(x, y) +#define sa_strrchr(x, y) strrchr(x, y) +#define sa_strtol(x, y, z) strtol(x, y, z) +#define sa_strtoul(x, y, z) strtoul(x, y, z) +#define sa_strtod(x, y) strtod(x, y) +#define sa_toi(x) atoi(x) +#define sa_tol(x) atol(x) +#define sa_sscanf sscanf +#define sa_printf printf +#define sa_scanf scanf +#define sa_getchar getchar +#ifdef SQLAPI_WINDOWS +#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0520) +#define sa_vsnprintf(x, y, z, j) vsprintf(x, z, j) +#else +#define sa_vsnprintf(x, y, z, j) _vsnprintf(x, y, z, j) +#endif +#define sa_snprintf _snprintf +#define sa_stricmp(x, y) _stricmp(x, y) +#else +#define sa_vsnprintf(x, y, z, j) vsnprintf(x, y, z, j) +#define sa_snprintf snprintf +#define sa_stricmp(x, y) strcasecmp(x, y) +#endif // ! SQLAPI_WINDOWS +#define sa_csinc(x) (++(x)) +#define sa_clen(x) (1) +#endif + +#ifdef SQLAPI_WINDOWS +#ifdef __BORLANDC__ +#define _strnicmp strnicmp +#define _stricmp stricmp +#endif +#elif SQLAPI_SCOOSR5 +#define _strnicmp strnicmp +#define _stricmp stricmp +#else +#define _strnicmp strncasecmp +#define _stricmp strcasecmp +#endif // defined(SQLAPI_WINDOWS) + +#ifdef SQLAPI_WINDOWS +#include +#else +#if defined(SA_USE_PTHREAD) +#include +#endif // defined(SA_USE_PTHREAD) +#endif + +class SQLAPI_API SAMutex +{ +#ifdef SQLAPI_WINDOWS +#ifdef SA_USE_MUTEXT_LOCK + HANDLE m_hMutex; +#else + CRITICAL_SECTION m_hCriticalSection; +#endif +#endif // defined(SQLAPI_WINDOWS) + +#if defined(SA_USE_PTHREAD) + pthread_mutex_t m_mutex; // mutex + // we need additional machinery + // to allow portable recursion + int m_locks; // number of times owner locked mutex + pthread_t m_owner_thread; //owner of mutex + pthread_mutex_t m_helper_mutex; // structure access lock +#endif // defined(SA_USE_PTHREAD) + +public: + SAMutex(); + virtual ~SAMutex(); + + void Wait(); + void Release(); +}; + +class SQLAPI_API SACriticalSectionScope +{ + SAMutex *m_pSAMutex; + +public: + SACriticalSectionScope(SAMutex *pSAMutex); + virtual ~SACriticalSectionScope(); +}; + +#endif // !defined(__SAMISC_H__) diff --git a/libraries/SQLAPI/include/sbAPI.h b/libraries/SQLAPI/include/sbAPI.h new file mode 100644 index 000000000..121cedca6 --- /dev/null +++ b/libraries/SQLAPI/include/sbAPI.h @@ -0,0 +1,514 @@ +// sbAPI.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__SB7API_H__) +#define __SB7API_H__ + +#include "SQLAPI.h" + +// API header(s) +#define SQL_32BITTARG 1 +#include + +extern long g_nSBDLLVersionLoaded; + +extern void AddSB6Support(const SAConnection * pCon); +extern void ReleaseSB6Support(); +extern bool CanBeLoadedSB7(const SAConnection * pCon); +extern void AddSB7Support(const SAConnection * pCon); +extern void ReleaseSB7Support(); + +typedef byte2 (SBSTDCALL *sqlarf_t)(SQLTCUR cur , SQLTFNP fnp , + SQLTFNL fnl , SQLTCHO cho ); +typedef byte2 (SBSTDCALL *sqlbbr_t)(SQLTCUR cur , SQLTXER PTR errnum , + SQLTDAP errbuf , SQLTDAL PTR buflen , + SQLTBIR PTR errrow , SQLTRBF PTR rbf , + SQLTBIR errseq ); +typedef byte2 (SBSTDCALL *sqlbdb_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +typedef byte2 (SBSTDCALL *sqlbef_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlber_t)(SQLTCUR cur , SQLTRCD PTR rcd , + SQLTBIR PTR errrow , SQLTRBF PTR rbf , + SQLTBIR errseq ); +typedef byte2 (SBSTDCALL *sqlbkp_t)(SQLTCUR cur , SQLTBOO defalt , + SQLTBOO overwrt , SQLTFNP bkfname , + SQLTFNL bkfnlen ); +typedef byte2 (SBSTDCALL *sqlbld_t)(SQLTCUR cur , SQLTBNP bnp , + SQLTBNL bnl ); +typedef byte2 (SBSTDCALL *sqlblf_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +typedef byte2 (SBSTDCALL *sqlblk_t)(SQLTCUR cur , SQLTFLG blkflg ); +typedef byte2 (SBSTDCALL *sqlbln_t)(SQLTCUR cur , SQLTBNN bnn ); +typedef byte2 (SBSTDCALL *sqlbna_t)(SQLTCUR cur , SQLTBNP bnp , + SQLTBNL bnl , SQLTDAP dap , + SQLTDAL dal , SQLTSCA sca , + SQLTPDT pdt , SQLTNUL nli ); +typedef byte2 (SBSTDCALL *sqlbnd_t)(SQLTCUR cur , SQLTBNP bnp , + SQLTBNL bnl , SQLTDAP dap , + SQLTDAL dal , SQLTSCA sca , + SQLTPDT pdt ); +typedef byte2 (SBSTDCALL *sqlbnn_t)(SQLTCUR cur , SQLTBNN bnn , + SQLTDAP dap , SQLTDAL dal , + SQLTSCA sca , SQLTPDT pdt ); +typedef byte2 (SBSTDCALL *sqlbnu_t)(SQLTCUR cur , SQLTBNN bnn , + SQLTDAP dap , SQLTDAL dal , + SQLTSCA sca , SQLTPDT pdt , + SQLTNUL nli ); +typedef byte2 (SBSTDCALL *sqlbss_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +typedef byte2 (SBSTDCALL *sqlcan_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlcbv_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlcdr_t)(SQLTSVH shandle, SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlcex_t)(SQLTCUR cur , SQLTDAP dap , + SQLTDAL dal ); +typedef byte2 (SBSTDCALL *sqlclf_t)(SQLTSVH cur , SQLTDAP logfile , + SQLTFMD startflag); +typedef byte2 (SBSTDCALL *sqlcmt_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlcnc_t)(SQLTCUR PTR curp , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqlcnr_t)(SQLTCUR PTR curp , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqlcom_t)(SQLTCUR cur , SQLTDAP cmdp , + SQLTDAL cmdl ); +typedef byte2 (SBSTDCALL *sqlcon_t)(SQLTCUR PTR curp , SQLTDAP dbnamp , + SQLTDAL dbnaml , SQLTWSI cursiz , + SQLTNPG pages , SQLTRCF recovr , + SQLTDAL outsize , SQLTDAL insize ); +typedef byte2 (SBSTDCALL *sqlcpy_t)(SQLTCUR fcur , SQLTDAP selp , + SQLTDAL sell , SQLTCUR tcur , + SQLTDAP isrtp , SQLTDAL isrtl ); +typedef byte2 (SBSTDCALL *sqlcre_t)(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqlcrf_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel ); +typedef byte2 (SBSTDCALL *sqlcrs_t)(SQLTCUR cur , SQLTDAP rsp , + SQLTDAL rsl ); +typedef byte2 (SBSTDCALL *sqlcsv_t)(SQLTSVH PTR shandlep, SQLTDAP serverid, + SQLTDAP password); +typedef byte2 (SBSTDCALL *sqlcty_t)(SQLTCUR cur , SQLTCTY PTR cty ); +typedef byte2 (SBSTDCALL *sqldbn_t)(SQLTDAP serverid, SQLTDAP buffer , + SQLTDAL length ); +typedef byte2 (SBSTDCALL *sqlded_t)(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqldel_t)(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqldes_t)(SQLTCUR cur , SQLTSLC slc , + SQLTDDT PTR ddt , SQLTDDL PTR ddl , + SQLTCHP chp , SQLTCHL PTR chlp , + SQLTPRE PTR prep , SQLTSCA PTR scap ); +typedef byte2 (SBSTDCALL *sqldid_t)(SQLTDAP dbname , SQLTDAL dbnamel ); +typedef byte2 (SBSTDCALL *sqldii_t)(SQLTCUR cur , SQLTSLC ivn , + SQLTDAP inp , SQLTCHL* inlp ); +typedef byte2 (SBSTDCALL *sqldin_t)(SQLTDAP dbnamp , SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqldir_t)(SQLTSVN srvno , SQLTDAP buffer , + SQLTDAL length ); +typedef byte2 (SBSTDCALL *sqldis_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqldon_t)(void); +typedef byte2 (SBSTDCALL *sqldox_t)(SQLTSVH shandle , SQLTDAP dirnamep, + SQLTFAT fattr ); +typedef byte2 (SBSTDCALL *sqldrc_t)(SQLTSVH cur ); +typedef byte2 (SBSTDCALL *sqldro_t)(SQLTSVH shandle , SQLTDAP dirname ); +typedef byte2 (SBSTDCALL *sqldrr_t)(SQLTSVH shandle , SQLTDAP filename); +typedef byte2 (SBSTDCALL *sqldrs_t)(SQLTCUR cur , SQLTDAP rsp , + SQLTDAL rsl ); +typedef byte2 (SBSTDCALL *sqldsc_t)(SQLTCUR cur , SQLTSLC slc , + SQLTDDT PTR edt , SQLTDDL PTR edl , + SQLTCHP chp , SQLTCHL PTR chlp , + SQLTPRE PTR prep , SQLTSCA PTR scap ); +typedef byte2 (SBSTDCALL *sqldst_t)(SQLTCUR cur , SQLTDAP cnp , + SQLTDAL cnl ); +typedef byte2 (SBSTDCALL *sqldsv_t)(SQLTSVH shandle ); +typedef byte2 (SBSTDCALL *sqlebk_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlefb_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlelo_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlenr_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel ); +typedef byte2 (SBSTDCALL *sqlepo_t)(SQLTCUR cur , SQLTEPO PTR epo ); +typedef byte2 (SBSTDCALL *sqlerf_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlerr_t)(SQLTRCD error , SQLTDAP msg ); +typedef byte2 (SBSTDCALL *sqlers_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqletx_t)(SQLTRCD error , SQLTPTY msgtyp , + SQLTDAP bfp , SQLTDAL bfl , + SQLTDAL PTR txtlen ); +typedef byte2 (SBSTDCALL *sqlexe_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlexp_t)(SQLTCUR cur , SQLTDAP buffer , + SQLTDAL length ); +typedef byte2 (SBSTDCALL *sqlfbk_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlfer_t)(SQLTRCD error , SQLTDAP msg ); +typedef byte2 (SBSTDCALL *sqlfet_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlfgt_t)(SQLTSVH cur , SQLTDAP srvfile , + SQLTDAP lclfile ); +typedef byte2 (SBSTDCALL *sqlfpt_t)(SQLTSVH cur , SQLTDAP srvfile , + SQLTDAP lclfile ); +typedef byte2 (SBSTDCALL *sqlfqn_t)(SQLTCUR cur , SQLTFLD field , + SQLTDAP nameptr , SQLTDAL PTR namelen ); +typedef byte2 (SBSTDCALL *sqlgbi_t)(SQLTCUR cur , SQLTCUR PTR pcur , + SQLTPNM PTR ppnm ); +typedef byte2 (SBSTDCALL *sqlgdi_t)(SQLTCUR cur , SQLTPGD gdi ); +typedef byte2 (SBSTDCALL *sqlget_t)(SQLTCUR cur , SQLTPTY parm , + SQLTDAP p , SQLTDAL PTR l ); +typedef byte2 (SBSTDCALL *sqlgfi_t)(SQLTCUR cur , SQLTSLC slc , + SQLTCDL PTR cvl , SQLTFSC PTR fsc ); +typedef byte2 (SBSTDCALL *sqlgls_t)(SQLTCUR cur , SQLTSLC slc , + SQLTLSI PTR size ); +typedef byte2 (SBSTDCALL *sqlgnl_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTLNG PTR lognum ); +typedef byte2 (SBSTDCALL *sqlgnr_t)(SQLTCUR cur , SQLTDAP tbnam , + SQLTDAL tbnaml , SQLTROW PTR rows ); +typedef byte2 (SBSTDCALL *sqlgsi_t)(SQLTSVH shandle , SQLTFLG infoflags, + SQLTDAP buffer , SQLTDAL buflen , + SQLTDAL PTR rbuflen ); +typedef byte2 (SBSTDCALL *sqlidb_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlims_t)(SQLTCUR cur , SQLTDAL insize ); +typedef byte2 (SBSTDCALL *sqlind_t)(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqlini_t)(SQLTPFP callback); +typedef byte2 (SBSTDCALL *sqlins_t)(SQLTSVN srvno , SQLTDAP dbnamp , + SQLTDAL dbnaml , SQLTFLG createflag, + SQLTFLG overwrite); +typedef byte2 (SBSTDCALL *sqllab_t)(SQLTCUR cur , SQLTSLC slc , + SQLTCHP lbp , SQLTCHL PTR lblp ); +typedef byte2 (SBSTDCALL *sqlldp_t)(SQLTCUR cur , SQLTDAP cmdp , + SQLTDAL cmdl ); +typedef byte2 (SBSTDCALL *sqllsk_t)(SQLTCUR cur , SQLTSLC slc , + SQLTLSI pos ); +typedef byte2 (SBSTDCALL *sqlmcl_t)(SQLTSVH shandle , SQLTFLH fd ); +typedef byte2 (SBSTDCALL *sqlmdl_t)(SQLTSVH shandle , SQLTDAP filename); +typedef byte2 (SBSTDCALL *sqlmop_t)(SQLTSVH shandle , SQLTFLH PTR fdp , + SQLTDAP filename, SQLTFMD openmode); +typedef byte2 (SBSTDCALL *sqlmrd_t)(SQLTSVH shandle , SQLTFLH fd , + SQLTDAP buffer , SQLTDAL len , + SQLTDAL PTR rlen ); +typedef byte2 (SBSTDCALL *sqlmsk_t)(SQLTSVH shandle , SQLTFLH fd , + SQLTLNG offset , SQLTWNC whence , + SQLTLNG PTR roffset ); +typedef byte2 (SBSTDCALL *sqlmwr_t)(SQLTSVH shandle , SQLTFLH fd , + SQLTDAP buffer , SQLTDAL len , + SQLTDAL PTR rlen ); +typedef byte2 (SBSTDCALL *sqlnbv_t)(SQLTCUR cur , SQLTNBV PTR nbv ); +typedef byte2 (SBSTDCALL *sqlnii_t)(SQLTCUR cur , SQLTNSI PTR nii ); +typedef byte2 (SBSTDCALL *sqlnrr_t)(SQLTCUR cur , SQLTROW PTR rcountp ); +typedef byte2 (SBSTDCALL *sqlnsi_t)(SQLTCUR cur , SQLTNSI PTR nsi ); +typedef byte2 (SBSTDCALL *sqloms_t)(SQLTCUR cur , SQLTDAL outsize ); +typedef byte2 (SBSTDCALL *sqlprs_t)(SQLTCUR cur , SQLTROW row ); +typedef byte2 (SBSTDCALL *sqlrbf_t)(SQLTCUR cur , SQLTRBF PTR rbf ); +typedef byte2 (SBSTDCALL *sqlrbk_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlrcd_t)(SQLTCUR cur , SQLTRCD PTR rcd ); +typedef byte2 (SBSTDCALL *sqlrdb_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +typedef byte2 (SBSTDCALL *sqlrdc_t)(SQLTCUR cur , SQLTDAP bufp , + SQLTDAL bufl , SQLTDAL PTR readl ); +typedef byte2 (SBSTDCALL *sqlrel_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlres_t)(SQLTCUR PTR curptr , SQLTFNP bkfname , + SQLTFNL bkfnlen , SQLTSVN bkfserv , + SQLTBOO overwrt , SQLTDAP dbname , + SQLTDAL dbnlen , SQLTSVN dbserv ); +typedef byte2 (SBSTDCALL *sqlret_t)(SQLTCUR cur , SQLTDAP cnp , + SQLTDAL cnl ); +typedef byte2 (SBSTDCALL *sqlrlf_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +typedef byte2 (SBSTDCALL *sqlrlo_t)(SQLTCUR cur , SQLTSLC slc , + SQLTDAP bufp , SQLTDAL bufl , + SQLTDAL PTR readl ); +typedef byte2 (SBSTDCALL *sqlrof_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTRFM mode , + SQLTDAP datetime, SQLTDAL datetimel); +typedef byte2 (SBSTDCALL *sqlrow_t)(SQLTCUR cur , SQLTROW PTR row ); +typedef byte2 (SBSTDCALL *sqlrrd_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlrrs_t)(SQLTCUR cur , SQLTDAP rsp , + SQLTDAL rsl ); +typedef byte2 (SBSTDCALL *sqlrsi_t)(SQLTSVH shandle ); +typedef byte2 (SBSTDCALL *sqlrss_t)(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +typedef byte2 (SBSTDCALL *sqlsab_t)(SQLTSVH shandle , SQLTPNM pnum ); +typedef byte2 (SBSTDCALL *sqlsap_t)(SQLTSVN srvno , SQLTDAP password, + SQLTPNM pnum ); +typedef byte2 (SBSTDCALL *sqlscl_t)(SQLTCUR cur , SQLTDAP namp , + SQLTDAL naml ); +typedef byte2 (SBSTDCALL *sqlscn_t)(SQLTCUR cur , SQLTDAP namp , + SQLTDAL naml ); +typedef byte2 (SBSTDCALL *sqlscp_t)(SQLTNPG pages ); +typedef byte2 (SBSTDCALL *sqlsdn_t)(SQLTDAP dbnamp , SQLTDAL dbnaml ); +typedef byte2 (SBSTDCALL *sqlsds_t)(SQLTSVH shandle, SQLTFLG shutdownflg); +typedef byte2 (SBSTDCALL *sqlsdx_t)(SQLTSVH shandle, SQLTDAP dbnamp, + SQLTDAL dbnaml , SQLTFLG shutdownflg); +typedef byte2 (SBSTDCALL *sqlset_t)(SQLTCUR cur , SQLTPTY parm , + SQLTDAP p , SQLTDAL l ); +typedef byte2 (SBSTDCALL *sqlsil_t)(SQLTCUR cur , SQLTILV isolation); +typedef byte2 (SBSTDCALL *sqlslp_t)(SQLTCUR cur , SQLTNPG lpt , + SQLTNPG lpm ); +typedef byte2 (SBSTDCALL *sqlspr_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlsrf_t)(SQLTCUR cur , SQLTDAP fnp , + SQLTDAL fnl ); +typedef byte2 (SBSTDCALL *sqlsrs_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlssb_t)(SQLTCUR cur , SQLTSLC slc , + SQLTPDT pdt , SQLTDAP pbp , + SQLTPDL pdl , SQLTSCA sca , + SQLTCDL PTR pcv , SQLTFSC PTR pfc ); +typedef byte2 (SBSTDCALL *sqlsss_t)(SQLTCUR cur , SQLTDAL size ); +typedef byte2 (SBSTDCALL *sqlsta_t)(SQLTCUR cur , SQLTSTC PTR svr , + SQLTSTC PTR svw , SQLTSTC PTR spr , + SQLTSTC PTR spw ); +typedef byte2 (SBSTDCALL *sqlstm_t)(SQLTSVH shandle ); +typedef byte2 (SBSTDCALL *sqlsto_t)(SQLTCUR cur , SQLTDAP cnp , + SQLTDAL cnl , SQLTDAP ctp , + SQLTDAL ctl ); +typedef byte2 (SBSTDCALL *sqlstr_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlsxt_t)(SQLTSVN srvno , SQLTDAP password); +typedef byte2 (SBSTDCALL *sqlsys_t)(SQLTCUR cur , SQLTSYS PTR sys ); +typedef byte2 (SBSTDCALL *sqltec_t)(SQLTRCD rcd , SQLTRCD PTR np ); +typedef byte2 (SBSTDCALL *sqltem_t)(SQLTCUR cur , SQLTXER PTR xer , + SQLTPTY msgtyp , SQLTDAP bfp , + SQLTDAL bfl , SQLTDAL PTR txtlen ); +typedef byte2 (SBSTDCALL *sqltio_t)(SQLTCUR cur , SQLTTIV _timeout); +typedef byte2 (SBSTDCALL *sqlunl_t)(SQLTCUR cur , SQLTDAP cmdp , + SQLTDAL cmdl ); +typedef byte2 (SBSTDCALL *sqlurs_t)(SQLTCUR cur ); +typedef byte2 (SBSTDCALL *sqlwdc_t)(SQLTCUR cur , SQLTDAP bufp , + SQLTDAL bufl ); +typedef byte2 (SBSTDCALL *sqlwlo_t)(SQLTCUR cur , SQLTDAP bufp , + SQLTDAL bufl ); +typedef byte2 (SBSTDCALL *sqlxad_t)(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); +typedef byte2 (SBSTDCALL *sqlxcn_t)(SQLTNMP op , SQLTDAP ip , + SQLTDAL il ); +typedef byte2 (SBSTDCALL *sqlxda_t)(SQLTNMP op , SQLTNMP dp , + SQLTNML dl , SQLTDAY days ); +typedef byte2 (SBSTDCALL *sqlxdp_t)(SQLTDAP op , SQLTDAL ol , + SQLTNMP ip , SQLTNML il , + SQLTDAP pp , SQLTDAL pl ); +typedef byte2 (SBSTDCALL *sqlxdv_t)(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); +typedef byte2 (SBSTDCALL *sqlxer_t)(SQLTCUR cur , SQLTXER PTR errnum, + SQLTDAP errbuf , SQLTDAL PTR buflen ); +typedef byte2 (SBSTDCALL *sqlxml_t)(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); +typedef byte2 (SBSTDCALL *sqlxnp_t)(SQLTDAP outp , SQLTDAL outl , + SQLTNMP isnp , SQLTNML isnl , + SQLTDAP picp , SQLTDAL picl ); +typedef byte2 (SBSTDCALL *sqlxpd_t)(SQLTNMP op , SQLTNML PTR olp , + SQLTDAP ip , SQLTDAP pp , + SQLTDAL pl ); +typedef byte2 (SBSTDCALL *sqlxsb_t)(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); + +// version 7 specific +typedef byte2 (SBSTDCALL *sqlcch_t)(SQLTCON PTR hConp , SQLTDAP dbnamp , + SQLTDAL dbnaml , SQLTMOD fType ); +typedef byte2 (SBSTDCALL *sqldch_t)(SQLTCON hCon ); +typedef byte2 (SBSTDCALL *sqlopc_t)(SQLTCUR PTR curp , SQLTCON hCon , + SQLTMOD fType ); + +// API declarations +class SQLAPI_API sb6API : public saAPI +{ +public: + sb6API(); + + sqlarf_t sqlarf; + sqlbbr_t sqlbbr; + sqlbdb_t sqlbdb; + sqlbef_t sqlbef; + sqlber_t sqlber; + sqlbkp_t sqlbkp; + sqlbld_t sqlbld; + sqlblf_t sqlblf; + sqlblk_t sqlblk; + sqlbln_t sqlbln; + sqlbna_t sqlbna; + sqlbnd_t sqlbnd; + sqlbnn_t sqlbnn; + sqlbnu_t sqlbnu; + sqlbss_t sqlbss; + sqlcan_t sqlcan; + sqlcbv_t sqlcbv; + sqlcdr_t sqlcdr; + sqlcex_t sqlcex; + sqlclf_t sqlclf; + sqlcmt_t sqlcmt; + sqlcnc_t sqlcnc; + sqlcnr_t sqlcnr; + sqlcom_t sqlcom; + sqlcon_t sqlcon; + sqlcpy_t sqlcpy; + sqlcre_t sqlcre; + sqlcrf_t sqlcrf; + sqlcrs_t sqlcrs; + sqlcsv_t sqlcsv; + sqlcty_t sqlcty; + sqldbn_t sqldbn; + sqlded_t sqlded; + sqldel_t sqldel; + sqldes_t sqldes; + sqldid_t sqldid; + sqldii_t sqldii; + sqldin_t sqldin; + sqldir_t sqldir; + sqldis_t sqldis; + sqldon_t sqldon; + sqldox_t sqldox; + sqldrc_t sqldrc; + sqldro_t sqldro; + sqldrr_t sqldrr; + sqldrs_t sqldrs; + sqldsc_t sqldsc; + sqldst_t sqldst; + sqldsv_t sqldsv; + sqlebk_t sqlebk; + sqlefb_t sqlefb; + sqlelo_t sqlelo; + sqlenr_t sqlenr; + sqlepo_t sqlepo; + sqlerf_t sqlerf; + sqlerr_t sqlerr; + sqlers_t sqlers; + sqletx_t sqletx; + sqlexe_t sqlexe; + sqlexp_t sqlexp; + sqlfbk_t sqlfbk; + sqlfer_t sqlfer; + sqlfet_t sqlfet; + sqlfgt_t sqlfgt; + sqlfpt_t sqlfpt; + sqlfqn_t sqlfqn; + sqlgbi_t sqlgbi; + sqlgdi_t sqlgdi; + sqlget_t sqlget; + sqlgfi_t sqlgfi; + sqlgls_t sqlgls; + sqlgnl_t sqlgnl; + sqlgnr_t sqlgnr; + sqlgsi_t sqlgsi; + sqlidb_t sqlidb; + sqlims_t sqlims; + sqlind_t sqlind; + sqlini_t sqlini; + sqlins_t sqlins; + sqllab_t sqllab; + sqlldp_t sqlldp; + sqllsk_t sqllsk; + sqlmcl_t sqlmcl; + sqlmdl_t sqlmdl; + sqlmop_t sqlmop; + sqlmrd_t sqlmrd; + sqlmsk_t sqlmsk; + sqlmwr_t sqlmwr; + sqlnbv_t sqlnbv; + sqlnii_t sqlnii; + sqlnrr_t sqlnrr; + sqlnsi_t sqlnsi; + sqloms_t sqloms; + sqlprs_t sqlprs; + sqlrbf_t sqlrbf; + sqlrbk_t sqlrbk; + sqlrcd_t sqlrcd; + sqlrdb_t sqlrdb; + sqlrdc_t sqlrdc; + sqlrel_t sqlrel; + sqlres_t sqlres; + sqlret_t sqlret; + sqlrlf_t sqlrlf; + sqlrlo_t sqlrlo; + sqlrof_t sqlrof; + sqlrow_t sqlrow; + sqlrrd_t sqlrrd; + sqlrrs_t sqlrrs; + sqlrsi_t sqlrsi; + sqlrss_t sqlrss; + sqlsab_t sqlsab; + sqlsap_t sqlsap; + sqlscl_t sqlscl; + sqlscn_t sqlscn; + sqlscp_t sqlscp; + sqlsdn_t sqlsdn; + sqlsds_t sqlsds; + sqlsdx_t sqlsdx; + sqlset_t sqlset; + sqlsil_t sqlsil; + sqlslp_t sqlslp; + sqlspr_t sqlspr; + sqlsrf_t sqlsrf; + sqlsrs_t sqlsrs; + sqlssb_t sqlssb; + sqlsss_t sqlsss; + sqlsta_t sqlsta; + sqlstm_t sqlstm; + sqlsto_t sqlsto; + sqlstr_t sqlstr; + sqlsxt_t sqlsxt; + sqlsys_t sqlsys; + sqltec_t sqltec; + sqltem_t sqltem; + sqltio_t sqltio; + sqlunl_t sqlunl; + sqlurs_t sqlurs; + sqlwdc_t sqlwdc; + sqlwlo_t sqlwlo; + sqlxad_t sqlxad; + sqlxcn_t sqlxcn; + sqlxda_t sqlxda; + sqlxdp_t sqlxdp; + sqlxdv_t sqlxdv; + sqlxer_t sqlxer; + sqlxml_t sqlxml; + sqlxnp_t sqlxnp; + sqlxpd_t sqlxpd; + sqlxsb_t sqlxsb; +}; + +// version 7 specific +class SQLAPI_API sb7API : public sb6API +{ +public: + sb7API(); + + sqlcch_t sqlcch; + sqldch_t sqldch; + sqlopc_t sqlopc; +}; + +class SQLAPI_API sb6ConnectionHandles : public saConnectionHandles +{ +public: + sb6ConnectionHandles(); + + SQLTCUR m_cur; // SQLBase cursor number +}; + +class SQLAPI_API sb7ConnectionHandles : public sb6ConnectionHandles +{ +public: + sb7ConnectionHandles(); + + SQLTCON m_hCon; +}; + +class SQLAPI_API sbCommandHandles : public saCommandHandles +{ +public: + sbCommandHandles(); + + SQLTCUR m_cur; +}; + +extern sb7API g_sb7API; +extern sb6API &g_sb6API; + +#endif // !defined(__SB7API_H__) diff --git a/libraries/SQLAPI/include/sl3API.h b/libraries/SQLAPI/include/sl3API.h new file mode 100644 index 000000000..c0b593d8b --- /dev/null +++ b/libraries/SQLAPI/include/sl3API.h @@ -0,0 +1,262 @@ +////////////////////////////////////////////////////////////////////// +// slAPI.h +////////////////////////////////////////////////////////////////////// + +#if !defined(__SLAPI_H__) +#define __SLAPI_H__ + +#include +#include + +extern void AddSQLite3Support(const SAConnection * pCon); +extern void ReleaseSQLite3Support(); + +typedef int (*sqlite3_open_t)(const void *filename, sqlite3 **ppDb); +typedef const char * (*sqlite3_libversion_t)(void); +typedef int (*sqlite3_libversion_number_t)(void); +typedef int (*sqlite3_threadsafe_t)(void); +typedef int (*sqlite3_close_t)(sqlite3 *); +typedef int (*sqlite3_extended_result_codes_t)(sqlite3*, int onoff); +typedef sqlite3_int64 (*sqlite3_last_insert_rowid_t)(sqlite3*); +typedef int (*sqlite3_changes_t)(sqlite3*); +typedef int (*sqlite3_total_changes_t)(sqlite3*); +typedef void (*sqlite3_interrupt_t)(sqlite3*); +typedef int (*sqlite3_complete_t)(const char *sql); +typedef int (*sqlite3_complete16_t)(const void *sql); +typedef int (*sqlite3_busy_handler_t)(sqlite3*, int(*)(void*,int), void*); +typedef int (*sqlite3_busy_timeout_t)(sqlite3*, int ms); +typedef void (*sqlite3_free_table_t)(char **result); +typedef char *(*sqlite3_mprintf_t)(const char*,...); +typedef char *(*sqlite3_vmprintf_t)(const char*, va_list); +typedef char *(*sqlite3_snprintf_t)(int,char*,const char*, ...); +typedef void *(*sqlite3_malloc_t)(int); +typedef void *(*sqlite3_realloc_t)(void*, int); +typedef void (*sqlite3_free_t)(void*); +typedef sqlite3_int64 (*sqlite3_memory_used_t)(void); +typedef sqlite3_int64 (*sqlite3_memory_highwater_t)(int resetFlag); +typedef void *(*sqlite3_trace_t)(sqlite3*, void(*xTrace)(void*,const char*), void*); +typedef void (*sqlite3_progress_handler_t)(sqlite3*, int, int(*)(void*), void*); +typedef int (*sqlite3_errcode_t)(sqlite3 *db); +typedef const void *(*sqlite3_errmsg_t)(sqlite3*); +typedef int (*sqlite3_bind_blob_t)(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); +typedef int (*sqlite3_bind_double_t)(sqlite3_stmt*, int, double); +typedef int (*sqlite3_bind_int_t)(sqlite3_stmt*, int, int); +typedef int (*sqlite3_bind_int64_t)(sqlite3_stmt*, int, sqlite3_int64); +typedef int (*sqlite3_bind_null_t)(sqlite3_stmt*, int); +typedef int (*sqlite3_bind_text_t)(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); +typedef int (*sqlite3_bind_value_t)(sqlite3_stmt*, int, const sqlite3_value*); +typedef int (*sqlite3_bind_zeroblob_t)(sqlite3_stmt*, int, int n); +typedef int (*sqlite3_bind_parameter_count_t)(sqlite3_stmt*); +typedef const char *(*sqlite3_bind_parameter_name_t)(sqlite3_stmt*, int); +typedef int (*sqlite3_bind_parameter_index_t)(sqlite3_stmt*, const char *zName); +typedef int (*sqlite3_clear_bindings_t)(sqlite3_stmt*); +typedef int (*sqlite3_column_count_t)(sqlite3_stmt *pStmt); +typedef const void *(*sqlite3_column_name_t)(sqlite3_stmt*, int N); +typedef const char *(*sqlite3_column_database_name_t)(sqlite3_stmt*,int); +typedef const void *(*sqlite3_column_database_name16_t)(sqlite3_stmt*,int); +typedef const char *(*sqlite3_column_table_name_t)(sqlite3_stmt*,int); +typedef const void *(*sqlite3_column_table_name16_t)(sqlite3_stmt*,int); +typedef const char *(*sqlite3_column_origin_name_t)(sqlite3_stmt*,int); +typedef const void *(*sqlite3_column_origin_name16_t)(sqlite3_stmt*,int); +typedef const void *(*sqlite3_column_decltype_t)(sqlite3_stmt *, int); +typedef int (*sqlite3_step_t)(sqlite3_stmt*); +typedef int (*sqlite3_data_count_t)(sqlite3_stmt *pStmt); +typedef const void *(*sqlite3_column_blob_t)(sqlite3_stmt*, int iCol); +typedef int (*sqlite3_column_bytes_t)(sqlite3_stmt*, int iCol); +typedef double (*sqlite3_column_double_t)(sqlite3_stmt*, int iCol); +typedef int (*sqlite3_column_int_t)(sqlite3_stmt*, int iCol); +typedef sqlite3_int64 (*sqlite3_column_int64_t)(sqlite3_stmt*, int iCol); +typedef const void *(*sqlite3_column_text_t)(sqlite3_stmt*, int iCol); +typedef int (*sqlite3_column_type_t)(sqlite3_stmt*, int iCol); +typedef sqlite3_value *(*sqlite3_column_value_t)(sqlite3_stmt*, int iCol); +typedef int (*sqlite3_finalize_t)(sqlite3_stmt *pStmt); +typedef int (*sqlite3_reset_t)(sqlite3_stmt *pStmt); +typedef int (*sqlite3_aggregate_count_t)(sqlite3_context*); +typedef int (*sqlite3_expired_t)(sqlite3_stmt*); +typedef int (*sqlite3_transfer_bindings_t)(sqlite3_stmt*, sqlite3_stmt*); +typedef int (*sqlite3_global_recover_t)(void); +typedef void (*sqlite3_thread_cleanup_t)(void); +typedef const void *(*sqlite3_value_blob_t)(sqlite3_value*); +typedef int (*sqlite3_value_bytes_t)(sqlite3_value*); +typedef int (*sqlite3_value_bytes16_t)(sqlite3_value*); +typedef double (*sqlite3_value_double_t)(sqlite3_value*); +typedef int (*sqlite3_value_int_t)(sqlite3_value*); +typedef sqlite3_int64 (*sqlite3_value_int64_t)(sqlite3_value*); +typedef const unsigned char *(*sqlite3_value_text_t)(sqlite3_value*); +typedef const void *(*sqlite3_value_text16_t)(sqlite3_value*); +typedef const void *(*sqlite3_value_text16le_t)(sqlite3_value*); +typedef const void *(*sqlite3_value_text16be_t)(sqlite3_value*); +typedef int (*sqlite3_value_type_t)(sqlite3_value*); +typedef int (*sqlite3_value_numeric_type_t)(sqlite3_value*); +typedef void *(*sqlite3_aggregate_context_t)(sqlite3_context*, int nBytes); +typedef void *(*sqlite3_user_data_t)(sqlite3_context*); +typedef void *(*sqlite3_get_auxdata_t)(sqlite3_context*, int); +typedef void (*sqlite3_set_auxdata_t)(sqlite3_context*, int, void*, void (*)(void*)); +typedef void (*sqlite3_result_blob_t)(sqlite3_context*, const void*, int, void(*)(void*)); +typedef void (*sqlite3_result_double_t)(sqlite3_context*, double); +typedef void (*sqlite3_result_error_t)(sqlite3_context*, const char*, int); +typedef void (*sqlite3_result_error16_t)(sqlite3_context*, const void*, int); +typedef void (*sqlite3_result_error_toobig_t)(sqlite3_context*); +typedef void (*sqlite3_result_error_nomem_t)(sqlite3_context*); +typedef void (*sqlite3_result_int_t)(sqlite3_context*, int); +typedef void (*sqlite3_result_int64_t)(sqlite3_context*, sqlite3_int64); +typedef void (*sqlite3_result_null_t)(sqlite3_context*); +typedef void (*sqlite3_result_text_t)(sqlite3_context*, const char*, int, void(*)(void*)); +typedef void (*sqlite3_result_text16_t)(sqlite3_context*, const void*, int, void(*)(void*)); +typedef void (*sqlite3_result_text16le_t)(sqlite3_context*, const void*, int,void(*)(void*)); +typedef void (*sqlite3_result_text16be_t)(sqlite3_context*, const void*, int,void(*)(void*)); +typedef void (*sqlite3_result_value_t)(sqlite3_context*, sqlite3_value*); +typedef void (*sqlite3_result_zeroblob_t)(sqlite3_context*, int n); +typedef int (*sqlite3_sleep_t)(int); +typedef int (*sqlite3_get_autocommit_t)(sqlite3*); +typedef sqlite3 *(*sqlite3_db_handle_t)(sqlite3_stmt*); +typedef void *(*sqlite3_commit_hook_t)(sqlite3*, int(*)(void*), void*); +typedef void *(*sqlite3_rollback_hook_t)(sqlite3*, void(*)(void *), void*); +typedef int (*sqlite3_enable_shared_cache_t)(int); +typedef int (*sqlite3_release_memory_t)(int); +typedef void (*sqlite3_soft_heap_limit_t)(int); +typedef int (*sqlite3_enable_load_extension_t)(sqlite3 *db, int onoff); +typedef int (*sqlite3_auto_extension_t)(void *xEntryPoint); +typedef void (*sqlite3_reset_auto_extension_t)(void); +typedef int (*sqlite3_declare_vtab_t)(sqlite3*, const char *zCreateTable); +typedef int (*sqlite3_overload_function_t)(sqlite3*, const char *zFuncName, int nArg); +typedef int (*sqlite3_blob_close_t)(sqlite3_blob *); +typedef int (*sqlite3_blob_bytes_t)(sqlite3_blob *); +typedef int (*sqlite3_blob_read_t)(sqlite3_blob *, void *z, int n, int iOffset); +typedef int (*sqlite3_blob_write_t)(sqlite3_blob *, const void *z, int n, int iOffset); +typedef sqlite3_vfs *(*sqlite3_vfs_find_t)(const char *zVfsName); +typedef int (*sqlite3_vfs_register_t)(sqlite3_vfs*, int makeDflt); +typedef int (*sqlite3_vfs_unregister_t)(sqlite3_vfs*); +typedef sqlite3_mutex *(*sqlite3_mutex_alloc_t)(int); +typedef void (*sqlite3_mutex_free_t)(sqlite3_mutex*); +typedef void (*sqlite3_mutex_enter_t)(sqlite3_mutex*); +typedef int (*sqlite3_mutex_try_t)(sqlite3_mutex*); +typedef void (*sqlite3_mutex_leave_t)(sqlite3_mutex*); +typedef int (*sqlite3_mutex_held_t)(sqlite3_mutex*); +typedef int (*sqlite3_mutex_notheld_t)(sqlite3_mutex*); +typedef int (*sqlite3_file_control_t)(sqlite3*, const char *zDbName, int op, void*); +typedef int (*sqlite3_exec_t)( + sqlite3*, /* An open database */ + const char *sql, /* SQL to be evaluted */ + int (*callback)(void*,int,char**,char**), /* Callback function */ + void *, /* 1st argument to callback */ + char **errmsg /* Error msg written here */ +); +typedef int (*sqlite3_prepare_t)( + sqlite3 *db, /* Database handle */ + const void *zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const void **pzTail /* OUT: Pointer to unused portion of zSql */ +); +typedef int (*sqlite3_open_v2_t)(const char *filename, sqlite3 **ppDb, int flags, const char *zVfs); + +typedef sqlite3_backup *(*sqlite3_backup_init_t)( + sqlite3 *pDest, /* Destination database handle */ + const char *zDestName, /* Destination database name */ + sqlite3 *pSource, /* Source database handle */ + const char *zSourceName /* Source database name */ +); +typedef int (*sqlite3_backup_step_t)(sqlite3_backup *p, int nPage); +typedef int (*sqlite3_backup_finish_t)(sqlite3_backup *p); +typedef int (*sqlite3_backup_remaining_t)(sqlite3_backup *p); +typedef int (*sqlite3_backup_pagecount_t)(sqlite3_backup *p); + + +typedef int (*sqlite3_table_column_metadata_t)( + sqlite3 *db, /* Connection handle */ + const char *zDbName, /* Database name or NULL */ + const char *zTableName, /* Table name */ + const char *zColumnName, /* Column name */ + char const **pzDataType, /* OUTPUT: Declared data type */ + char const **pzCollSeq, /* OUTPUT: Collation sequence name */ + int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ + int *pPrimaryKey, /* OUTPUT: True if column part of PK */ + int *pAutoinc /* OUTPUT: True if column is auto-increment */ +); + +typedef void *(*sqlite3_update_hook_t)( + sqlite3*, + void(*)(void *,int ,char const *,char const *,sqlite3_int64), + void* +); + +// API declarations +class SQLAPI_API sl3API : public saAPI +{ +public: + sl3API(); + + sqlite3_open_t sqlite3_open; + sqlite3_libversion_t sqlite3_libversion; + sqlite3_libversion_number_t sqlite3_libversion_number; + sqlite3_errcode_t sqlite3_errcode; + sqlite3_errmsg_t sqlite3_errmsg; + sqlite3_close_t sqlite3_close; + sqlite3_exec_t sqlite3_exec; + sqlite3_prepare_t sqlite3_prepare; + sqlite3_bind_parameter_index_t sqlite3_bind_parameter_index; + sqlite3_column_count_t sqlite3_column_count; + sqlite3_column_name_t sqlite3_column_name; + sqlite3_column_type_t sqlite3_column_type; + sqlite3_column_bytes_t sqlite3_column_bytes; + sqlite3_step_t sqlite3_step; + sqlite3_db_handle_t sqlite3_db_handle; + sqlite3_reset_t sqlite3_reset; + sqlite3_clear_bindings_t sqlite3_clear_bindings; + sqlite3_finalize_t sqlite3_finalize; + sqlite3_interrupt_t sqlite3_interrupt; + sqlite3_changes_t sqlite3_changes; + sqlite3_column_int64_t sqlite3_column_int64; + sqlite3_column_double_t sqlite3_column_double; + sqlite3_column_blob_t sqlite3_column_blob; + sqlite3_column_text_t sqlite3_column_text; + sqlite3_bind_blob_t sqlite3_bind_blob; + sqlite3_bind_double_t sqlite3_bind_double; + sqlite3_bind_int_t sqlite3_bind_int; + sqlite3_bind_int64_t sqlite3_bind_int64; + sqlite3_bind_null_t sqlite3_bind_null; + sqlite3_bind_text_t sqlite3_bind_text; + + sqlite3_busy_handler_t sqlite3_busy_handler; + sqlite3_busy_timeout_t sqlite3_busy_timeout; + sqlite3_threadsafe_t sqlite3_threadsafe; + sqlite3_last_insert_rowid_t sqlite3_last_insert_rowid; + + sqlite3_column_decltype_t sqlite3_column_decltype; + + sqlite3_open_v2_t sqlite3_open_v2; + + sqlite3_backup_init_t sqlite3_backup_init; + sqlite3_backup_step_t sqlite3_backup_step; + sqlite3_backup_finish_t sqlite3_backup_finish; + sqlite3_backup_remaining_t sqlite3_backup_remaining; + sqlite3_backup_pagecount_t sqlite3_backup_pagecount; + + sqlite3_table_column_metadata_t sqlite3_table_column_metadata; + + sqlite3_column_value_t sqlite3_column_value; + sqlite3_value_type_t sqlite3_value_type; + + sqlite3_update_hook_t sqlite3_update_hook; + + sqlite3_enable_load_extension_t sqlite3_enable_load_extension; +}; + +class SQLAPI_API sl3ConnectionHandles : public saConnectionHandles +{ +public: + sl3ConnectionHandles(); + sqlite3 *pDb; +}; + +class SQLAPI_API sl3CommandHandles : public saCommandHandles +{ +public: + sl3CommandHandles(); + sqlite3_stmt *pStmt; +}; + +extern sl3API g_sl3API; + +#endif //__SLAPI_H__ diff --git a/libraries/SQLAPI/include/sqlbase/sql.h b/libraries/SQLAPI/include/sqlbase/sql.h new file mode 100644 index 000000000..fddfd8b83 --- /dev/null +++ b/libraries/SQLAPI/include/sqlbase/sql.h @@ -0,0 +1,1834 @@ +/* COPYRIGHT (C) GUPTA TECHNOLOGIES, LLC 1984-2004 */ +/* +INTERFACE TO + SQL +*/ +/* +REVISION HISTORY + 12/04/91 GTI release 5.0.0 + 12/08/91 GTI release 5.0.1 + 04/01/92 GTI release 5.0.2 + 08/28/92 GTI release 5.1.0 + 11/02/92 GTI release 5.1.1 + 02/12/93 GTI release 5.1.2 + 04/02/93 GTI release 5.2.0 + 05/03/93 GTI release 5.2.0 + 06/15/93 GTI release (null) + 06/15/93 GTI release 5.2.A + 06/30/93 GTI release 5.1.3 + 08/04/93 GTI release 5.1.4 + 01/19/94 GTI release 5.2.C + 03/22/94 GTI release 5.2.0 + 04/18/93 GTI release 6.0.A + 01/14/94 GTI release 6.0.B + 05/11/94 GTI release 6.0.C + 09/27/94 GTI release 6.0.0 + 04/12/95 GTI release 6.0.1 + 08/02/95 GTI release 6.1.0 + 11/14/96 GTI release 6.5.0 + 10/20/97 GTI release 7.0.0 + 10/23/98 GTI release 7.5.0 + 11/10/00 GTI release 7.6.0 + 08/22/01 RWS release 8.0.0 + 10/22/02 GTI release 8.1.0 + 12/20/02 GTI release 8.5.0 + 01/18/05 RWS release 9.0.1 +DESCRIPTION + This file contains structure definitions and defined constants used to + interface with SQLBASE. For a more complete definition see "SQLBASE: C + Programmer's Guide". +*/ + +#ifndef SQL +#define SQL + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +#ifndef SBSTDCALL +#ifdef __GNUC__ + #define SBSTDCALL /* stdcall */ +#else + #define SBSTDCALL __stdcall +#endif +#endif + +/* VERSION NUMBER */ +#define SQLVERS 90001 /* version number */ +#define SQLAPIV 00102 /* API version number since 3.6 */ +/* DEFINED CONSTANTS */ + +/*------------------------------------------------------------------------- + For 32-bit target systems, such as NetWare 386, Windows/NT, and OS/2 2.x, + redefine some 16-bit-oriented constructs, such as far, near, pascal, etc. + These redefinitions assume the compiler being used supports the flat + memory model. + ------------------------------------------------------------------------- */ + +# undef far +# undef near +# undef pascal +# undef cdecl + +# define far +# define near +# define pascal +# define cdecl +# ifndef CDECL +# define CDECL __cdecl +# endif +# define PTR * + +/* FETCH RETURN CODES */ +#define FETRTRU 1 /* data truncated */ +#define FETRSIN 2 /* signed number fetched */ +#define FETRDNN 3 /* data is not numeric */ +#define FETRNOF 4 /* numeric overflow */ +#define FETRDTN 5 /* data type not supported */ +#define FETRDND 6 /* data is not in date format */ +#define FETRNUL 7 /* data is null */ +/* DATABASE DATA TYPES */ +#define SQLDCHR 1 /* character data type */ +#define SQLDNUM 2 /* numeric data type */ +#define SQLDDAT 3 /* date-time data type */ +#define SQLDLON 4 /* long data type */ +#define SQLDDTE 5 /* date (only) data type */ +#define SQLDTIM 6 /* time (only) data type */ +#define SQLDHDL 7 /* sql handle data type */ +#define SQLDBOO 8 /* boolean data type */ +#define SQLDDTM 8 /* maximum data type */ +/* PROGRAM DATA TYPES */ +#define SQLPBUF 1 /* buffer */ +#define SQLPSTR 2 /* string (zero terminated) */ +#define SQLPUCH 3 /* unsigned char */ +#define SQLPSCH 4 /* char */ +#define SQLPUIN 5 /* unsigned int */ +#define SQLPSIN 6 /* int */ +#define SQLPULO 7 /* unsigned long */ +#define SQLPSLO 8 /* long */ +#define SQLPFLT 9 /* float */ +#define SQLPDOU 10 /* double */ +#define SQLPNUM 11 /* SQLBASE internal numeric format */ +#define SQLPDAT 12 /* SQLBASE internal datetime format */ +#define SQLPUPD 13 /* unsigned packed decimal */ +#define SQLPSPD 14 /* signed packed decimal */ +#define SQLPDTE 15 /* date only format */ +#define SQLPTIM 16 /* time only format */ +#define SQLPUSH 17 /* unsigned short */ +#define SQLPSSH 18 /* short */ +#define SQLPNST 19 /* numeric string */ +#define SQLPNBU 20 /* numeric buffer */ +#define SQLPEBC 21 /* EBCDIC buffer format */ +#define SQLPLON 22 /* long text string */ +#define SQLPLBI 23 /* long binary buffer */ +#define SQLPLVR 24 /* char\long varchar > 254 */ +#define SQLPULL 25 /* unsigned long long */ +#define SQLPSLL 26 /* long long */ +#define SQLPDTM 26 /* data type maximum */ +/* EXTERNAL DATA TYPES */ +#define SQLEINT 1 /* INTEGER */ +#define SQLESMA 2 /* SMALLINT */ +#define SQLEFLO 3 /* FLOAT */ +#define SQLECHR 4 /* CHAR */ +#define SQLEVAR 5 /* VARCHAR */ +#define SQLELON 6 /* LONGVAR */ +#define SQLEDEC 7 /* DECIMAL */ +#define SQLEDAT 8 /* DATE */ +#define SQLETIM 9 /* TIME */ +#define SQLETMS 10 /* TIMESTAMP */ +#define SQLEMON 11 /* MONEY */ +#define SQLEDOU 12 /* DOUBLE */ +#define SQLEGPH 13 /* GRAPHIC */ +#define SQLEVGP 14 /* VAR GRAPHIC */ +#define SQLELGP 15 /* LONG VAR GRAPHIC */ +#define SQLEBIN 16 /* BINARY */ +#define SQLEVBI 17 /* VAR BINARY */ +#define SQLELBI 18 /* LONG BINARY */ +#define SQLEBOO 19 /* BOOLEAN */ +#define SQLELCH 20 /* CHAR > 254 */ +#define SQLELVR 21 /* VARCHAR > 254 */ + +/* SET and GET PARAMETER TYPES */ +/* Global parameters + ------------------ */ +#define SQLPDDB 1 /* default database name */ +#define SQLPDUS 2 /* default user name */ +#define SQLPDPW 3 /* default password */ +#define SQLPGBC 4 /* global cursor value */ +#define SQLPLRD 5 /* local result set directory */ +#define SQLPDBM 6 /* db mode - see below */ +#define SQLPDBD 7 /* dbdir */ +#define SQLPCPG 8 /* code page information */ +#define SQLPNIE 9 /* null indicator error */ +#define SQLPCPT 10 /* connect pass thru to backend */ +#define SQLPTPD 11 /* temp dir */ +#define SQLPDTR 12 /* distributed transaction mode */ +#define SQLPPSW 15 /* server password */ +#define SQLPOOJ 16 /* oracle outer join */ +#define SQLPNPF 17 /* net prefix */ +#define SQLPNLG 18 /* net log */ +#define SQLPNCT 19 /* net check type */ +#define SQLPNCK 20 /* net check */ +#define SQLPLCK 22 /* locks */ +#define SQLPINT 25 /* interrupt */ +#define SQLPERF 27 /* error file */ +#define SQLPDIO 28 /* direct I/O */ +#define SQLPSWR 29 /* default write */ +#define SQLPCTY 31 /* country */ +#define SQLPCSD 32 /* commit server daemon */ +#define SQLPCSR 33 /* commit server */ +#define SQLPCCK 36 /* client check */ +#define SQLPCTS 37 /* characterset */ +#define SQLPCGR 38 /* cache group */ +#define SQLPAIO 39 /* asyncio */ +#define SQLPANL 40 /* apply net log */ +#define SQLPGRS 41 /* get reentracy state */ +#define SQLPSTF 42 /* set SQLTrace flags */ +#define SQLPCLG 43 /* set commit-order logging */ + +/* Server specific parameters + -------------------------- */ + +#define SQLPHEP 1001 /* HEAP size for TSR executables */ +#define SQLPCAC 1002 /* CACHE size in Kbytes */ +#define SQLPBRN 1003 /* brand of database */ +#define SQLPVER 1004 /* release version (ex. "4.0.J") */ +#define SQLPPRF 1005 /* server profiling */ +#define SQLPPDB 1006 /* partitioned database */ +#define SQLPGCM 1007 /* group commit count */ +#define SQLPGCD 1008 /* group commit delay ticks */ +#define SQLPDLK 1009 /* number of deadlocks */ +#define SQLPCTL 1010 /* command time limit */ +#define SQLPAPT 1011 /* process timer activated */ +#define SQLPOSR 1012 /* OS sample rate */ +#define SQLPAWS 1013 /* OS Averaging window size */ +#define SQLPWKL 1014 /* Work Limit */ +#define SQLPWKA 1015 /* Work Space allocation */ +#define SQLPUSR 1016 /* Number of users */ +#define SQLPTMO 1017 /* time out */ +#define SQLPTSS 1018 /* thread stack size */ +#define SQLPTHM 1019 /* thread mode */ +#define SQLPSTC 1020 /* sortcache size in kilobytes */ +#define SQLPSIL 1021 /* silent mode */ +#define SQLPSPF 1022 /* server prefix */ +#define SQLPSVN 1024 /* server name */ +#define SQLPROM 1025 /* read-only mode (0 or 1) */ +#define SQLPSTA 1026 /* enable stats gathering */ +#define SQLPCSV 1027 /* commit server */ +#define SQLPTTP 1028 /* trace for 2PC */ +#define SQLPAJS 1029 /* ANSI join syntax */ +#define SQLPSDIR 1030 /* server module directory */ +#define SQLPSINI 1031 /* server ini file full path name */ +#define SQLPBLD 1032 /* server build number */ + +/* Database specific parameters + ---------------------------- */ + +#define SQLPDBN 2001 /* database name */ +#define SQLPDDR 2002 /* database directory */ +#define SQLPLDR 2003 /* log directory */ +#define SQLPLFS 2004 /* log file size in Kbytes */ +#define SQLPCTI 2005 /* checkpoint time interval in mins */ +#define SQLPLBM 2006 /* log backup mode? (0 or 1) */ +#define SQLPPLF 2007 /* Pre-allocate log files? (0 or 1) */ +#define SQLPTSL 2008 /* transaction span limit */ +#define SQLPROT 2009 /* read-only transactions (0, 1, 2) */ +#define SQLPHFS 2010 /* history file size in Kbytes */ +#define SQLPREC 2011 /* recovery */ +#define SQLPEXE 2012 /* name of executable */ +#define SQLPNLB 2013 /* next log to backup */ +#define SQLPROD 2014 /* read-only database (0 or 1) */ +#define SQLPEXS 2015 /* database file extension size */ +#define SQLPPAR 2016 /* partitioned database (0 or 1) */ +#define SQLPNDB 2017 /* NEWDB */ +#define SQLPLGF 2018 /* log file offset */ +#define SQLPDTL 2019 /* command timelimit */ +#define SQLPSMN 2020 /* show main db */ +#define SQLPCVC 2021 /* catalog version counter */ +#define SQLPDBS 2022 /* database block size */ +#define SQLPUED 2023 /* update external dictionary */ +#define SQLPCINI 2024 /* client ini file full path name */ + +/* Cursor specific parameters + -------------------------- */ + +#define SQLPISO 3001 /* isolation level (SQLILRR etc..) */ +#define SQLPWTO 3002 /* lock wait timeout in seconds */ +#define SQLPPCX 3003 /* preserve context (0 or 1) */ +#define SQLPFRS 3004 /* front end result sets */ +#define SQLPLDV 3005 /* load version (ex. "3.6.22") */ +#define SQLPAUT 3006 /* autocommit */ +#define SQLPRTO 3007 /* rollback trans on lock timeout */ +#define SQLPSCR 3008 /* scroll mode (0 or 1) */ +#define SQLPRES 3009 /* restriction mode (0 or 1) */ +#define SQLPFT 3010 /* fetch through */ +#define SQLPNPB 3011 /* no pre-build in RL mode */ +#define SQLPPWD 3012 /* current password */ +#define SQLPDB2 3013 /* DB2 compatibility mode */ +#define SQLPREF 3014 /* referential integrity checking */ +#define SQLPBLK 3015 /* bulk-execute mode */ +#define SQLPOBL 3016 /* optimized bulk-execute mode */ +#define SQLPLFF 3017 /* LONG data allowed in FERS */ +#define SQLPDIS 3018 /* When to return Describe info */ +#define SQLPCMP 3019 /* Compress messages sent to server */ +#define SQLPCHS 3020 /* chained cmd has SELECT (0 or 1) */ +#define SQLPOPL 3021 /* optimizer level */ +#define SQLPRID 3022 /* ROWID */ +#define SQLPEMT 3023 /* Error Message Tokens */ +#define SQLPCLN 3024 /* client name */ +#define SQLPLSS 3025 /* last compiled SQL statement */ +#define SQLPEXP 3026 /* explain query plan */ +#define SQLPCXP 3027 /* cost of execution plan */ +#define SQLPOCL 3028 /* optimizercostlevel */ +#define SQLPTST 3029 /* distributed transaction status */ +#define SQLP2PP 3030 /* 2-phase protocol (SQL2STD, etc.) */ +/* defined for Load/Unload parsed parameters - cursor specific */ +#define SQLPCLI 3031 /* ON CLIENT option */ +#define SQLPFNM 3032 /* load/unload file name */ +#define SQLPOVR 3033 /* file OVERWRITE flag */ +#define SQLPTFN 3034 /* A Temporary file name */ +#define SQLPTRC 3035 /* Trace stored procedures */ +#define SQLPTRF 3036 /* Tracefile for stored procedures */ +#define SQLPCTF 3037 /* control file flag */ + +#define SQLPMID 3038 /* mail id */ +#define SQLPAID 3039 /* adapter id */ +#define SQLPNID 3040 /* network id */ +#define SQLPUID 3041 /* user application id */ +#define SQLPCIS 3042 /* client identification strings */ +#define SQLPIMB 3043 /* input message buffer size */ +#define SQLPOMB 3044 /* output message buffer size */ +#define SQLPWFC 3045 /* which fetchable command */ +#define SQLPRFE 3046 /* Return on First Error-bulk insert */ +#define SQLPCUN 3047 /* Current cursor user name */ +#define SQLPOFF 3048 /* Optimize First Fetch */ +#define SQLPUSC 3049 /* Use Specified Cursor for ref */ +#define SQLPPDG 3050 /* Plan Debug */ + +/* Application Specific ie. applicable to all cursors that + belong to the same application (3700 - 3799) */ + +#define SQLPCCB 3700 /* Connect Closure Behaviour */ +#define SQLPTTV 3701 /* Thread Timeout Value */ + +/* Static attributes + -------------------------- */ + +#define SQLPFAT 4000 /* first attribute */ +#define SQLPBRS 4001 /* back end result sets */ +#define SQLPMUL 4002 /* multi-user */ +#define SQLPDMO 4003 /* demonstration version */ +#define SQLPLOC 4004 /* local version of database */ +#define SQLPFPT 4005 /* 1st participant */ +#define SQLPLAT 4006 /* last attribute */ +#define SQLPCAP 4007 /* API capability level */ +#define SQLPSCL 4008 /* server capability level */ +#define SQLPRUN 4009 /* runtime version */ + +/* Server specific parameters + ---------------------------- */ + +#define SQLPPLV 5001 /* print level */ +#define SQLPALG 5002 /* activity log */ +#define SQLPTMS 5003 /* time stamp */ +#define SQLPPTH 5004 /* path name seperator */ +#define SQLPTMZ 5005 /* time zone */ +#define SQLPTCO 5006 /* time colon only */ + +/* SQL Server & Router/Gateway specific parameters + ------------------------------ */ +#define SQLPESTR 5101 /* get server error # and string */ +#define SQLPMSTR 5102 /* get server msg# and string */ +#define SQLPMAPC 5103 /* MapGTICursors */ +#define SQLPUPRE 5104 /* get user prefix */ +#define SQLPORID 5105 /* Oracle RowID */ +#define SQLPERRM 5106 /* error mapping */ +#define SQLPRTS 5107 /* SQL Server - Return Status */ +#define SQLPSAUT 5108 /* SQL Server - Autocommit */ +#define SQLPROW 5109 /* SQL Server - Command Type */ +#define SQLPEHC 5110 /* SQL Server - Enhanced Cursors */ +#define SQLPGFS 5111 /* SQL Server - Get Fetch Status */ +#define SQLPLBUF 5112 /* Longbuffer setting */ +#define SQLPDPH 5113 /* SQL Server - DBProcess handle */ +#define SQLPCKE 5114 /* SQL Server - CHECK EXISTS */ +#define SQLPWTX 5115 /* SQL Server - DBWRITETEXT */ +#define SQLPYLD 5116 /* SQL Server - YieldOnServerCall */ +#define SQLPOBN 5117 /* ODBC Router - backend brand */ +#define SQLPOBV 5118 /* ODBC Router - backend version */ +#define SQLPODN 5119 /* ODBC Router - driver name */ +#define SQLPODV 5120 /* ODBC Router - driver version */ +#define SQLPOCV 5121 /* ODBC Router - ODBC version */ +#define SQLPRSYS 5122 /* DRDA - EXEC SQL CONNECT TO remote system name */ +#define SQLPLAB 5123 /* DB2 - return label information if exists */ +#define SQLPCID 5124 /* DB2 - Set Current SQLID default */ +#define SQLPNUMST 5125 /* AS/400 Number of Statements */ +#define SQLPBNDRW 5126 /* Oracle- bind SQLPBUF as RAW */ +#define SQLPNLS 5127 /* Informix - NLS database */ + +#define SQLPFRW 5200 /* fetchrow */ +#define SQLPBRW 5201 /* buffrow */ + +/* Sybase System 10 parameters (reserved 5220 - 5250) + ------------------------------------------------------------ */ + +#define SQLPNESTR 5220 /* SYB - get next error from client */ +#define SQLPNMSTR 5221 /* SYB - get next error from server */ +#define SQLPCESTR 5222 /* SYB - get client message count */ +#define SQLPCMSTR 5223 /* SYB - get server message count */ +#define SQLPTXT 5224 /* SYB - allow bind for text, image */ +#define SQLPEMC 5225 /* SYB - enable multiple connections */ + +/* ODBC specific parameters - Refer to ODBC spec for definition + ------------------------------------------------------------ */ + +#define SQLP_ACTIVE_CONNECTIONS 5500 +#define SQLP_ACTIVE_STATEMENTS 5501 +#define SQLP_DATA_SOURCE_NAME 5502 +#define SQLP_DRIVER_HDBC 5503 +#define SQLP_DRIVER_HENV 5504 +#define SQLP_DRIVER_HSTMT 5505 +#define SQLP_DRIVER_NAME 5506 +#define SQLP_DRIVER_VER 5507 +#define SQLP_FETCH_DIRECTION 5508 +#define SQLP_ODBC_API_CONFORMANCE 5509 +#define SQLP_ODBC_VER 5510 +#define SQLP_ROW_UPDATES 5511 +#define SQLP_ODBC_SAG_CLI_CONFORMANCE 5512 +#define SQLP_SERVER_NAME 5513 +#define SQLP_SEARCH_PATTERN_ESCAPE 5514 +#define SQLP_ODBC_SQL_CONFORMANCE 5515 +#define SQLP_DATABASE_NAME 5516 +#define SQLP_DBMS_NAME 5517 +#define SQLP_DBMS_VER 5518 +#define SQLP_ACCESSIBLE_TABLES 5519 +#define SQLP_ACCESSIBLE_PROCEDURES 5520 +#define SQLP_PROCEDURES 5521 +#define SQLP_CONCAT_NULL_BEHAVIOUR 5522 +#define SQLP_CURSOR_COMMIT_BEHAVIOUR 5523 +#define SQLP_CURSOR_ROLLBACK_BEHAVIOUR 5524 +#define SQLP_DATA_SOURCE_READ_ONLY 5525 +#define SQLP_DEFAULT_TXN_ISOLATION 5526 +#define SQLP_EXPRESSIONS_IN_ORDERBY 5527 +#define SQLP_IDENTIFIER_CASE 5528 +#define SQLP_IDENTIFIER_QUOTE_CHAR 5529 +#define SQLP_MAX_COLUMN_NAME_LEN 5530 +#define SQLP_MAX_CURSOR_NAME_LEN 5531 +#define SQLP_MAX_OWNER_NAME_LEN 5532 +#define SQLP_MAX_PROCEDURE_NAME_LEN 5533 +#define SQLP_MAX_QUALIFIER_NAME_LEN 5534 +#define SQLP_MAX_TABLE_NAME_LEN 5535 +#define SQLP_MULT_RESULT_SETS 5536 +#define SQLP_MULTIPLE_ACTIVE_TXN 5537 +#define SQLP_OUTER_JOINS 5538 +#define SQLP_OWNER_TERM 5539 +#define SQLP_PROCEDURE_TERM 5540 +#define SQLP_QUALIFIER_NAME_SEPARATOR 5541 +#define SQLP_QUALIFIER_TERM 5542 +#define SQLP_SCROLL_CONCURRENCY 5543 +#define SQLP_SCROLL_OPTIONS 5544 +#define SQLP_TABLE_TERM 5545 +#define SQLP_TXN_CAPABLE 5546 +#define SQLP_USER_NAME 5547 +#define SQLP_CONVERT_FUNCTIONS 5548 +#define SQLP_NUMERIC_FUNCTIONS 5549 +#define SQLP_STRING_FUNCTIONS 5550 +#define SQLP_SYSTEM_FUNCTIONS 5551 +#define SQLP_TIMEDATE_FUNCTIONS 5552 +#define SQLP_CONVERT_BIGINT 5553 +#define SQLP_CONVERT_BINARY 5554 +#define SQLP_CONVERT_BIT 5555 +#define SQLP_CONVERT_CHAR 5556 +#define SQLP_CONVERT_DATE 5557 +#define SQLP_CONVERT_DECIMAL 5558 +#define SQLP_CONVERT_DOUBLE 5559 +#define SQLP_CONVERT_FLOAT 5560 +#define SQLP_CONVERT_INTEGER 5561 +#define SQLP_CONVERT_LONGVARCHAR 5562 +#define SQLP_CONVERT_NUMERIC 5563 +#define SQLP_CONVERT_REAL 5564 +#define SQLP_CONVERT_SMALLINT 5565 +#define SQLP_CONVERT_TIME 5566 +#define SQLP_CONVERT_TIMESTAMP 5567 +#define SQLP_CONVERT_TINYINT 5568 +#define SQLP_CONVERT_VARBINARY 5569 +#define SQLP_CONVERT_VARCHAR 5570 +#define SQLP_CONVERT_LONGVARBINARY 5571 +#define SQLP_TXN_ISOLATION_OPTION 5572 +#define SQLP_ODBC_SQL_OPT_IEF 5573 + +/*** ODBC SDK 1.0 Additions ***/ +#define SQLP_CORRELATION_NAME 5574 +#define SQLP_NON_NULLABLE_COLUMNS 5575 + +/*** ODBC SDK 2.0 Additions ***/ +#define SQLP_DRIVER_HLIB 5576 +#define SQLP_DRIVER_ODBC_VER 5577 +#define SQLP_LOCK_TYPES 5578 +#define SQLP_POS_OPERATIONS 5579 +#define SQLP_POSITIONED_STATEMENTS 5580 +#define SQLP_GETDATA_EXTENSIONS 5581 +#define SQLP_BOOKMARK_PERSISTENCE 5582 +#define SQLP_STATIC_SENSITIVITY 5583 +#define SQLP_FILE_USAGE 5584 +#define SQLP_NULL_COLLATION 5585 +#define SQLP_ALTER_TABLE 5586 +#define SQLP_COLUMN_ALIAS 5587 +#define SQLP_GROUP_BY 5588 +#define SQLP_KEYWORDS 5589 +#define SQLP_ORDER_BY_COLUMNS_IN_SELECT 5590 +#define SQLP_OWNER_USAGE 5591 +#define SQLP_QUALIFIER_USAGE 5592 +#define SQLP_QUOTED_IDENTIFIER_CASE 5593 +#define SQLP_SPECIAL_CHARACTERS 5594 +#define SQLP_SUBQUERIES 5595 +#define SQLP_UNION 5596 +#define SQLP_MAX_COLUMNS_IN_GROUP_BY 5597 +#define SQLP_MAX_COLUMNS_IN_INDEX 5598 +#define SQLP_MAX_COLUMNS_IN_ORDER_BY 5599 +#define SQLP_MAX_COLUMNS_IN_SELECT 5600 +#define SQLP_MAX_COLUMNS_IN_TABLE 5601 +#define SQLP_MAX_INDEX_SIZE 5602 +#define SQLP_MAX_ROW_SIZE_INCLUDES_LONG 5603 +#define SQLP_MAX_ROW_SIZE 5604 +#define SQLP_MAX_STATEMENT_LEN 5605 +#define SQLP_MAX_TABLES_IN_SELECT 5606 +#define SQLP_MAX_USER_NAME_LEN 5607 +#define SQLP_MAX_CHAR_LITERAL_LEN 5608 +#define SQLP_TIMEDATE_ADD_INTERVALS 5609 +#define SQLP_TIMEDATE_DIFF_INTERVALS 5610 +#define SQLP_NEED_LONG_DATA_LEN 5611 +#define SQLP_MAX_BINARY_LITERAL_LEN 5612 +#define SQLP_LIKE_ESCAPE_CLAUSE 5613 +#define SQLP_QUALIFIER_LOCATION 5614 + +#define SQLP_GET_TYPE_INFO 5699 + + +/* The following parmeters in the range 6000 - 7000 are reserved for + SQLBase INTERNAL use. +*/ + +#define SQLP000 6000 /* for internal use only */ +#define SQLP999 6999 /* for internal use only */ +#define SQLPITP 0x4000 /* INTERNAL USE ONLY */ +#define SQLPITC 0x8000 /* INTERNAL USE ONLY */ + +/* end of SET and GET PARAMETER TYPES */ + + +/* defines for ON, OFF, DEFAULT parameter values */ + +#define SQLVOFF 0 /* parameter should be OFF */ +#define SQLVON 1 /* parameter should be ON */ +#define SQLVDFL 2 /* parameter should default */ + +/* defines for SQLPDBM (db mode) */ + +#define SQLMDBL 1 /* DB Local */ +#define SQLMRTR 2 /* DB Router */ +#define SQLMCOM 3 /* DB Combo */ + +/* defines for database brands */ + +#define SQLBSQB 1 /* SQLBASE */ +#define SQLBDB2 2 /* DB2 */ +#define SQLBDBM 3 /* IBM OS/2 Database Manager */ +#define SQLBORA 4 /* Oracle */ +#define SQLBIGW 5 /* Informix */ +#define SQLBNTW 6 /* Netware SQL */ +#define SQLBAS4 7 /* IBM AS/400 SQL/400 */ +#define SQLBSYB 8 /* Sybase SQL Server */ +#define SQLBDBC 9 /* Teradata DBC Machines */ +#define SQLBALB 10 /* HP Allbase */ +#define SQLBRDB 11 /* DEC's RDB */ +#define SQLBTDM 12 /* Tandem's Nonstop SQL */ +#define SQLBSDS 13 /* IBM SQL/DS */ +#define SQLBSES 14 /* SNI SESAM */ +#define SQLBING 15 /* Ingres */ +#define SQLBSQL 16 /* SQL Access */ +#define SQLBDBA 17 /* DBase */ +#define SQLBDB4 18 /* SNI DDB4 */ +#define SQLBFUJ 19 /* Fujitsu RDBII */ +#define SQLBSUP 20 /* Cincom SUPRA */ +#define SQLB204 21 /* CCA Model 204 */ +#define SQLBDAL 22 /* Apple DAL interface */ +#define SQLBSHR 23 /* Teradata ShareBase */ +#define SQLBIOL 24 /* Informix On-Line */ +#define SQLBEDA 25 /* EDA/SQL */ +#define SQLBUDS 26 /* SNI UDS */ +#define SQLBMIM 27 /* Nocom Mimer */ +#define SQLBOR7 28 /* Oracle version 7 */ +#define SQLBIOS 29 /* Ingres OpenSQL */ +#define SQLBIOD 30 /* Ingres OpenSQL with date support */ +#define SQLBODB 31 /* ODBC Router */ +#define SQLBS10 32 /* SYBASE System 10 */ +#define SQLBSE6 33 /* Informix SE version 6 */ +#define SQLBOL6 34 /* Informix On-Line version 6 */ +#define SQLBNSE 35 /* Informix SE NLS version 6 */ +#define SQLBNOL 36 /* Informix On-Line NLS version 6 */ +#define SQLBSE7 37 /* Informix SE version 7 */ +#define SQLBOL7 38 /* Informix On-Line version 7 */ +#define SQLBETA 39 /* Entire Access, ADABAS */ +#define SQLBI12 40 /* Ingres CA-OpenIngres 1.2 */ +#define SQLBAPP 99 /* SQLHost App Services */ + +/* SIZES */ +#define SQLSNUM 12 /* numeric program buffer size */ +#define SQLSDAT 12 /* date-time program buffer size */ +#define SQLSCDA 26 /* character date-time size */ +#define SQLSDTE SQLSDAT /* date (only) program buffer size */ +#define SQLSCDE 10 /* character date (only) size */ +#define SQLSRID 40 /* size of ROWID */ +#define SQLSTIM SQLSDAT /* time (only) program buffer size */ +#define SQLSCTI 15 /* character time (only) size */ +#define SQLSFEM 100L /* file extension size (multi-user) */ +#define SQLSFES 20L /* file extension size (single-user) */ +#define SQLSTEX 5L /* table extent size */ + + +/* Two-phase Commit Protocols */ + +typedef int SQLT2PP; /* type: 2-phase commit protocol */ + +#define SQL2MIN SQL2STD /* minimum protocol value */ + +#define SQL2STD ((SQLT2PP) 1) /* standard 2pc protocol */ +#define SQL2PRA ((SQLT2PP) 2) /* presumed-abort 2pc protocol */ +#define SQL2PRC ((SQLT2PP) 3) /* presumed-commit 2pc protocol */ +#define SQL2DEF SQL2STD /* default is standard */ + +#define SQL2MAX SQL2PRC /* maximum protocol value */ + +/* Two-phase Commit Votes */ + +typedef int SQLT2PV; /* type: 2-phase commit vote */ + +#define SQLVMIN SQLVCMT /* minimum vote value */ + +#define SQLVCMT ((SQLT2PV) 1) /* Vote Commit */ +#define SQLVRBK ((SQLT2PV) 2) /* Vote Rollback */ +#define SQLVRO ((SQLT2PV) 3) /* Vote ReadOnly */ + +#define SQLVMAX SQLVRO /* maximum vote value */ + +/* defines for distributed transaction status */ + +typedef int SQLTTST; /* distributed transaction state */ + +#define SQLSCMT ((SQLTTST) 1) /* transaction state = COMMITted */ +#define SQLSRBK ((SQLTTST) 2) /* transaction state = ROLLBACKed */ +#define SQLSUNK ((SQLTTST) 3) /* transaction state = UNKNOWN */ + + +/* NULL POINTER */ +#define SQLNPTR (ubyte1 PTR)0 /* null pointer */ +/* RESULT COMMAND TYPES */ +#define SQLTSEL 1 /* select */ +#define SQLTINS 2 /* insert */ +#define SQLTCTB 3 /* create table */ +#define SQLTUPD 4 /* update */ +#define SQLTDEL 5 /* delete */ +#define SQLTCIN 6 /* create index */ +#define SQLTDIN 7 /* drop index */ +#define SQLTDTB 8 /* drop table */ +#define SQLTCMT 9 /* commit */ +#define SQLTRBK 10 /* rollback */ +#define SQLTACO 11 /* add column */ +#define SQLTDCO 12 /* drop column */ +#define SQLTRTB 13 /* rename table */ +#define SQLTRCO 14 /* rename column */ +#define SQLTMCO 15 /* modify column */ +#define SQLTGRP 16 /* grant privilege on table */ +#define SQLTGRD 17 /* grant dba */ +#define SQLTGRC 18 /* grant connect */ +#define SQLTGRR 19 /* grant resource */ +#define SQLTREP 20 /* revoke privilege on table */ +#define SQLTRED 21 /* revoke dba */ +#define SQLTREC 22 /* revoke connect */ +#define SQLTRER 23 /* revoke resource */ +#define SQLTCOM 24 /* comment on */ +#define SQLTWAI 25 /* wait */ +#define SQLTPOS 26 /* post */ +#define SQLTCSY 27 /* create synonym */ +#define SQLTDSY 28 /* drop synonym */ +#define SQLTCVW 29 /* create view */ +#define SQLTDVW 30 /* drop view */ +#define SQLTRCT 31 /* row count */ +#define SQLTAPW 32 /* alter password */ +#define SQLTLAB 33 /* label on */ +#define SQLTCHN 34 /* chained command */ +#define SQLTRPT 35 /* repair table */ +#define SQLTSVP 36 /* savepoint */ +#define SQLTRBS 37 /* rollback to savepoint */ +#define SQLTUDS 38 /* update statistics */ +#define SQLTCDB 39 /* check database */ +#define SQLTFRN 40 /* foreign DBMS commands */ +#define SQLTAPK 41 /* add primary key */ +#define SQLTAFK 42 /* add foreign key */ +#define SQLTDPK 43 /* drop primary key */ +#define SQLTDFK 44 /* drop foreign key */ +/* SERVER COMMAND TYPES */ +#define SQLTCDA 45 /* create dbarea */ +#define SQLTADA 46 /* alter dbarea */ +#define SQLTDDA 47 /* delete dbarea */ +#define SQLTCSG 48 /* create stogroup */ +#define SQLTASG 49 /* alter stogroup */ +#define SQLTDSG 50 /* delete stogroup */ +#define SQLTCRD 51 /* create database */ +#define SQLTADB 52 /* alter database */ +#define SQLTDDB 53 /* delete database */ +#define SQLTSDS 54 /* set default stogroup */ +#define SQLTIND 55 /* install database */ +#define SQLTDED 56 /* de-install database */ +/* END OF SERVER COMMAND TYPES */ + +#define SQLTARU 57 /* add RI user error */ +#define SQLTDRU 58 /* drop RI user error */ +#define SQLTMRU 59 /* modify RI user error */ +#define SQLTSCL 60 /* set client */ +#define SQLTCKT 61 /* check table */ +#define SQLTCKI 62 /* check index */ +#define SQLTOPL 63 /* PL/SQL Stored Procedure */ +#define SQLTBGT 64 /* BEGIN TRANSACTION */ +#define SQLTPRT 65 /* PREPARE TRANSACTION */ +#define SQLTCXN 66 /* COMMIT TRANSACTION */ +#define SQLTRXN 67 /* ROLLBACK TRANSACTION */ +#define SQLTENT 68 /* END TRANSACTION */ + +/* COMMIT SERVER COMMAND TYPES */ +#define SQLTCBT 69 /* begin transaction */ +#define SQLTCCT 70 /* commit transaction */ +#define SQLTCET 71 /* end transaction */ +#define SQLTCPT 72 /* prepare transaction */ +#define SQLTCRT 73 /* rollback transaction */ +#define SQLTCST 74 /* status transaction */ +#define SQLTCRX 75 /* reduce transaction */ +#define SQLTCSD 76 /* start daemon */ +#define SQLTCTD 77 /* stop daemon */ +#define SQLTCRA 78 /* resolve all transactions */ +#define SQLTCRO 79 /* resolve one transaction */ +#define SQLTCOT 80 /* orphan a transaction */ +#define SQLTCFL 81 /* CREATE FAILURE */ +#define SQLTDFL 82 /* DELETE FAILURE */ +#define SQLTSTN 83 /* SET TRACETWOPC ON */ +#define SQLTSTF 84 /* SET TRACETWOPC OFF */ +#define SQLTUNL 85 /* Unload command */ +#define SQLTLDP 86 /* load command */ +#define SQLTPRO 87 /* stored procedure */ +#define SQLTGEP 88 /* grant execute privilege */ +#define SQLTREE 89 /* revoke execute privilege */ +#define SQLTTGC 90 /* create trigger */ +#define SQLTTGD 91 /* drop trigger */ +#define SQLTVNC 92 /* create event */ +#define SQLTVND 93 /* drop event */ +#define SQLTSTR 94 /* start audit */ +#define SQLTAUD 95 /* audit message */ +#define SQLTSTP 96 /* stop audit */ +#define SQLTACM 97 /* Alter CoMmand */ +#define SQLTXDL 98 /* lock database */ +#define SQLTXDU 99 /* unlock database */ +#define SQLTCEF 100 /* create external function */ +#define SQLTDEF 101 /* drop external function */ +#define SQLTDBT 102 /* DBATTRIBUTE */ +#define SQLTATG 103 /* ALTER TRIGGER */ +#define SQLTAEF 104 /* alter external function */ +#define SQLTADS 105 /* alter database security */ +#define SQLTAEK 106 /* alter exportkey */ +#define SQLTASP 107 /* alter server */ + +/* DEFAULTS */ +#define SQLDCGP 30 /* CACHEGROUP, cache page allocation group */ +#define SQLDCRT 5 /* CONNECTRETRY, seconds for connect timeout */ +#define SQLDCPT 10 /* CONNECTPAUSETICKS, ticks for pausing */ +#define SQLDDGH 10000l /* HEAP, DBGATEWY heap size */ +#define SQLDDLH 145000l /* HEAP, DBLOCAL heap size */ +#define SQLDDRH 20000l /* HEAP, DBROUTER heap size */ +#define SQLDNTN 71 /* INTERRUPT, interrupt number */ +#define SQLDNBS 30000 /* NETBUFFER, size DBXROUTR network buffer */ +#define SQLDRET 3 /* RETRY, number of connect retries */ +#define SQLDSVS 0X8000 /* STACKSIZE, DBSERVER stack */ +#define SQLDSMS 0X8000 /* STACKSIZE, DBSIM stack */ +#define SQLDSRS 7000 /* STACKSIZE, DBSIM w/router stack */ +#define SQLDTMZ 0l /* TIMEZONE */ +#define SQLDSVU 128 /* USERS, DBSERVER users */ +#define SQLDSMU 3 /* USERS, DBSIM users */ +#define SQLDCLI 1024000L /* checkpoint log interval in bytes */ +#define SQLDCTI 1 /* checkpt time interval in minutes */ +#define SQLDWSA 1000 /* cursor work space allocation */ +#define SQLDPRE 5 /* decimal precision */ +#define SQLDSCA 0 /* decimal scale */ +#define SQLDIML 2000 /* input message buffer length */ +#define SQLDPRI 10 /* integer precision */ +#define SQLDSUL 6 /* length of system user name */ +#define SQLDLBS 20480 /* log buffer size in bytes */ +#define SQLDLFS 1024000L /* log file size in bytes */ +#define SQLDSLS 15 /* maximum # of large server stacks */ +#define SQLDHFS 1000 /* maximum history file size */ +#define SQLDLPM 20000 /* maximum number of rollback log pages */ +#define SQLDNES 100 /* normal file extension size */ +#define SQLDOML 1000 /* output message buffer length */ +#define SQLDPES 1024 /* partitioned file extension size */ +#define SQLDPUB "PUBLIC" /* public user name */ +#define SQLDLPT 16000 /* rollback log page threshold */ +#define SQLDPRS 5 /* smallint precision */ +#define SQLDRTO 5 /* default response time out */ +#define SQLDSUN "SYSADM" /* system default username */ +#define SQLDESC "$$" /* connect escape sequence */ +#define SQLDSUN "SYSADM" /* system default username */ +#define SQLDNTG 16 /* number of triggers allowed per event/time/scope */ + /* Maximum triggers for an event is * 4 */ + +/* MAXIMUM SIZES */ +#define SQLMSBNL 18 /* short bind name length */ +#define SQLMBNL 36 /* bind name length */ +#define SQLMLBNL 64 /* long bind name length */ +#define SQLMBSL 32000 /* max length Backend string literal */ +#define SQLMCG1 32767 /* cache group pages */ +#define SQLMCKF 16 /* concatenated key fields */ +#define SQLMCLL 255 /* clientlimit */ +#define SQLMCLN 12 /* maximum client name size */ +#define SQLMCLP 128 /* commmand line parameter length */ +#define SQLMCMT 106 /* max command types */ +#define SQLMCNM SQLMBNL /* max referential constraint name */ +#define SQLMCOH 255 /* column heading string */ +#define SQLMCST 400 /* max connect string length */ +#define SQLMDBA 10 /* number of databases accessed */ +#define SQLMDFN 25 /* database file name */ +#define SQLMPSS 25 /* process status string */ +#define SQLMDMO 750 /* maximum DB size for demos (Kbytes) */ +#define SQLMSDNM 8 /* database name CAM_1..4_VERSION */ +#define SQLMDNM 16 /* database name */ +#define SQLMDVL 254 /* data value length */ +#define SQLMERR 255 /* error message length */ +#define SQLMETX 3000 /* error text length */ +/* ------------------------------------------------------------------------- * + * We are reverting back to the previous value of 128 for SQLMFNL because it * + * is resulting in unnecessary complications in the cdm, aic size etc. * + * ------------------------------------------------------------------------- */ +#define SQLMFNL 128 /* filename length */ + +/* ------------------------------------------------------------------------- * + * Note : We are defining a new constant called SQLRFNL which is used to * + * create a filename of restricted length (128) instead of SQLMFNL. It is * + * required because the areas table created by main.ini uses a pathname of * + * 128 bytes * + * ------------------------------------------------------------------------- */ +#define SQLRFNL 128 +#define SQLMFQN 3 /* number of fields in fully qualified column name */ +#define SQLMFRD 40 /* maximum size of foreign result set directory */ +#define SQLMGCM 32767 /* maximum group commit count */ +#define SQLMICO 255 /* installed cache page owners */ +#define SQLMICU 255 /* installed cursors */ +#define SQLMIDB 255 /* installed databases */ +#define SQLMILK 32767 /* installed locks */ +#define SQLMINL 2000 /* input length */ +#define SQLMIPG 1000000 /* installed pages */ +#define SQLMIPR 800 /* installed processes */ +#define SQLMITR 800 /* installed transactions */ +#define SQLMJTB 17 /* joined tables */ +#define SQLMTAC 17*16 /* tables each tab can have subsel */ +#define SQLMLID 32 /* long identifiers */ +#define SQLMNBF 60000 /* network buffer size */ +#define SQLMNCO 254 /* number of columns per row */ +#define SQLMUCO 253 /* number of user columns available */ +#define SQLMNPF 3 /* NETPREFIX size */ +#define SQLMOUL 1000 /* output length */ +#define SQLMPAL 255 /* max path string length */ +#define SQLMSVP 1024 /* max serverpath (inside ini client section) string length */ +#define SQLMPFS 21 /* max platform string length */ +#define SQLMPKL 254 /* max primary key length */ +#define SQLMPRE 15 /* maximum decimal precision */ +#define SQLMPTL 4 /* maximum print level */ +#define SQLMPWD 128 /* maximum password length */ +#define SQLMCTL 43200 /* max query timelimit (12 hours) */ +#define SQLMRBB 8192 /* maximum rollback log buffer */ +#define SQLMRCB 20480 /* maximum recovery log buffer */ +#define SQLMRET 1000 /* retry count */ +#define SQLMRFH 4 /* maximum # remote file handles */ +#define SQLMROB 8192 /* max size of restore output buffer */ +#define SQLMSES 16 /* number of sessions */ +#define SQLMSID 8 /* short identifiers */ +#define SQLMSLI 255 /* max number of select list exprs. */ +#define SQLMSNM 8 /* server name */ +#define SQLMSRL 32 /* max length of SQL reserved word */ +#define SQLMSVN 199 /* maximum server names */ +#define SQLMTFS 10 /* maximum temporary file size */ +#define SQLMTMO 200 /* maximum timeout */ +#define SQLMTSS 256 /* text string space size */ +#define SQLMUSR 128 /* maximum username length */ +#define SQLMVER 8 /* max version string (nn.nn.nn) */ +#define SQLMXER 255 /* Extended error message length */ +#define SQLMXFS 2147483648UL /* max file size in bytes */ +#define SQLMXLF 2097152 /* max log file size in KB */ +#define SQLMTHM 2 /* maximum thread mode value */ +#define SQLMPKL 254 /* max primary key length */ +#define SQLMGTI 250 /* max global transaction-id length */ +#define SQLMAUF 32 /* max concurrent audit files */ +#define SQLMPNM 8 /* max protocol name length */ +#define SQLMOSR 255 /* max OS sample rate */ +#define SQLMAWS 255 /* max OS Averaging window size */ +#define SQLMMID 32 /* max length identificatin strings */ + +/* MINIMUMS */ +#define SQLMCG0 1 /* cache group pages */ +#define SQLMEXS 1024 /* partitioned file extension size */ +#define SQLMLFE 100000L /* minimum log file extension size */ +#define SQLMLFS 100000L /* minimum log file size */ +#define SQLMPAG 15 /* minimum pages (cache) */ +#define SQLMITM 1 /* minimum thread mode value */ + +/* typedefs */ +#if defined(WIN32) || defined(SYSFWNT) + #ifndef SQLFI64 + #define SQLFI64 + typedef __int64 b8; /* 64-bits signed */ + typedef unsigned __int64 ub8; /* 64-bits unsigned */ + #endif + +#else + #ifndef SQLFI64 + #define SQLFI64 + typedef struct { + unsigned long LoPart; + unsigned long HiPart; + } ub8; + typedef struct { + unsigned long LoPart; + long HiPart; + } b8; + #endif + +#endif + +typedef unsigned char ubyte1; +typedef unsigned short ubyte2; +typedef unsigned long ubyte4; +typedef ub8 ubyte8; +typedef ubyte1 byte1; +typedef short byte2; +typedef long byte4; +typedef b8 byte8; +typedef unsigned char PTR ubyte1p; +typedef int (SBSTDCALL *SQLTPFP)(void); + +typedef ubyte1 SQLTARC; /* remote connection architecture */ +typedef ubyte1 SQLTBNL; /* bind name length */ +typedef ubyte1 SQLTBNN; /* bind number */ +typedef ubyte1p SQLTBNP; /* bind name pointer */ +typedef byte2 SQLTNUL; /* null indicator */ +typedef ubyte1 SQLTBOO; /* boolean data type */ +typedef ubyte1 SQLTCDL; /* column data length */ +typedef ubyte1 SQLTCHL; /* column header length */ +typedef ubyte1 SQLTCHO; /* check option */ +typedef ubyte1p SQLTCHP; /* column header pointer */ +typedef ubyte2 SQLTCLL; /* column data length(long) */ +typedef ubyte1 SQLTCTY; /* command type */ +typedef ubyte2 SQLTCUR; /* cursor number */ +typedef ubyte2 SQLTDAL; /* data length */ +typedef ubyte1p SQLTDAP; /* data pointer */ +typedef byte2 SQLTDAY; /* number of days */ +typedef ubyte1 SQLTDDL; /* database data length */ +typedef ubyte1 SQLTDDT; /* database data type */ +typedef ubyte2 SQLTDEDL; /* database extended data length */ +typedef ubyte2 SQLTDPT; /* database parameter type */ +typedef ubyte4 SQLTDPV; /* database parameter value */ +typedef ubyte2 SQLTEPO; /* error position */ +typedef ubyte2 SQLTFAT; /* file attribute */ +typedef ubyte2 SQLTFLD; /* SELECT statement field number */ +typedef byte2 SQLTFLG; /* flag field */ +typedef ubyte4 SQLTFLH; /* file handle */ +typedef byte2 SQLTFMD; /* file mode */ +typedef ubyte2 SQLTFNL; /* file name length */ +typedef ubyte1p SQLTFNP; /* file name pointer */ +typedef ubyte1 SQLTFSC; /* fetch status code */ +typedef ubyte1p SQLTILV; /* isolation level string */ +typedef ubyte1 SQLTLBL; /* label information length */ +typedef ubyte1p SQLTLBP; /* label infromation pointer */ +typedef byte8 SQLTLLI; /* long long integer */ +typedef byte4 SQLTLNG; /* long size */ +typedef ubyte4 SQLTLSI; /* long size */ +typedef ubyte2 SQLTMSZ; /* message size */ +typedef ubyte1 SQLTNBV; /* number of bind variables */ +typedef ubyte2 SQLTNCU; /* number of cursors */ +typedef ubyte1 SQLTNML; /* number length */ +typedef ubyte1p SQLTNMP; /* number pointer */ +typedef ubyte2 SQLTNPG; /* number of pages */ +typedef ubyte4 SQLTLNPG; /* number of pages */ +typedef ubyte1 SQLTNSI; /* number of select items */ +typedef ubyte1 SQLTPCX; /* preserve context flag */ +typedef ubyte1 SQLTPDL; /* program data length */ +typedef ubyte1 SQLTPDT; /* program data type */ +typedef ubyte4 SQLTPGN; /* page number */ +typedef ubyte2 SQLTPNM; /* process number */ +typedef ubyte1 SQLTPRE; /* precision */ +typedef ubyte2 SQLTPTY; /* set/get parameter type */ +typedef ubyte1 SQLTRBF; /* roll back flag */ +typedef byte2 SQLTRCD; /* return codes */ +typedef ubyte1 SQLTRCF; /* recovery flag */ +typedef ubyte2 SQLTRFM; /* rollforward mode */ +typedef byte4 SQLTROW; /* number of rows */ +typedef ubyte1 SQLTSCA; /* scale */ +typedef ubyte1 SQLTSLC; /* select list column */ +typedef ubyte2 SQLTSTC; /* statistics counter */ +typedef ubyte2 SQLTSVH; /* server handle */ +typedef ubyte2 SQLTSVN; /* server number */ +typedef byte2 SQLTTIV; /* wait timeout value */ +typedef byte2 SQLTWNC; /* whence */ +typedef ubyte2 SQLTWSI; /* work size */ +typedef ubyte2 SQLTBIR; /* bulk insert error row number */ +typedef ubyte1p SQLTDIS; /* Describe info indicator */ +typedef byte4 SQLTXER; /* extended error # */ +typedef ubyte4 SQLTPID; /* client process id */ +typedef ubyte4 SQLTMOD; /* mode flag */ +typedef ubyte4 SQLTCON; /* connection handle */ + +/* defines for isolation level string */ +#define SQLILRR "RR" /* Repeatable Read isolation */ +#define SQLILCS "CS" /* Cursor Stability isolation */ +#define SQLILRO "RO" /* Read-Only isolation */ +#define SQLILRL "RL" /* Release Locks isolation */ +/* defines for isolation level flags*/ +#define SQLFIRR 0x01 /* Repeatable Read isolation flag */ +#define SQLFICS 0x02 /* Cursor Stability isolation flag */ +#define SQLFIRO 0x04 /* Read-Only isolation flag */ +#define SQLFIRL 0x08 /* Release Locks isolation flag */ +/* defines for SQLROF rollforward mode parameter */ +#define SQLMEOL 1 /* rollforward to end of log */ +#define SQLMEOB 2 /* rollforward to end of backup */ +#define SQLMTIM 3 /* rollforward to specified time */ +/* defines for when to collect Describe information */ +#define SQLDELY 0 /* get Describe info after sqlcom */ +#define SQLDDLD 1 /* get Describe info after sqlexe */ +#define SQLDNVR 2 /* never get any Describe info */ +/* defines for SQLETX() and SQLTEM(): error text type parameters */ +#define SQLXMSG 1 /* retrieve error message text */ +#define SQLXREA 2 /* retrieve error message reason */ +#define SQLXREM 4 /* retrieve error message remedy */ + +/* defines for extended directory open function */ +#define SQLANRM 0x00 /* normal - no restrictions */ +#define SQLARDO 0x01 /* read only */ +#define SQLAHDN 0x02 /* hidden file */ +#define SQLASYS 0x04 /* system file */ +#define SQLAVOL 0x08 /* volume label */ +#define SQLADIR 0x10 /* directory */ +#define SQLAARC 0x20 /* archive bit */ +#define SQLAFDL 0x100 /* files and directories */ +#define SQLAFIL 0x200 /* files only */ + +/* defines for state of cursor */ +#define SQLCIDL 0 /* idle cursor */ +#define SQLCECM 1 /* executing compile */ +#define SQLCCCM 2 /* completed compile */ +#define SQLCEXE 3 /* executing command */ +#define SQLCCXE 4 /* completed command */ +#define SQLCEFT 5 /* executing fetch */ +#define SQLCCFT 6 /* completed fetch */ +/* SYSTEM DEFINED TYPEDEF'S -- FOR SYSTEM USE ONLY */ + +typedef ubyte2 SQLTMSL; /* message length */ +typedef byte1 far* SQLTMSP; /* message pointer */ + +/* +DESCRIPTION + This structure is used to receive system information from the + backend. Structure elements must be arranged so that the structure + layout is the same in packed or padded compilation modes. For + now, this means longs in the front, ints in the middle, and chars at + the end of the structure. +*/ + +struct sysdefx + { + SQLTPGN syslpt; /* log page threshold */ + SQLTPGN syslpm; /* log page maximum */ + ubyte4 syshep; /* heap size */ + SQLTNPG sysncp; /* number of cache pages */ + SQLTTIV systiv; /* wait timeout value in seconds */ + ubyte1 sysiso[3]; /* isolation level */ + ubyte1 sysjou; /* journal */ + ubyte1 syslog; /* log */ + ubyte1 sysrec; /* recovery */ + ubyte1 systyp; /* system type */ + }; +typedef struct sysdefx sysdef; +typedef struct sysdefx SQLTSYS; +#define SYSSIZ sizeof(sysdef) + +/* +DESCRIPTION: + This structure is used as a parameter to the SQLGDI function. After a + a compile, all relevant information for a given Select column can be + obtained in this structure. + Note: + Please note that, originally, gdichb was the first element of the + gdidefx structure. It has been moved further down because a column + heading can be greater than 31 bytes. A bug was reported complaining + that the column heading was not being returned correctly since the + maximum length of a column heading is 46. This can now be returned + since the size of the buffer (gdichb) has been changed to 47. + Also, the length field (gdichl) has also been moved down to go with + the column heading buffer (gdichb). + The original gdichb and gdichl fields have been renamed to gdifl1 and + gdifl2. +*/ +struct gdidefx + { + ubyte1 gdifl1[31]; /* filler reserved for future use */ + ubyte1 gdifl2; /* filler reserved for future use */ + ubyte1 gdilbb[31]; /* label buffer */ + SQLTLBL gdilbl; /* label info length */ + SQLTSLC gdicol; /* select column number */ + SQLTDDT gdiddt; /* database data type */ + SQLTDEDL gdiddl; /* database extended data length */ + SQLTDDT gdiedt; /* external data type */ + SQLTDEDL gdiedl; /* external extended data length */ + SQLTPRE gdipre; /* decimal precision */ + SQLTSCA gdisca; /* decimal scale */ + byte2 gdinul; /* null indicator */ + ubyte1 gdichb[47]; /* column heading buffer */ + SQLTCHL gdichl; /* column heading length */ + byte1 gdifil[2]; /* for future use */ + }; +typedef struct gdidefx gdidef; +typedef struct gdidefx SQLTGDI; +typedef struct gdidefx* SQLTPGD; +#define GDISIZ sizeof(gdidef) + +/* +DESCRIPTION + This structure is used when passing binary data to and from external + functions. Since binary data can contains nulls as part of the data + we cannot look for a string terminator. Hence this structure is used + to provide a pointer to the binary data and the length of the data. +*/ + +struct binaryx + { + long binary_len; + char* binary_ptr; + }; + +#ifndef _INC_FSTREAM +typedef struct binaryx binary; +#endif +typedef struct binaryx BINARY; +typedef struct binaryx *lpbinary; +typedef struct binaryx *LPBINARY; + +#define BINARYSIZ sizeof(BINARY) + +#define BINARY_GET_LENGTH(x) (x.binary_len) +#define BINARY_GET_BUFFER(x) (x.binary_ptr) + +#define BINARY_SET_LENGTH(x,y) (x.binary_len=y) +#define BINARY_SET_BUFFER(x,y) (x.binary_ptr=y) + +/* + The following datatypes are analogous to the SqlWindows datatypes + NUMBER and DATETIME. They are used to pass the Sqlbase internal number + and datatime datatypes to external functions +*/ + +struct datetimex + { + char datetime_len; + char datetime_value[12]; + }; + +typedef struct datetimex datetime; + +#define DATETIMESIZ sizeof(datetime) + +#define DATETIME_IS_NULL(x) (x.datetime_len == 0) +#define DATETIME_SET_NULL(x) (x.datetime_len = 0) + +struct numberx + { + char number_len; + char number_value[12]; + }; + +typedef struct numberx number; + +#define NUMBERSIZ sizeof(number) + +#define NUMBER_IS_NULL(x) (x.number_len == 0) +#define NUMBER_SET_NULL(x) (x.number_len = 0) + + +/* system types */ +#define SYSTSGL 1 /* single user */ +#define SYSTMUL 2 /* multi-user */ +#define SYSTDB2 3 /* DB2 */ +#define SYSTDMO 4 /* demo */ +#define SYSTGWY 5 /* SQLNetwork Gateway */ +#define SYSTRTR 6 /* SQLNetwork Router */ +#define SYSTSHAS 7 /* SQLNetwork SQLHost App Services */ + +/*------------------------------------------------------------------------- + SQL API calling convention: + + For 32-bit systems, the calling convention used depends on the + target platform: + + - For NetWare and Windows/NT, the __stdcall calling convention is used. + If __stdcall is not supported by your compiler, then you will need + to define it to be something equivalent to __stdcall. + ------------------------------------------------------------------------- */ + +# define SQLTAPI byte2 SBSTDCALL /* Use __stdcall */ + +#ifndef SQL_PROTO +#ifndef NLINT_ARGS /* argument checking enabled */ + +/* SQL FUNCTION PROTOTYPES */ + +SQLTAPI sqlarf(SQLTCUR cur , SQLTFNP fnp , + SQLTFNL fnl , SQLTCHO cho ); +SQLTAPI sqlbbr(SQLTCUR cur , SQLTXER PTR errnum , + SQLTDAP errbuf , SQLTDAL PTR buflen , + SQLTBIR PTR errrow , SQLTRBF PTR rbf , + SQLTBIR errseq ); +SQLTAPI sqlbdb(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +SQLTAPI sqlbef(SQLTCUR cur ); +SQLTAPI sqlber(SQLTCUR cur , SQLTRCD PTR rcd , + SQLTBIR PTR errrow , SQLTRBF PTR rbf , + SQLTBIR errseq ); +SQLTAPI sqlbkp(SQLTCUR cur , SQLTBOO defalt , + SQLTBOO overwrt , SQLTFNP bkfname , + SQLTFNL bkfnlen ); +SQLTAPI sqlbld(SQLTCUR cur , SQLTBNP bnp , + SQLTBNL bnl ); +SQLTAPI sqlblf(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +SQLTAPI sqlblk(SQLTCUR cur , SQLTFLG blkflg ); +SQLTAPI sqlbln(SQLTCUR cur , SQLTBNN bnn ); +SQLTAPI sqlbna(SQLTCUR cur , SQLTBNP bnp , + SQLTBNL bnl , SQLTDAP dap , + SQLTDAL dal , SQLTSCA sca , + SQLTPDT pdt , SQLTNUL nli ); +SQLTAPI sqlbnd(SQLTCUR cur , SQLTBNP bnp , + SQLTBNL bnl , SQLTDAP dap , + SQLTDAL dal , SQLTSCA sca , + SQLTPDT pdt ); +SQLTAPI sqlbnn(SQLTCUR cur , SQLTBNN bnn , + SQLTDAP dap , SQLTDAL dal , + SQLTSCA sca , SQLTPDT pdt ); +SQLTAPI sqlbnu(SQLTCUR cur , SQLTBNN bnn , + SQLTDAP dap , SQLTDAL dal , + SQLTSCA sca , SQLTPDT pdt , + SQLTNUL nli ); +SQLTAPI sqlbss(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +SQLTAPI sqlcan(SQLTCUR cur ); +SQLTAPI sqlcbv(SQLTCUR cur ); +SQLTAPI sqlcch(SQLTCON PTR hConp , SQLTDAP dbnamp , + SQLTDAL dbnaml , SQLTMOD fType ); +SQLTAPI sqlcdr(SQLTSVH shandle, SQLTCUR cur ); +SQLTAPI sqlcex(SQLTCUR cur , SQLTDAP dap , + SQLTDAL dal ); +SQLTAPI sqlclf(SQLTSVH cur , SQLTDAP logfile , + SQLTFMD startflag); +SQLTAPI sqlcmt(SQLTCUR cur ); +SQLTAPI sqlcnc(SQLTCUR PTR curp , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +SQLTAPI sqlcnr(SQLTCUR PTR curp , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +SQLTAPI sqlcom(SQLTCUR cur , SQLTDAP cmdp , + SQLTDAL cmdl ); +SQLTAPI sqlcon(SQLTCUR PTR curp , SQLTDAP dbnamp , + SQLTDAL dbnaml , SQLTWSI cursiz , + SQLTNPG pages , SQLTRCF recovr , + SQLTDAL outsize , SQLTDAL insize ); +SQLTAPI sqlcpy(SQLTCUR fcur , SQLTDAP selp , + SQLTDAL sell , SQLTCUR tcur , + SQLTDAP isrtp , SQLTDAL isrtl ); +SQLTAPI sqlcre(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +SQLTAPI sqlcrf(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel ); +SQLTAPI sqlcrs(SQLTCUR cur , SQLTDAP rsp , + SQLTDAL rsl ); +SQLTAPI sqlcsv(SQLTSVH PTR shandlep, SQLTDAP serverid, + SQLTDAP password); +SQLTAPI sqlcty(SQLTCUR cur , SQLTCTY PTR cty ); +SQLTAPI sqldbn(SQLTDAP serverid, SQLTDAP buffer , + SQLTDAL length ); +SQLTAPI sqldch(SQLTCON hCon ); +SQLTAPI sqlded(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +SQLTAPI sqldel(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +SQLTAPI sqldes(SQLTCUR cur , SQLTSLC slc , + SQLTDDT PTR ddt , SQLTDDL PTR ddl , + SQLTCHP chp , SQLTCHL PTR chlp , + SQLTPRE PTR prep , SQLTSCA PTR scap ); +SQLTAPI sqldid(SQLTDAP dbname , SQLTDAL dbnamel ); +SQLTAPI sqldii(SQLTCUR cur , SQLTSLC ivn , + SQLTDAP inp , SQLTCHL* inlp ); +SQLTAPI sqldin(SQLTDAP dbnamp , SQLTDAL dbnaml ); +SQLTAPI sqldir(SQLTSVN srvno , SQLTDAP buffer , + SQLTDAL length ); +SQLTAPI sqldis(SQLTCUR cur ); +SQLTAPI sqldon(void); +SQLTAPI sqldox(SQLTSVH shandle , SQLTDAP dirnamep, + SQLTFAT fattr ); +SQLTAPI sqldrc(SQLTSVH cur ); +SQLTAPI sqldro(SQLTSVH shandle , SQLTDAP dirname ); +SQLTAPI sqldrr(SQLTSVH shandle , SQLTDAP filename); +SQLTAPI sqldrs(SQLTCUR cur , SQLTDAP rsp , + SQLTDAL rsl ); +SQLTAPI sqldsc(SQLTCUR cur , SQLTSLC slc , + SQLTDDT PTR edt , SQLTDDL PTR edl , + SQLTCHP chp , SQLTCHL PTR chlp , + SQLTPRE PTR prep , SQLTSCA PTR scap ); +SQLTAPI sqldst(SQLTCUR cur , SQLTDAP cnp , + SQLTDAL cnl ); +SQLTAPI sqldsv(SQLTSVH shandle ); +SQLTAPI sqlebk(SQLTCUR cur ); +SQLTAPI sqlefb(SQLTCUR cur ); +SQLTAPI sqlelo(SQLTCUR cur ); +SQLTAPI sqlenl(SQLTCON hCon , SQLTDAP p1, SQLTDAL l1, + SQLTDAP p2 , SQLTDAL* l2_p ); +SQLTAPI sqlenr(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel ); +SQLTAPI sqlepo(SQLTCUR cur , SQLTEPO PTR epo ); +SQLTAPI sqlerf(SQLTCUR cur ); +SQLTAPI sqlerr(SQLTRCD error , SQLTDAP msg ); +SQLTAPI sqlers(SQLTCUR cur ); +SQLTAPI sqletx(SQLTRCD error , SQLTPTY msgtyp , + SQLTDAP bfp , SQLTDAL bfl , + SQLTDAL PTR txtlen ); +SQLTAPI sqlexe(SQLTCUR cur ); +SQLTAPI sqlexp(SQLTCUR cur , SQLTDAP buffer , + SQLTDAL length ); +SQLTAPI sqlfbk(SQLTCUR cur ); +SQLTAPI sqlfer(SQLTRCD error , SQLTDAP msg ); +SQLTAPI sqlfet(SQLTCUR cur ); +SQLTAPI sqlfgt(SQLTSVH cur , SQLTDAP srvfile , + SQLTDAP lclfile ); +SQLTAPI sqlfpt(SQLTSVH cur , SQLTDAP srvfile , + SQLTDAP lclfile ); +SQLTAPI sqlfqn(SQLTCUR cur , SQLTFLD field , + SQLTDAP nameptr , SQLTDAL PTR namelen ); +SQLTAPI sqlgbi(SQLTCUR cur , SQLTCUR PTR pcur , + SQLTPNM PTR ppnm ); +SQLTAPI sqlgdi(SQLTCUR cur , SQLTPGD gdi ); +SQLTAPI sqlget(SQLTCUR cur , SQLTPTY parm , + SQLTDAP p , SQLTDAL PTR l ); +SQLTAPI sqlgfi(SQLTCUR cur , SQLTSLC slc , + SQLTCDL PTR cvl , SQLTFSC PTR fsc ); +SQLTAPI sqlgls(SQLTCUR cur , SQLTSLC slc , + SQLTLSI PTR size ); +SQLTAPI sqlgnl(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTLNG PTR lognum ); +SQLTAPI sqlgnr(SQLTCUR cur , SQLTDAP tbnam , + SQLTDAL tbnaml , SQLTROW PTR rows ); +SQLTAPI sqlgsi(SQLTSVH shandle , SQLTFLG infoflags, + SQLTDAP buffer , SQLTDAL buflen , + SQLTDAL PTR rbuflen ); +SQLTAPI sqlgwo(SQLTCON hCon , SQLTDAP p , + SQLTDAL PTR l ); +SQLTAPI sqlidb(SQLTCUR cur ); +SQLTAPI sqlims(SQLTCUR cur , SQLTDAL insize ); +SQLTAPI sqlind(SQLTSVH shandle , SQLTDAP dbnamp , + SQLTDAL dbnaml ); +SQLTAPI sqlini(SQLTPFP callback); +SQLTAPI sqliniEx(SQLTDAP iniPath, SQLTDAL l); +SQLTAPI sqlins(SQLTSVN srvno , SQLTDAP dbnamp , + SQLTDAL dbnaml , SQLTFLG createflag, + SQLTFLG overwrite); +SQLTAPI sqliqx(SQLTCON hCon, SQLTDAP p, + SQLTDAL l, SQLTBOO PTR b ); +SQLTAPI sqllab(SQLTCUR cur , SQLTSLC slc , + SQLTCHP lbp , SQLTCHL PTR lblp ); +SQLTAPI sqlldp(SQLTCUR cur , SQLTDAP cmdp , + SQLTDAL cmdl ); +SQLTAPI sqllsk(SQLTCUR cur , SQLTSLC slc , + SQLTLSI pos ); +SQLTAPI sqlmcl(SQLTSVH shandle , SQLTFLH fd ); +SQLTAPI sqlmdl(SQLTSVH shandle , SQLTDAP filename); +SQLTAPI sqlmls(SQLTSVH shandle , SQLTFLH fd , + SQLTLLI offset , SQLTWNC whence , + SQLTLLI PTR roffset ); +SQLTAPI sqlmop(SQLTSVH shandle , SQLTFLH PTR fdp , + SQLTDAP filename, SQLTFMD openmode); +SQLTAPI sqlmrd(SQLTSVH shandle , SQLTFLH fd , + SQLTDAP buffer , SQLTDAL len , + SQLTDAL PTR rlen ); +SQLTAPI sqlmsk(SQLTSVH shandle , SQLTFLH fd , + SQLTLNG offset , SQLTWNC whence , + SQLTLNG PTR roffset ); +SQLTAPI sqlmwr(SQLTSVH shandle , SQLTFLH fd , + SQLTDAP buffer , SQLTDAL len , + SQLTDAL PTR rlen ); +SQLTAPI sqlnbv(SQLTCUR cur , SQLTNBV PTR nbv ); +SQLTAPI sqlnii(SQLTCUR cur , SQLTNSI PTR nii ); +SQLTAPI sqlnrr(SQLTCUR cur , SQLTROW PTR rcountp ); +SQLTAPI sqlnsi(SQLTCUR cur , SQLTNSI PTR nsi ); +SQLTAPI sqloms(SQLTCUR cur , SQLTDAL outsize ); +SQLTAPI sqlopc(SQLTCUR PTR curp , SQLTCON hCon , + SQLTMOD fType ); +SQLTAPI sqlprs(SQLTCUR cur , SQLTROW row ); +SQLTAPI sqlrbf(SQLTCUR cur , SQLTRBF PTR rbf ); +SQLTAPI sqlrbk(SQLTCUR cur ); +SQLTAPI sqlrcd(SQLTCUR cur , SQLTRCD PTR rcd ); +SQLTAPI sqlrdb(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +SQLTAPI sqlrdc(SQLTCUR cur , SQLTDAP bufp , + SQLTDAL bufl , SQLTDAL PTR readl ); +SQLTAPI sqlrel(SQLTCUR cur ); +SQLTAPI sqlres(SQLTCUR PTR curptr , SQLTFNP bkfname , + SQLTFNL bkfnlen , SQLTSVN bkfserv , + SQLTBOO overwrt , SQLTDAP dbname , + SQLTDAL dbnlen , SQLTSVN dbserv ); +SQLTAPI sqlret(SQLTCUR cur , SQLTDAP cnp , + SQLTDAL cnl ); +SQLTAPI sqlrlf(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +SQLTAPI sqlrlo(SQLTCUR cur , SQLTSLC slc , + SQLTDAP bufp , SQLTDAL bufl , + SQLTDAL PTR readl ); +SQLTAPI sqlrof(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTRFM mode , + SQLTDAP datetime, SQLTDAL datetimel); +SQLTAPI sqlrow(SQLTCUR cur , SQLTROW PTR row ); +SQLTAPI sqlrrd(SQLTCUR cur ); +SQLTAPI sqlrrs(SQLTCUR cur , SQLTDAP rsp , + SQLTDAL rsl ); +SQLTAPI sqlrsi(SQLTSVH shandle ); +SQLTAPI sqlrss(SQLTSVH shandle , SQLTDAP dbname , + SQLTDAL dbnamel , SQLTFNP bkpdir , + SQLTFNL bkpdirl , SQLTBOO local , + SQLTBOO over ); +SQLTAPI sqlsab(SQLTSVH shandle , SQLTPNM pnum ); +SQLTAPI sqlsap(SQLTSVN srvno , SQLTDAP password, + SQLTPNM pnum ); +SQLTAPI sqlscl(SQLTCUR cur , SQLTDAP namp , + SQLTDAL naml ); +SQLTAPI sqlscn(SQLTCUR cur , SQLTDAP namp , + SQLTDAL naml ); +SQLTAPI sqlscp(SQLTNPG pages ); +SQLTAPI sqlsdn(SQLTDAP dbnamp , SQLTDAL dbnaml ); +SQLTAPI sqlsds(SQLTSVH shandle, SQLTFLG shutdownflg); +SQLTAPI sqlsdx(SQLTSVH shandle, SQLTDAP dbnamp, + SQLTDAL dbnaml , SQLTFLG shutdownflg); +SQLTAPI sqlset(SQLTCUR cur , SQLTPTY parm , + SQLTDAP p , SQLTDAL l ); +SQLTAPI sqlsil(SQLTCUR cur , SQLTILV isolation); +SQLTAPI sqlslp(SQLTCUR cur , SQLTNPG lpt , + SQLTNPG lpm ); +SQLTAPI sqlspr(SQLTCUR cur ); +SQLTAPI sqlsrf(SQLTCUR cur , SQLTDAP fnp , + SQLTDAL fnl ); +SQLTAPI sqlsrs(SQLTCUR cur ); +SQLTAPI sqlssb(SQLTCUR cur , SQLTSLC slc , + SQLTPDT pdt , SQLTDAP pbp , + SQLTPDL pdl , SQLTSCA sca , + SQLTCDL PTR pcv , SQLTFSC PTR pfc ); +SQLTAPI sqlsss(SQLTCUR cur , SQLTDAL size ); +SQLTAPI sqlsta(SQLTCUR cur , SQLTSTC PTR svr , + SQLTSTC PTR svw , SQLTSTC PTR spr , + SQLTSTC PTR spw ); +SQLTAPI sqlstm(SQLTSVH shandle ); +SQLTAPI sqlsto(SQLTCUR cur , SQLTDAP cnp , + SQLTDAL cnl , SQLTDAP ctp , + SQLTDAL ctl ); +SQLTAPI sqlstr(SQLTCUR cur ); +SQLTAPI sqlsxt(SQLTSVN srvno , SQLTDAP password); +SQLTAPI sqlsys(SQLTCUR cur , SQLTSYS PTR sys ); +SQLTAPI sqltec(SQLTRCD rcd , SQLTRCD PTR np ); +SQLTAPI sqltem(SQLTCUR cur , SQLTXER PTR xer , + SQLTPTY msgtyp , SQLTDAP bfp , + SQLTDAL bfl , SQLTDAL PTR txtlen ); +SQLTAPI sqltio(SQLTCUR cur , SQLTTIV _timeout); +SQLTAPI sqlunl(SQLTCUR cur , SQLTDAP cmdp , + SQLTDAL cmdl ); +SQLTAPI sqlurs(SQLTCUR cur ); +SQLTAPI sqlwdc(SQLTCUR cur , SQLTDAP bufp , + SQLTDAL bufl ); +SQLTAPI sqlwlo(SQLTCUR cur , SQLTDAP bufp , + SQLTDAL bufl ); +SQLTAPI sqlxad(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); +SQLTAPI sqlxcn(SQLTNMP op , SQLTDAP ip , + SQLTDAL il ); +SQLTAPI sqlxda(SQLTNMP op , SQLTNMP dp , + SQLTNML dl , SQLTDAY days ); +SQLTAPI sqlxdp(SQLTDAP op , SQLTDAL ol , + SQLTNMP ip , SQLTNML il , + SQLTDAP pp , SQLTDAL pl ); +SQLTAPI sqlxdv(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); +SQLTAPI sqlxer(SQLTCUR cur , SQLTXER PTR errnum, + SQLTDAP errbuf , SQLTDAL PTR buflen ); +SQLTAPI sqlxml(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); +SQLTAPI sqlxnp(SQLTDAP outp , SQLTDAL outl , + SQLTNMP isnp , SQLTNML isnl , + SQLTDAP picp , SQLTDAL picl ); +SQLTAPI sqlxpd(SQLTNMP op , SQLTNML PTR olp , + SQLTDAP ip , SQLTDAP pp , + SQLTDAL pl ); +SQLTAPI sqlxsb(SQLTNMP op , SQLTNMP np1 , + SQLTNML nl1 , SQLTNMP np2 , + SQLTNML nl2 ); + +#else + +SQLTAPI sqlarf(); +SQLTAPI sqlbbr(); +SQLTAPI sqlbdb(); +SQLTAPI sqlbef(); +SQLTAPI sqlber(); +SQLTAPI sqlbkp(); +SQLTAPI sqlbld(); +SQLTAPI sqlblf(); +SQLTAPI sqlblk(); +SQLTAPI sqlbln(); +SQLTAPI sqlbna(); +SQLTAPI sqlbnd(); +SQLTAPI sqlbnn(); +SQLTAPI sqlbnu(); +SQLTAPI sqlbss(); +SQLTAPI sqlcan(); +SQLTAPI sqlcbv(); +SQLTAPI sqlcch(); +SQLTAPI sqlcdr(); +SQLTAPI sqlcex(); +SQLTAPI sqlclf(); +SQLTAPI sqlcmt(); +SQLTAPI sqlcnc(); +SQLTAPI sqlcnr(); +SQLTAPI sqlcom(); +SQLTAPI sqlcon(); +SQLTAPI sqlcpy(); +SQLTAPI sqlcre(); +SQLTAPI sqlcrf(); +SQLTAPI sqlcrs(); +SQLTAPI sqlcsv(); +SQLTAPI sqlcty(); +SQLTAPI sqldbn(); +SQLTAPI sqldch(); +SQLTAPI sqlded(); +SQLTAPI sqldel(); +SQLTAPI sqldes(); +SQLTAPI sqldid(); +SQLTAPI sqldii(); +SQLTAPI sqldin(); +SQLTAPI sqldir(); +SQLTAPI sqldis(); +SQLTAPI sqldon(); +SQLTAPI sqldox(); +SQLTAPI sqldrc(); +SQLTAPI sqldro(); +SQLTAPI sqldrr(); +SQLTAPI sqldrs(); +SQLTAPI sqldsc(); +SQLTAPI sqldst(); +SQLTAPI sqldsv(); +SQLTAPI sqlebk(); +SQLTAPI sqlefb(); +SQLTAPI sqlelo(); +SQLTAPI sqlenr(); +SQLTAPI sqlepo(); +SQLTAPI sqlerf(); +SQLTAPI sqlerr(); +SQLTAPI sqlers(); +SQLTAPI sqletx(); +SQLTAPI sqlexe(); +SQLTAPI sqlexp(); +SQLTAPI sqlfbk(); +SQLTAPI sqlfer(); +SQLTAPI sqlfet(); +SQLTAPI sqlfgt(); +SQLTAPI sqlfpt(); +SQLTAPI sqlfqn(); +SQLTAPI sqlgbi(); +SQLTAPI sqlgdi(); +SQLTAPI sqlget(); +SQLTAPI sqlgfi(); +SQLTAPI sqlgls(); +SQLTAPI sqlgnl(); +SQLTAPI sqlgnr(); +SQLTAPI sqlgsi(); +SQLTAPI sqlgwo(); +SQLTAPI sqlidb(); +SQLTAPI sqlims(); +SQLTAPI sqlind(); +SQLTAPI sqlini(); +SQLTAPI sqliniEx(); +SQLTAPI sqlins(); +SQLTAPI sqliqx(); +SQLTAPI sqllab(); +SQLTAPI sqlldp(); +SQLTAPI sqllsk(); +SQLTAPI sqlmcl(); +SQLTAPI sqlmdl(); +SQLTAPI sqlmls(); +SQLTAPI sqlmop(); +SQLTAPI sqlmrd(); +SQLTAPI sqlmsk(); +SQLTAPI sqlmwr(); +SQLTAPI sqlnbv(); +SQLTAPI sqlnii(); +SQLTAPI sqlnrr(); +SQLTAPI sqlnsi(); +SQLTAPI sqloms(); +SQLTAPI sqlopc(); +SQLTAPI sqlprs(); +SQLTAPI sqlrbf(); +SQLTAPI sqlrbk(); +SQLTAPI sqlrcd(); +SQLTAPI sqlrdb(); +SQLTAPI sqlrdc(); +SQLTAPI sqlrel(); +SQLTAPI sqlres(); +SQLTAPI sqlret(); +SQLTAPI sqlrlf(); +SQLTAPI sqlrlo(); +SQLTAPI sqlrof(); +SQLTAPI sqlrow(); +SQLTAPI sqlrrd(); +SQLTAPI sqlrrs(); +SQLTAPI sqlrsi(); +SQLTAPI sqlrss(); +SQLTAPI sqlsab(); +SQLTAPI sqlsap(); +SQLTAPI sqlscl(); +SQLTAPI sqlscn(); +SQLTAPI sqlscp(); +SQLTAPI sqlsdn(); +SQLTAPI sqlsds(); +SQLTAPI sqlsdx(); +SQLTAPI sqlset(); +SQLTAPI sqlsil(); +SQLTAPI sqlslp(); +SQLTAPI sqlspr(); +SQLTAPI sqlsrf(); +SQLTAPI sqlsrs(); +SQLTAPI sqlssb(); +SQLTAPI sqlsss(); +SQLTAPI sqlsta(); +SQLTAPI sqlstm(); +SQLTAPI sqlsto(); +SQLTAPI sqlstr(); +SQLTAPI sqlsxt(); +SQLTAPI sqlsys(); +SQLTAPI sqltec(); +SQLTAPI sqltem(); +SQLTAPI sqltio(); +SQLTAPI sqlunl(); +SQLTAPI sqlurs(); +SQLTAPI sqlwdc(); +SQLTAPI sqlwlo(); +SQLTAPI sqlxad(); +SQLTAPI sqlxcn(); +SQLTAPI sqlxda(); +SQLTAPI sqlxdp(); +SQLTAPI sqlxdv(); +SQLTAPI sqlxer(); +SQLTAPI sqlxml(); +SQLTAPI sqlxnp(); +SQLTAPI sqlxpd(); +SQLTAPI sqlxsb(); + +#endif +#endif + +#define SQLF000 0 /* not a function */ +#define SQLFINI 1 /* SQL INItialize applications use of the database */ +#define SQLFDON 2 /* SQL DONe using database */ +#define SQLFCON 3 /* SQL CONnect to a cursor/database */ +#define SQLFDIS 4 /* SQL DISconnect from a cursor/database */ +#define SQLFCOM 5 /* SQL COMpile a SQL command */ +#define SQLFEXE 6 /* SQL EXEcute an SQL command */ +#define SQLFCEX 7 /* SQL Compile and EXecute a SQL command */ +#define SQLFCMT 8 /* SQL CoMmiT a transaction to the database */ +#define SQLFDES 9 /* SQL DEScribe the items of a select statement */ +#define SQLFGFI 10 /* SQL Get Fetch Information */ +#define SQLFFBK 11 /* SQL FETch previous row from SELECT */ +#define SQLFFET 12 /* SQL FETch next row from SELECT */ +#define SQLFEFB 13 /* SQL Enable Fetch Backwards */ +#define SQLFPRS 14 /* SQL Position in Result Set */ +#define SQLFURS 15 /* SQL Undo Result Set */ +#define SQLFNBV 16 /* SQL get Number of Bind Variables */ +#define SQLFBND 17 /* SQL BiNd Data variables. This function is supercede */ +#define SQLFBNN 18 /* SQL BiNd Numerics */ +#define SQLFBLN 19 /* SQL Bind Long Number */ +#define SQLFBLD 20 /* SQL Bind Long Data variables */ +#define SQLFSRS 21 /* SQL Start Restriction Set processing */ +#define SQLFRRS 22 /* SQL Restart Restriction Set processing */ +#define SQLFCRS 23 /* SQL Close Restriction Set */ +#define SQLFDRS 24 /* SQL Drop Restriction Set */ +#define SQLFARF 25 /* SQL Apply Roll Forward journal */ +#define SQLFERF 26 /* SQL End RollForward recovery (no longer supported) */ +#define SQLFSRF 27 /* SQL Start Roll Forward journal */ +#define SQLFSTO 28 /* SQL STOre a compiled SQL command */ +#define SQLFRET 29 /* SQL RETrieve a compiled SQL command */ +#define SQLFDST 30 /* SQL Drop a STored command */ +#define SQLFCTY 31 /* SQL get Command TYpe */ +#define SQLFEPO 32 /* SQL get Error POsition */ +#define SQLFGNR 33 /* SQL Get Number of Rows */ +#define SQLFNSI 34 /* SQL get Number of Select Items */ +#define SQLFRBF 35 /* SQL get Roll Back Flag */ +#define SQLFRCD 36 /* SQL get Return CoDe */ +#define SQLFROW 37 /* SQL get number of ROWs */ +#define SQLFSCN 38 /* SQL Set Cursor Name */ +#define SQLFSIL 39 /* SQL Set Isolation Level */ +#define SQLFSLP 40 /* SQL Set Log Parameters */ +#define SQLFSSB 41 /* SQL Set Select Buffer */ +#define SQLFSSS 42 /* SQL Set SortSpace */ +#define SQLFRLO 43 /* SQL Read LOng */ +#define SQLFWLO 44 /* SQL Write LOng */ +#define SQLFLSK 45 /* SQL Long SeeK */ +#define SQLFGLS 46 /* SQL Get Long Size */ +#define SQLFELO 47 /* SQL End Long Operation */ +#define SQLFRBK 48 /* SQL RollBacK a transaction from the database */ +#define SQLFERR 49 /* SQL get ERRor message */ +#define SQLFCPY 50 /* SQL CoPY */ +#define SQLFIDB 51 /* SQL Initialize DataBase */ +#define SQLFSYS 52 /* SQL SYSTEM */ +#define SQLFSTA 53 /* SQL STAtistics */ +#define SQLFR02 54 /* SQL RESERVED */ +#define SQLFXAD 55 /* SQL eXtra ADd */ +#define SQLFXCN 56 /* SQL eXtra Character to NUmber */ +#define SQLFXDA 57 /* SQL eXtra Date Add */ +#define SQLFXDP 58 /* SQL eXtra convert SQLBASE Date to Picture */ +#define SQLFXDV 59 /* SQL eXtra DiVide */ +#define SQLFXML 60 /* SQL eXtra MuLtiply */ +#define SQLFXNP 61 /* SQL eXtra convert SQLBASE Numeric to Picture */ +#define SQLFXPD 62 /* SQL eXtra convert Picture to SQLBASE Date. */ +#define SQLFXSB 63 /* SQL eXtra SuBtract */ +#define SQLFINS 64 /* SQL INStall database (no longer supported) */ +#define SQLFDIN 65 /* SQL DeINstall database (no longer supported) */ +#define SQLFDIR 66 /* SQL DIRectory of databases */ +#define SQLFTIO 67 /* SQL TImeOut */ +#define SQLFFQN 68 /* SQL get Fully Qualified column Name */ +#define SQLFEXP 69 /* SQL EXexcution Plan */ +#define SQLFFER 70 /* SQL Full ERror message */ +#define SQLFBKP 71 /* SQL BacKuP */ +#define SQLFRDC 72 /* SQL Read Database Chunk */ +#define SQLFEBK 73 /* SQL End network online BacKup */ +#define SQLFRES 74 /* SQL REStore from backup */ +#define SQLFWDC 75 /* SQL Write Database Chunk */ +#define SQLFRRD 76 /* SQL Recover Restored Database */ +#define SQLFERS 77 /* SQL End network ReStore */ +#define SQLFNRR 78 /* SQL Number of Rows in Result set */ +#define SQLFSTR 79 /* SQL STart Restriction mode */ +#define SQLFSPR 80 /* SQL StoP Restriction mode */ +#define SQLFCNC 81 /* SQL CoNneCt: the sequel. */ +#define SQLFCNR 82 /* SQL Connect with No Recovery */ +#define SQLFOMS 83 /* SQL set Output Message Size */ +#define SQLFIMS 84 /* SQL set Input Message Size */ +#define SQLFSCP 85 /* SQL Set Cache Pages */ +#define SQLFDSC 86 /* SQL DeSCribe item of SELECT with external type */ +#define SQLFLAB 87 /* SQL get LABel information */ +#define SQLFCBV 88 /* SQL Clear Bind Variables */ +#define SQLFGET 89 /* SQL GET database parameter */ +#define SQLFSET 90 /* SQL SET database parameter */ +#define SQLFTEC 91 /* SQL Translate Error Code */ +#define SQLFBDB 92 /* SQL Backup DataBase */ +#define SQLFBEF 93 /* SQL Bulk Execute Flush */ +#define SQLFBER 94 /* SQL get Bulk Execute Returned code */ +#define SQLFBLF 95 /* SQL Backup Log Files */ +#define SQLFBLK 96 /* SQL set BuLK insert mode */ +#define SQLFBSS 97 /* SQL Backup SnapShot */ +#define SQLFCAN 98 /* SQL CaNceL command */ +#define SQLFCLF 99 /* SQL Change server activity LogFile */ +#define SQLFCRE 100 /* SQL CREate database */ +#define SQLFCRF 101 /* SQL Continue RollForward recovery */ +#define SQLFCSV 102 /* SQL Connect to SerVer */ +#define SQLFDBN 103 /* SQL Directory By Name */ +#define SQLFDED 104 /* SQL DeINstall database */ +#define SQLFDEL 105 /* SQL DELete database */ +#define SQLFDID 106 /* SQL DeInstall database and Delete database files */ +#define SQLFDRC 107 /* SQL DiRectory Close */ +#define SQLFDRO 108 /* SQL DiRectory Open */ +#define SQLFDRR 109 /* SQL DiRectory Read */ +#define SQLFDSV 110 /* SQL Disconnect from SerVer */ +#define SQLFENR 111 /* SQL ENd Rollforward recovery */ +#define SQLFFGT 112 /* SQL File GeT */ +#define SQLFFPT 113 /* SQL File Put */ +#define SQLFGNL 114 /* SQL Get Next Log for rollforward */ +#define SQLFGSI 115 /* SQL Get Server Information */ +#define SQLFIND 116 /* SQL INstall Database */ +#define SQLFMCL 117 /* SQL reMote CLose server file */ +#define SQLFMDL 118 /* SQL reMote DeLete file or directory on remote server */ +#define SQLFMOP 119 /* SQL reMote OPen file on server */ +#define SQLFMRD 120 /* SQL reMote ReaD from file on server */ +#define SQLFMSK 121 /* SQL reMote SeeK into file on server */ +#define SQLFMWR 122 /* SQL reMote WRite to file on server */ +#define SQLFRDB 123 /* SQL Restore DataBase */ +#define SQLFREL 124 /* SQL RELease log */ +#define SQLFRLF 125 /* SQL Restore Log Files */ +#define SQLFROF 126 /* SQL ROllForward recovery */ +#define SQLFRSS 127 /* SQL Restore SnapShot */ +#define SQLFSAB 128 /* SQL Server ABort process */ +#define SQLFSAP 129 /* SQL Server Abort Process */ +#define SQLFSDN 130 /* SQL ShutDowN database */ +#define SQLFSTM 131 /* SQL Server TerMinate */ +#define SQLFBBR 132 /* SQL get Bulk Execute Backend error # and message */ +#define SQLFBNA 133 /* SQL BiNd Data variables by name */ +#define SQLFBNU 134 /* SQL BiNd Numerical bind variable */ +#define SQLFGDI 135 /* SQL Get Descriptor info for a given Select column. */ +#define SQLFSXT 136 /* SQL Server eXiT (no longer supported) */ +#define SQLFXER 137 /* SQL get backend (Extended) error number and Message */ +#define SQLFETX 138 /* SQL get Error message TeXt */ +#define SQLFTEM 139 /* SQL get Tokenized Error Message */ +#define SQLFSCL 140 /* SQL Set CLient name */ +#define SQLFLDP 141 /* SQL LoaD oPeration */ +#define SQLFUNL 142 /* SQL UNLoad command */ +#define SQLFGBI 143 /* SQL Get Backend cursor Information */ +#define SQLFNII 144 /* SQL get Number of Into variable Information */ +#define SQLFDII 145 /* SQL Describe Into variable Information */ +#define SQLFSDS 146 /* SQL Shutdown/enable server */ +#define SQLFSDX 147 /* SQL Shutdown/enable Database Extended */ +#define SQLFCDR 148 /* SQL Cancel Database Request */ +#define SQLFDOX 149 /* SQL Directory Open Extended */ +#define SQLFRSI 150 /* SQL Reset Statistical Information */ +#define SQLFCCH 151 /* SQL Create Connection Handle */ +#define SQLFOPC 152 /* SQL OPen Cursor */ +#define SQLFDCH 153 /* SQL Destroy Connection Handle */ +#define SQLFENL 154 /* SQL MTS Enlist */ +#define SQLFGWO 155 /* SQL MTS Get Whereabouts Object */ +#define SQLFMLS 156 /* SQL reMote Long SeeK into file on server */ +#define SQLFIQX 157 /* SQL MTS Query a transaction's status */ + +#define SQLFMINAPI SQLFINI /* changes these when API entry */ +#define SQLFMAXAPI SQLFGWO /* points change */ + +/* + * The following default value macros are obsolete and are not used by + * the SQLBase code anymore. + */ +#if 0 +#define SQLDNPG 500 /* CACHE, number of cache pages */ +#define SQLDNSCPG 500 /* SORTCACHE, num of sortcache pages */ +#define SQLMISCPG 1000000 /* installed sort cache pages */ +#define SQLMSCPAG 0 /* minimum sort cache pages */ +#define SQLMSRS 3000 /* minimum sort space */ +#endif + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* !SQL */ diff --git a/libraries/SQLAPI/include/sqlite/sqlite3.h b/libraries/SQLAPI/include/sqlite/sqlite3.h new file mode 100644 index 000000000..d72fdbd51 --- /dev/null +++ b/libraries/SQLAPI/include/sqlite/sqlite3.h @@ -0,0 +1,5734 @@ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the interface that the SQLite library +** presents to client programs. If a C-function, structure, datatype, +** or constant definition does not appear in this file, then it is +** not a published API of SQLite, is subject to change without +** notice, and should not be referenced by programs that use SQLite. +** +** Some of the definitions that are in this file are marked as +** "experimental". Experimental interfaces are normally new +** features recently added to SQLite. We do not anticipate changes +** to experimental interfaces but reserve the right to make minor changes +** if experience from use "in the wild" suggest such changes are prudent. +** +** The official C-language API documentation for SQLite is derived +** from comments in this file. This file is the authoritative source +** on how SQLite interfaces are suppose to operate. +** +** The name of this file under configuration management is "sqlite.h.in". +** The makefile makes some minor changes to this file (such as inserting +** the version number) and changes its name to "sqlite3.h" as +** part of the build process. +*/ +#ifndef _SQLITE3_H_ +#define _SQLITE3_H_ +#include /* Needed for the definition of va_list */ + +/* +** Make sure we can call this stuff from C++. +*/ +#ifdef __cplusplus +extern "C" { +#endif + + +/* +** Add the ability to override 'extern' +*/ +#ifndef SQLITE_EXTERN +# define SQLITE_EXTERN extern +#endif + +#ifndef SQLITE_API +# define SQLITE_API +#endif + + +/* +** These no-op macros are used in front of interfaces to mark those +** interfaces as either deprecated or experimental. New applications +** should not use deprecated interfaces - they are support for backwards +** compatibility only. Application writers should be aware that +** experimental interfaces are subject to change in point releases. +** +** These macros used to resolve to various kinds of compiler magic that +** would generate warning messages when they were used. But that +** compiler magic ended up generating such a flurry of bug reports +** that we have taken it all out and gone back to using simple +** noop macros. +*/ +#define SQLITE_DEPRECATED +#define SQLITE_EXPERIMENTAL + +/* +** Ensure these symbols were not defined by some previous header file. +*/ +#ifdef SQLITE_VERSION +# undef SQLITE_VERSION +#endif +#ifdef SQLITE_VERSION_NUMBER +# undef SQLITE_VERSION_NUMBER +#endif + +/* +** CAPI3REF: Compile-Time Library Version Numbers +** +** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header +** evaluates to a string literal that is the SQLite version in the +** format "X.Y.Z" where X is the major version number (always 3 for +** SQLite3) and Y is the minor version number and Z is the release number.)^ +** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer +** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same +** numbers used in [SQLITE_VERSION].)^ +** The SQLITE_VERSION_NUMBER for any given release of SQLite will also +** be larger than the release from which it is derived. Either Y will +** be held constant and Z will be incremented or else Y will be incremented +** and Z will be reset to zero. +** +** Since version 3.6.18, SQLite source code has been stored in the +** Fossil configuration management +** system. ^The SQLITE_SOURCE_ID macro evalutes to +** a string which identifies a particular check-in of SQLite +** within its configuration management system. ^The SQLITE_SOURCE_ID +** string contains the date and time of the check-in (UTC) and an SHA1 +** hash of the entire source tree. +** +** See also: [sqlite3_libversion()], +** [sqlite3_libversion_number()], [sqlite3_sourceid()], +** [sqlite_version()] and [sqlite_source_id()]. +*/ +#define SQLITE_VERSION "3.6.23.1" +#define SQLITE_VERSION_NUMBER 3006023 +#define SQLITE_SOURCE_ID "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e" + +/* +** CAPI3REF: Run-Time Library Version Numbers +** KEYWORDS: sqlite3_version, sqlite3_sourceid +** +** These interfaces provide the same information as the [SQLITE_VERSION], +** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros +** but are associated with the library instead of the header file. ^(Cautious +** programmers might include assert() statements in their application to +** verify that values returned by these interfaces match the macros in +** the header, and thus insure that the application is +** compiled with matching library and header files. +** +**
+** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
+** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+** 
)^ +** +** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] +** macro. ^The sqlite3_libversion() function returns a pointer to the +** to the sqlite3_version[] string constant. The sqlite3_libversion() +** function is provided for use in DLLs since DLL users usually do not have +** direct access to string constants within the DLL. ^The +** sqlite3_libversion_number() function returns an integer equal to +** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns +** a pointer to a string constant whose value is the same as the +** [SQLITE_SOURCE_ID] C preprocessor macro. +** +** See also: [sqlite_version()] and [sqlite_source_id()]. +*/ +SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; +SQLITE_API const char *sqlite3_libversion(void); +SQLITE_API const char *sqlite3_sourceid(void); +SQLITE_API int sqlite3_libversion_number(void); + +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS +/* +** CAPI3REF: Run-Time Library Compilation Options Diagnostics +** +** ^The sqlite3_compileoption_used() function returns 0 or 1 +** indicating whether the specified option was defined at +** compile time. ^The SQLITE_ prefix may be omitted from the +** option name passed to sqlite3_compileoption_used(). +** +** ^The sqlite3_compileoption_get() function allows interating +** over the list of options that were defined at compile time by +** returning the N-th compile time option string. ^If N is out of range, +** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ +** prefix is omitted from any strings returned by +** sqlite3_compileoption_get(). +** +** ^Support for the diagnostic functions sqlite3_compileoption_used() +** and sqlite3_compileoption_get() may be omitted by specifing the +** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. +** +** See also: SQL functions [sqlite_compileoption_used()] and +** [sqlite_compileoption_get()] and the [compile_options pragma]. +*/ +SQLITE_API int sqlite3_compileoption_used(const char *zOptName); +SQLITE_API const char *sqlite3_compileoption_get(int N); +#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ + +/* +** CAPI3REF: Test To See If The Library Is Threadsafe +** +** ^The sqlite3_threadsafe() function returns zero if and only if +** SQLite was compiled mutexing code omitted due to the +** [SQLITE_THREADSAFE] compile-time option being set to 0. +** +** SQLite can be compiled with or without mutexes. When +** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes +** are enabled and SQLite is threadsafe. When the +** [SQLITE_THREADSAFE] macro is 0, +** the mutexes are omitted. Without the mutexes, it is not safe +** to use SQLite concurrently from more than one thread. +** +** Enabling mutexes incurs a measurable performance penalty. +** So if speed is of utmost importance, it makes sense to disable +** the mutexes. But for maximum safety, mutexes should be enabled. +** ^The default behavior is for mutexes to be enabled. +** +** This interface can be used by an application to make sure that the +** version of SQLite that it is linking against was compiled with +** the desired setting of the [SQLITE_THREADSAFE] macro. +** +** This interface only reports on the compile-time mutex setting +** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with +** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but +** can be fully or partially disabled using a call to [sqlite3_config()] +** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], +** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the +** sqlite3_threadsafe() function shows only the compile-time setting of +** thread safety, not any run-time changes to that setting made by +** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() +** is unchanged by calls to sqlite3_config().)^ +** +** See the [threading mode] documentation for additional information. +*/ +SQLITE_API int sqlite3_threadsafe(void); + +/* +** CAPI3REF: Database Connection Handle +** KEYWORDS: {database connection} {database connections} +** +** Each open SQLite database is represented by a pointer to an instance of +** the opaque structure named "sqlite3". It is useful to think of an sqlite3 +** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and +** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] +** is its destructor. There are many other interfaces (such as +** [sqlite3_prepare_v2()], [sqlite3_create_function()], and +** [sqlite3_busy_timeout()] to name but three) that are methods on an +** sqlite3 object. +*/ +typedef struct sqlite3 sqlite3; + +/* +** CAPI3REF: 64-Bit Integer Types +** KEYWORDS: sqlite_int64 sqlite_uint64 +** +** Because there is no cross-platform way to specify 64-bit integer types +** SQLite includes typedefs for 64-bit signed and unsigned integers. +** +** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. +** The sqlite_int64 and sqlite_uint64 types are supported for backwards +** compatibility only. +** +** ^The sqlite3_int64 and sqlite_int64 types can store integer values +** between -9223372036854775808 and +9223372036854775807 inclusive. ^The +** sqlite3_uint64 and sqlite_uint64 types can store integer values +** between 0 and +18446744073709551615 inclusive. +*/ +#ifdef SQLITE_INT64_TYPE + typedef SQLITE_INT64_TYPE sqlite_int64; + typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; +#elif defined(_MSC_VER) || defined(__BORLANDC__) + typedef __int64 sqlite_int64; + typedef unsigned __int64 sqlite_uint64; +#else + typedef long long int sqlite_int64; + typedef unsigned long long int sqlite_uint64; +#endif +typedef sqlite_int64 sqlite3_int64; +typedef sqlite_uint64 sqlite3_uint64; + +/* +** If compiling for a processor that lacks floating point support, +** substitute integer for floating-point. +*/ +#ifdef SQLITE_OMIT_FLOATING_POINT +# define double sqlite3_int64 +#endif + +/* +** CAPI3REF: Closing A Database Connection +** +** ^The sqlite3_close() routine is the destructor for the [sqlite3] object. +** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is +** successfullly destroyed and all associated resources are deallocated. +** +** Applications must [sqlite3_finalize | finalize] all [prepared statements] +** and [sqlite3_blob_close | close] all [BLOB handles] associated with +** the [sqlite3] object prior to attempting to close the object. ^If +** sqlite3_close() is called on a [database connection] that still has +** outstanding [prepared statements] or [BLOB handles], then it returns +** SQLITE_BUSY. +** +** ^If [sqlite3_close()] is invoked while a transaction is open, +** the transaction is automatically rolled back. +** +** The C parameter to [sqlite3_close(C)] must be either a NULL +** pointer or an [sqlite3] object pointer obtained +** from [sqlite3_open()], [sqlite3_open16()], or +** [sqlite3_open_v2()], and not previously closed. +** ^Calling sqlite3_close() with a NULL pointer argument is a +** harmless no-op. +*/ +SQLITE_API int sqlite3_close(sqlite3 *); + +/* +** The type for a callback function. +** This is legacy and deprecated. It is included for historical +** compatibility and is not documented. +*/ +typedef int (*sqlite3_callback)(void*,int,char**, char**); + +/* +** CAPI3REF: One-Step Query Execution Interface +** +** The sqlite3_exec() interface is a convenience wrapper around +** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], +** that allows an application to run multiple statements of SQL +** without having to use a lot of C code. +** +** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, +** semicolon-separate SQL statements passed into its 2nd argument, +** in the context of the [database connection] passed in as its 1st +** argument. ^If the callback function of the 3rd argument to +** sqlite3_exec() is not NULL, then it is invoked for each result row +** coming out of the evaluated SQL statements. ^The 4th argument to +** to sqlite3_exec() is relayed through to the 1st argument of each +** callback invocation. ^If the callback pointer to sqlite3_exec() +** is NULL, then no callback is ever invoked and result rows are +** ignored. +** +** ^If an error occurs while evaluating the SQL statements passed into +** sqlite3_exec(), then execution of the current statement stops and +** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() +** is not NULL then any error message is written into memory obtained +** from [sqlite3_malloc()] and passed back through the 5th parameter. +** To avoid memory leaks, the application should invoke [sqlite3_free()] +** on error message strings returned through the 5th parameter of +** of sqlite3_exec() after the error message string is no longer needed. +** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors +** occur, then sqlite3_exec() sets the pointer in its 5th parameter to +** NULL before returning. +** +** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() +** routine returns SQLITE_ABORT without invoking the callback again and +** without running any subsequent SQL statements. +** +** ^The 2nd argument to the sqlite3_exec() callback function is the +** number of columns in the result. ^The 3rd argument to the sqlite3_exec() +** callback is an array of pointers to strings obtained as if from +** [sqlite3_column_text()], one for each column. ^If an element of a +** result row is NULL then the corresponding string pointer for the +** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the +** sqlite3_exec() callback is an array of pointers to strings where each +** entry represents the name of corresponding result column as obtained +** from [sqlite3_column_name()]. +** +** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer +** to an empty string, or a pointer that contains only whitespace and/or +** SQL comments, then no SQL statements are evaluated and the database +** is not changed. +** +** Restrictions: +** +**
    +**
  • The application must insure that the 1st parameter to sqlite3_exec() +** is a valid and open [database connection]. +**
  • The application must not close [database connection] specified by +** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. +**
  • The application must not modify the SQL statement text passed into +** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. +**
+*/ +SQLITE_API int sqlite3_exec( + sqlite3*, /* An open database */ + const char *sql, /* SQL to be evaluated */ + int (*callback)(void*,int,char**,char**), /* Callback function */ + void *, /* 1st argument to callback */ + char **errmsg /* Error msg written here */ +); + +/* +** CAPI3REF: Result Codes +** KEYWORDS: SQLITE_OK {error code} {error codes} +** KEYWORDS: {result code} {result codes} +** +** Many SQLite functions return an integer result code from the set shown +** here in order to indicates success or failure. +** +** New error codes may be added in future versions of SQLite. +** +** See also: [SQLITE_IOERR_READ | extended result codes] +*/ +#define SQLITE_OK 0 /* Successful result */ +/* beginning-of-error-codes */ +#define SQLITE_ERROR 1 /* SQL error or missing database */ +#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ +#define SQLITE_PERM 3 /* Access permission denied */ +#define SQLITE_ABORT 4 /* Callback routine requested an abort */ +#define SQLITE_BUSY 5 /* The database file is locked */ +#define SQLITE_LOCKED 6 /* A table in the database is locked */ +#define SQLITE_NOMEM 7 /* A malloc() failed */ +#define SQLITE_READONLY 8 /* Attempt to write a readonly database */ +#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ +#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ +#define SQLITE_CORRUPT 11 /* The database disk image is malformed */ +#define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */ +#define SQLITE_FULL 13 /* Insertion failed because database is full */ +#define SQLITE_CANTOPEN 14 /* Unable to open the database file */ +#define SQLITE_PROTOCOL 15 /* NOT USED. Database lock protocol error */ +#define SQLITE_EMPTY 16 /* Database is empty */ +#define SQLITE_SCHEMA 17 /* The database schema changed */ +#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ +#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ +#define SQLITE_MISMATCH 20 /* Data type mismatch */ +#define SQLITE_MISUSE 21 /* Library used incorrectly */ +#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ +#define SQLITE_AUTH 23 /* Authorization denied */ +#define SQLITE_FORMAT 24 /* Auxiliary database format error */ +#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ +#define SQLITE_NOTADB 26 /* File opened that is not a database file */ +#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ +#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ +/* end-of-error-codes */ + +/* +** CAPI3REF: Extended Result Codes +** KEYWORDS: {extended error code} {extended error codes} +** KEYWORDS: {extended result code} {extended result codes} +** +** In its default configuration, SQLite API routines return one of 26 integer +** [SQLITE_OK | result codes]. However, experience has shown that many of +** these result codes are too coarse-grained. They do not provide as +** much information about problems as programmers might like. In an effort to +** address this, newer versions of SQLite (version 3.3.8 and later) include +** support for additional result codes that provide more detailed information +** about errors. The extended result codes are enabled or disabled +** on a per database connection basis using the +** [sqlite3_extended_result_codes()] API. +** +** Some of the available extended result codes are listed here. +** One may expect the number of extended result codes will be expand +** over time. Software that uses extended result codes should expect +** to see new result codes in future releases of SQLite. +** +** The SQLITE_OK result code will never be extended. It will always +** be exactly zero. +*/ +#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) +#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) +#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) +#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) +#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) +#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) +#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) +#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) +#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) +#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) +#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) +#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8)) +#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8)) +#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8)) +#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8)) +#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8)) +#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8)) +#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8) ) + +/* +** CAPI3REF: Flags For File Open Operations +** +** These bit values are intended for use in the +** 3rd parameter to the [sqlite3_open_v2()] interface and +** in the 4th parameter to the xOpen method of the +** [sqlite3_vfs] object. +*/ +#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ +#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ +#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ +#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ +#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ +#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ +#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */ +#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ +#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ +#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ +#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ + +/* +** CAPI3REF: Device Characteristics +** +** The xDeviceCapabilities method of the [sqlite3_io_methods] +** object returns an integer which is a vector of the these +** bit values expressing I/O characteristics of the mass storage +** device that holds the file that the [sqlite3_io_methods] +** refers to. +** +** The SQLITE_IOCAP_ATOMIC property means that all writes of +** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +** mean that writes of blocks that are nnn bytes in size and +** are aligned to an address which is an integer multiple of +** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +** that when data is appended to a file, the data is appended +** first then the size of the file is extended, never the other +** way around. The SQLITE_IOCAP_SEQUENTIAL property means that +** information is written to disk in the same order as calls +** to xWrite(). +*/ +#define SQLITE_IOCAP_ATOMIC 0x00000001 +#define SQLITE_IOCAP_ATOMIC512 0x00000002 +#define SQLITE_IOCAP_ATOMIC1K 0x00000004 +#define SQLITE_IOCAP_ATOMIC2K 0x00000008 +#define SQLITE_IOCAP_ATOMIC4K 0x00000010 +#define SQLITE_IOCAP_ATOMIC8K 0x00000020 +#define SQLITE_IOCAP_ATOMIC16K 0x00000040 +#define SQLITE_IOCAP_ATOMIC32K 0x00000080 +#define SQLITE_IOCAP_ATOMIC64K 0x00000100 +#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 +#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 + +/* +** CAPI3REF: File Locking Levels +** +** SQLite uses one of these integer values as the second +** argument to calls it makes to the xLock() and xUnlock() methods +** of an [sqlite3_io_methods] object. +*/ +#define SQLITE_LOCK_NONE 0 +#define SQLITE_LOCK_SHARED 1 +#define SQLITE_LOCK_RESERVED 2 +#define SQLITE_LOCK_PENDING 3 +#define SQLITE_LOCK_EXCLUSIVE 4 + +/* +** CAPI3REF: Synchronization Type Flags +** +** When SQLite invokes the xSync() method of an +** [sqlite3_io_methods] object it uses a combination of +** these integer values as the second argument. +** +** When the SQLITE_SYNC_DATAONLY flag is used, it means that the +** sync operation only needs to flush data to mass storage. Inode +** information need not be flushed. If the lower four bits of the flag +** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. +** If the lower four bits equal SQLITE_SYNC_FULL, that means +** to use Mac OS X style fullsync instead of fsync(). +*/ +#define SQLITE_SYNC_NORMAL 0x00002 +#define SQLITE_SYNC_FULL 0x00003 +#define SQLITE_SYNC_DATAONLY 0x00010 + +/* +** CAPI3REF: OS Interface Open File Handle +** +** An [sqlite3_file] object represents an open file in the +** [sqlite3_vfs | OS interface layer]. Individual OS interface +** implementations will +** want to subclass this object by appending additional fields +** for their own use. The pMethods entry is a pointer to an +** [sqlite3_io_methods] object that defines methods for performing +** I/O operations on the open file. +*/ +typedef struct sqlite3_file sqlite3_file; +struct sqlite3_file { + const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ +}; + +/* +** CAPI3REF: OS Interface File Virtual Methods Object +** +** Every file opened by the [sqlite3_vfs] xOpen method populates an +** [sqlite3_file] object (or, more commonly, a subclass of the +** [sqlite3_file] object) with a pointer to an instance of this object. +** This object defines the methods used to perform various operations +** against the open file represented by the [sqlite3_file] object. +** +** If the xOpen method sets the sqlite3_file.pMethods element +** to a non-NULL pointer, then the sqlite3_io_methods.xClose method +** may be invoked even if the xOpen reported that it failed. The +** only way to prevent a call to xClose following a failed xOpen +** is for the xOpen to set the sqlite3_file.pMethods element to NULL. +** +** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or +** [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). +** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] +** flag may be ORed in to indicate that only the data of the file +** and not its inode needs to be synced. +** +** The integer values to xLock() and xUnlock() are one of +**
    +**
  • [SQLITE_LOCK_NONE], +**
  • [SQLITE_LOCK_SHARED], +**
  • [SQLITE_LOCK_RESERVED], +**
  • [SQLITE_LOCK_PENDING], or +**
  • [SQLITE_LOCK_EXCLUSIVE]. +**
+** xLock() increases the lock. xUnlock() decreases the lock. +** The xCheckReservedLock() method checks whether any database connection, +** either in this process or in some other process, is holding a RESERVED, +** PENDING, or EXCLUSIVE lock on the file. It returns true +** if such a lock exists and false otherwise. +** +** The xFileControl() method is a generic interface that allows custom +** VFS implementations to directly control an open file using the +** [sqlite3_file_control()] interface. The second "op" argument is an +** integer opcode. The third argument is a generic pointer intended to +** point to a structure that may contain arguments or space in which to +** write return values. Potential uses for xFileControl() might be +** functions to enable blocking locks with timeouts, to change the +** locking strategy (for example to use dot-file locks), to inquire +** about the status of a lock, or to break stale locks. The SQLite +** core reserves all opcodes less than 100 for its own use. +** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available. +** Applications that define a custom xFileControl method should use opcodes +** greater than 100 to avoid conflicts. +** +** The xSectorSize() method returns the sector size of the +** device that underlies the file. The sector size is the +** minimum write that can be performed without disturbing +** other bytes in the file. The xDeviceCharacteristics() +** method returns a bit vector describing behaviors of the +** underlying device: +** +**
    +**
  • [SQLITE_IOCAP_ATOMIC] +**
  • [SQLITE_IOCAP_ATOMIC512] +**
  • [SQLITE_IOCAP_ATOMIC1K] +**
  • [SQLITE_IOCAP_ATOMIC2K] +**
  • [SQLITE_IOCAP_ATOMIC4K] +**
  • [SQLITE_IOCAP_ATOMIC8K] +**
  • [SQLITE_IOCAP_ATOMIC16K] +**
  • [SQLITE_IOCAP_ATOMIC32K] +**
  • [SQLITE_IOCAP_ATOMIC64K] +**
  • [SQLITE_IOCAP_SAFE_APPEND] +**
  • [SQLITE_IOCAP_SEQUENTIAL] +**
+** +** The SQLITE_IOCAP_ATOMIC property means that all writes of +** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +** mean that writes of blocks that are nnn bytes in size and +** are aligned to an address which is an integer multiple of +** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +** that when data is appended to a file, the data is appended +** first then the size of the file is extended, never the other +** way around. The SQLITE_IOCAP_SEQUENTIAL property means that +** information is written to disk in the same order as calls +** to xWrite(). +** +** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill +** in the unread portions of the buffer with zeros. A VFS that +** fails to zero-fill short reads might seem to work. However, +** failure to zero-fill short reads will eventually lead to +** database corruption. +*/ +typedef struct sqlite3_io_methods sqlite3_io_methods; +struct sqlite3_io_methods { + int iVersion; + int (*xClose)(sqlite3_file*); + int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); + int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); + int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); + int (*xSync)(sqlite3_file*, int flags); + int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); + int (*xLock)(sqlite3_file*, int); + int (*xUnlock)(sqlite3_file*, int); + int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); + int (*xFileControl)(sqlite3_file*, int op, void *pArg); + int (*xSectorSize)(sqlite3_file*); + int (*xDeviceCharacteristics)(sqlite3_file*); + /* Additional methods may be added in future releases */ +}; + +/* +** CAPI3REF: Standard File Control Opcodes +** +** These integer constants are opcodes for the xFileControl method +** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] +** interface. +** +** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This +** opcode causes the xFileControl method to write the current state of +** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], +** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) +** into an integer that the pArg argument points to. This capability +** is used during testing and only needs to be supported when SQLITE_TEST +** is defined. +*/ +#define SQLITE_FCNTL_LOCKSTATE 1 +#define SQLITE_GET_LOCKPROXYFILE 2 +#define SQLITE_SET_LOCKPROXYFILE 3 +#define SQLITE_LAST_ERRNO 4 + +/* +** CAPI3REF: Mutex Handle +** +** The mutex module within SQLite defines [sqlite3_mutex] to be an +** abstract type for a mutex object. The SQLite core never looks +** at the internal representation of an [sqlite3_mutex]. It only +** deals with pointers to the [sqlite3_mutex] object. +** +** Mutexes are created using [sqlite3_mutex_alloc()]. +*/ +typedef struct sqlite3_mutex sqlite3_mutex; + +/* +** CAPI3REF: OS Interface Object +** +** An instance of the sqlite3_vfs object defines the interface between +** the SQLite core and the underlying operating system. The "vfs" +** in the name of the object stands for "virtual file system". +** +** The value of the iVersion field is initially 1 but may be larger in +** future versions of SQLite. Additional fields may be appended to this +** object when the iVersion value is increased. Note that the structure +** of the sqlite3_vfs object changes in the transaction between +** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not +** modified. +** +** The szOsFile field is the size of the subclassed [sqlite3_file] +** structure used by this VFS. mxPathname is the maximum length of +** a pathname in this VFS. +** +** Registered sqlite3_vfs objects are kept on a linked list formed by +** the pNext pointer. The [sqlite3_vfs_register()] +** and [sqlite3_vfs_unregister()] interfaces manage this list +** in a thread-safe way. The [sqlite3_vfs_find()] interface +** searches the list. Neither the application code nor the VFS +** implementation should use the pNext pointer. +** +** The pNext field is the only field in the sqlite3_vfs +** structure that SQLite will ever modify. SQLite will only access +** or modify this field while holding a particular static mutex. +** The application should never modify anything within the sqlite3_vfs +** object once the object has been registered. +** +** The zName field holds the name of the VFS module. The name must +** be unique across all VFS modules. +** +** SQLite will guarantee that the zFilename parameter to xOpen +** is either a NULL pointer or string obtained +** from xFullPathname(). SQLite further guarantees that +** the string will be valid and unchanged until xClose() is +** called. Because of the previous sentence, +** the [sqlite3_file] can safely store a pointer to the +** filename if it needs to remember the filename for some reason. +** If the zFilename parameter is xOpen is a NULL pointer then xOpen +** must invent its own temporary name for the file. Whenever the +** xFilename parameter is NULL it will also be the case that the +** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. +** +** The flags argument to xOpen() includes all bits set in +** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] +** or [sqlite3_open16()] is used, then flags includes at least +** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. +** If xOpen() opens a file read-only then it sets *pOutFlags to +** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. +** +** SQLite will also add one of the following flags to the xOpen() +** call, depending on the object being opened: +** +**
    +**
  • [SQLITE_OPEN_MAIN_DB] +**
  • [SQLITE_OPEN_MAIN_JOURNAL] +**
  • [SQLITE_OPEN_TEMP_DB] +**
  • [SQLITE_OPEN_TEMP_JOURNAL] +**
  • [SQLITE_OPEN_TRANSIENT_DB] +**
  • [SQLITE_OPEN_SUBJOURNAL] +**
  • [SQLITE_OPEN_MASTER_JOURNAL] +**
+** +** The file I/O implementation can use the object type flags to +** change the way it deals with files. For example, an application +** that does not care about crash recovery or rollback might make +** the open of a journal file a no-op. Writes to this journal would +** also be no-ops, and any attempt to read the journal would return +** SQLITE_IOERR. Or the implementation might recognize that a database +** file will be doing page-aligned sector reads and writes in a random +** order and set up its I/O subsystem accordingly. +** +** SQLite might also add one of the following flags to the xOpen method: +** +**
    +**
  • [SQLITE_OPEN_DELETEONCLOSE] +**
  • [SQLITE_OPEN_EXCLUSIVE] +**
+** +** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be +** deleted when it is closed. The [SQLITE_OPEN_DELETEONCLOSE] +** will be set for TEMP databases, journals and for subjournals. +** +** The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction +** with the [SQLITE_OPEN_CREATE] flag, which are both directly +** analogous to the O_EXCL and O_CREAT flags of the POSIX open() +** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the +** SQLITE_OPEN_CREATE, is used to indicate that file should always +** be created, and that it is an error if it already exists. +** It is not used to indicate the file should be opened +** for exclusive access. +** +** At least szOsFile bytes of memory are allocated by SQLite +** to hold the [sqlite3_file] structure passed as the third +** argument to xOpen. The xOpen method does not have to +** allocate the structure; it should just fill it in. Note that +** the xOpen method must set the sqlite3_file.pMethods to either +** a valid [sqlite3_io_methods] object or to NULL. xOpen must do +** this even if the open fails. SQLite expects that the sqlite3_file.pMethods +** element will be valid after xOpen returns regardless of the success +** or failure of the xOpen call. +** +** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] +** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to +** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] +** to test whether a file is at least readable. The file can be a +** directory. +** +** SQLite will always allocate at least mxPathname+1 bytes for the +** output buffer xFullPathname. The exact size of the output buffer +** is also passed as a parameter to both methods. If the output buffer +** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is +** handled as a fatal error by SQLite, vfs implementations should endeavor +** to prevent this by setting mxPathname to a sufficiently large value. +** +** The xRandomness(), xSleep(), and xCurrentTime() interfaces +** are not strictly a part of the filesystem, but they are +** included in the VFS structure for completeness. +** The xRandomness() function attempts to return nBytes bytes +** of good-quality randomness into zOut. The return value is +** the actual number of bytes of randomness obtained. +** The xSleep() method causes the calling thread to sleep for at +** least the number of microseconds given. The xCurrentTime() +** method returns a Julian Day Number for the current date and time. +** +*/ +typedef struct sqlite3_vfs sqlite3_vfs; +struct sqlite3_vfs { + int iVersion; /* Structure version number */ + int szOsFile; /* Size of subclassed sqlite3_file */ + int mxPathname; /* Maximum file pathname length */ + sqlite3_vfs *pNext; /* Next registered VFS */ + const char *zName; /* Name of this virtual file system */ + void *pAppData; /* Pointer to application-specific data */ + int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, + int flags, int *pOutFlags); + int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); + int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); + int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); + void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); + void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); + void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); + void (*xDlClose)(sqlite3_vfs*, void*); + int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); + int (*xSleep)(sqlite3_vfs*, int microseconds); + int (*xCurrentTime)(sqlite3_vfs*, double*); + int (*xGetLastError)(sqlite3_vfs*, int, char *); + /* New fields may be appended in figure versions. The iVersion + ** value will increment whenever this happens. */ +}; + +/* +** CAPI3REF: Flags for the xAccess VFS method +** +** These integer constants can be used as the third parameter to +** the xAccess method of an [sqlite3_vfs] object. They determine +** what kind of permissions the xAccess method is looking for. +** With SQLITE_ACCESS_EXISTS, the xAccess method +** simply checks whether the file exists. +** With SQLITE_ACCESS_READWRITE, the xAccess method +** checks whether the file is both readable and writable. +** With SQLITE_ACCESS_READ, the xAccess method +** checks whether the file is readable. +*/ +#define SQLITE_ACCESS_EXISTS 0 +#define SQLITE_ACCESS_READWRITE 1 +#define SQLITE_ACCESS_READ 2 + +/* +** CAPI3REF: Initialize The SQLite Library +** +** ^The sqlite3_initialize() routine initializes the +** SQLite library. ^The sqlite3_shutdown() routine +** deallocates any resources that were allocated by sqlite3_initialize(). +** These routines are designed to aid in process initialization and +** shutdown on embedded systems. Workstation applications using +** SQLite normally do not need to invoke either of these routines. +** +** A call to sqlite3_initialize() is an "effective" call if it is +** the first time sqlite3_initialize() is invoked during the lifetime of +** the process, or if it is the first time sqlite3_initialize() is invoked +** following a call to sqlite3_shutdown(). ^(Only an effective call +** of sqlite3_initialize() does any initialization. All other calls +** are harmless no-ops.)^ +** +** A call to sqlite3_shutdown() is an "effective" call if it is the first +** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only +** an effective call to sqlite3_shutdown() does any deinitialization. +** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ +** +** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() +** is not. The sqlite3_shutdown() interface must only be called from a +** single thread. All open [database connections] must be closed and all +** other SQLite resources must be deallocated prior to invoking +** sqlite3_shutdown(). +** +** Among other things, ^sqlite3_initialize() will invoke +** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() +** will invoke sqlite3_os_end(). +** +** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. +** ^If for some reason, sqlite3_initialize() is unable to initialize +** the library (perhaps it is unable to allocate a needed resource such +** as a mutex) it returns an [error code] other than [SQLITE_OK]. +** +** ^The sqlite3_initialize() routine is called internally by many other +** SQLite interfaces so that an application usually does not need to +** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] +** calls sqlite3_initialize() so the SQLite library will be automatically +** initialized when [sqlite3_open()] is called if it has not be initialized +** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] +** compile-time option, then the automatic calls to sqlite3_initialize() +** are omitted and the application must call sqlite3_initialize() directly +** prior to using any other SQLite interface. For maximum portability, +** it is recommended that applications always invoke sqlite3_initialize() +** directly prior to using any other SQLite interface. Future releases +** of SQLite may require this. In other words, the behavior exhibited +** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the +** default behavior in some future release of SQLite. +** +** The sqlite3_os_init() routine does operating-system specific +** initialization of the SQLite library. The sqlite3_os_end() +** routine undoes the effect of sqlite3_os_init(). Typical tasks +** performed by these routines include allocation or deallocation +** of static resources, initialization of global variables, +** setting up a default [sqlite3_vfs] module, or setting up +** a default configuration using [sqlite3_config()]. +** +** The application should never invoke either sqlite3_os_init() +** or sqlite3_os_end() directly. The application should only invoke +** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() +** interface is called automatically by sqlite3_initialize() and +** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate +** implementations for sqlite3_os_init() and sqlite3_os_end() +** are built into SQLite when it is compiled for Unix, Windows, or OS/2. +** When [custom builds | built for other platforms] +** (using the [SQLITE_OS_OTHER=1] compile-time +** option) the application must supply a suitable implementation for +** sqlite3_os_init() and sqlite3_os_end(). An application-supplied +** implementation of sqlite3_os_init() or sqlite3_os_end() +** must return [SQLITE_OK] on success and some other [error code] upon +** failure. +*/ +SQLITE_API int sqlite3_initialize(void); +SQLITE_API int sqlite3_shutdown(void); +SQLITE_API int sqlite3_os_init(void); +SQLITE_API int sqlite3_os_end(void); + +/* +** CAPI3REF: Configuring The SQLite Library +** +** The sqlite3_config() interface is used to make global configuration +** changes to SQLite in order to tune SQLite to the specific needs of +** the application. The default configuration is recommended for most +** applications and so this routine is usually not necessary. It is +** provided to support rare applications with unusual needs. +** +** The sqlite3_config() interface is not threadsafe. The application +** must insure that no other SQLite interfaces are invoked by other +** threads while sqlite3_config() is running. Furthermore, sqlite3_config() +** may only be invoked prior to library initialization using +** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. +** ^If sqlite3_config() is called after [sqlite3_initialize()] and before +** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. +** Note, however, that ^sqlite3_config() can be called as part of the +** implementation of an application-defined [sqlite3_os_init()]. +** +** The first argument to sqlite3_config() is an integer +** [SQLITE_CONFIG_SINGLETHREAD | configuration option] that determines +** what property of SQLite is to be configured. Subsequent arguments +** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option] +** in the first argument. +** +** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. +** ^If the option is unknown or SQLite is unable to set the option +** then this routine returns a non-zero [error code]. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_config(int, ...); + +/* +** CAPI3REF: Configure database connections +** EXPERIMENTAL +** +** The sqlite3_db_config() interface is used to make configuration +** changes to a [database connection]. The interface is similar to +** [sqlite3_config()] except that the changes apply to a single +** [database connection] (specified in the first argument). The +** sqlite3_db_config() interface should only be used immediately after +** the database connection is created using [sqlite3_open()], +** [sqlite3_open16()], or [sqlite3_open_v2()]. +** +** The second argument to sqlite3_db_config(D,V,...) is the +** configuration verb - an integer code that indicates what +** aspect of the [database connection] is being configured. +** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE]. +** New verbs are likely to be added in future releases of SQLite. +** Additional arguments depend on the verb. +** +** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if +** the call is considered successful. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_config(sqlite3*, int op, ...); + +/* +** CAPI3REF: Memory Allocation Routines +** EXPERIMENTAL +** +** An instance of this object defines the interface between SQLite +** and low-level memory allocation routines. +** +** This object is used in only one place in the SQLite interface. +** A pointer to an instance of this object is the argument to +** [sqlite3_config()] when the configuration option is +** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. +** By creating an instance of this object +** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) +** during configuration, an application can specify an alternative +** memory allocation subsystem for SQLite to use for all of its +** dynamic memory needs. +** +** Note that SQLite comes with several [built-in memory allocators] +** that are perfectly adequate for the overwhelming majority of applications +** and that this object is only useful to a tiny minority of applications +** with specialized memory allocation requirements. This object is +** also used during testing of SQLite in order to specify an alternative +** memory allocator that simulates memory out-of-memory conditions in +** order to verify that SQLite recovers gracefully from such +** conditions. +** +** The xMalloc and xFree methods must work like the +** malloc() and free() functions from the standard C library. +** The xRealloc method must work like realloc() from the standard C library +** with the exception that if the second argument to xRealloc is zero, +** xRealloc must be a no-op - it must not perform any allocation or +** deallocation. ^SQLite guarantees that the second argument to +** xRealloc is always a value returned by a prior call to xRoundup. +** And so in cases where xRoundup always returns a positive number, +** xRealloc can perform exactly as the standard library realloc() and +** still be in compliance with this specification. +** +** xSize should return the allocated size of a memory allocation +** previously obtained from xMalloc or xRealloc. The allocated size +** is always at least as big as the requested size but may be larger. +** +** The xRoundup method returns what would be the allocated size of +** a memory allocation given a particular requested size. Most memory +** allocators round up memory allocations at least to the next multiple +** of 8. Some allocators round up to a larger multiple or to a power of 2. +** Every memory allocation request coming in through [sqlite3_malloc()] +** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, +** that causes the corresponding memory allocation to fail. +** +** The xInit method initializes the memory allocator. (For example, +** it might allocate any require mutexes or initialize internal data +** structures. The xShutdown method is invoked (indirectly) by +** [sqlite3_shutdown()] and should deallocate any resources acquired +** by xInit. The pAppData pointer is used as the only parameter to +** xInit and xShutdown. +** +** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes +** the xInit method, so the xInit method need not be threadsafe. The +** xShutdown method is only called from [sqlite3_shutdown()] so it does +** not need to be threadsafe either. For all other methods, SQLite +** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the +** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which +** it is by default) and so the methods are automatically serialized. +** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other +** methods must be threadsafe or else make their own arrangements for +** serialization. +** +** SQLite will never invoke xInit() more than once without an intervening +** call to xShutdown(). +*/ +typedef struct sqlite3_mem_methods sqlite3_mem_methods; +struct sqlite3_mem_methods { + void *(*xMalloc)(int); /* Memory allocation function */ + void (*xFree)(void*); /* Free a prior allocation */ + void *(*xRealloc)(void*,int); /* Resize an allocation */ + int (*xSize)(void*); /* Return the size of an allocation */ + int (*xRoundup)(int); /* Round up request size to allocation size */ + int (*xInit)(void*); /* Initialize the memory allocator */ + void (*xShutdown)(void*); /* Deinitialize the memory allocator */ + void *pAppData; /* Argument to xInit() and xShutdown() */ +}; + +/* +** CAPI3REF: Configuration Options +** EXPERIMENTAL +** +** These constants are the available integer configuration options that +** can be passed as the first argument to the [sqlite3_config()] interface. +** +** New configuration options may be added in future releases of SQLite. +** Existing configuration options might be discontinued. Applications +** should check the return code from [sqlite3_config()] to make sure that +** the call worked. The [sqlite3_config()] interface will return a +** non-zero [error code] if a discontinued or unsupported configuration option +** is invoked. +** +**
+**
SQLITE_CONFIG_SINGLETHREAD
+**
There are no arguments to this option. ^This option sets the +** [threading mode] to Single-thread. In other words, it disables +** all mutexing and puts SQLite into a mode where it can only be used +** by a single thread. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** it is not possible to change the [threading mode] from its default +** value of Single-thread and so [sqlite3_config()] will return +** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD +** configuration option.
+** +**
SQLITE_CONFIG_MULTITHREAD
+**
There are no arguments to this option. ^This option sets the +** [threading mode] to Multi-thread. In other words, it disables +** mutexing on [database connection] and [prepared statement] objects. +** The application is responsible for serializing access to +** [database connections] and [prepared statements]. But other mutexes +** are enabled so that SQLite will be safe to use in a multi-threaded +** environment as long as no two threads attempt to use the same +** [database connection] at the same time. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** it is not possible to set the Multi-thread [threading mode] and +** [sqlite3_config()] will return [SQLITE_ERROR] if called with the +** SQLITE_CONFIG_MULTITHREAD configuration option.
+** +**
SQLITE_CONFIG_SERIALIZED
+**
There are no arguments to this option. ^This option sets the +** [threading mode] to Serialized. In other words, this option enables +** all mutexes including the recursive +** mutexes on [database connection] and [prepared statement] objects. +** In this mode (which is the default when SQLite is compiled with +** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access +** to [database connections] and [prepared statements] so that the +** application is free to use the same [database connection] or the +** same [prepared statement] in different threads at the same time. +** ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** it is not possible to set the Serialized [threading mode] and +** [sqlite3_config()] will return [SQLITE_ERROR] if called with the +** SQLITE_CONFIG_SERIALIZED configuration option.
+** +**
SQLITE_CONFIG_MALLOC
+**
^(This option takes a single argument which is a pointer to an +** instance of the [sqlite3_mem_methods] structure. The argument specifies +** alternative low-level memory allocation routines to be used in place of +** the memory allocation routines built into SQLite.)^ ^SQLite makes +** its own private copy of the content of the [sqlite3_mem_methods] structure +** before the [sqlite3_config()] call returns.
+** +**
SQLITE_CONFIG_GETMALLOC
+**
^(This option takes a single argument which is a pointer to an +** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods] +** structure is filled with the currently defined memory allocation routines.)^ +** This option can be used to overload the default memory allocation +** routines with a wrapper that simulations memory allocation failure or +** tracks memory usage, for example.
+** +**
SQLITE_CONFIG_MEMSTATUS
+**
^This option takes single argument of type int, interpreted as a +** boolean, which enables or disables the collection of memory allocation +** statistics. ^(When memory allocation statistics are disabled, the +** following SQLite interfaces become non-operational: +**
    +**
  • [sqlite3_memory_used()] +**
  • [sqlite3_memory_highwater()] +**
  • [sqlite3_soft_heap_limit()] +**
  • [sqlite3_status()] +**
)^ +** ^Memory allocation statistics are enabled by default unless SQLite is +** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory +** allocation statistics are disabled by default. +**
+** +**
SQLITE_CONFIG_SCRATCH
+**
^This option specifies a static memory buffer that SQLite can use for +** scratch memory. There are three arguments: A pointer an 8-byte +** aligned memory buffer from which the scrach allocations will be +** drawn, the size of each scratch allocation (sz), +** and the maximum number of scratch allocations (N). The sz +** argument must be a multiple of 16. The sz parameter should be a few bytes +** larger than the actual scratch space required due to internal overhead. +** The first argument must be a pointer to an 8-byte aligned buffer +** of at least sz*N bytes of memory. +** ^SQLite will use no more than one scratch buffer per thread. So +** N should be set to the expected maximum number of threads. ^SQLite will +** never require a scratch buffer that is more than 6 times the database +** page size. ^If SQLite needs needs additional scratch memory beyond +** what is provided by this configuration option, then +** [sqlite3_malloc()] will be used to obtain the memory needed.
+** +**
SQLITE_CONFIG_PAGECACHE
+**
^This option specifies a static memory buffer that SQLite can use for +** the database page cache with the default page cache implemenation. +** This configuration should not be used if an application-define page +** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option. +** There are three arguments to this option: A pointer to 8-byte aligned +** memory, the size of each page buffer (sz), and the number of pages (N). +** The sz argument should be the size of the largest database page +** (a power of two between 512 and 32768) plus a little extra for each +** page header. ^The page header size is 20 to 40 bytes depending on +** the host architecture. ^It is harmless, apart from the wasted memory, +** to make sz a little too large. The first +** argument should point to an allocation of at least sz*N bytes of memory. +** ^SQLite will use the memory provided by the first argument to satisfy its +** memory needs for the first N pages that it adds to cache. ^If additional +** page cache memory is needed beyond what is provided by this option, then +** SQLite goes to [sqlite3_malloc()] for the additional storage space. +** ^The implementation might use one or more of the N buffers to hold +** memory accounting information. The pointer in the first argument must +** be aligned to an 8-byte boundary or subsequent behavior of SQLite +** will be undefined.
+** +**
SQLITE_CONFIG_HEAP
+**
^This option specifies a static memory buffer that SQLite will use +** for all of its dynamic memory allocation needs beyond those provided +** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE]. +** There are three arguments: An 8-byte aligned pointer to the memory, +** the number of bytes in the memory buffer, and the minimum allocation size. +** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts +** to using its default memory allocator (the system malloc() implementation), +** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the +** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or +** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory +** allocator is engaged to handle all of SQLites memory allocation needs. +** The first pointer (the memory pointer) must be aligned to an 8-byte +** boundary or subsequent behavior of SQLite will be undefined.
+** +**
SQLITE_CONFIG_MUTEX
+**
^(This option takes a single argument which is a pointer to an +** instance of the [sqlite3_mutex_methods] structure. The argument specifies +** alternative low-level mutex routines to be used in place +** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the +** content of the [sqlite3_mutex_methods] structure before the call to +** [sqlite3_config()] returns. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** the entire mutexing subsystem is omitted from the build and hence calls to +** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will +** return [SQLITE_ERROR].
+** +**
SQLITE_CONFIG_GETMUTEX
+**
^(This option takes a single argument which is a pointer to an +** instance of the [sqlite3_mutex_methods] structure. The +** [sqlite3_mutex_methods] +** structure is filled with the currently defined mutex routines.)^ +** This option can be used to overload the default mutex allocation +** routines with a wrapper used to track mutex usage for performance +** profiling or testing, for example. ^If SQLite is compiled with +** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then +** the entire mutexing subsystem is omitted from the build and hence calls to +** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will +** return [SQLITE_ERROR].
+** +**
SQLITE_CONFIG_LOOKASIDE
+**
^(This option takes two arguments that determine the default +** memory allocation for the lookaside memory allocator on each +** [database connection]. The first argument is the +** size of each lookaside buffer slot and the second is the number of +** slots allocated to each database connection.)^ ^(This option sets the +** default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] +** verb to [sqlite3_db_config()] can be used to change the lookaside +** configuration on individual connections.)^
+** +**
SQLITE_CONFIG_PCACHE
+**
^(This option takes a single argument which is a pointer to +** an [sqlite3_pcache_methods] object. This object specifies the interface +** to a custom page cache implementation.)^ ^SQLite makes a copy of the +** object and uses it for page cache memory allocations.
+** +**
SQLITE_CONFIG_GETPCACHE
+**
^(This option takes a single argument which is a pointer to an +** [sqlite3_pcache_methods] object. SQLite copies of the current +** page cache implementation into that object.)^
+** +**
+*/ +#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ +#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ +#define SQLITE_CONFIG_SERIALIZED 3 /* nil */ +#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ +#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ +#define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ +#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ +#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ +#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ +#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ +#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ +/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ +#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ +#define SQLITE_CONFIG_PCACHE 14 /* sqlite3_pcache_methods* */ +#define SQLITE_CONFIG_GETPCACHE 15 /* sqlite3_pcache_methods* */ +#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ + +/* +** CAPI3REF: Configuration Options +** EXPERIMENTAL +** +** These constants are the available integer configuration options that +** can be passed as the second argument to the [sqlite3_db_config()] interface. +** +** New configuration options may be added in future releases of SQLite. +** Existing configuration options might be discontinued. Applications +** should check the return code from [sqlite3_db_config()] to make sure that +** the call worked. ^The [sqlite3_db_config()] interface will return a +** non-zero [error code] if a discontinued or unsupported configuration option +** is invoked. +** +**
+**
SQLITE_DBCONFIG_LOOKASIDE
+**
^This option takes three additional arguments that determine the +** [lookaside memory allocator] configuration for the [database connection]. +** ^The first argument (the third parameter to [sqlite3_db_config()] is a +** pointer to an memory buffer to use for lookaside memory. +** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb +** may be NULL in which case SQLite will allocate the +** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the +** size of each lookaside buffer slot. ^The third argument is the number of +** slots. The size of the buffer in the first argument must be greater than +** or equal to the product of the second and third arguments. The buffer +** must be aligned to an 8-byte boundary. ^If the second argument to +** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally +** rounded down to the next smaller +** multiple of 8. See also: [SQLITE_CONFIG_LOOKASIDE]
+** +**
+*/ +#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ + + +/* +** CAPI3REF: Enable Or Disable Extended Result Codes +** +** ^The sqlite3_extended_result_codes() routine enables or disables the +** [extended result codes] feature of SQLite. ^The extended result +** codes are disabled by default for historical compatibility. +*/ +SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); + +/* +** CAPI3REF: Last Insert Rowid +** +** ^Each entry in an SQLite table has a unique 64-bit signed +** integer key called the [ROWID | "rowid"]. ^The rowid is always available +** as an undeclared column named ROWID, OID, or _ROWID_ as long as those +** names are not also used by explicitly declared columns. ^If +** the table has a column of type [INTEGER PRIMARY KEY] then that column +** is another alias for the rowid. +** +** ^This routine returns the [rowid] of the most recent +** successful [INSERT] into the database from the [database connection] +** in the first argument. ^If no successful [INSERT]s +** have ever occurred on that database connection, zero is returned. +** +** ^(If an [INSERT] occurs within a trigger, then the [rowid] of the inserted +** row is returned by this routine as long as the trigger is running. +** But once the trigger terminates, the value returned by this routine +** reverts to the last value inserted before the trigger fired.)^ +** +** ^An [INSERT] that fails due to a constraint violation is not a +** successful [INSERT] and does not change the value returned by this +** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, +** and INSERT OR ABORT make no changes to the return value of this +** routine when their insertion fails. ^(When INSERT OR REPLACE +** encounters a constraint violation, it does not fail. The +** INSERT continues to completion after deleting rows that caused +** the constraint problem so INSERT OR REPLACE will always change +** the return value of this interface.)^ +** +** ^For the purposes of this routine, an [INSERT] is considered to +** be successful even if it is subsequently rolled back. +** +** This function is accessible to SQL statements via the +** [last_insert_rowid() SQL function]. +** +** If a separate thread performs a new [INSERT] on the same +** database connection while the [sqlite3_last_insert_rowid()] +** function is running and thus changes the last insert [rowid], +** then the value returned by [sqlite3_last_insert_rowid()] is +** unpredictable and might not equal either the old or the new +** last insert [rowid]. +*/ +SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); + +/* +** CAPI3REF: Count The Number Of Rows Modified +** +** ^This function returns the number of database rows that were changed +** or inserted or deleted by the most recently completed SQL statement +** on the [database connection] specified by the first parameter. +** ^(Only changes that are directly specified by the [INSERT], [UPDATE], +** or [DELETE] statement are counted. Auxiliary changes caused by +** triggers or [foreign key actions] are not counted.)^ Use the +** [sqlite3_total_changes()] function to find the total number of changes +** including changes caused by triggers and foreign key actions. +** +** ^Changes to a view that are simulated by an [INSTEAD OF trigger] +** are not counted. Only real table changes are counted. +** +** ^(A "row change" is a change to a single row of a single table +** caused by an INSERT, DELETE, or UPDATE statement. Rows that +** are changed as side effects of [REPLACE] constraint resolution, +** rollback, ABORT processing, [DROP TABLE], or by any other +** mechanisms do not count as direct row changes.)^ +** +** A "trigger context" is a scope of execution that begins and +** ends with the script of a [CREATE TRIGGER | trigger]. +** Most SQL statements are +** evaluated outside of any trigger. This is the "top level" +** trigger context. If a trigger fires from the top level, a +** new trigger context is entered for the duration of that one +** trigger. Subtriggers create subcontexts for their duration. +** +** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does +** not create a new trigger context. +** +** ^This function returns the number of direct row changes in the +** most recent INSERT, UPDATE, or DELETE statement within the same +** trigger context. +** +** ^Thus, when called from the top level, this function returns the +** number of changes in the most recent INSERT, UPDATE, or DELETE +** that also occurred at the top level. ^(Within the body of a trigger, +** the sqlite3_changes() interface can be called to find the number of +** changes in the most recently completed INSERT, UPDATE, or DELETE +** statement within the body of the same trigger. +** However, the number returned does not include changes +** caused by subtriggers since those have their own context.)^ +** +** See also the [sqlite3_total_changes()] interface, the +** [count_changes pragma], and the [changes() SQL function]. +** +** If a separate thread makes changes on the same database connection +** while [sqlite3_changes()] is running then the value returned +** is unpredictable and not meaningful. +*/ +SQLITE_API int sqlite3_changes(sqlite3*); + +/* +** CAPI3REF: Total Number Of Rows Modified +** +** ^This function returns the number of row changes caused by [INSERT], +** [UPDATE] or [DELETE] statements since the [database connection] was opened. +** ^(The count returned by sqlite3_total_changes() includes all changes +** from all [CREATE TRIGGER | trigger] contexts and changes made by +** [foreign key actions]. However, +** the count does not include changes used to implement [REPLACE] constraints, +** do rollbacks or ABORT processing, or [DROP TABLE] processing. The +** count does not include rows of views that fire an [INSTEAD OF trigger], +** though if the INSTEAD OF trigger makes changes of its own, those changes +** are counted.)^ +** ^The sqlite3_total_changes() function counts the changes as soon as +** the statement that makes them is completed (when the statement handle +** is passed to [sqlite3_reset()] or [sqlite3_finalize()]). +** +** See also the [sqlite3_changes()] interface, the +** [count_changes pragma], and the [total_changes() SQL function]. +** +** If a separate thread makes changes on the same database connection +** while [sqlite3_total_changes()] is running then the value +** returned is unpredictable and not meaningful. +*/ +SQLITE_API int sqlite3_total_changes(sqlite3*); + +/* +** CAPI3REF: Interrupt A Long-Running Query +** +** ^This function causes any pending database operation to abort and +** return at its earliest opportunity. This routine is typically +** called in response to a user action such as pressing "Cancel" +** or Ctrl-C where the user wants a long query operation to halt +** immediately. +** +** ^It is safe to call this routine from a thread different from the +** thread that is currently running the database operation. But it +** is not safe to call this routine with a [database connection] that +** is closed or might close before sqlite3_interrupt() returns. +** +** ^If an SQL operation is very nearly finished at the time when +** sqlite3_interrupt() is called, then it might not have an opportunity +** to be interrupted and might continue to completion. +** +** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. +** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE +** that is inside an explicit transaction, then the entire transaction +** will be rolled back automatically. +** +** ^The sqlite3_interrupt(D) call is in effect until all currently running +** SQL statements on [database connection] D complete. ^Any new SQL statements +** that are started after the sqlite3_interrupt() call and before the +** running statements reaches zero are interrupted as if they had been +** running prior to the sqlite3_interrupt() call. ^New SQL statements +** that are started after the running statement count reaches zero are +** not effected by the sqlite3_interrupt(). +** ^A call to sqlite3_interrupt(D) that occurs when there are no running +** SQL statements is a no-op and has no effect on SQL statements +** that are started after the sqlite3_interrupt() call returns. +** +** If the database connection closes while [sqlite3_interrupt()] +** is running then bad things will likely happen. +*/ +SQLITE_API void sqlite3_interrupt(sqlite3*); + +/* +** CAPI3REF: Determine If An SQL Statement Is Complete +** +** These routines are useful during command-line input to determine if the +** currently entered text seems to form a complete SQL statement or +** if additional input is needed before sending the text into +** SQLite for parsing. ^These routines return 1 if the input string +** appears to be a complete SQL statement. ^A statement is judged to be +** complete if it ends with a semicolon token and is not a prefix of a +** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within +** string literals or quoted identifier names or comments are not +** independent tokens (they are part of the token in which they are +** embedded) and thus do not count as a statement terminator. ^Whitespace +** and comments that follow the final semicolon are ignored. +** +** ^These routines return 0 if the statement is incomplete. ^If a +** memory allocation fails, then SQLITE_NOMEM is returned. +** +** ^These routines do not parse the SQL statements thus +** will not detect syntactically incorrect SQL. +** +** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior +** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked +** automatically by sqlite3_complete16(). If that initialization fails, +** then the return value from sqlite3_complete16() will be non-zero +** regardless of whether or not the input SQL is complete.)^ +** +** The input to [sqlite3_complete()] must be a zero-terminated +** UTF-8 string. +** +** The input to [sqlite3_complete16()] must be a zero-terminated +** UTF-16 string in native byte order. +*/ +SQLITE_API int sqlite3_complete(const char *sql); +SQLITE_API int sqlite3_complete16(const void *sql); + +/* +** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors +** +** ^This routine sets a callback function that might be invoked whenever +** an attempt is made to open a database table that another thread +** or process has locked. +** +** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] +** is returned immediately upon encountering the lock. ^If the busy callback +** is not NULL, then the callback might be invoked with two arguments. +** +** ^The first argument to the busy handler is a copy of the void* pointer which +** is the third argument to sqlite3_busy_handler(). ^The second argument to +** the busy handler callback is the number of times that the busy handler has +** been invoked for this locking event. ^If the +** busy callback returns 0, then no additional attempts are made to +** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned. +** ^If the callback returns non-zero, then another attempt +** is made to open the database for reading and the cycle repeats. +** +** The presence of a busy handler does not guarantee that it will be invoked +** when there is lock contention. ^If SQLite determines that invoking the busy +** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] +** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler. +** Consider a scenario where one process is holding a read lock that +** it is trying to promote to a reserved lock and +** a second process is holding a reserved lock that it is trying +** to promote to an exclusive lock. The first process cannot proceed +** because it is blocked by the second and the second process cannot +** proceed because it is blocked by the first. If both processes +** invoke the busy handlers, neither will make any progress. Therefore, +** SQLite returns [SQLITE_BUSY] for the first process, hoping that this +** will induce the first process to release its read lock and allow +** the second process to proceed. +** +** ^The default busy callback is NULL. +** +** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] +** when SQLite is in the middle of a large transaction where all the +** changes will not fit into the in-memory cache. SQLite will +** already hold a RESERVED lock on the database file, but it needs +** to promote this lock to EXCLUSIVE so that it can spill cache +** pages into the database file without harm to concurrent +** readers. ^If it is unable to promote the lock, then the in-memory +** cache will be left in an inconsistent state and so the error +** code is promoted from the relatively benign [SQLITE_BUSY] to +** the more severe [SQLITE_IOERR_BLOCKED]. ^This error code promotion +** forces an automatic rollback of the changes. See the +** +** CorruptionFollowingBusyError wiki page for a discussion of why +** this is important. +** +** ^(There can only be a single busy handler defined for each +** [database connection]. Setting a new busy handler clears any +** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] +** will also set or clear the busy handler. +** +** The busy callback should not take any actions which modify the +** database connection that invoked the busy handler. Any such actions +** result in undefined behavior. +** +** A busy handler must not close the database connection +** or [prepared statement] that invoked the busy handler. +*/ +SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); + +/* +** CAPI3REF: Set A Busy Timeout +** +** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps +** for a specified amount of time when a table is locked. ^The handler +** will sleep multiple times until at least "ms" milliseconds of sleeping +** have accumulated. ^After at least "ms" milliseconds of sleeping, +** the handler returns 0 which causes [sqlite3_step()] to return +** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]. +** +** ^Calling this routine with an argument less than or equal to zero +** turns off all busy handlers. +** +** ^(There can only be a single busy handler for a particular +** [database connection] any any given moment. If another busy handler +** was defined (using [sqlite3_busy_handler()]) prior to calling +** this routine, that other busy handler is cleared.)^ +*/ +SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); + +/* +** CAPI3REF: Convenience Routines For Running Queries +** +** Definition: A result table is memory data structure created by the +** [sqlite3_get_table()] interface. A result table records the +** complete query results from one or more queries. +** +** The table conceptually has a number of rows and columns. But +** these numbers are not part of the result table itself. These +** numbers are obtained separately. Let N be the number of rows +** and M be the number of columns. +** +** A result table is an array of pointers to zero-terminated UTF-8 strings. +** There are (N+1)*M elements in the array. The first M pointers point +** to zero-terminated strings that contain the names of the columns. +** The remaining entries all point to query results. NULL values result +** in NULL pointers. All other values are in their UTF-8 zero-terminated +** string representation as returned by [sqlite3_column_text()]. +** +** A result table might consist of one or more memory allocations. +** It is not safe to pass a result table directly to [sqlite3_free()]. +** A result table should be deallocated using [sqlite3_free_table()]. +** +** As an example of the result table format, suppose a query result +** is as follows: +** +**
+**        Name        | Age
+**        -----------------------
+**        Alice       | 43
+**        Bob         | 28
+**        Cindy       | 21
+** 
+** +** There are two column (M==2) and three rows (N==3). Thus the +** result table has 8 entries. Suppose the result table is stored +** in an array names azResult. Then azResult holds this content: +** +**
+**        azResult[0] = "Name";
+**        azResult[1] = "Age";
+**        azResult[2] = "Alice";
+**        azResult[3] = "43";
+**        azResult[4] = "Bob";
+**        azResult[5] = "28";
+**        azResult[6] = "Cindy";
+**        azResult[7] = "21";
+** 
+** +** ^The sqlite3_get_table() function evaluates one or more +** semicolon-separated SQL statements in the zero-terminated UTF-8 +** string of its 2nd parameter and returns a result table to the +** pointer given in its 3rd parameter. +** +** After the application has finished with the result from sqlite3_get_table(), +** it should pass the result table pointer to sqlite3_free_table() in order to +** release the memory that was malloced. Because of the way the +** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling +** function must not try to call [sqlite3_free()] directly. Only +** [sqlite3_free_table()] is able to release the memory properly and safely. +** +** ^(The sqlite3_get_table() interface is implemented as a wrapper around +** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access +** to any internal data structures of SQLite. It uses only the public +** interface defined here. As a consequence, errors that occur in the +** wrapper layer outside of the internal [sqlite3_exec()] call are not +** reflected in subsequent calls to [sqlite3_errcode()] or +** [sqlite3_errmsg()].)^ +*/ +SQLITE_API int sqlite3_get_table( + sqlite3 *db, /* An open database */ + const char *zSql, /* SQL to be evaluated */ + char ***pazResult, /* Results of the query */ + int *pnRow, /* Number of result rows written here */ + int *pnColumn, /* Number of result columns written here */ + char **pzErrmsg /* Error msg written here */ +); +SQLITE_API void sqlite3_free_table(char **result); + +/* +** CAPI3REF: Formatted String Printing Functions +** +** These routines are work-alikes of the "printf()" family of functions +** from the standard C library. +** +** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their +** results into memory obtained from [sqlite3_malloc()]. +** The strings returned by these two routines should be +** released by [sqlite3_free()]. ^Both routines return a +** NULL pointer if [sqlite3_malloc()] is unable to allocate enough +** memory to hold the resulting string. +** +** ^(In sqlite3_snprintf() routine is similar to "snprintf()" from +** the standard C library. The result is written into the +** buffer supplied as the second parameter whose size is given by +** the first parameter. Note that the order of the +** first two parameters is reversed from snprintf().)^ This is an +** historical accident that cannot be fixed without breaking +** backwards compatibility. ^(Note also that sqlite3_snprintf() +** returns a pointer to its buffer instead of the number of +** characters actually written into the buffer.)^ We admit that +** the number of characters written would be a more useful return +** value but we cannot change the implementation of sqlite3_snprintf() +** now without breaking compatibility. +** +** ^As long as the buffer size is greater than zero, sqlite3_snprintf() +** guarantees that the buffer is always zero-terminated. ^The first +** parameter "n" is the total size of the buffer, including space for +** the zero terminator. So the longest string that can be completely +** written will be n-1 characters. +** +** These routines all implement some additional formatting +** options that are useful for constructing SQL statements. +** All of the usual printf() formatting options apply. In addition, there +** is are "%q", "%Q", and "%z" options. +** +** ^(The %q option works like %s in that it substitutes a null-terminated +** string from the argument list. But %q also doubles every '\'' character. +** %q is designed for use inside a string literal.)^ By doubling each '\'' +** character it escapes that character and allows it to be inserted into +** the string. +** +** For example, assume the string variable zText contains text as follows: +** +**
+**  char *zText = "It's a happy day!";
+** 
+** +** One can use this text in an SQL statement as follows: +** +**
+**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
+**  sqlite3_exec(db, zSQL, 0, 0, 0);
+**  sqlite3_free(zSQL);
+** 
+** +** Because the %q format string is used, the '\'' character in zText +** is escaped and the SQL generated is as follows: +** +**
+**  INSERT INTO table1 VALUES('It''s a happy day!')
+** 
+** +** This is correct. Had we used %s instead of %q, the generated SQL +** would have looked like this: +** +**
+**  INSERT INTO table1 VALUES('It's a happy day!');
+** 
+** +** This second example is an SQL syntax error. As a general rule you should +** always use %q instead of %s when inserting text into a string literal. +** +** ^(The %Q option works like %q except it also adds single quotes around +** the outside of the total string. Additionally, if the parameter in the +** argument list is a NULL pointer, %Q substitutes the text "NULL" (without +** single quotes).)^ So, for example, one could say: +** +**
+**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
+**  sqlite3_exec(db, zSQL, 0, 0, 0);
+**  sqlite3_free(zSQL);
+** 
+** +** The code above will render a correct SQL statement in the zSQL +** variable even if the zText variable is a NULL pointer. +** +** ^(The "%z" formatting option works like "%s" but with the +** addition that after the string has been read and copied into +** the result, [sqlite3_free()] is called on the input string.)^ +*/ +SQLITE_API char *sqlite3_mprintf(const char*,...); +SQLITE_API char *sqlite3_vmprintf(const char*, va_list); +SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); + +/* +** CAPI3REF: Memory Allocation Subsystem +** +** The SQLite core uses these three routines for all of its own +** internal memory allocation needs. "Core" in the previous sentence +** does not include operating-system specific VFS implementation. The +** Windows VFS uses native malloc() and free() for some operations. +** +** ^The sqlite3_malloc() routine returns a pointer to a block +** of memory at least N bytes in length, where N is the parameter. +** ^If sqlite3_malloc() is unable to obtain sufficient free +** memory, it returns a NULL pointer. ^If the parameter N to +** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns +** a NULL pointer. +** +** ^Calling sqlite3_free() with a pointer previously returned +** by sqlite3_malloc() or sqlite3_realloc() releases that memory so +** that it might be reused. ^The sqlite3_free() routine is +** a no-op if is called with a NULL pointer. Passing a NULL pointer +** to sqlite3_free() is harmless. After being freed, memory +** should neither be read nor written. Even reading previously freed +** memory might result in a segmentation fault or other severe error. +** Memory corruption, a segmentation fault, or other severe error +** might result if sqlite3_free() is called with a non-NULL pointer that +** was not obtained from sqlite3_malloc() or sqlite3_realloc(). +** +** ^(The sqlite3_realloc() interface attempts to resize a +** prior memory allocation to be at least N bytes, where N is the +** second parameter. The memory allocation to be resized is the first +** parameter.)^ ^ If the first parameter to sqlite3_realloc() +** is a NULL pointer then its behavior is identical to calling +** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc(). +** ^If the second parameter to sqlite3_realloc() is zero or +** negative then the behavior is exactly the same as calling +** sqlite3_free(P) where P is the first parameter to sqlite3_realloc(). +** ^sqlite3_realloc() returns a pointer to a memory allocation +** of at least N bytes in size or NULL if sufficient memory is unavailable. +** ^If M is the size of the prior allocation, then min(N,M) bytes +** of the prior allocation are copied into the beginning of buffer returned +** by sqlite3_realloc() and the prior allocation is freed. +** ^If sqlite3_realloc() returns NULL, then the prior allocation +** is not freed. +** +** ^The memory returned by sqlite3_malloc() and sqlite3_realloc() +** is always aligned to at least an 8 byte boundary. +** +** In SQLite version 3.5.0 and 3.5.1, it was possible to define +** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in +** implementation of these routines to be omitted. That capability +** is no longer provided. Only built-in memory allocators can be used. +** +** The Windows OS interface layer calls +** the system malloc() and free() directly when converting +** filenames between the UTF-8 encoding used by SQLite +** and whatever filename encoding is used by the particular Windows +** installation. Memory allocation errors are detected, but +** they are reported back as [SQLITE_CANTOPEN] or +** [SQLITE_IOERR] rather than [SQLITE_NOMEM]. +** +** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] +** must be either NULL or else pointers obtained from a prior +** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have +** not yet been released. +** +** The application must not read or write any part of +** a block of memory after it has been released using +** [sqlite3_free()] or [sqlite3_realloc()]. +*/ +SQLITE_API void *sqlite3_malloc(int); +SQLITE_API void *sqlite3_realloc(void*, int); +SQLITE_API void sqlite3_free(void*); + +/* +** CAPI3REF: Memory Allocator Statistics +** +** SQLite provides these two interfaces for reporting on the status +** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] +** routines, which form the built-in memory allocation subsystem. +** +** ^The [sqlite3_memory_used()] routine returns the number of bytes +** of memory currently outstanding (malloced but not freed). +** ^The [sqlite3_memory_highwater()] routine returns the maximum +** value of [sqlite3_memory_used()] since the high-water mark +** was last reset. ^The values returned by [sqlite3_memory_used()] and +** [sqlite3_memory_highwater()] include any overhead +** added by SQLite in its implementation of [sqlite3_malloc()], +** but not overhead added by the any underlying system library +** routines that [sqlite3_malloc()] may call. +** +** ^The memory high-water mark is reset to the current value of +** [sqlite3_memory_used()] if and only if the parameter to +** [sqlite3_memory_highwater()] is true. ^The value returned +** by [sqlite3_memory_highwater(1)] is the high-water mark +** prior to the reset. +*/ +SQLITE_API sqlite3_int64 sqlite3_memory_used(void); +SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); + +/* +** CAPI3REF: Pseudo-Random Number Generator +** +** SQLite contains a high-quality pseudo-random number generator (PRNG) used to +** select random [ROWID | ROWIDs] when inserting new records into a table that +** already uses the largest possible [ROWID]. The PRNG is also used for +** the build-in random() and randomblob() SQL functions. This interface allows +** applications to access the same PRNG for other purposes. +** +** ^A call to this routine stores N bytes of randomness into buffer P. +** +** ^The first time this routine is invoked (either internally or by +** the application) the PRNG is seeded using randomness obtained +** from the xRandomness method of the default [sqlite3_vfs] object. +** ^On all subsequent invocations, the pseudo-randomness is generated +** internally and without recourse to the [sqlite3_vfs] xRandomness +** method. +*/ +SQLITE_API void sqlite3_randomness(int N, void *P); + +/* +** CAPI3REF: Compile-Time Authorization Callbacks +** +** ^This routine registers a authorizer callback with a particular +** [database connection], supplied in the first argument. +** ^The authorizer callback is invoked as SQL statements are being compiled +** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], +** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various +** points during the compilation process, as logic is being created +** to perform various actions, the authorizer callback is invoked to +** see if those actions are allowed. ^The authorizer callback should +** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the +** specific action but allow the SQL statement to continue to be +** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be +** rejected with an error. ^If the authorizer callback returns +** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] +** then the [sqlite3_prepare_v2()] or equivalent call that triggered +** the authorizer will fail with an error message. +** +** When the callback returns [SQLITE_OK], that means the operation +** requested is ok. ^When the callback returns [SQLITE_DENY], the +** [sqlite3_prepare_v2()] or equivalent call that triggered the +** authorizer will fail with an error message explaining that +** access is denied. +** +** ^The first parameter to the authorizer callback is a copy of the third +** parameter to the sqlite3_set_authorizer() interface. ^The second parameter +** to the callback is an integer [SQLITE_COPY | action code] that specifies +** the particular action to be authorized. ^The third through sixth parameters +** to the callback are zero-terminated strings that contain additional +** details about the action to be authorized. +** +** ^If the action code is [SQLITE_READ] +** and the callback returns [SQLITE_IGNORE] then the +** [prepared statement] statement is constructed to substitute +** a NULL value in place of the table column that would have +** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] +** return can be used to deny an untrusted user access to individual +** columns of a table. +** ^If the action code is [SQLITE_DELETE] and the callback returns +** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the +** [truncate optimization] is disabled and all rows are deleted individually. +** +** An authorizer is used when [sqlite3_prepare | preparing] +** SQL statements from an untrusted source, to ensure that the SQL statements +** do not try to access data they are not allowed to see, or that they do not +** try to execute malicious statements that damage the database. For +** example, an application may allow a user to enter arbitrary +** SQL queries for evaluation by a database. But the application does +** not want the user to be able to make arbitrary changes to the +** database. An authorizer could then be put in place while the +** user-entered SQL is being [sqlite3_prepare | prepared] that +** disallows everything except [SELECT] statements. +** +** Applications that need to process SQL from untrusted sources +** might also consider lowering resource limits using [sqlite3_limit()] +** and limiting database size using the [max_page_count] [PRAGMA] +** in addition to using an authorizer. +** +** ^(Only a single authorizer can be in place on a database connection +** at a time. Each call to sqlite3_set_authorizer overrides the +** previous call.)^ ^Disable the authorizer by installing a NULL callback. +** The authorizer is disabled by default. +** +** The authorizer callback must not do anything that will modify +** the database connection that invoked the authorizer callback. +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** database connections for the meaning of "modify" in this paragraph. +** +** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the +** statement might be re-prepared during [sqlite3_step()] due to a +** schema change. Hence, the application should ensure that the +** correct authorizer callback remains in place during the [sqlite3_step()]. +** +** ^Note that the authorizer callback is invoked only during +** [sqlite3_prepare()] or its variants. Authorization is not +** performed during statement evaluation in [sqlite3_step()], unless +** as stated in the previous paragraph, sqlite3_step() invokes +** sqlite3_prepare_v2() to reprepare a statement after a schema change. +*/ +SQLITE_API int sqlite3_set_authorizer( + sqlite3*, + int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), + void *pUserData +); + +/* +** CAPI3REF: Authorizer Return Codes +** +** The [sqlite3_set_authorizer | authorizer callback function] must +** return either [SQLITE_OK] or one of these two constants in order +** to signal SQLite whether or not the action is permitted. See the +** [sqlite3_set_authorizer | authorizer documentation] for additional +** information. +*/ +#define SQLITE_DENY 1 /* Abort the SQL statement with an error */ +#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ + +/* +** CAPI3REF: Authorizer Action Codes +** +** The [sqlite3_set_authorizer()] interface registers a callback function +** that is invoked to authorize certain SQL statement actions. The +** second parameter to the callback is an integer code that specifies +** what action is being authorized. These are the integer action codes that +** the authorizer callback may be passed. +** +** These action code values signify what kind of operation is to be +** authorized. The 3rd and 4th parameters to the authorization +** callback function will be parameters or NULL depending on which of these +** codes is used as the second parameter. ^(The 5th parameter to the +** authorizer callback is the name of the database ("main", "temp", +** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback +** is the name of the inner-most trigger or view that is responsible for +** the access attempt or NULL if this access attempt is directly from +** top-level SQL code. +*/ +/******************************************* 3rd ************ 4th ***********/ +#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ +#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ +#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ +#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ +#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ +#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ +#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ +#define SQLITE_CREATE_VIEW 8 /* View Name NULL */ +#define SQLITE_DELETE 9 /* Table Name NULL */ +#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ +#define SQLITE_DROP_TABLE 11 /* Table Name NULL */ +#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ +#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ +#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ +#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ +#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ +#define SQLITE_DROP_VIEW 17 /* View Name NULL */ +#define SQLITE_INSERT 18 /* Table Name NULL */ +#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ +#define SQLITE_READ 20 /* Table Name Column Name */ +#define SQLITE_SELECT 21 /* NULL NULL */ +#define SQLITE_TRANSACTION 22 /* Operation NULL */ +#define SQLITE_UPDATE 23 /* Table Name Column Name */ +#define SQLITE_ATTACH 24 /* Filename NULL */ +#define SQLITE_DETACH 25 /* Database Name NULL */ +#define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ +#define SQLITE_REINDEX 27 /* Index Name NULL */ +#define SQLITE_ANALYZE 28 /* Table Name NULL */ +#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ +#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ +#define SQLITE_FUNCTION 31 /* NULL Function Name */ +#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ +#define SQLITE_COPY 0 /* No longer used */ + +/* +** CAPI3REF: Tracing And Profiling Functions +** EXPERIMENTAL +** +** These routines register callback functions that can be used for +** tracing and profiling the execution of SQL statements. +** +** ^The callback function registered by sqlite3_trace() is invoked at +** various times when an SQL statement is being run by [sqlite3_step()]. +** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the +** SQL statement text as the statement first begins executing. +** ^(Additional sqlite3_trace() callbacks might occur +** as each triggered subprogram is entered. The callbacks for triggers +** contain a UTF-8 SQL comment that identifies the trigger.)^ +** +** ^The callback function registered by sqlite3_profile() is invoked +** as each SQL statement finishes. ^The profile callback contains +** the original statement text and an estimate of wall-clock time +** of how long that statement took to run. +*/ +SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); +SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, + void(*xProfile)(void*,const char*,sqlite3_uint64), void*); + +/* +** CAPI3REF: Query Progress Callbacks +** +** ^This routine configures a callback function - the +** progress callback - that is invoked periodically during long +** running calls to [sqlite3_exec()], [sqlite3_step()] and +** [sqlite3_get_table()]. An example use for this +** interface is to keep a GUI updated during a large query. +** +** ^If the progress callback returns non-zero, the operation is +** interrupted. This feature can be used to implement a +** "Cancel" button on a GUI progress dialog box. +** +** The progress handler must not do anything that will modify +** the database connection that invoked the progress handler. +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** database connections for the meaning of "modify" in this paragraph. +** +*/ +SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); + +/* +** CAPI3REF: Opening A New Database Connection +** +** ^These routines open an SQLite database file whose name is given by the +** filename argument. ^The filename argument is interpreted as UTF-8 for +** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte +** order for sqlite3_open16(). ^(A [database connection] handle is usually +** returned in *ppDb, even if an error occurs. The only exception is that +** if SQLite is unable to allocate memory to hold the [sqlite3] object, +** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] +** object.)^ ^(If the database is opened (and/or created) successfully, then +** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The +** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain +** an English language description of the error following a failure of any +** of the sqlite3_open() routines. +** +** ^The default encoding for the database will be UTF-8 if +** sqlite3_open() or sqlite3_open_v2() is called and +** UTF-16 in the native byte order if sqlite3_open16() is used. +** +** Whether or not an error occurs when it is opened, resources +** associated with the [database connection] handle should be released by +** passing it to [sqlite3_close()] when it is no longer required. +** +** The sqlite3_open_v2() interface works like sqlite3_open() +** except that it accepts two additional parameters for additional control +** over the new database connection. ^(The flags parameter to +** sqlite3_open_v2() can take one of +** the following three values, optionally combined with the +** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE], +** and/or [SQLITE_OPEN_PRIVATECACHE] flags:)^ +** +**
+** ^(
[SQLITE_OPEN_READONLY]
+**
The database is opened in read-only mode. If the database does not +** already exist, an error is returned.
)^ +** +** ^(
[SQLITE_OPEN_READWRITE]
+**
The database is opened for reading and writing if possible, or reading +** only if the file is write protected by the operating system. In either +** case the database must already exist, otherwise an error is returned.
)^ +** +** ^(
[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
+**
The database is opened for reading and writing, and is creates it if +** it does not already exist. This is the behavior that is always used for +** sqlite3_open() and sqlite3_open16().
)^ +**
+** +** If the 3rd parameter to sqlite3_open_v2() is not one of the +** combinations shown above or one of the combinations shown above combined +** with the [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], +** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_SHAREDCACHE] flags, +** then the behavior is undefined. +** +** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection +** opens in the multi-thread [threading mode] as long as the single-thread +** mode has not been set at compile-time or start-time. ^If the +** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens +** in the serialized [threading mode] unless single-thread was +** previously selected at compile-time or start-time. +** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be +** eligible to use [shared cache mode], regardless of whether or not shared +** cache is enabled using [sqlite3_enable_shared_cache()]. ^The +** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not +** participate in [shared cache mode] even if it is enabled. +** +** ^If the filename is ":memory:", then a private, temporary in-memory database +** is created for the connection. ^This in-memory database will vanish when +** the database connection is closed. Future versions of SQLite might +** make use of additional special filenames that begin with the ":" character. +** It is recommended that when a database filename actually does begin with +** a ":" character you should prefix the filename with a pathname such as +** "./" to avoid ambiguity. +** +** ^If the filename is an empty string, then a private, temporary +** on-disk database will be created. ^This private database will be +** automatically deleted as soon as the database connection is closed. +** +** ^The fourth parameter to sqlite3_open_v2() is the name of the +** [sqlite3_vfs] object that defines the operating system interface that +** the new database connection should use. ^If the fourth parameter is +** a NULL pointer then the default [sqlite3_vfs] object is used. +** +** Note to Windows users: The encoding used for the filename argument +** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever +** codepage is currently defined. Filenames containing international +** characters must be converted to UTF-8 prior to passing them into +** sqlite3_open() or sqlite3_open_v2(). +*/ +SQLITE_API int sqlite3_open( + const char *filename, /* Database filename (UTF-8) */ + sqlite3 **ppDb /* OUT: SQLite db handle */ +); +SQLITE_API int sqlite3_open16( + const void *filename, /* Database filename (UTF-16) */ + sqlite3 **ppDb /* OUT: SQLite db handle */ +); +SQLITE_API int sqlite3_open_v2( + const char *filename, /* Database filename (UTF-8) */ + sqlite3 **ppDb, /* OUT: SQLite db handle */ + int flags, /* Flags */ + const char *zVfs /* Name of VFS module to use */ +); + +/* +** CAPI3REF: Error Codes And Messages +** +** ^The sqlite3_errcode() interface returns the numeric [result code] or +** [extended result code] for the most recent failed sqlite3_* API call +** associated with a [database connection]. If a prior API call failed +** but the most recent API call succeeded, the return value from +** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode() +** interface is the same except that it always returns the +** [extended result code] even when extended result codes are +** disabled. +** +** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language +** text that describes the error, as either UTF-8 or UTF-16 respectively. +** ^(Memory to hold the error message string is managed internally. +** The application does not need to worry about freeing the result. +** However, the error string might be overwritten or deallocated by +** subsequent calls to other SQLite interface functions.)^ +** +** When the serialized [threading mode] is in use, it might be the +** case that a second error occurs on a separate thread in between +** the time of the first error and the call to these interfaces. +** When that happens, the second error will be reported since these +** interfaces always report the most recent result. To avoid +** this, each thread can obtain exclusive use of the [database connection] D +** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning +** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after +** all calls to the interfaces listed here are completed. +** +** If an interface fails with SQLITE_MISUSE, that means the interface +** was invoked incorrectly by the application. In that case, the +** error code and message may or may not be set. +*/ +SQLITE_API int sqlite3_errcode(sqlite3 *db); +SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); +SQLITE_API const char *sqlite3_errmsg(sqlite3*); +SQLITE_API const void *sqlite3_errmsg16(sqlite3*); + +/* +** CAPI3REF: SQL Statement Object +** KEYWORDS: {prepared statement} {prepared statements} +** +** An instance of this object represents a single SQL statement. +** This object is variously known as a "prepared statement" or a +** "compiled SQL statement" or simply as a "statement". +** +** The life of a statement object goes something like this: +** +**
    +**
  1. Create the object using [sqlite3_prepare_v2()] or a related +** function. +**
  2. Bind values to [host parameters] using the sqlite3_bind_*() +** interfaces. +**
  3. Run the SQL by calling [sqlite3_step()] one or more times. +**
  4. Reset the statement using [sqlite3_reset()] then go back +** to step 2. Do this zero or more times. +**
  5. Destroy the object using [sqlite3_finalize()]. +**
+** +** Refer to documentation on individual methods above for additional +** information. +*/ +typedef struct sqlite3_stmt sqlite3_stmt; + +/* +** CAPI3REF: Run-time Limits +** +** ^(This interface allows the size of various constructs to be limited +** on a connection by connection basis. The first parameter is the +** [database connection] whose limit is to be set or queried. The +** second parameter is one of the [limit categories] that define a +** class of constructs to be size limited. The third parameter is the +** new limit for that construct. The function returns the old limit.)^ +** +** ^If the new limit is a negative number, the limit is unchanged. +** ^(For the limit category of SQLITE_LIMIT_XYZ there is a +** [limits | hard upper bound] +** set by a compile-time C preprocessor macro named +** [limits | SQLITE_MAX_XYZ]. +** (The "_LIMIT_" in the name is changed to "_MAX_".))^ +** ^Attempts to increase a limit above its hard upper bound are +** silently truncated to the hard upper bound. +** +** Run-time limits are intended for use in applications that manage +** both their own internal database and also databases that are controlled +** by untrusted external sources. An example application might be a +** web browser that has its own databases for storing history and +** separate databases controlled by JavaScript applications downloaded +** off the Internet. The internal databases can be given the +** large, default limits. Databases managed by external sources can +** be given much smaller limits designed to prevent a denial of service +** attack. Developers might also want to use the [sqlite3_set_authorizer()] +** interface to further control untrusted SQL. The size of the database +** created by an untrusted script can be contained using the +** [max_page_count] [PRAGMA]. +** +** New run-time limit categories may be added in future releases. +*/ +SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); + +/* +** CAPI3REF: Run-Time Limit Categories +** KEYWORDS: {limit category} {*limit categories} +** +** These constants define various performance limits +** that can be lowered at run-time using [sqlite3_limit()]. +** The synopsis of the meanings of the various limits is shown below. +** Additional information is available at [limits | Limits in SQLite]. +** +**
+** ^(
SQLITE_LIMIT_LENGTH
+**
The maximum size of any string or BLOB or table row.
)^ +** +** ^(
SQLITE_LIMIT_SQL_LENGTH
+**
The maximum length of an SQL statement, in bytes.
)^ +** +** ^(
SQLITE_LIMIT_COLUMN
+**
The maximum number of columns in a table definition or in the +** result set of a [SELECT] or the maximum number of columns in an index +** or in an ORDER BY or GROUP BY clause.
)^ +** +** ^(
SQLITE_LIMIT_EXPR_DEPTH
+**
The maximum depth of the parse tree on any expression.
)^ +** +** ^(
SQLITE_LIMIT_COMPOUND_SELECT
+**
The maximum number of terms in a compound SELECT statement.
)^ +** +** ^(
SQLITE_LIMIT_VDBE_OP
+**
The maximum number of instructions in a virtual machine program +** used to implement an SQL statement.
)^ +** +** ^(
SQLITE_LIMIT_FUNCTION_ARG
+**
The maximum number of arguments on a function.
)^ +** +** ^(
SQLITE_LIMIT_ATTACHED
+**
The maximum number of [ATTACH | attached databases].)^
+** +** ^(
SQLITE_LIMIT_LIKE_PATTERN_LENGTH
+**
The maximum length of the pattern argument to the [LIKE] or +** [GLOB] operators.
)^ +** +** ^(
SQLITE_LIMIT_VARIABLE_NUMBER
+**
The maximum number of variables in an SQL statement that can +** be bound.
)^ +** +** ^(
SQLITE_LIMIT_TRIGGER_DEPTH
+**
The maximum depth of recursion for triggers.
)^ +**
+*/ +#define SQLITE_LIMIT_LENGTH 0 +#define SQLITE_LIMIT_SQL_LENGTH 1 +#define SQLITE_LIMIT_COLUMN 2 +#define SQLITE_LIMIT_EXPR_DEPTH 3 +#define SQLITE_LIMIT_COMPOUND_SELECT 4 +#define SQLITE_LIMIT_VDBE_OP 5 +#define SQLITE_LIMIT_FUNCTION_ARG 6 +#define SQLITE_LIMIT_ATTACHED 7 +#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 +#define SQLITE_LIMIT_VARIABLE_NUMBER 9 +#define SQLITE_LIMIT_TRIGGER_DEPTH 10 + +/* +** CAPI3REF: Compiling An SQL Statement +** KEYWORDS: {SQL statement compiler} +** +** To execute an SQL query, it must first be compiled into a byte-code +** program using one of these routines. +** +** The first argument, "db", is a [database connection] obtained from a +** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or +** [sqlite3_open16()]. The database connection must not have been closed. +** +** The second argument, "zSql", is the statement to be compiled, encoded +** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() +** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() +** use UTF-16. +** +** ^If the nByte argument is less than zero, then zSql is read up to the +** first zero terminator. ^If nByte is non-negative, then it is the maximum +** number of bytes read from zSql. ^When nByte is non-negative, the +** zSql string ends at either the first '\000' or '\u0000' character or +** the nByte-th byte, whichever comes first. If the caller knows +** that the supplied string is nul-terminated, then there is a small +** performance advantage to be gained by passing an nByte parameter that +** is equal to the number of bytes in the input string including +** the nul-terminator bytes. +** +** ^If pzTail is not NULL then *pzTail is made to point to the first byte +** past the end of the first SQL statement in zSql. These routines only +** compile the first statement in zSql, so *pzTail is left pointing to +** what remains uncompiled. +** +** ^*ppStmt is left pointing to a compiled [prepared statement] that can be +** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set +** to NULL. ^If the input text contains no SQL (if the input is an empty +** string or a comment) then *ppStmt is set to NULL. +** The calling procedure is responsible for deleting the compiled +** SQL statement using [sqlite3_finalize()] after it has finished with it. +** ppStmt may not be NULL. +** +** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; +** otherwise an [error code] is returned. +** +** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are +** recommended for all new programs. The two older interfaces are retained +** for backwards compatibility, but their use is discouraged. +** ^In the "v2" interfaces, the prepared statement +** that is returned (the [sqlite3_stmt] object) contains a copy of the +** original SQL text. This causes the [sqlite3_step()] interface to +** behave differently in three ways: +** +**
    +**
  1. +** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it +** always used to do, [sqlite3_step()] will automatically recompile the SQL +** statement and try to run it again. ^If the schema has changed in +** a way that makes the statement no longer valid, [sqlite3_step()] will still +** return [SQLITE_SCHEMA]. But unlike the legacy behavior, [SQLITE_SCHEMA] is +** now a fatal error. Calling [sqlite3_prepare_v2()] again will not make the +** error go away. Note: use [sqlite3_errmsg()] to find the text +** of the parsing error that results in an [SQLITE_SCHEMA] return. +**
  2. +** +**
  3. +** ^When an error occurs, [sqlite3_step()] will return one of the detailed +** [error codes] or [extended error codes]. ^The legacy behavior was that +** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code +** and the application would have to make a second call to [sqlite3_reset()] +** in order to find the underlying cause of the problem. With the "v2" prepare +** interfaces, the underlying reason for the error is returned immediately. +**
  4. +** +**
  5. +** ^If the value of a [parameter | host parameter] in the WHERE clause might +** change the query plan for a statement, then the statement may be +** automatically recompiled (as if there had been a schema change) on the first +** [sqlite3_step()] call following any change to the +** [sqlite3_bind_text | bindings] of the [parameter]. +**
  6. +**
+*/ +SQLITE_API int sqlite3_prepare( + sqlite3 *db, /* Database handle */ + const char *zSql, /* SQL statement, UTF-8 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const char **pzTail /* OUT: Pointer to unused portion of zSql */ +); +SQLITE_API int sqlite3_prepare_v2( + sqlite3 *db, /* Database handle */ + const char *zSql, /* SQL statement, UTF-8 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const char **pzTail /* OUT: Pointer to unused portion of zSql */ +); +SQLITE_API int sqlite3_prepare16( + sqlite3 *db, /* Database handle */ + const void *zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const void **pzTail /* OUT: Pointer to unused portion of zSql */ +); +SQLITE_API int sqlite3_prepare16_v2( + sqlite3 *db, /* Database handle */ + const void *zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const void **pzTail /* OUT: Pointer to unused portion of zSql */ +); + +/* +** CAPI3REF: Retrieving Statement SQL +** +** ^This interface can be used to retrieve a saved copy of the original +** SQL text used to create a [prepared statement] if that statement was +** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. +*/ +SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); + +/* +** CAPI3REF: Dynamically Typed Value Object +** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} +** +** SQLite uses the sqlite3_value object to represent all values +** that can be stored in a database table. SQLite uses dynamic typing +** for the values it stores. ^Values stored in sqlite3_value objects +** can be integers, floating point values, strings, BLOBs, or NULL. +** +** An sqlite3_value object may be either "protected" or "unprotected". +** Some interfaces require a protected sqlite3_value. Other interfaces +** will accept either a protected or an unprotected sqlite3_value. +** Every interface that accepts sqlite3_value arguments specifies +** whether or not it requires a protected sqlite3_value. +** +** The terms "protected" and "unprotected" refer to whether or not +** a mutex is held. A internal mutex is held for a protected +** sqlite3_value object but no mutex is held for an unprotected +** sqlite3_value object. If SQLite is compiled to be single-threaded +** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) +** or if SQLite is run in one of reduced mutex modes +** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] +** then there is no distinction between protected and unprotected +** sqlite3_value objects and they can be used interchangeably. However, +** for maximum code portability it is recommended that applications +** still make the distinction between between protected and unprotected +** sqlite3_value objects even when not strictly required. +** +** ^The sqlite3_value objects that are passed as parameters into the +** implementation of [application-defined SQL functions] are protected. +** ^The sqlite3_value object returned by +** [sqlite3_column_value()] is unprotected. +** Unprotected sqlite3_value objects may only be used with +** [sqlite3_result_value()] and [sqlite3_bind_value()]. +** The [sqlite3_value_blob | sqlite3_value_type()] family of +** interfaces require protected sqlite3_value objects. +*/ +typedef struct Mem sqlite3_value; + +/* +** CAPI3REF: SQL Function Context Object +** +** The context in which an SQL function executes is stored in an +** sqlite3_context object. ^A pointer to an sqlite3_context object +** is always first parameter to [application-defined SQL functions]. +** The application-defined SQL function implementation will pass this +** pointer through into calls to [sqlite3_result_int | sqlite3_result()], +** [sqlite3_aggregate_context()], [sqlite3_user_data()], +** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], +** and/or [sqlite3_set_auxdata()]. +*/ +typedef struct sqlite3_context sqlite3_context; + +/* +** CAPI3REF: Binding Values To Prepared Statements +** KEYWORDS: {host parameter} {host parameters} {host parameter name} +** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} +** +** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, +** literals may be replaced by a [parameter] that matches one of following +** templates: +** +**
    +**
  • ? +**
  • ?NNN +**
  • :VVV +**
  • @VVV +**
  • $VVV +**
+** +** In the templates above, NNN represents an integer literal, +** and VVV represents an alphanumeric identifer.)^ ^The values of these +** parameters (also called "host parameter names" or "SQL parameters") +** can be set using the sqlite3_bind_*() routines defined here. +** +** ^The first argument to the sqlite3_bind_*() routines is always +** a pointer to the [sqlite3_stmt] object returned from +** [sqlite3_prepare_v2()] or its variants. +** +** ^The second argument is the index of the SQL parameter to be set. +** ^The leftmost SQL parameter has an index of 1. ^When the same named +** SQL parameter is used more than once, second and subsequent +** occurrences have the same index as the first occurrence. +** ^The index for named parameters can be looked up using the +** [sqlite3_bind_parameter_index()] API if desired. ^The index +** for "?NNN" parameters is the value of NNN. +** ^The NNN value must be between 1 and the [sqlite3_limit()] +** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999). +** +** ^The third argument is the value to bind to the parameter. +** +** ^(In those routines that have a fourth argument, its value is the +** number of bytes in the parameter. To be clear: the value is the +** number of bytes in the value, not the number of characters.)^ +** ^If the fourth parameter is negative, the length of the string is +** the number of bytes up to the first zero terminator. +** +** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and +** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or +** string after SQLite has finished with it. ^If the fifth argument is +** the special value [SQLITE_STATIC], then SQLite assumes that the +** information is in static, unmanaged space and does not need to be freed. +** ^If the fifth argument has the value [SQLITE_TRANSIENT], then +** SQLite makes its own private copy of the data immediately, before +** the sqlite3_bind_*() routine returns. +** +** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that +** is filled with zeroes. ^A zeroblob uses a fixed amount of memory +** (just an integer to hold its size) while it is being processed. +** Zeroblobs are intended to serve as placeholders for BLOBs whose +** content is later written using +** [sqlite3_blob_open | incremental BLOB I/O] routines. +** ^A negative value for the zeroblob results in a zero-length BLOB. +** +** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer +** for the [prepared statement] or with a prepared statement for which +** [sqlite3_step()] has been called more recently than [sqlite3_reset()], +** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() +** routine is passed a [prepared statement] that has been finalized, the +** result is undefined and probably harmful. +** +** ^Bindings are not cleared by the [sqlite3_reset()] routine. +** ^Unbound parameters are interpreted as NULL. +** +** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an +** [error code] if anything goes wrong. +** ^[SQLITE_RANGE] is returned if the parameter +** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. +** +** See also: [sqlite3_bind_parameter_count()], +** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. +*/ +SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); +SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); +SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); +SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); +SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); +SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); +SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); +SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); +SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); + +/* +** CAPI3REF: Number Of SQL Parameters +** +** ^This routine can be used to find the number of [SQL parameters] +** in a [prepared statement]. SQL parameters are tokens of the +** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as +** placeholders for values that are [sqlite3_bind_blob | bound] +** to the parameters at a later time. +** +** ^(This routine actually returns the index of the largest (rightmost) +** parameter. For all forms except ?NNN, this will correspond to the +** number of unique parameters. If parameters of the ?NNN form are used, +** there may be gaps in the list.)^ +** +** See also: [sqlite3_bind_blob|sqlite3_bind()], +** [sqlite3_bind_parameter_name()], and +** [sqlite3_bind_parameter_index()]. +*/ +SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); + +/* +** CAPI3REF: Name Of A Host Parameter +** +** ^The sqlite3_bind_parameter_name(P,N) interface returns +** the name of the N-th [SQL parameter] in the [prepared statement] P. +** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" +** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" +** respectively. +** In other words, the initial ":" or "$" or "@" or "?" +** is included as part of the name.)^ +** ^Parameters of the form "?" without a following integer have no name +** and are referred to as "nameless" or "anonymous parameters". +** +** ^The first host parameter has an index of 1, not 0. +** +** ^If the value N is out of range or if the N-th parameter is +** nameless, then NULL is returned. ^The returned string is +** always in UTF-8 encoding even if the named parameter was +** originally specified as UTF-16 in [sqlite3_prepare16()] or +** [sqlite3_prepare16_v2()]. +** +** See also: [sqlite3_bind_blob|sqlite3_bind()], +** [sqlite3_bind_parameter_count()], and +** [sqlite3_bind_parameter_index()]. +*/ +SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); + +/* +** CAPI3REF: Index Of A Parameter With A Given Name +** +** ^Return the index of an SQL parameter given its name. ^The +** index value returned is suitable for use as the second +** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero +** is returned if no matching parameter is found. ^The parameter +** name must be given in UTF-8 even if the original statement +** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. +** +** See also: [sqlite3_bind_blob|sqlite3_bind()], +** [sqlite3_bind_parameter_count()], and +** [sqlite3_bind_parameter_index()]. +*/ +SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); + +/* +** CAPI3REF: Reset All Bindings On A Prepared Statement +** +** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset +** the [sqlite3_bind_blob | bindings] on a [prepared statement]. +** ^Use this routine to reset all host parameters to NULL. +*/ +SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); + +/* +** CAPI3REF: Number Of Columns In A Result Set +** +** ^Return the number of columns in the result set returned by the +** [prepared statement]. ^This routine returns 0 if pStmt is an SQL +** statement that does not return data (for example an [UPDATE]). +*/ +SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); + +/* +** CAPI3REF: Column Names In A Result Set +** +** ^These routines return the name assigned to a particular column +** in the result set of a [SELECT] statement. ^The sqlite3_column_name() +** interface returns a pointer to a zero-terminated UTF-8 string +** and sqlite3_column_name16() returns a pointer to a zero-terminated +** UTF-16 string. ^The first parameter is the [prepared statement] +** that implements the [SELECT] statement. ^The second parameter is the +** column number. ^The leftmost column is number 0. +** +** ^The returned string pointer is valid until either the [prepared statement] +** is destroyed by [sqlite3_finalize()] or until the next call to +** sqlite3_column_name() or sqlite3_column_name16() on the same column. +** +** ^If sqlite3_malloc() fails during the processing of either routine +** (for example during a conversion from UTF-8 to UTF-16) then a +** NULL pointer is returned. +** +** ^The name of a result column is the value of the "AS" clause for +** that column, if there is an AS clause. If there is no AS clause +** then the name of the column is unspecified and may change from +** one release of SQLite to the next. +*/ +SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); +SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); + +/* +** CAPI3REF: Source Of Data In A Query Result +** +** ^These routines provide a means to determine the database, table, and +** table column that is the origin of a particular result column in +** [SELECT] statement. +** ^The name of the database or table or column can be returned as +** either a UTF-8 or UTF-16 string. ^The _database_ routines return +** the database name, the _table_ routines return the table name, and +** the origin_ routines return the column name. +** ^The returned string is valid until the [prepared statement] is destroyed +** using [sqlite3_finalize()] or until the same information is requested +** again in a different encoding. +** +** ^The names returned are the original un-aliased names of the +** database, table, and column. +** +** ^The first argument to these interfaces is a [prepared statement]. +** ^These functions return information about the Nth result column returned by +** the statement, where N is the second function argument. +** ^The left-most column is column 0 for these routines. +** +** ^If the Nth column returned by the statement is an expression or +** subquery and is not a column value, then all of these functions return +** NULL. ^These routine might also return NULL if a memory allocation error +** occurs. ^Otherwise, they return the name of the attached database, table, +** or column that query result column was extracted from. +** +** ^As with all other SQLite APIs, those whose names end with "16" return +** UTF-16 encoded strings and the other functions return UTF-8. +** +** ^These APIs are only available if the library was compiled with the +** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. +** +** If two or more threads call one or more of these routines against the same +** prepared statement and column at the same time then the results are +** undefined. +** +** If two or more threads call one or more +** [sqlite3_column_database_name | column metadata interfaces] +** for the same [prepared statement] and result column +** at the same time then the results are undefined. +*/ +SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); +SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); +SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); +SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); +SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); +SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); + +/* +** CAPI3REF: Declared Datatype Of A Query Result +** +** ^(The first parameter is a [prepared statement]. +** If this statement is a [SELECT] statement and the Nth column of the +** returned result set of that [SELECT] is a table column (not an +** expression or subquery) then the declared type of the table +** column is returned.)^ ^If the Nth column of the result set is an +** expression or subquery, then a NULL pointer is returned. +** ^The returned string is always UTF-8 encoded. +** +** ^(For example, given the database schema: +** +** CREATE TABLE t1(c1 VARIANT); +** +** and the following statement to be compiled: +** +** SELECT c1 + 1, c1 FROM t1; +** +** this routine would return the string "VARIANT" for the second result +** column (i==1), and a NULL pointer for the first result column (i==0).)^ +** +** ^SQLite uses dynamic run-time typing. ^So just because a column +** is declared to contain a particular type does not mean that the +** data stored in that column is of the declared type. SQLite is +** strongly typed, but the typing is dynamic not static. ^Type +** is associated with individual values, not with the containers +** used to hold those values. +*/ +SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); +SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); + +/* +** CAPI3REF: Evaluate An SQL Statement +** +** After a [prepared statement] has been prepared using either +** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy +** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function +** must be called one or more times to evaluate the statement. +** +** The details of the behavior of the sqlite3_step() interface depend +** on whether the statement was prepared using the newer "v2" interface +** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy +** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the +** new "v2" interface is recommended for new applications but the legacy +** interface will continue to be supported. +** +** ^In the legacy interface, the return value will be either [SQLITE_BUSY], +** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. +** ^With the "v2" interface, any of the other [result codes] or +** [extended result codes] might be returned as well. +** +** ^[SQLITE_BUSY] means that the database engine was unable to acquire the +** database locks it needs to do its job. ^If the statement is a [COMMIT] +** or occurs outside of an explicit transaction, then you can retry the +** statement. If the statement is not a [COMMIT] and occurs within a +** explicit transaction then you should rollback the transaction before +** continuing. +** +** ^[SQLITE_DONE] means that the statement has finished executing +** successfully. sqlite3_step() should not be called again on this virtual +** machine without first calling [sqlite3_reset()] to reset the virtual +** machine back to its initial state. +** +** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] +** is returned each time a new row of data is ready for processing by the +** caller. The values may be accessed using the [column access functions]. +** sqlite3_step() is called again to retrieve the next row of data. +** +** ^[SQLITE_ERROR] means that a run-time error (such as a constraint +** violation) has occurred. sqlite3_step() should not be called again on +** the VM. More information may be found by calling [sqlite3_errmsg()]. +** ^With the legacy interface, a more specific error code (for example, +** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) +** can be obtained by calling [sqlite3_reset()] on the +** [prepared statement]. ^In the "v2" interface, +** the more specific error code is returned directly by sqlite3_step(). +** +** [SQLITE_MISUSE] means that the this routine was called inappropriately. +** Perhaps it was called on a [prepared statement] that has +** already been [sqlite3_finalize | finalized] or on one that had +** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could +** be the case that the same database connection is being used by two or +** more threads at the same moment in time. +** +** Goofy Interface Alert: In the legacy interface, the sqlite3_step() +** API always returns a generic error code, [SQLITE_ERROR], following any +** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call +** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the +** specific [error codes] that better describes the error. +** We admit that this is a goofy design. The problem has been fixed +** with the "v2" interface. If you prepare all of your SQL statements +** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead +** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, +** then the more specific [error codes] are returned directly +** by sqlite3_step(). The use of the "v2" interface is recommended. +*/ +SQLITE_API int sqlite3_step(sqlite3_stmt*); + +/* +** CAPI3REF: Number of columns in a result set +** +** ^The sqlite3_data_count(P) the number of columns in the +** of the result set of [prepared statement] P. +*/ +SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); + +/* +** CAPI3REF: Fundamental Datatypes +** KEYWORDS: SQLITE_TEXT +** +** ^(Every value in SQLite has one of five fundamental datatypes: +** +**
    +**
  • 64-bit signed integer +**
  • 64-bit IEEE floating point number +**
  • string +**
  • BLOB +**
  • NULL +**
)^ +** +** These constants are codes for each of those types. +** +** Note that the SQLITE_TEXT constant was also used in SQLite version 2 +** for a completely different meaning. Software that links against both +** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not +** SQLITE_TEXT. +*/ +#define SQLITE_INTEGER 1 +#define SQLITE_FLOAT 2 +#define SQLITE_BLOB 4 +#define SQLITE_NULL 5 +#ifdef SQLITE_TEXT +# undef SQLITE_TEXT +#else +# define SQLITE_TEXT 3 +#endif +#define SQLITE3_TEXT 3 + +/* +** CAPI3REF: Result Values From A Query +** KEYWORDS: {column access functions} +** +** These routines form the "result set" interface. +** +** ^These routines return information about a single column of the current +** result row of a query. ^In every case the first argument is a pointer +** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] +** that was returned from [sqlite3_prepare_v2()] or one of its variants) +** and the second argument is the index of the column for which information +** should be returned. ^The leftmost column of the result set has the index 0. +** ^The number of columns in the result can be determined using +** [sqlite3_column_count()]. +** +** If the SQL statement does not currently point to a valid row, or if the +** column index is out of range, the result is undefined. +** These routines may only be called when the most recent call to +** [sqlite3_step()] has returned [SQLITE_ROW] and neither +** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. +** If any of these routines are called after [sqlite3_reset()] or +** [sqlite3_finalize()] or after [sqlite3_step()] has returned +** something other than [SQLITE_ROW], the results are undefined. +** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] +** are called from a different thread while any of these routines +** are pending, then the results are undefined. +** +** ^The sqlite3_column_type() routine returns the +** [SQLITE_INTEGER | datatype code] for the initial data type +** of the result column. ^The returned value is one of [SQLITE_INTEGER], +** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value +** returned by sqlite3_column_type() is only meaningful if no type +** conversions have occurred as described below. After a type conversion, +** the value returned by sqlite3_column_type() is undefined. Future +** versions of SQLite may change the behavior of sqlite3_column_type() +** following a type conversion. +** +** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() +** routine returns the number of bytes in that BLOB or string. +** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts +** the string to UTF-8 and then returns the number of bytes. +** ^If the result is a numeric value then sqlite3_column_bytes() uses +** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns +** the number of bytes in that string. +** ^The value returned does not include the zero terminator at the end +** of the string. ^For clarity: the value returned is the number of +** bytes in the string, not the number of characters. +** +** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), +** even empty strings, are always zero terminated. ^The return +** value from sqlite3_column_blob() for a zero-length BLOB is an arbitrary +** pointer, possibly even a NULL pointer. +** +** ^The sqlite3_column_bytes16() routine is similar to sqlite3_column_bytes() +** but leaves the result in UTF-16 in native byte order instead of UTF-8. +** ^The zero terminator is not included in this count. +** +** ^The object returned by [sqlite3_column_value()] is an +** [unprotected sqlite3_value] object. An unprotected sqlite3_value object +** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()]. +** If the [unprotected sqlite3_value] object returned by +** [sqlite3_column_value()] is used in any other way, including calls +** to routines like [sqlite3_value_int()], [sqlite3_value_text()], +** or [sqlite3_value_bytes()], then the behavior is undefined. +** +** These routines attempt to convert the value where appropriate. ^For +** example, if the internal representation is FLOAT and a text result +** is requested, [sqlite3_snprintf()] is used internally to perform the +** conversion automatically. ^(The following table details the conversions +** that are applied: +** +**
+** +**
Internal
Type
Requested
Type
Conversion +** +**
NULL INTEGER Result is 0 +**
NULL FLOAT Result is 0.0 +**
NULL TEXT Result is NULL pointer +**
NULL BLOB Result is NULL pointer +**
INTEGER FLOAT Convert from integer to float +**
INTEGER TEXT ASCII rendering of the integer +**
INTEGER BLOB Same as INTEGER->TEXT +**
FLOAT INTEGER Convert from float to integer +**
FLOAT TEXT ASCII rendering of the float +**
FLOAT BLOB Same as FLOAT->TEXT +**
TEXT INTEGER Use atoi() +**
TEXT FLOAT Use atof() +**
TEXT BLOB No change +**
BLOB INTEGER Convert to TEXT then use atoi() +**
BLOB FLOAT Convert to TEXT then use atof() +**
BLOB TEXT Add a zero terminator if needed +**
+**
)^ +** +** The table above makes reference to standard C library functions atoi() +** and atof(). SQLite does not really use these functions. It has its +** own equivalent internal routines. The atoi() and atof() names are +** used in the table for brevity and because they are familiar to most +** C programmers. +** +** ^Note that when type conversions occur, pointers returned by prior +** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or +** sqlite3_column_text16() may be invalidated. +** ^(Type conversions and pointer invalidations might occur +** in the following cases: +** +**
    +**
  • The initial content is a BLOB and sqlite3_column_text() or +** sqlite3_column_text16() is called. A zero-terminator might +** need to be added to the string.
  • +**
  • The initial content is UTF-8 text and sqlite3_column_bytes16() or +** sqlite3_column_text16() is called. The content must be converted +** to UTF-16.
  • +**
  • The initial content is UTF-16 text and sqlite3_column_bytes() or +** sqlite3_column_text() is called. The content must be converted +** to UTF-8.
  • +**
)^ +** +** ^Conversions between UTF-16be and UTF-16le are always done in place and do +** not invalidate a prior pointer, though of course the content of the buffer +** that the prior pointer points to will have been modified. Other kinds +** of conversion are done in place when it is possible, but sometimes they +** are not possible and in those cases prior pointers are invalidated. +** +** ^(The safest and easiest to remember policy is to invoke these routines +** in one of the following ways: +** +**
    +**
  • sqlite3_column_text() followed by sqlite3_column_bytes()
  • +**
  • sqlite3_column_blob() followed by sqlite3_column_bytes()
  • +**
  • sqlite3_column_text16() followed by sqlite3_column_bytes16()
  • +**
)^ +** +** In other words, you should call sqlite3_column_text(), +** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result +** into the desired format, then invoke sqlite3_column_bytes() or +** sqlite3_column_bytes16() to find the size of the result. Do not mix calls +** to sqlite3_column_text() or sqlite3_column_blob() with calls to +** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() +** with calls to sqlite3_column_bytes(). +** +** ^The pointers returned are valid until a type conversion occurs as +** described above, or until [sqlite3_step()] or [sqlite3_reset()] or +** [sqlite3_finalize()] is called. ^The memory space used to hold strings +** and BLOBs is freed automatically. Do not pass the pointers returned +** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into +** [sqlite3_free()]. +** +** ^(If a memory allocation error occurs during the evaluation of any +** of these routines, a default value is returned. The default value +** is either the integer 0, the floating point number 0.0, or a NULL +** pointer. Subsequent calls to [sqlite3_errcode()] will return +** [SQLITE_NOMEM].)^ +*/ +SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); +SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); +SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); +SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); +SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); +SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); +SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); + +/* +** CAPI3REF: Destroy A Prepared Statement Object +** +** ^The sqlite3_finalize() function is called to delete a [prepared statement]. +** ^If the statement was executed successfully or not executed at all, then +** SQLITE_OK is returned. ^If execution of the statement failed then an +** [error code] or [extended error code] is returned. +** +** ^This routine can be called at any point during the execution of the +** [prepared statement]. ^If the virtual machine has not +** completed execution when this routine is called, that is like +** encountering an error or an [sqlite3_interrupt | interrupt]. +** ^Incomplete updates may be rolled back and transactions canceled, +** depending on the circumstances, and the +** [error code] returned will be [SQLITE_ABORT]. +*/ +SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); + +/* +** CAPI3REF: Reset A Prepared Statement Object +** +** The sqlite3_reset() function is called to reset a [prepared statement] +** object back to its initial state, ready to be re-executed. +** ^Any SQL statement variables that had values bound to them using +** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. +** Use [sqlite3_clear_bindings()] to reset the bindings. +** +** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S +** back to the beginning of its program. +** +** ^If the most recent call to [sqlite3_step(S)] for the +** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], +** or if [sqlite3_step(S)] has never before been called on S, +** then [sqlite3_reset(S)] returns [SQLITE_OK]. +** +** ^If the most recent call to [sqlite3_step(S)] for the +** [prepared statement] S indicated an error, then +** [sqlite3_reset(S)] returns an appropriate [error code]. +** +** ^The [sqlite3_reset(S)] interface does not change the values +** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. +*/ +SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); + +/* +** CAPI3REF: Create Or Redefine SQL Functions +** KEYWORDS: {function creation routines} +** KEYWORDS: {application-defined SQL function} +** KEYWORDS: {application-defined SQL functions} +** +** ^These two functions (collectively known as "function creation routines") +** are used to add SQL functions or aggregates or to redefine the behavior +** of existing SQL functions or aggregates. The only difference between the +** two is that the second parameter, the name of the (scalar) function or +** aggregate, is encoded in UTF-8 for sqlite3_create_function() and UTF-16 +** for sqlite3_create_function16(). +** +** ^The first parameter is the [database connection] to which the SQL +** function is to be added. ^If an application uses more than one database +** connection then application-defined SQL functions must be added +** to each database connection separately. +** +** The second parameter is the name of the SQL function to be created or +** redefined. ^The length of the name is limited to 255 bytes, exclusive of +** the zero-terminator. Note that the name length limit is in bytes, not +** characters. ^Any attempt to create a function with a longer name +** will result in [SQLITE_ERROR] being returned. +** +** ^The third parameter (nArg) +** is the number of arguments that the SQL function or +** aggregate takes. ^If this parameter is -1, then the SQL function or +** aggregate may take any number of arguments between 0 and the limit +** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third +** parameter is less than -1 or greater than 127 then the behavior is +** undefined. +** +** The fourth parameter, eTextRep, specifies what +** [SQLITE_UTF8 | text encoding] this SQL function prefers for +** its parameters. Any SQL function implementation should be able to work +** work with UTF-8, UTF-16le, or UTF-16be. But some implementations may be +** more efficient with one encoding than another. ^An application may +** invoke sqlite3_create_function() or sqlite3_create_function16() multiple +** times with the same function but with different values of eTextRep. +** ^When multiple implementations of the same function are available, SQLite +** will pick the one that involves the least amount of data conversion. +** If there is only a single implementation which does not care what text +** encoding is used, then the fourth argument should be [SQLITE_ANY]. +** +** ^(The fifth parameter is an arbitrary pointer. The implementation of the +** function can gain access to this pointer using [sqlite3_user_data()].)^ +** +** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are +** pointers to C-language functions that implement the SQL function or +** aggregate. ^A scalar SQL function requires an implementation of the xFunc +** callback only; NULL pointers should be passed as the xStep and xFinal +** parameters. ^An aggregate SQL function requires an implementation of xStep +** and xFinal and NULL should be passed for xFunc. ^To delete an existing +** SQL function or aggregate, pass NULL for all three function callbacks. +** +** ^It is permitted to register multiple implementations of the same +** functions with the same name but with either differing numbers of +** arguments or differing preferred text encodings. ^SQLite will use +** the implementation that most closely matches the way in which the +** SQL function is used. ^A function implementation with a non-negative +** nArg parameter is a better match than a function implementation with +** a negative nArg. ^A function where the preferred text encoding +** matches the database encoding is a better +** match than a function where the encoding is different. +** ^A function where the encoding difference is between UTF16le and UTF16be +** is a closer match than a function where the encoding difference is +** between UTF8 and UTF16. +** +** ^Built-in functions may be overloaded by new application-defined functions. +** ^The first application-defined function with a given name overrides all +** built-in functions in the same [database connection] with the same name. +** ^Subsequent application-defined functions of the same name only override +** prior application-defined functions that are an exact match for the +** number of parameters and preferred encoding. +** +** ^An application-defined function is permitted to call other +** SQLite interfaces. However, such calls must not +** close the database connection nor finalize or reset the prepared +** statement in which the function is running. +*/ +SQLITE_API int sqlite3_create_function( + sqlite3 *db, + const char *zFunctionName, + int nArg, + int eTextRep, + void *pApp, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*) +); +SQLITE_API int sqlite3_create_function16( + sqlite3 *db, + const void *zFunctionName, + int nArg, + int eTextRep, + void *pApp, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*) +); + +/* +** CAPI3REF: Text Encodings +** +** These constant define integer codes that represent the various +** text encodings supported by SQLite. +*/ +#define SQLITE_UTF8 1 +#define SQLITE_UTF16LE 2 +#define SQLITE_UTF16BE 3 +#define SQLITE_UTF16 4 /* Use native byte order */ +#define SQLITE_ANY 5 /* sqlite3_create_function only */ +#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ + +/* +** CAPI3REF: Deprecated Functions +** DEPRECATED +** +** These functions are [deprecated]. In order to maintain +** backwards compatibility with older code, these functions continue +** to be supported. However, new applications should avoid +** the use of these functions. To help encourage people to avoid +** using these functions, we are not going to tell you what they do. +*/ +#ifndef SQLITE_OMIT_DEPRECATED +SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); +SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); +SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); +SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); +SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); +SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64); +#endif + +/* +** CAPI3REF: Obtaining SQL Function Parameter Values +** +** The C-language implementation of SQL functions and aggregates uses +** this set of interface routines to access the parameter values on +** the function or aggregate. +** +** The xFunc (for scalar functions) or xStep (for aggregates) parameters +** to [sqlite3_create_function()] and [sqlite3_create_function16()] +** define callbacks that implement the SQL functions and aggregates. +** The 4th parameter to these callbacks is an array of pointers to +** [protected sqlite3_value] objects. There is one [sqlite3_value] object for +** each parameter to the SQL function. These routines are used to +** extract values from the [sqlite3_value] objects. +** +** These routines work only with [protected sqlite3_value] objects. +** Any attempt to use these routines on an [unprotected sqlite3_value] +** object results in undefined behavior. +** +** ^These routines work just like the corresponding [column access functions] +** except that these routines take a single [protected sqlite3_value] object +** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. +** +** ^The sqlite3_value_text16() interface extracts a UTF-16 string +** in the native byte-order of the host machine. ^The +** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces +** extract UTF-16 strings as big-endian and little-endian respectively. +** +** ^(The sqlite3_value_numeric_type() interface attempts to apply +** numeric affinity to the value. This means that an attempt is +** made to convert the value to an integer or floating point. If +** such a conversion is possible without loss of information (in other +** words, if the value is a string that looks like a number) +** then the conversion is performed. Otherwise no conversion occurs. +** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ +** +** Please pay particular attention to the fact that the pointer returned +** from [sqlite3_value_blob()], [sqlite3_value_text()], or +** [sqlite3_value_text16()] can be invalidated by a subsequent call to +** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], +** or [sqlite3_value_text16()]. +** +** These routines must be called from the same thread as +** the SQL function that supplied the [sqlite3_value*] parameters. +*/ +SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); +SQLITE_API int sqlite3_value_bytes(sqlite3_value*); +SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); +SQLITE_API double sqlite3_value_double(sqlite3_value*); +SQLITE_API int sqlite3_value_int(sqlite3_value*); +SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); +SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); +SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); +SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); +SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); +SQLITE_API int sqlite3_value_type(sqlite3_value*); +SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); + +/* +** CAPI3REF: Obtain Aggregate Function Context +** +** Implementions of aggregate SQL functions use this +** routine to allocate memory for storing their state. +** +** ^The first time the sqlite3_aggregate_context(C,N) routine is called +** for a particular aggregate function, SQLite +** allocates N of memory, zeroes out that memory, and returns a pointer +** to the new memory. ^On second and subsequent calls to +** sqlite3_aggregate_context() for the same aggregate function instance, +** the same buffer is returned. Sqlite3_aggregate_context() is normally +** called once for each invocation of the xStep callback and then one +** last time when the xFinal callback is invoked. ^(When no rows match +** an aggregate query, the xStep() callback of the aggregate function +** implementation is never called and xFinal() is called exactly once. +** In those cases, sqlite3_aggregate_context() might be called for the +** first time from within xFinal().)^ +** +** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is +** less than or equal to zero or if a memory allocate error occurs. +** +** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is +** determined by the N parameter on first successful call. Changing the +** value of N in subsequent call to sqlite3_aggregate_context() within +** the same aggregate function instance will not resize the memory +** allocation.)^ +** +** ^SQLite automatically frees the memory allocated by +** sqlite3_aggregate_context() when the aggregate query concludes. +** +** The first parameter must be a copy of the +** [sqlite3_context | SQL function context] that is the first parameter +** to the xStep or xFinal callback routine that implements the aggregate +** function. +** +** This routine must be called from the same thread in which +** the aggregate SQL function is running. +*/ +SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); + +/* +** CAPI3REF: User Data For Functions +** +** ^The sqlite3_user_data() interface returns a copy of +** the pointer that was the pUserData parameter (the 5th parameter) +** of the [sqlite3_create_function()] +** and [sqlite3_create_function16()] routines that originally +** registered the application defined function. +** +** This routine must be called from the same thread in which +** the application-defined function is running. +*/ +SQLITE_API void *sqlite3_user_data(sqlite3_context*); + +/* +** CAPI3REF: Database Connection For Functions +** +** ^The sqlite3_context_db_handle() interface returns a copy of +** the pointer to the [database connection] (the 1st parameter) +** of the [sqlite3_create_function()] +** and [sqlite3_create_function16()] routines that originally +** registered the application defined function. +*/ +SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); + +/* +** CAPI3REF: Function Auxiliary Data +** +** The following two functions may be used by scalar SQL functions to +** associate metadata with argument values. If the same value is passed to +** multiple invocations of the same SQL function during query execution, under +** some circumstances the associated metadata may be preserved. This may +** be used, for example, to add a regular-expression matching scalar +** function. The compiled version of the regular expression is stored as +** metadata associated with the SQL value passed as the regular expression +** pattern. The compiled regular expression can be reused on multiple +** invocations of the same function so that the original pattern string +** does not need to be recompiled on each invocation. +** +** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata +** associated by the sqlite3_set_auxdata() function with the Nth argument +** value to the application-defined function. ^If no metadata has been ever +** been set for the Nth argument of the function, or if the corresponding +** function parameter has changed since the meta-data was set, +** then sqlite3_get_auxdata() returns a NULL pointer. +** +** ^The sqlite3_set_auxdata() interface saves the metadata +** pointed to by its 3rd parameter as the metadata for the N-th +** argument of the application-defined function. Subsequent +** calls to sqlite3_get_auxdata() might return this data, if it has +** not been destroyed. +** ^If it is not NULL, SQLite will invoke the destructor +** function given by the 4th parameter to sqlite3_set_auxdata() on +** the metadata when the corresponding function parameter changes +** or when the SQL statement completes, whichever comes first. +** +** SQLite is free to call the destructor and drop metadata on any +** parameter of any function at any time. ^The only guarantee is that +** the destructor will be called before the metadata is dropped. +** +** ^(In practice, metadata is preserved between function calls for +** expressions that are constant at compile time. This includes literal +** values and [parameters].)^ +** +** These routines must be called from the same thread in which +** the SQL function is running. +*/ +SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); +SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); + + +/* +** CAPI3REF: Constants Defining Special Destructor Behavior +** +** These are special values for the destructor that is passed in as the +** final argument to routines like [sqlite3_result_blob()]. ^If the destructor +** argument is SQLITE_STATIC, it means that the content pointer is constant +** and will never change. It does not need to be destroyed. ^The +** SQLITE_TRANSIENT value means that the content will likely change in +** the near future and that SQLite should make its own private copy of +** the content before returning. +** +** The typedef is necessary to work around problems in certain +** C++ compilers. See ticket #2191. +*/ +typedef void (*sqlite3_destructor_type)(void*); +#define SQLITE_STATIC ((sqlite3_destructor_type)0) +#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) + +/* +** CAPI3REF: Setting The Result Of An SQL Function +** +** These routines are used by the xFunc or xFinal callbacks that +** implement SQL functions and aggregates. See +** [sqlite3_create_function()] and [sqlite3_create_function16()] +** for additional information. +** +** These functions work very much like the [parameter binding] family of +** functions used to bind values to host parameters in prepared statements. +** Refer to the [SQL parameter] documentation for additional information. +** +** ^The sqlite3_result_blob() interface sets the result from +** an application-defined function to be the BLOB whose content is pointed +** to by the second parameter and which is N bytes long where N is the +** third parameter. +** +** ^The sqlite3_result_zeroblob() interfaces set the result of +** the application-defined function to be a BLOB containing all zero +** bytes and N bytes in size, where N is the value of the 2nd parameter. +** +** ^The sqlite3_result_double() interface sets the result from +** an application-defined function to be a floating point value specified +** by its 2nd argument. +** +** ^The sqlite3_result_error() and sqlite3_result_error16() functions +** cause the implemented SQL function to throw an exception. +** ^SQLite uses the string pointed to by the +** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() +** as the text of an error message. ^SQLite interprets the error +** message string from sqlite3_result_error() as UTF-8. ^SQLite +** interprets the string from sqlite3_result_error16() as UTF-16 in native +** byte order. ^If the third parameter to sqlite3_result_error() +** or sqlite3_result_error16() is negative then SQLite takes as the error +** message all text up through the first zero character. +** ^If the third parameter to sqlite3_result_error() or +** sqlite3_result_error16() is non-negative then SQLite takes that many +** bytes (not characters) from the 2nd parameter as the error message. +** ^The sqlite3_result_error() and sqlite3_result_error16() +** routines make a private copy of the error message text before +** they return. Hence, the calling function can deallocate or +** modify the text after they return without harm. +** ^The sqlite3_result_error_code() function changes the error code +** returned by SQLite as a result of an error in a function. ^By default, +** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() +** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. +** +** ^The sqlite3_result_toobig() interface causes SQLite to throw an error +** indicating that a string or BLOB is too long to represent. +** +** ^The sqlite3_result_nomem() interface causes SQLite to throw an error +** indicating that a memory allocation failed. +** +** ^The sqlite3_result_int() interface sets the return value +** of the application-defined function to be the 32-bit signed integer +** value given in the 2nd argument. +** ^The sqlite3_result_int64() interface sets the return value +** of the application-defined function to be the 64-bit signed integer +** value given in the 2nd argument. +** +** ^The sqlite3_result_null() interface sets the return value +** of the application-defined function to be NULL. +** +** ^The sqlite3_result_text(), sqlite3_result_text16(), +** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces +** set the return value of the application-defined function to be +** a text string which is represented as UTF-8, UTF-16 native byte order, +** UTF-16 little endian, or UTF-16 big endian, respectively. +** ^SQLite takes the text result from the application from +** the 2nd parameter of the sqlite3_result_text* interfaces. +** ^If the 3rd parameter to the sqlite3_result_text* interfaces +** is negative, then SQLite takes result text from the 2nd parameter +** through the first zero character. +** ^If the 3rd parameter to the sqlite3_result_text* interfaces +** is non-negative, then as many bytes (not characters) of the text +** pointed to by the 2nd parameter are taken as the application-defined +** function result. +** ^If the 4th parameter to the sqlite3_result_text* interfaces +** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that +** function as the destructor on the text or BLOB result when it has +** finished using that result. +** ^If the 4th parameter to the sqlite3_result_text* interfaces or to +** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite +** assumes that the text or BLOB result is in constant space and does not +** copy the content of the parameter nor call a destructor on the content +** when it has finished using that result. +** ^If the 4th parameter to the sqlite3_result_text* interfaces +** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT +** then SQLite makes a copy of the result into space obtained from +** from [sqlite3_malloc()] before it returns. +** +** ^The sqlite3_result_value() interface sets the result of +** the application-defined function to be a copy the +** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The +** sqlite3_result_value() interface makes a copy of the [sqlite3_value] +** so that the [sqlite3_value] specified in the parameter may change or +** be deallocated after sqlite3_result_value() returns without harm. +** ^A [protected sqlite3_value] object may always be used where an +** [unprotected sqlite3_value] object is required, so either +** kind of [sqlite3_value] object can be used with this interface. +** +** If these routines are called from within the different thread +** than the one containing the application-defined function that received +** the [sqlite3_context] pointer, the results are undefined. +*/ +SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); +SQLITE_API void sqlite3_result_double(sqlite3_context*, double); +SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); +SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); +SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); +SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); +SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); +SQLITE_API void sqlite3_result_int(sqlite3_context*, int); +SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); +SQLITE_API void sqlite3_result_null(sqlite3_context*); +SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); +SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); +SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); +SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); +SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); +SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); + +/* +** CAPI3REF: Define New Collating Sequences +** +** These functions are used to add new collation sequences to the +** [database connection] specified as the first argument. +** +** ^The name of the new collation sequence is specified as a UTF-8 string +** for sqlite3_create_collation() and sqlite3_create_collation_v2() +** and a UTF-16 string for sqlite3_create_collation16(). ^In all cases +** the name is passed as the second function argument. +** +** ^The third argument may be one of the constants [SQLITE_UTF8], +** [SQLITE_UTF16LE], or [SQLITE_UTF16BE], indicating that the user-supplied +** routine expects to be passed pointers to strings encoded using UTF-8, +** UTF-16 little-endian, or UTF-16 big-endian, respectively. ^The +** third argument might also be [SQLITE_UTF16] to indicate that the routine +** expects pointers to be UTF-16 strings in the native byte order, or the +** argument can be [SQLITE_UTF16_ALIGNED] if the +** the routine expects pointers to 16-bit word aligned strings +** of UTF-16 in the native byte order. +** +** A pointer to the user supplied routine must be passed as the fifth +** argument. ^If it is NULL, this is the same as deleting the collation +** sequence (so that SQLite cannot call it anymore). +** ^Each time the application supplied function is invoked, it is passed +** as its first parameter a copy of the void* passed as the fourth argument +** to sqlite3_create_collation() or sqlite3_create_collation16(). +** +** ^The remaining arguments to the application-supplied routine are two strings, +** each represented by a (length, data) pair and encoded in the encoding +** that was passed as the third argument when the collation sequence was +** registered. The application defined collation routine should +** return negative, zero or positive if the first string is less than, +** equal to, or greater than the second string. i.e. (STRING1 - STRING2). +** +** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() +** except that it takes an extra argument which is a destructor for +** the collation. ^The destructor is called when the collation is +** destroyed and is passed a copy of the fourth parameter void* pointer +** of the sqlite3_create_collation_v2(). +** ^Collations are destroyed when they are overridden by later calls to the +** collation creation functions or when the [database connection] is closed +** using [sqlite3_close()]. +** +** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. +*/ +SQLITE_API int sqlite3_create_collation( + sqlite3*, + const char *zName, + int eTextRep, + void*, + int(*xCompare)(void*,int,const void*,int,const void*) +); +SQLITE_API int sqlite3_create_collation_v2( + sqlite3*, + const char *zName, + int eTextRep, + void*, + int(*xCompare)(void*,int,const void*,int,const void*), + void(*xDestroy)(void*) +); +SQLITE_API int sqlite3_create_collation16( + sqlite3*, + const void *zName, + int eTextRep, + void*, + int(*xCompare)(void*,int,const void*,int,const void*) +); + +/* +** CAPI3REF: Collation Needed Callbacks +** +** ^To avoid having to register all collation sequences before a database +** can be used, a single callback function may be registered with the +** [database connection] to be invoked whenever an undefined collation +** sequence is required. +** +** ^If the function is registered using the sqlite3_collation_needed() API, +** then it is passed the names of undefined collation sequences as strings +** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, +** the names are passed as UTF-16 in machine native byte order. +** ^A call to either function replaces the existing collation-needed callback. +** +** ^(When the callback is invoked, the first argument passed is a copy +** of the second argument to sqlite3_collation_needed() or +** sqlite3_collation_needed16(). The second argument is the database +** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], +** or [SQLITE_UTF16LE], indicating the most desirable form of the collation +** sequence function required. The fourth parameter is the name of the +** required collation sequence.)^ +** +** The callback function should register the desired collation using +** [sqlite3_create_collation()], [sqlite3_create_collation16()], or +** [sqlite3_create_collation_v2()]. +*/ +SQLITE_API int sqlite3_collation_needed( + sqlite3*, + void*, + void(*)(void*,sqlite3*,int eTextRep,const char*) +); +SQLITE_API int sqlite3_collation_needed16( + sqlite3*, + void*, + void(*)(void*,sqlite3*,int eTextRep,const void*) +); + +#if SQLITE_HAS_CODEC +/* +** Specify the key for an encrypted database. This routine should be +** called right after sqlite3_open(). +** +** The code to implement this API is not available in the public release +** of SQLite. +*/ +SQLITE_API int sqlite3_key( + sqlite3 *db, /* Database to be rekeyed */ + const void *pKey, int nKey /* The key */ +); + +/* +** Change the key on an open database. If the current database is not +** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the +** database is decrypted. +** +** The code to implement this API is not available in the public release +** of SQLite. +*/ +SQLITE_API int sqlite3_rekey( + sqlite3 *db, /* Database to be rekeyed */ + const void *pKey, int nKey /* The new key */ +); + +/* +** Specify the activation key for a SEE database. Unless +** activated, none of the SEE routines will work. +*/ +SQLITE_API void sqlite3_activate_see( + const char *zPassPhrase /* Activation phrase */ +); +#endif + +#ifdef SQLITE_ENABLE_CEROD +/* +** Specify the activation key for a CEROD database. Unless +** activated, none of the CEROD routines will work. +*/ +SQLITE_API void sqlite3_activate_cerod( + const char *zPassPhrase /* Activation phrase */ +); +#endif + +/* +** CAPI3REF: Suspend Execution For A Short Time +** +** ^The sqlite3_sleep() function causes the current thread to suspend execution +** for at least a number of milliseconds specified in its parameter. +** +** ^If the operating system does not support sleep requests with +** millisecond time resolution, then the time will be rounded up to +** the nearest second. ^The number of milliseconds of sleep actually +** requested from the operating system is returned. +** +** ^SQLite implements this interface by calling the xSleep() +** method of the default [sqlite3_vfs] object. +*/ +SQLITE_API int sqlite3_sleep(int); + +/* +** CAPI3REF: Name Of The Folder Holding Temporary Files +** +** ^(If this global variable is made to point to a string which is +** the name of a folder (a.k.a. directory), then all temporary files +** created by SQLite when using a built-in [sqlite3_vfs | VFS] +** will be placed in that directory.)^ ^If this variable +** is a NULL pointer, then SQLite performs a search for an appropriate +** temporary file directory. +** +** It is not safe to read or modify this variable in more than one +** thread at a time. It is not safe to read or modify this variable +** if a [database connection] is being used at the same time in a separate +** thread. +** It is intended that this variable be set once +** as part of process initialization and before any SQLite interface +** routines have been called and that this variable remain unchanged +** thereafter. +** +** ^The [temp_store_directory pragma] may modify this variable and cause +** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, +** the [temp_store_directory pragma] always assumes that any string +** that this variable points to is held in memory obtained from +** [sqlite3_malloc] and the pragma may attempt to free that memory +** using [sqlite3_free]. +** Hence, if this variable is modified directly, either it should be +** made NULL or made to point to memory obtained from [sqlite3_malloc] +** or else the use of the [temp_store_directory pragma] should be avoided. +*/ +SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; + +/* +** CAPI3REF: Test For Auto-Commit Mode +** KEYWORDS: {autocommit mode} +** +** ^The sqlite3_get_autocommit() interface returns non-zero or +** zero if the given database connection is or is not in autocommit mode, +** respectively. ^Autocommit mode is on by default. +** ^Autocommit mode is disabled by a [BEGIN] statement. +** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. +** +** If certain kinds of errors occur on a statement within a multi-statement +** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], +** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the +** transaction might be rolled back automatically. The only way to +** find out whether SQLite automatically rolled back the transaction after +** an error is to use this function. +** +** If another thread changes the autocommit status of the database +** connection while this routine is running, then the return value +** is undefined. +*/ +SQLITE_API int sqlite3_get_autocommit(sqlite3*); + +/* +** CAPI3REF: Find The Database Handle Of A Prepared Statement +** +** ^The sqlite3_db_handle interface returns the [database connection] handle +** to which a [prepared statement] belongs. ^The [database connection] +** returned by sqlite3_db_handle is the same [database connection] +** that was the first argument +** to the [sqlite3_prepare_v2()] call (or its variants) that was used to +** create the statement in the first place. +*/ +SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); + +/* +** CAPI3REF: Find the next prepared statement +** +** ^This interface returns a pointer to the next [prepared statement] after +** pStmt associated with the [database connection] pDb. ^If pStmt is NULL +** then this interface returns a pointer to the first prepared statement +** associated with the database connection pDb. ^If no prepared statement +** satisfies the conditions of this routine, it returns NULL. +** +** The [database connection] pointer D in a call to +** [sqlite3_next_stmt(D,S)] must refer to an open database +** connection and in particular must not be a NULL pointer. +*/ +SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); + +/* +** CAPI3REF: Commit And Rollback Notification Callbacks +** +** ^The sqlite3_commit_hook() interface registers a callback +** function to be invoked whenever a transaction is [COMMIT | committed]. +** ^Any callback set by a previous call to sqlite3_commit_hook() +** for the same database connection is overridden. +** ^The sqlite3_rollback_hook() interface registers a callback +** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. +** ^Any callback set by a previous call to sqlite3_rollback_hook() +** for the same database connection is overridden. +** ^The pArg argument is passed through to the callback. +** ^If the callback on a commit hook function returns non-zero, +** then the commit is converted into a rollback. +** +** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions +** return the P argument from the previous call of the same function +** on the same [database connection] D, or NULL for +** the first call for each function on D. +** +** The callback implementation must not do anything that will modify +** the database connection that invoked the callback. Any actions +** to modify the database connection must be deferred until after the +** completion of the [sqlite3_step()] call that triggered the commit +** or rollback hook in the first place. +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** database connections for the meaning of "modify" in this paragraph. +** +** ^Registering a NULL function disables the callback. +** +** ^When the commit hook callback routine returns zero, the [COMMIT] +** operation is allowed to continue normally. ^If the commit hook +** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK]. +** ^The rollback hook is invoked on a rollback that results from a commit +** hook returning non-zero, just as it would be with any other rollback. +** +** ^For the purposes of this API, a transaction is said to have been +** rolled back if an explicit "ROLLBACK" statement is executed, or +** an error or constraint causes an implicit rollback to occur. +** ^The rollback callback is not invoked if a transaction is +** automatically rolled back because the database connection is closed. +** ^The rollback callback is not invoked if a transaction is +** rolled back because a commit callback returned non-zero. +** +** See also the [sqlite3_update_hook()] interface. +*/ +SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); +SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); + +/* +** CAPI3REF: Data Change Notification Callbacks +** +** ^The sqlite3_update_hook() interface registers a callback function +** with the [database connection] identified by the first argument +** to be invoked whenever a row is updated, inserted or deleted. +** ^Any callback set by a previous call to this function +** for the same database connection is overridden. +** +** ^The second argument is a pointer to the function to invoke when a +** row is updated, inserted or deleted. +** ^The first argument to the callback is a copy of the third argument +** to sqlite3_update_hook(). +** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], +** or [SQLITE_UPDATE], depending on the operation that caused the callback +** to be invoked. +** ^The third and fourth arguments to the callback contain pointers to the +** database and table name containing the affected row. +** ^The final callback parameter is the [rowid] of the row. +** ^In the case of an update, this is the [rowid] after the update takes place. +** +** ^(The update hook is not invoked when internal system tables are +** modified (i.e. sqlite_master and sqlite_sequence).)^ +** +** ^In the current implementation, the update hook +** is not invoked when duplication rows are deleted because of an +** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook +** invoked when rows are deleted using the [truncate optimization]. +** The exceptions defined in this paragraph might change in a future +** release of SQLite. +** +** The update hook implementation must not do anything that will modify +** the database connection that invoked the update hook. Any actions +** to modify the database connection must be deferred until after the +** completion of the [sqlite3_step()] call that triggered the update hook. +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** database connections for the meaning of "modify" in this paragraph. +** +** ^The sqlite3_update_hook(D,C,P) function +** returns the P argument from the previous call +** on the same [database connection] D, or NULL for +** the first call on D. +** +** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()] +** interfaces. +*/ +SQLITE_API void *sqlite3_update_hook( + sqlite3*, + void(*)(void *,int ,char const *,char const *,sqlite3_int64), + void* +); + +/* +** CAPI3REF: Enable Or Disable Shared Pager Cache +** KEYWORDS: {shared cache} +** +** ^(This routine enables or disables the sharing of the database cache +** and schema data structures between [database connection | connections] +** to the same database. Sharing is enabled if the argument is true +** and disabled if the argument is false.)^ +** +** ^Cache sharing is enabled and disabled for an entire process. +** This is a change as of SQLite version 3.5.0. In prior versions of SQLite, +** sharing was enabled or disabled for each thread separately. +** +** ^(The cache sharing mode set by this interface effects all subsequent +** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. +** Existing database connections continue use the sharing mode +** that was in effect at the time they were opened.)^ +** +** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled +** successfully. An [error code] is returned otherwise.)^ +** +** ^Shared cache is disabled by default. But this might change in +** future releases of SQLite. Applications that care about shared +** cache setting should set it explicitly. +** +** See Also: [SQLite Shared-Cache Mode] +*/ +SQLITE_API int sqlite3_enable_shared_cache(int); + +/* +** CAPI3REF: Attempt To Free Heap Memory +** +** ^The sqlite3_release_memory() interface attempts to free N bytes +** of heap memory by deallocating non-essential memory allocations +** held by the database library. Memory used to cache database +** pages to improve performance is an example of non-essential memory. +** ^sqlite3_release_memory() returns the number of bytes actually freed, +** which might be more or less than the amount requested. +*/ +SQLITE_API int sqlite3_release_memory(int); + +/* +** CAPI3REF: Impose A Limit On Heap Size +** +** ^The sqlite3_soft_heap_limit() interface places a "soft" limit +** on the amount of heap memory that may be allocated by SQLite. +** ^If an internal allocation is requested that would exceed the +** soft heap limit, [sqlite3_release_memory()] is invoked one or +** more times to free up some space before the allocation is performed. +** +** ^The limit is called "soft" because if [sqlite3_release_memory()] +** cannot free sufficient memory to prevent the limit from being exceeded, +** the memory is allocated anyway and the current operation proceeds. +** +** ^A negative or zero value for N means that there is no soft heap limit and +** [sqlite3_release_memory()] will only be called when memory is exhausted. +** ^The default value for the soft heap limit is zero. +** +** ^(SQLite makes a best effort to honor the soft heap limit. +** But if the soft heap limit cannot be honored, execution will +** continue without error or notification.)^ This is why the limit is +** called a "soft" limit. It is advisory only. +** +** Prior to SQLite version 3.5.0, this routine only constrained the memory +** allocated by a single thread - the same thread in which this routine +** runs. Beginning with SQLite version 3.5.0, the soft heap limit is +** applied to all threads. The value specified for the soft heap limit +** is an upper bound on the total memory allocation for all threads. In +** version 3.5.0 there is no mechanism for limiting the heap usage for +** individual threads. +*/ +SQLITE_API void sqlite3_soft_heap_limit(int); + +/* +** CAPI3REF: Extract Metadata About A Column Of A Table +** +** ^This routine returns metadata about a specific column of a specific +** database table accessible using the [database connection] handle +** passed as the first function argument. +** +** ^The column is identified by the second, third and fourth parameters to +** this function. ^The second parameter is either the name of the database +** (i.e. "main", "temp", or an attached database) containing the specified +** table or NULL. ^If it is NULL, then all attached databases are searched +** for the table using the same algorithm used by the database engine to +** resolve unqualified table references. +** +** ^The third and fourth parameters to this function are the table and column +** name of the desired column, respectively. Neither of these parameters +** may be NULL. +** +** ^Metadata is returned by writing to the memory locations passed as the 5th +** and subsequent parameters to this function. ^Any of these arguments may be +** NULL, in which case the corresponding element of metadata is omitted. +** +** ^(
+** +**
Parameter Output
Type
Description +** +**
5th const char* Data type +**
6th const char* Name of default collation sequence +**
7th int True if column has a NOT NULL constraint +**
8th int True if column is part of the PRIMARY KEY +**
9th int True if column is [AUTOINCREMENT] +**
+**
)^ +** +** ^The memory pointed to by the character pointers returned for the +** declaration type and collation sequence is valid only until the next +** call to any SQLite API function. +** +** ^If the specified table is actually a view, an [error code] is returned. +** +** ^If the specified column is "rowid", "oid" or "_rowid_" and an +** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output +** parameters are set for the explicitly declared column. ^(If there is no +** explicitly declared [INTEGER PRIMARY KEY] column, then the output +** parameters are set as follows: +** +**
+**     data type: "INTEGER"
+**     collation sequence: "BINARY"
+**     not null: 0
+**     primary key: 1
+**     auto increment: 0
+** 
)^ +** +** ^(This function may load one or more schemas from database files. If an +** error occurs during this process, or if the requested table or column +** cannot be found, an [error code] is returned and an error message left +** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^ +** +** ^This API is only available if the library was compiled with the +** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined. +*/ +SQLITE_API int sqlite3_table_column_metadata( + sqlite3 *db, /* Connection handle */ + const char *zDbName, /* Database name or NULL */ + const char *zTableName, /* Table name */ + const char *zColumnName, /* Column name */ + char const **pzDataType, /* OUTPUT: Declared data type */ + char const **pzCollSeq, /* OUTPUT: Collation sequence name */ + int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ + int *pPrimaryKey, /* OUTPUT: True if column part of PK */ + int *pAutoinc /* OUTPUT: True if column is auto-increment */ +); + +/* +** CAPI3REF: Load An Extension +** +** ^This interface loads an SQLite extension library from the named file. +** +** ^The sqlite3_load_extension() interface attempts to load an +** SQLite extension library contained in the file zFile. +** +** ^The entry point is zProc. +** ^zProc may be 0, in which case the name of the entry point +** defaults to "sqlite3_extension_init". +** ^The sqlite3_load_extension() interface returns +** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. +** ^If an error occurs and pzErrMsg is not 0, then the +** [sqlite3_load_extension()] interface shall attempt to +** fill *pzErrMsg with error message text stored in memory +** obtained from [sqlite3_malloc()]. The calling function +** should free this memory by calling [sqlite3_free()]. +** +** ^Extension loading must be enabled using +** [sqlite3_enable_load_extension()] prior to calling this API, +** otherwise an error will be returned. +** +** See also the [load_extension() SQL function]. +*/ +SQLITE_API int sqlite3_load_extension( + sqlite3 *db, /* Load the extension into this database connection */ + const char *zFile, /* Name of the shared library containing extension */ + const char *zProc, /* Entry point. Derived from zFile if 0 */ + char **pzErrMsg /* Put error message here if not 0 */ +); + +/* +** CAPI3REF: Enable Or Disable Extension Loading +** +** ^So as not to open security holes in older applications that are +** unprepared to deal with extension loading, and as a means of disabling +** extension loading while evaluating user-entered SQL, the following API +** is provided to turn the [sqlite3_load_extension()] mechanism on and off. +** +** ^Extension loading is off by default. See ticket #1863. +** ^Call the sqlite3_enable_load_extension() routine with onoff==1 +** to turn extension loading on and call it with onoff==0 to turn +** it back off again. +*/ +SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); + +/* +** CAPI3REF: Automatically Load An Extensions +** +** ^This API can be invoked at program startup in order to register +** one or more statically linked extensions that will be available +** to all new [database connections]. +** +** ^(This routine stores a pointer to the extension entry point +** in an array that is obtained from [sqlite3_malloc()]. That memory +** is deallocated by [sqlite3_reset_auto_extension()].)^ +** +** ^This function registers an extension entry point that is +** automatically invoked whenever a new [database connection] +** is opened using [sqlite3_open()], [sqlite3_open16()], +** or [sqlite3_open_v2()]. +** ^Duplicate extensions are detected so calling this routine +** multiple times with the same extension is harmless. +** ^Automatic extensions apply across all threads. +*/ +SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); + +/* +** CAPI3REF: Reset Automatic Extension Loading +** +** ^(This function disables all previously registered automatic +** extensions. It undoes the effect of all prior +** [sqlite3_auto_extension()] calls.)^ +** +** ^This function disables automatic extensions in all threads. +*/ +SQLITE_API void sqlite3_reset_auto_extension(void); + +/* +****** EXPERIMENTAL - subject to change without notice ************** +** +** The interface to the virtual-table mechanism is currently considered +** to be experimental. The interface might change in incompatible ways. +** If this is a problem for you, do not use the interface at this time. +** +** When the virtual-table mechanism stabilizes, we will declare the +** interface fixed, support it indefinitely, and remove this comment. +*/ + +/* +** Structures used by the virtual table interface +*/ +typedef struct sqlite3_vtab sqlite3_vtab; +typedef struct sqlite3_index_info sqlite3_index_info; +typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; +typedef struct sqlite3_module sqlite3_module; + +/* +** CAPI3REF: Virtual Table Object +** KEYWORDS: sqlite3_module {virtual table module} +** EXPERIMENTAL +** +** This structure, sometimes called a a "virtual table module", +** defines the implementation of a [virtual tables]. +** This structure consists mostly of methods for the module. +** +** ^A virtual table module is created by filling in a persistent +** instance of this structure and passing a pointer to that instance +** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. +** ^The registration remains valid until it is replaced by a different +** module or until the [database connection] closes. The content +** of this structure must not change while it is registered with +** any database connection. +*/ +struct sqlite3_module { + int iVersion; + int (*xCreate)(sqlite3*, void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVTab, char**); + int (*xConnect)(sqlite3*, void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVTab, char**); + int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); + int (*xDisconnect)(sqlite3_vtab *pVTab); + int (*xDestroy)(sqlite3_vtab *pVTab); + int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); + int (*xClose)(sqlite3_vtab_cursor*); + int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, + int argc, sqlite3_value **argv); + int (*xNext)(sqlite3_vtab_cursor*); + int (*xEof)(sqlite3_vtab_cursor*); + int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); + int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); + int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); + int (*xBegin)(sqlite3_vtab *pVTab); + int (*xSync)(sqlite3_vtab *pVTab); + int (*xCommit)(sqlite3_vtab *pVTab); + int (*xRollback)(sqlite3_vtab *pVTab); + int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, + void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), + void **ppArg); + int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); +}; + +/* +** CAPI3REF: Virtual Table Indexing Information +** KEYWORDS: sqlite3_index_info +** EXPERIMENTAL +** +** The sqlite3_index_info structure and its substructures is used to +** pass information into and receive the reply from the [xBestIndex] +** method of a [virtual table module]. The fields under **Inputs** are the +** inputs to xBestIndex and are read-only. xBestIndex inserts its +** results into the **Outputs** fields. +** +** ^(The aConstraint[] array records WHERE clause constraints of the form: +** +**
column OP expr
+** +** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is +** stored in aConstraint[].op.)^ ^(The index of the column is stored in +** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the +** expr on the right-hand side can be evaluated (and thus the constraint +** is usable) and false if it cannot.)^ +** +** ^The optimizer automatically inverts terms of the form "expr OP column" +** and makes other simplifications to the WHERE clause in an attempt to +** get as many WHERE clause terms into the form shown above as possible. +** ^The aConstraint[] array only reports WHERE clause terms that are +** relevant to the particular virtual table being queried. +** +** ^Information about the ORDER BY clause is stored in aOrderBy[]. +** ^Each term of aOrderBy records a column of the ORDER BY clause. +** +** The [xBestIndex] method must fill aConstraintUsage[] with information +** about what parameters to pass to xFilter. ^If argvIndex>0 then +** the right-hand side of the corresponding aConstraint[] is evaluated +** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit +** is true, then the constraint is assumed to be fully handled by the +** virtual table and is not checked again by SQLite.)^ +** +** ^The idxNum and idxPtr values are recorded and passed into the +** [xFilter] method. +** ^[sqlite3_free()] is used to free idxPtr if and only if +** needToFreeIdxPtr is true. +** +** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in +** the correct order to satisfy the ORDER BY clause so that no separate +** sorting step is required. +** +** ^The estimatedCost value is an estimate of the cost of doing the +** particular lookup. A full scan of a table with N entries should have +** a cost of N. A binary search of a table of N entries should have a +** cost of approximately log(N). +*/ +struct sqlite3_index_info { + /* Inputs */ + int nConstraint; /* Number of entries in aConstraint */ + struct sqlite3_index_constraint { + int iColumn; /* Column on left-hand side of constraint */ + unsigned char op; /* Constraint operator */ + unsigned char usable; /* True if this constraint is usable */ + int iTermOffset; /* Used internally - xBestIndex should ignore */ + } *aConstraint; /* Table of WHERE clause constraints */ + int nOrderBy; /* Number of terms in the ORDER BY clause */ + struct sqlite3_index_orderby { + int iColumn; /* Column number */ + unsigned char desc; /* True for DESC. False for ASC. */ + } *aOrderBy; /* The ORDER BY clause */ + /* Outputs */ + struct sqlite3_index_constraint_usage { + int argvIndex; /* if >0, constraint is part of argv to xFilter */ + unsigned char omit; /* Do not code a test for this constraint */ + } *aConstraintUsage; + int idxNum; /* Number used to identify the index */ + char *idxStr; /* String, possibly obtained from sqlite3_malloc */ + int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ + int orderByConsumed; /* True if output is already ordered */ + double estimatedCost; /* Estimated cost of using this index */ +}; +#define SQLITE_INDEX_CONSTRAINT_EQ 2 +#define SQLITE_INDEX_CONSTRAINT_GT 4 +#define SQLITE_INDEX_CONSTRAINT_LE 8 +#define SQLITE_INDEX_CONSTRAINT_LT 16 +#define SQLITE_INDEX_CONSTRAINT_GE 32 +#define SQLITE_INDEX_CONSTRAINT_MATCH 64 + +/* +** CAPI3REF: Register A Virtual Table Implementation +** EXPERIMENTAL +** +** ^These routines are used to register a new [virtual table module] name. +** ^Module names must be registered before +** creating a new [virtual table] using the module and before using a +** preexisting [virtual table] for the module. +** +** ^The module name is registered on the [database connection] specified +** by the first parameter. ^The name of the module is given by the +** second parameter. ^The third parameter is a pointer to +** the implementation of the [virtual table module]. ^The fourth +** parameter is an arbitrary client data pointer that is passed through +** into the [xCreate] and [xConnect] methods of the virtual table module +** when a new virtual table is be being created or reinitialized. +** +** ^The sqlite3_create_module_v2() interface has a fifth parameter which +** is a pointer to a destructor for the pClientData. ^SQLite will +** invoke the destructor function (if it is not NULL) when SQLite +** no longer needs the pClientData pointer. ^The sqlite3_create_module() +** interface is equivalent to sqlite3_create_module_v2() with a NULL +** destructor. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_create_module( + sqlite3 *db, /* SQLite connection to register module with */ + const char *zName, /* Name of the module */ + const sqlite3_module *p, /* Methods for the module */ + void *pClientData /* Client data for xCreate/xConnect */ +); +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_create_module_v2( + sqlite3 *db, /* SQLite connection to register module with */ + const char *zName, /* Name of the module */ + const sqlite3_module *p, /* Methods for the module */ + void *pClientData, /* Client data for xCreate/xConnect */ + void(*xDestroy)(void*) /* Module destructor function */ +); + +/* +** CAPI3REF: Virtual Table Instance Object +** KEYWORDS: sqlite3_vtab +** EXPERIMENTAL +** +** Every [virtual table module] implementation uses a subclass +** of this object to describe a particular instance +** of the [virtual table]. Each subclass will +** be tailored to the specific needs of the module implementation. +** The purpose of this superclass is to define certain fields that are +** common to all module implementations. +** +** ^Virtual tables methods can set an error message by assigning a +** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should +** take care that any prior string is freed by a call to [sqlite3_free()] +** prior to assigning a new string to zErrMsg. ^After the error message +** is delivered up to the client application, the string will be automatically +** freed by sqlite3_free() and the zErrMsg field will be zeroed. +*/ +struct sqlite3_vtab { + const sqlite3_module *pModule; /* The module for this virtual table */ + int nRef; /* NO LONGER USED */ + char *zErrMsg; /* Error message from sqlite3_mprintf() */ + /* Virtual table implementations will typically add additional fields */ +}; + +/* +** CAPI3REF: Virtual Table Cursor Object +** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} +** EXPERIMENTAL +** +** Every [virtual table module] implementation uses a subclass of the +** following structure to describe cursors that point into the +** [virtual table] and are used +** to loop through the virtual table. Cursors are created using the +** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed +** by the [sqlite3_module.xClose | xClose] method. Cursors are used +** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods +** of the module. Each module implementation will define +** the content of a cursor structure to suit its own needs. +** +** This superclass exists in order to define fields of the cursor that +** are common to all implementations. +*/ +struct sqlite3_vtab_cursor { + sqlite3_vtab *pVtab; /* Virtual table of this cursor */ + /* Virtual table implementations will typically add additional fields */ +}; + +/* +** CAPI3REF: Declare The Schema Of A Virtual Table +** EXPERIMENTAL +** +** ^The [xCreate] and [xConnect] methods of a +** [virtual table module] call this interface +** to declare the format (the names and datatypes of the columns) of +** the virtual tables they implement. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_declare_vtab(sqlite3*, const char *zSQL); + +/* +** CAPI3REF: Overload A Function For A Virtual Table +** EXPERIMENTAL +** +** ^(Virtual tables can provide alternative implementations of functions +** using the [xFindFunction] method of the [virtual table module]. +** But global versions of those functions +** must exist in order to be overloaded.)^ +** +** ^(This API makes sure a global version of a function with a particular +** name and number of parameters exists. If no such function exists +** before this API is called, a new function is created.)^ ^The implementation +** of the new function always causes an exception to be thrown. So +** the new function is not good for anything by itself. Its only +** purpose is to be a placeholder function that can be overloaded +** by a [virtual table]. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); + +/* +** The interface to the virtual-table mechanism defined above (back up +** to a comment remarkably similar to this one) is currently considered +** to be experimental. The interface might change in incompatible ways. +** If this is a problem for you, do not use the interface at this time. +** +** When the virtual-table mechanism stabilizes, we will declare the +** interface fixed, support it indefinitely, and remove this comment. +** +****** EXPERIMENTAL - subject to change without notice ************** +*/ + +/* +** CAPI3REF: A Handle To An Open BLOB +** KEYWORDS: {BLOB handle} {BLOB handles} +** +** An instance of this object represents an open BLOB on which +** [sqlite3_blob_open | incremental BLOB I/O] can be performed. +** ^Objects of this type are created by [sqlite3_blob_open()] +** and destroyed by [sqlite3_blob_close()]. +** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces +** can be used to read or write small subsections of the BLOB. +** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. +*/ +typedef struct sqlite3_blob sqlite3_blob; + +/* +** CAPI3REF: Open A BLOB For Incremental I/O +** +** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located +** in row iRow, column zColumn, table zTable in database zDb; +** in other words, the same BLOB that would be selected by: +** +**
+**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
+** 
)^ +** +** ^If the flags parameter is non-zero, then the BLOB is opened for read +** and write access. ^If it is zero, the BLOB is opened for read access. +** ^It is not possible to open a column that is part of an index or primary +** key for writing. ^If [foreign key constraints] are enabled, it is +** not possible to open a column that is part of a [child key] for writing. +** +** ^Note that the database name is not the filename that contains +** the database but rather the symbolic name of the database that +** appears after the AS keyword when the database is connected using [ATTACH]. +** ^For the main database file, the database name is "main". +** ^For TEMP tables, the database name is "temp". +** +** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written +** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set +** to be a null pointer.)^ +** ^This function sets the [database connection] error code and message +** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related +** functions. ^Note that the *ppBlob variable is always initialized in a +** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob +** regardless of the success or failure of this routine. +** +** ^(If the row that a BLOB handle points to is modified by an +** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects +** then the BLOB handle is marked as "expired". +** This is true if any column of the row is changed, even a column +** other than the one the BLOB handle is open on.)^ +** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for +** a expired BLOB handle fail with an return code of [SQLITE_ABORT]. +** ^(Changes written into a BLOB prior to the BLOB expiring are not +** rolled back by the expiration of the BLOB. Such changes will eventually +** commit if the transaction continues to completion.)^ +** +** ^Use the [sqlite3_blob_bytes()] interface to determine the size of +** the opened blob. ^The size of a blob may not be changed by this +** interface. Use the [UPDATE] SQL command to change the size of a +** blob. +** +** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces +** and the built-in [zeroblob] SQL function can be used, if desired, +** to create an empty, zero-filled blob in which to read or write using +** this interface. +** +** To avoid a resource leak, every open [BLOB handle] should eventually +** be released by a call to [sqlite3_blob_close()]. +*/ +SQLITE_API int sqlite3_blob_open( + sqlite3*, + const char *zDb, + const char *zTable, + const char *zColumn, + sqlite3_int64 iRow, + int flags, + sqlite3_blob **ppBlob +); + +/* +** CAPI3REF: Close A BLOB Handle +** +** ^Closes an open [BLOB handle]. +** +** ^Closing a BLOB shall cause the current transaction to commit +** if there are no other BLOBs, no pending prepared statements, and the +** database connection is in [autocommit mode]. +** ^If any writes were made to the BLOB, they might be held in cache +** until the close operation if they will fit. +** +** ^(Closing the BLOB often forces the changes +** out to disk and so if any I/O errors occur, they will likely occur +** at the time when the BLOB is closed. Any errors that occur during +** closing are reported as a non-zero return value.)^ +** +** ^(The BLOB is closed unconditionally. Even if this routine returns +** an error code, the BLOB is still closed.)^ +** +** ^Calling this routine with a null pointer (such as would be returned +** by a failed call to [sqlite3_blob_open()]) is a harmless no-op. +*/ +SQLITE_API int sqlite3_blob_close(sqlite3_blob *); + +/* +** CAPI3REF: Return The Size Of An Open BLOB +** +** ^Returns the size in bytes of the BLOB accessible via the +** successfully opened [BLOB handle] in its only argument. ^The +** incremental blob I/O routines can only read or overwriting existing +** blob content; they cannot change the size of a blob. +** +** This routine only works on a [BLOB handle] which has been created +** by a prior successful call to [sqlite3_blob_open()] and which has not +** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** to this routine results in undefined and probably undesirable behavior. +*/ +SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); + +/* +** CAPI3REF: Read Data From A BLOB Incrementally +** +** ^(This function is used to read data from an open [BLOB handle] into a +** caller-supplied buffer. N bytes of data are copied into buffer Z +** from the open BLOB, starting at offset iOffset.)^ +** +** ^If offset iOffset is less than N bytes from the end of the BLOB, +** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is +** less than zero, [SQLITE_ERROR] is returned and no data is read. +** ^The size of the blob (and hence the maximum value of N+iOffset) +** can be determined using the [sqlite3_blob_bytes()] interface. +** +** ^An attempt to read from an expired [BLOB handle] fails with an +** error code of [SQLITE_ABORT]. +** +** ^(On success, sqlite3_blob_read() returns SQLITE_OK. +** Otherwise, an [error code] or an [extended error code] is returned.)^ +** +** This routine only works on a [BLOB handle] which has been created +** by a prior successful call to [sqlite3_blob_open()] and which has not +** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** to this routine results in undefined and probably undesirable behavior. +** +** See also: [sqlite3_blob_write()]. +*/ +SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); + +/* +** CAPI3REF: Write Data Into A BLOB Incrementally +** +** ^This function is used to write data into an open [BLOB handle] from a +** caller-supplied buffer. ^N bytes of data are copied from the buffer Z +** into the open BLOB, starting at offset iOffset. +** +** ^If the [BLOB handle] passed as the first argument was not opened for +** writing (the flags parameter to [sqlite3_blob_open()] was zero), +** this function returns [SQLITE_READONLY]. +** +** ^This function may only modify the contents of the BLOB; it is +** not possible to increase the size of a BLOB using this API. +** ^If offset iOffset is less than N bytes from the end of the BLOB, +** [SQLITE_ERROR] is returned and no data is written. ^If N is +** less than zero [SQLITE_ERROR] is returned and no data is written. +** The size of the BLOB (and hence the maximum value of N+iOffset) +** can be determined using the [sqlite3_blob_bytes()] interface. +** +** ^An attempt to write to an expired [BLOB handle] fails with an +** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred +** before the [BLOB handle] expired are not rolled back by the +** expiration of the handle, though of course those changes might +** have been overwritten by the statement that expired the BLOB handle +** or by other independent statements. +** +** ^(On success, sqlite3_blob_write() returns SQLITE_OK. +** Otherwise, an [error code] or an [extended error code] is returned.)^ +** +** This routine only works on a [BLOB handle] which has been created +** by a prior successful call to [sqlite3_blob_open()] and which has not +** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** to this routine results in undefined and probably undesirable behavior. +** +** See also: [sqlite3_blob_read()]. +*/ +SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); + +/* +** CAPI3REF: Virtual File System Objects +** +** A virtual filesystem (VFS) is an [sqlite3_vfs] object +** that SQLite uses to interact +** with the underlying operating system. Most SQLite builds come with a +** single default VFS that is appropriate for the host computer. +** New VFSes can be registered and existing VFSes can be unregistered. +** The following interfaces are provided. +** +** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. +** ^Names are case sensitive. +** ^Names are zero-terminated UTF-8 strings. +** ^If there is no match, a NULL pointer is returned. +** ^If zVfsName is NULL then the default VFS is returned. +** +** ^New VFSes are registered with sqlite3_vfs_register(). +** ^Each new VFS becomes the default VFS if the makeDflt flag is set. +** ^The same VFS can be registered multiple times without injury. +** ^To make an existing VFS into the default VFS, register it again +** with the makeDflt flag set. If two different VFSes with the +** same name are registered, the behavior is undefined. If a +** VFS is registered with a name that is NULL or an empty string, +** then the behavior is undefined. +** +** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. +** ^(If the default VFS is unregistered, another VFS is chosen as +** the default. The choice for the new VFS is arbitrary.)^ +*/ +SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); +SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); +SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); + +/* +** CAPI3REF: Mutexes +** +** The SQLite core uses these routines for thread +** synchronization. Though they are intended for internal +** use by SQLite, code that links against SQLite is +** permitted to use any of these routines. +** +** The SQLite source code contains multiple implementations +** of these mutex routines. An appropriate implementation +** is selected automatically at compile-time. ^(The following +** implementations are available in the SQLite core: +** +**
    +**
  • SQLITE_MUTEX_OS2 +**
  • SQLITE_MUTEX_PTHREAD +**
  • SQLITE_MUTEX_W32 +**
  • SQLITE_MUTEX_NOOP +**
)^ +** +** ^The SQLITE_MUTEX_NOOP implementation is a set of routines +** that does no real locking and is appropriate for use in +** a single-threaded application. ^The SQLITE_MUTEX_OS2, +** SQLITE_MUTEX_PTHREAD, and SQLITE_MUTEX_W32 implementations +** are appropriate for use on OS/2, Unix, and Windows. +** +** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor +** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex +** implementation is included with the library. In this case the +** application must supply a custom mutex implementation using the +** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function +** before calling sqlite3_initialize() or any other public sqlite3_ +** function that calls sqlite3_initialize().)^ +** +** ^The sqlite3_mutex_alloc() routine allocates a new +** mutex and returns a pointer to it. ^If it returns NULL +** that means that a mutex could not be allocated. ^SQLite +** will unwind its stack and return an error. ^(The argument +** to sqlite3_mutex_alloc() is one of these integer constants: +** +**
    +**
  • SQLITE_MUTEX_FAST +**
  • SQLITE_MUTEX_RECURSIVE +**
  • SQLITE_MUTEX_STATIC_MASTER +**
  • SQLITE_MUTEX_STATIC_MEM +**
  • SQLITE_MUTEX_STATIC_MEM2 +**
  • SQLITE_MUTEX_STATIC_PRNG +**
  • SQLITE_MUTEX_STATIC_LRU +**
  • SQLITE_MUTEX_STATIC_LRU2 +**
)^ +** +** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) +** cause sqlite3_mutex_alloc() to create +** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE +** is used but not necessarily so when SQLITE_MUTEX_FAST is used. +** The mutex implementation does not need to make a distinction +** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does +** not want to. ^SQLite will only request a recursive mutex in +** cases where it really needs one. ^If a faster non-recursive mutex +** implementation is available on the host platform, the mutex subsystem +** might return such a mutex in response to SQLITE_MUTEX_FAST. +** +** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other +** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return +** a pointer to a static preexisting mutex. ^Six static mutexes are +** used by the current version of SQLite. Future versions of SQLite +** may add additional static mutexes. Static mutexes are for internal +** use by SQLite only. Applications that use SQLite mutexes should +** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or +** SQLITE_MUTEX_RECURSIVE. +** +** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST +** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() +** returns a different mutex on every call. ^But for the static +** mutex types, the same mutex is returned on every call that has +** the same type number. +** +** ^The sqlite3_mutex_free() routine deallocates a previously +** allocated dynamic mutex. ^SQLite is careful to deallocate every +** dynamic mutex that it allocates. The dynamic mutexes must not be in +** use when they are deallocated. Attempting to deallocate a static +** mutex results in undefined behavior. ^SQLite never deallocates +** a static mutex. +** +** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +** to enter a mutex. ^If another thread is already within the mutex, +** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return +** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] +** upon successful entry. ^(Mutexes created using +** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. +** In such cases the, +** mutex must be exited an equal number of times before another thread +** can enter.)^ ^(If the same thread tries to enter any other +** kind of mutex more than once, the behavior is undefined. +** SQLite will never exhibit +** such behavior in its own use of mutexes.)^ +** +** ^(Some systems (for example, Windows 95) do not support the operation +** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() +** will always return SQLITE_BUSY. The SQLite core only ever uses +** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^ +** +** ^The sqlite3_mutex_leave() routine exits a mutex that was +** previously entered by the same thread. ^(The behavior +** is undefined if the mutex is not currently entered by the +** calling thread or is not currently allocated. SQLite will +** never do either.)^ +** +** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or +** sqlite3_mutex_leave() is a NULL pointer, then all three routines +** behave as no-ops. +** +** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. +*/ +SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); +SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); +SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); +SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); +SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); + +/* +** CAPI3REF: Mutex Methods Object +** EXPERIMENTAL +** +** An instance of this structure defines the low-level routines +** used to allocate and use mutexes. +** +** Usually, the default mutex implementations provided by SQLite are +** sufficient, however the user has the option of substituting a custom +** implementation for specialized deployments or systems for which SQLite +** does not provide a suitable implementation. In this case, the user +** creates and populates an instance of this structure to pass +** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. +** Additionally, an instance of this structure can be used as an +** output variable when querying the system for the current mutex +** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. +** +** ^The xMutexInit method defined by this structure is invoked as +** part of system initialization by the sqlite3_initialize() function. +** ^The xMutexInit routine is calle by SQLite exactly once for each +** effective call to [sqlite3_initialize()]. +** +** ^The xMutexEnd method defined by this structure is invoked as +** part of system shutdown by the sqlite3_shutdown() function. The +** implementation of this method is expected to release all outstanding +** resources obtained by the mutex methods implementation, especially +** those obtained by the xMutexInit method. ^The xMutexEnd() +** interface is invoked exactly once for each call to [sqlite3_shutdown()]. +** +** ^(The remaining seven methods defined by this structure (xMutexAlloc, +** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and +** xMutexNotheld) implement the following interfaces (respectively): +** +**
    +**
  • [sqlite3_mutex_alloc()]
  • +**
  • [sqlite3_mutex_free()]
  • +**
  • [sqlite3_mutex_enter()]
  • +**
  • [sqlite3_mutex_try()]
  • +**
  • [sqlite3_mutex_leave()]
  • +**
  • [sqlite3_mutex_held()]
  • +**
  • [sqlite3_mutex_notheld()]
  • +**
)^ +** +** The only difference is that the public sqlite3_XXX functions enumerated +** above silently ignore any invocations that pass a NULL pointer instead +** of a valid mutex handle. The implementations of the methods defined +** by this structure are not required to handle this case, the results +** of passing a NULL pointer instead of a valid mutex handle are undefined +** (i.e. it is acceptable to provide an implementation that segfaults if +** it is passed a NULL pointer). +** +** The xMutexInit() method must be threadsafe. ^It must be harmless to +** invoke xMutexInit() mutiple times within the same process and without +** intervening calls to xMutexEnd(). Second and subsequent calls to +** xMutexInit() must be no-ops. +** +** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] +** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory +** allocation for a static mutex. ^However xMutexAlloc() may use SQLite +** memory allocation for a fast or recursive mutex. +** +** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is +** called, but only if the prior call to xMutexInit returned SQLITE_OK. +** If xMutexInit fails in any way, it is expected to clean up after itself +** prior to returning. +*/ +typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; +struct sqlite3_mutex_methods { + int (*xMutexInit)(void); + int (*xMutexEnd)(void); + sqlite3_mutex *(*xMutexAlloc)(int); + void (*xMutexFree)(sqlite3_mutex *); + void (*xMutexEnter)(sqlite3_mutex *); + int (*xMutexTry)(sqlite3_mutex *); + void (*xMutexLeave)(sqlite3_mutex *); + int (*xMutexHeld)(sqlite3_mutex *); + int (*xMutexNotheld)(sqlite3_mutex *); +}; + +/* +** CAPI3REF: Mutex Verification Routines +** +** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines +** are intended for use inside assert() statements. ^The SQLite core +** never uses these routines except inside an assert() and applications +** are advised to follow the lead of the core. ^The SQLite core only +** provides implementations for these routines when it is compiled +** with the SQLITE_DEBUG flag. ^External mutex implementations +** are only required to provide these routines if SQLITE_DEBUG is +** defined and if NDEBUG is not defined. +** +** ^These routines should return true if the mutex in their argument +** is held or not held, respectively, by the calling thread. +** +** ^The implementation is not required to provided versions of these +** routines that actually work. If the implementation does not provide working +** versions of these routines, it should at least provide stubs that always +** return true so that one does not get spurious assertion failures. +** +** ^If the argument to sqlite3_mutex_held() is a NULL pointer then +** the routine should return 1. This seems counter-intuitive since +** clearly the mutex cannot be held if it does not exist. But the +** the reason the mutex does not exist is because the build is not +** using mutexes. And we do not want the assert() containing the +** call to sqlite3_mutex_held() to fail, so a non-zero return is +** the appropriate thing to do. ^The sqlite3_mutex_notheld() +** interface should also return 1 when given a NULL pointer. +*/ +#ifndef NDEBUG +SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); +SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); +#endif + +/* +** CAPI3REF: Mutex Types +** +** The [sqlite3_mutex_alloc()] interface takes a single argument +** which is one of these integer constants. +** +** The set of static mutexes may change from one SQLite release to the +** next. Applications that override the built-in mutex logic must be +** prepared to accommodate additional static mutexes. +*/ +#define SQLITE_MUTEX_FAST 0 +#define SQLITE_MUTEX_RECURSIVE 1 +#define SQLITE_MUTEX_STATIC_MASTER 2 +#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ +#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ +#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ +#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ +#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ +#define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */ + +/* +** CAPI3REF: Retrieve the mutex for a database connection +** +** ^This interface returns a pointer the [sqlite3_mutex] object that +** serializes access to the [database connection] given in the argument +** when the [threading mode] is Serialized. +** ^If the [threading mode] is Single-thread or Multi-thread then this +** routine returns a NULL pointer. +*/ +SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); + +/* +** CAPI3REF: Low-Level Control Of Database Files +** +** ^The [sqlite3_file_control()] interface makes a direct call to the +** xFileControl method for the [sqlite3_io_methods] object associated +** with a particular database identified by the second argument. ^The +** name of the database "main" for the main database or "temp" for the +** TEMP database, or the name that appears after the AS keyword for +** databases that are added using the [ATTACH] SQL command. +** ^A NULL pointer can be used in place of "main" to refer to the +** main database file. +** ^The third and fourth parameters to this routine +** are passed directly through to the second and third parameters of +** the xFileControl method. ^The return value of the xFileControl +** method becomes the return value of this routine. +** +** ^If the second parameter (zDbName) does not match the name of any +** open database file, then SQLITE_ERROR is returned. ^This error +** code is not remembered and will not be recalled by [sqlite3_errcode()] +** or [sqlite3_errmsg()]. The underlying xFileControl method might +** also return SQLITE_ERROR. There is no way to distinguish between +** an incorrect zDbName and an SQLITE_ERROR return from the underlying +** xFileControl method. +** +** See also: [SQLITE_FCNTL_LOCKSTATE] +*/ +SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); + +/* +** CAPI3REF: Testing Interface +** +** ^The sqlite3_test_control() interface is used to read out internal +** state of SQLite and to inject faults into SQLite for testing +** purposes. ^The first parameter is an operation code that determines +** the number, meaning, and operation of all subsequent parameters. +** +** This interface is not for use by applications. It exists solely +** for verifying the correct operation of the SQLite library. Depending +** on how the SQLite library is compiled, this interface might not exist. +** +** The details of the operation codes, their meanings, the parameters +** they take, and what they do are all subject to change without notice. +** Unlike most of the SQLite API, this function is not guaranteed to +** operate consistently from one release to the next. +*/ +SQLITE_API int sqlite3_test_control(int op, ...); + +/* +** CAPI3REF: Testing Interface Operation Codes +** +** These constants are the valid operation code parameters used +** as the first argument to [sqlite3_test_control()]. +** +** These parameters and their meanings are subject to change +** without notice. These values are for testing purposes only. +** Applications should not use any of these parameters or the +** [sqlite3_test_control()] interface. +*/ +#define SQLITE_TESTCTRL_FIRST 5 +#define SQLITE_TESTCTRL_PRNG_SAVE 5 +#define SQLITE_TESTCTRL_PRNG_RESTORE 6 +#define SQLITE_TESTCTRL_PRNG_RESET 7 +#define SQLITE_TESTCTRL_BITVEC_TEST 8 +#define SQLITE_TESTCTRL_FAULT_INSTALL 9 +#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 +#define SQLITE_TESTCTRL_PENDING_BYTE 11 +#define SQLITE_TESTCTRL_ASSERT 12 +#define SQLITE_TESTCTRL_ALWAYS 13 +#define SQLITE_TESTCTRL_RESERVE 14 +#define SQLITE_TESTCTRL_OPTIMIZATIONS 15 +#define SQLITE_TESTCTRL_ISKEYWORD 16 +#define SQLITE_TESTCTRL_LAST 16 + +/* +** CAPI3REF: SQLite Runtime Status +** EXPERIMENTAL +** +** ^This interface is used to retrieve runtime status information +** about the preformance of SQLite, and optionally to reset various +** highwater marks. ^The first argument is an integer code for +** the specific parameter to measure. ^(Recognized integer codes +** are of the form [SQLITE_STATUS_MEMORY_USED | SQLITE_STATUS_...].)^ +** ^The current value of the parameter is returned into *pCurrent. +** ^The highest recorded value is returned in *pHighwater. ^If the +** resetFlag is true, then the highest record value is reset after +** *pHighwater is written. ^(Some parameters do not record the highest +** value. For those parameters +** nothing is written into *pHighwater and the resetFlag is ignored.)^ +** ^(Other parameters record only the highwater mark and not the current +** value. For these latter parameters nothing is written into *pCurrent.)^ +** +** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a +** non-zero [error code] on failure. +** +** This routine is threadsafe but is not atomic. This routine can be +** called while other threads are running the same or different SQLite +** interfaces. However the values returned in *pCurrent and +** *pHighwater reflect the status of SQLite at different points in time +** and it is possible that another thread might change the parameter +** in between the times when *pCurrent and *pHighwater are written. +** +** See also: [sqlite3_db_status()] +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); + + +/* +** CAPI3REF: Status Parameters +** EXPERIMENTAL +** +** These integer constants designate various run-time status parameters +** that can be returned by [sqlite3_status()]. +** +**
+** ^(
SQLITE_STATUS_MEMORY_USED
+**
This parameter is the current amount of memory checked out +** using [sqlite3_malloc()], either directly or indirectly. The +** figure includes calls made to [sqlite3_malloc()] by the application +** and internal memory usage by the SQLite library. Scratch memory +** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache +** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in +** this parameter. The amount returned is the sum of the allocation +** sizes as reported by the xSize method in [sqlite3_mem_methods].
)^ +** +** ^(
SQLITE_STATUS_MALLOC_SIZE
+**
This parameter records the largest memory allocation request +** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their +** internal equivalents). Only the value returned in the +** *pHighwater parameter to [sqlite3_status()] is of interest. +** The value written into the *pCurrent parameter is undefined.
)^ +** +** ^(
SQLITE_STATUS_PAGECACHE_USED
+**
This parameter returns the number of pages used out of the +** [pagecache memory allocator] that was configured using +** [SQLITE_CONFIG_PAGECACHE]. The +** value returned is in pages, not in bytes.
)^ +** +** ^(
SQLITE_STATUS_PAGECACHE_OVERFLOW
+**
This parameter returns the number of bytes of page cache +** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE] +** buffer and where forced to overflow to [sqlite3_malloc()]. The +** returned value includes allocations that overflowed because they +** where too large (they were larger than the "sz" parameter to +** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because +** no space was left in the page cache.
)^ +** +** ^(
SQLITE_STATUS_PAGECACHE_SIZE
+**
This parameter records the largest memory allocation request +** handed to [pagecache memory allocator]. Only the value returned in the +** *pHighwater parameter to [sqlite3_status()] is of interest. +** The value written into the *pCurrent parameter is undefined.
)^ +** +** ^(
SQLITE_STATUS_SCRATCH_USED
+**
This parameter returns the number of allocations used out of the +** [scratch memory allocator] configured using +** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not +** in bytes. Since a single thread may only have one scratch allocation +** outstanding at time, this parameter also reports the number of threads +** using scratch memory at the same time.
)^ +** +** ^(
SQLITE_STATUS_SCRATCH_OVERFLOW
+**
This parameter returns the number of bytes of scratch memory +** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH] +** buffer and where forced to overflow to [sqlite3_malloc()]. The values +** returned include overflows because the requested allocation was too +** larger (that is, because the requested allocation was larger than the +** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer +** slots were available. +**
)^ +** +** ^(
SQLITE_STATUS_SCRATCH_SIZE
+**
This parameter records the largest memory allocation request +** handed to [scratch memory allocator]. Only the value returned in the +** *pHighwater parameter to [sqlite3_status()] is of interest. +** The value written into the *pCurrent parameter is undefined.
)^ +** +** ^(
SQLITE_STATUS_PARSER_STACK
+**
This parameter records the deepest parser stack. It is only +** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].
)^ +**
+** +** New status parameters may be added from time to time. +*/ +#define SQLITE_STATUS_MEMORY_USED 0 +#define SQLITE_STATUS_PAGECACHE_USED 1 +#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 +#define SQLITE_STATUS_SCRATCH_USED 3 +#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 +#define SQLITE_STATUS_MALLOC_SIZE 5 +#define SQLITE_STATUS_PARSER_STACK 6 +#define SQLITE_STATUS_PAGECACHE_SIZE 7 +#define SQLITE_STATUS_SCRATCH_SIZE 8 + +/* +** CAPI3REF: Database Connection Status +** EXPERIMENTAL +** +** ^This interface is used to retrieve runtime status information +** about a single [database connection]. ^The first argument is the +** database connection object to be interrogated. ^The second argument +** is the parameter to interrogate. ^Currently, the only allowed value +** for the second parameter is [SQLITE_DBSTATUS_LOOKASIDE_USED]. +** Additional options will likely appear in future releases of SQLite. +** +** ^The current value of the requested parameter is written into *pCur +** and the highest instantaneous value is written into *pHiwtr. ^If +** the resetFlg is true, then the highest instantaneous value is +** reset back down to the current value. +** +** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); + +/* +** CAPI3REF: Status Parameters for database connections +** EXPERIMENTAL +** +** These constants are the available integer "verbs" that can be passed as +** the second argument to the [sqlite3_db_status()] interface. +** +** New verbs may be added in future releases of SQLite. Existing verbs +** might be discontinued. Applications should check the return code from +** [sqlite3_db_status()] to make sure that the call worked. +** The [sqlite3_db_status()] interface will return a non-zero error code +** if a discontinued or unsupported verb is invoked. +** +**
+** ^(
SQLITE_DBSTATUS_LOOKASIDE_USED
+**
This parameter returns the number of lookaside memory slots currently +** checked out.
)^ +**
+*/ +#define SQLITE_DBSTATUS_LOOKASIDE_USED 0 + + +/* +** CAPI3REF: Prepared Statement Status +** EXPERIMENTAL +** +** ^(Each prepared statement maintains various +** [SQLITE_STMTSTATUS_SORT | counters] that measure the number +** of times it has performed specific operations.)^ These counters can +** be used to monitor the performance characteristics of the prepared +** statements. For example, if the number of table steps greatly exceeds +** the number of table searches or result rows, that would tend to indicate +** that the prepared statement is using a full table scan rather than +** an index. +** +** ^(This interface is used to retrieve and reset counter values from +** a [prepared statement]. The first argument is the prepared statement +** object to be interrogated. The second argument +** is an integer code for a specific [SQLITE_STMTSTATUS_SORT | counter] +** to be interrogated.)^ +** ^The current value of the requested counter is returned. +** ^If the resetFlg is true, then the counter is reset to zero after this +** interface call returns. +** +** See also: [sqlite3_status()] and [sqlite3_db_status()]. +*/ +SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); + +/* +** CAPI3REF: Status Parameters for prepared statements +** EXPERIMENTAL +** +** These preprocessor macros define integer codes that name counter +** values associated with the [sqlite3_stmt_status()] interface. +** The meanings of the various counters are as follows: +** +**
+**
SQLITE_STMTSTATUS_FULLSCAN_STEP
+**
^This is the number of times that SQLite has stepped forward in +** a table as part of a full table scan. Large numbers for this counter +** may indicate opportunities for performance improvement through +** careful use of indices.
+** +**
SQLITE_STMTSTATUS_SORT
+**
^This is the number of sort operations that have occurred. +** A non-zero value in this counter may indicate an opportunity to +** improvement performance through careful use of indices.
+** +**
+*/ +#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 +#define SQLITE_STMTSTATUS_SORT 2 + +/* +** CAPI3REF: Custom Page Cache Object +** EXPERIMENTAL +** +** The sqlite3_pcache type is opaque. It is implemented by +** the pluggable module. The SQLite core has no knowledge of +** its size or internal structure and never deals with the +** sqlite3_pcache object except by holding and passing pointers +** to the object. +** +** See [sqlite3_pcache_methods] for additional information. +*/ +typedef struct sqlite3_pcache sqlite3_pcache; + +/* +** CAPI3REF: Application Defined Page Cache. +** KEYWORDS: {page cache} +** EXPERIMENTAL +** +** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can +** register an alternative page cache implementation by passing in an +** instance of the sqlite3_pcache_methods structure.)^ The majority of the +** heap memory used by SQLite is used by the page cache to cache data read +** from, or ready to be written to, the database file. By implementing a +** custom page cache using this API, an application can control more +** precisely the amount of memory consumed by SQLite, the way in which +** that memory is allocated and released, and the policies used to +** determine exactly which parts of a database file are cached and for +** how long. +** +** ^(The contents of the sqlite3_pcache_methods structure are copied to an +** internal buffer by SQLite within the call to [sqlite3_config]. Hence +** the application may discard the parameter after the call to +** [sqlite3_config()] returns.)^ +** +** ^The xInit() method is called once for each call to [sqlite3_initialize()] +** (usually only once during the lifetime of the process). ^(The xInit() +** method is passed a copy of the sqlite3_pcache_methods.pArg value.)^ +** ^The xInit() method can set up up global structures and/or any mutexes +** required by the custom page cache implementation. +** +** ^The xShutdown() method is called from within [sqlite3_shutdown()], +** if the application invokes this API. It can be used to clean up +** any outstanding resources before process shutdown, if required. +** +** ^SQLite holds a [SQLITE_MUTEX_RECURSIVE] mutex when it invokes +** the xInit method, so the xInit method need not be threadsafe. ^The +** xShutdown method is only called from [sqlite3_shutdown()] so it does +** not need to be threadsafe either. All other methods must be threadsafe +** in multithreaded applications. +** +** ^SQLite will never invoke xInit() more than once without an intervening +** call to xShutdown(). +** +** ^The xCreate() method is used to construct a new cache instance. SQLite +** will typically create one cache instance for each open database file, +** though this is not guaranteed. ^The +** first parameter, szPage, is the size in bytes of the pages that must +** be allocated by the cache. ^szPage will not be a power of two. ^szPage +** will the page size of the database file that is to be cached plus an +** increment (here called "R") of about 100 or 200. ^SQLite will use the +** extra R bytes on each page to store metadata about the underlying +** database page on disk. The value of R depends +** on the SQLite version, the target platform, and how SQLite was compiled. +** ^R is constant for a particular build of SQLite. ^The second argument to +** xCreate(), bPurgeable, is true if the cache being created will +** be used to cache database pages of a file stored on disk, or +** false if it is used for an in-memory database. ^The cache implementation +** does not have to do anything special based with the value of bPurgeable; +** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will +** never invoke xUnpin() except to deliberately delete a page. +** ^In other words, a cache created with bPurgeable set to false will +** never contain any unpinned pages. +** +** ^(The xCachesize() method may be called at any time by SQLite to set the +** suggested maximum cache-size (number of pages stored by) the cache +** instance passed as the first argument. This is the value configured using +** the SQLite "[PRAGMA cache_size]" command.)^ ^As with the bPurgeable +** parameter, the implementation is not required to do anything with this +** value; it is advisory only. +** +** ^The xPagecount() method should return the number of pages currently +** stored in the cache. +** +** ^The xFetch() method is used to fetch a page and return a pointer to it. +** ^A 'page', in this context, is a buffer of szPage bytes aligned at an +** 8-byte boundary. ^The page to be fetched is determined by the key. ^The +** mimimum key value is 1. After it has been retrieved using xFetch, the page +** is considered to be "pinned". +** +** ^If the requested page is already in the page cache, then the page cache +** implementation must return a pointer to the page buffer with its content +** intact. ^(If the requested page is not already in the cache, then the +** behavior of the cache implementation is determined by the value of the +** createFlag parameter passed to xFetch, according to the following table: +** +** +**
createFlag Behaviour when page is not already in cache +**
0 Do not allocate a new page. Return NULL. +**
1 Allocate a new page if it easy and convenient to do so. +** Otherwise return NULL. +**
2 Make every effort to allocate a new page. Only return +** NULL if allocating a new page is effectively impossible. +**
)^ +** +** SQLite will normally invoke xFetch() with a createFlag of 0 or 1. If +** a call to xFetch() with createFlag==1 returns NULL, then SQLite will +** attempt to unpin one or more cache pages by spilling the content of +** pinned pages to disk and synching the operating system disk cache. After +** attempting to unpin pages, the xFetch() method will be invoked again with +** a createFlag of 2. +** +** ^xUnpin() is called by SQLite with a pointer to a currently pinned page +** as its second argument. ^(If the third parameter, discard, is non-zero, +** then the page should be evicted from the cache. In this case SQLite +** assumes that the next time the page is retrieved from the cache using +** the xFetch() method, it will be zeroed.)^ ^If the discard parameter is +** zero, then the page is considered to be unpinned. ^The cache implementation +** may choose to evict unpinned pages at any time. +** +** ^(The cache is not required to perform any reference counting. A single +** call to xUnpin() unpins the page regardless of the number of prior calls +** to xFetch().)^ +** +** ^The xRekey() method is used to change the key value associated with the +** page passed as the second argument from oldKey to newKey. ^If the cache +** previously contains an entry associated with newKey, it should be +** discarded. ^Any prior cache entry associated with newKey is guaranteed not +** to be pinned. +** +** ^When SQLite calls the xTruncate() method, the cache must discard all +** existing cache entries with page numbers (keys) greater than or equal +** to the value of the iLimit parameter passed to xTruncate(). ^If any +** of these pages are pinned, they are implicitly unpinned, meaning that +** they can be safely discarded. +** +** ^The xDestroy() method is used to delete a cache allocated by xCreate(). +** All resources associated with the specified cache should be freed. ^After +** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] +** handle invalid, and will not use it with any other sqlite3_pcache_methods +** functions. +*/ +typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; +struct sqlite3_pcache_methods { + void *pArg; + int (*xInit)(void*); + void (*xShutdown)(void*); + sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); + void (*xCachesize)(sqlite3_pcache*, int nCachesize); + int (*xPagecount)(sqlite3_pcache*); + void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); + void (*xUnpin)(sqlite3_pcache*, void*, int discard); + void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); + void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); + void (*xDestroy)(sqlite3_pcache*); +}; + +/* +** CAPI3REF: Online Backup Object +** EXPERIMENTAL +** +** The sqlite3_backup object records state information about an ongoing +** online backup operation. ^The sqlite3_backup object is created by +** a call to [sqlite3_backup_init()] and is destroyed by a call to +** [sqlite3_backup_finish()]. +** +** See Also: [Using the SQLite Online Backup API] +*/ +typedef struct sqlite3_backup sqlite3_backup; + +/* +** CAPI3REF: Online Backup API. +** EXPERIMENTAL +** +** The backup API copies the content of one database into another. +** It is useful either for creating backups of databases or +** for copying in-memory databases to or from persistent files. +** +** See Also: [Using the SQLite Online Backup API] +** +** ^Exclusive access is required to the destination database for the +** duration of the operation. ^However the source database is only +** read-locked while it is actually being read; it is not locked +** continuously for the entire backup operation. ^Thus, the backup may be +** performed on a live source database without preventing other users from +** reading or writing to the source database while the backup is underway. +** +** ^(To perform a backup operation: +**
    +**
  1. sqlite3_backup_init() is called once to initialize the +** backup, +**
  2. sqlite3_backup_step() is called one or more times to transfer +** the data between the two databases, and finally +**
  3. sqlite3_backup_finish() is called to release all resources +** associated with the backup operation. +**
)^ +** There should be exactly one call to sqlite3_backup_finish() for each +** successful call to sqlite3_backup_init(). +** +** sqlite3_backup_init() +** +** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the +** [database connection] associated with the destination database +** and the database name, respectively. +** ^The database name is "main" for the main database, "temp" for the +** temporary database, or the name specified after the AS keyword in +** an [ATTACH] statement for an attached database. +** ^The S and M arguments passed to +** sqlite3_backup_init(D,N,S,M) identify the [database connection] +** and database name of the source database, respectively. +** ^The source and destination [database connections] (parameters S and D) +** must be different or else sqlite3_backup_init(D,N,S,M) will file with +** an error. +** +** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is +** returned and an error code and error message are store3d in the +** destination [database connection] D. +** ^The error code and message for the failed call to sqlite3_backup_init() +** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or +** [sqlite3_errmsg16()] functions. +** ^A successful call to sqlite3_backup_init() returns a pointer to an +** [sqlite3_backup] object. +** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and +** sqlite3_backup_finish() functions to perform the specified backup +** operation. +** +** sqlite3_backup_step() +** +** ^Function sqlite3_backup_step(B,N) will copy up to N pages between +** the source and destination databases specified by [sqlite3_backup] object B. +** ^If N is negative, all remaining source pages are copied. +** ^If sqlite3_backup_step(B,N) successfully copies N pages and there +** are still more pages to be copied, then the function resturns [SQLITE_OK]. +** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages +** from source to destination, then it returns [SQLITE_DONE]. +** ^If an error occurs while running sqlite3_backup_step(B,N), +** then an [error code] is returned. ^As well as [SQLITE_OK] and +** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], +** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an +** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. +** +** ^The sqlite3_backup_step() might return [SQLITE_READONLY] if the destination +** database was opened read-only or if +** the destination is an in-memory database with a different page size +** from the source database. +** +** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then +** the [sqlite3_busy_handler | busy-handler function] +** is invoked (if one is specified). ^If the +** busy-handler returns non-zero before the lock is available, then +** [SQLITE_BUSY] is returned to the caller. ^In this case the call to +** sqlite3_backup_step() can be retried later. ^If the source +** [database connection] +** is being used to write to the source database when sqlite3_backup_step() +** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this +** case the call to sqlite3_backup_step() can be retried later on. ^(If +** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or +** [SQLITE_READONLY] is returned, then +** there is no point in retrying the call to sqlite3_backup_step(). These +** errors are considered fatal.)^ The application must accept +** that the backup operation has failed and pass the backup operation handle +** to the sqlite3_backup_finish() to release associated resources. +** +** ^The first call to sqlite3_backup_step() obtains an exclusive lock +** on the destination file. ^The exclusive lock is not released until either +** sqlite3_backup_finish() is called or the backup operation is complete +** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to +** sqlite3_backup_step() obtains a [shared lock] on the source database that +** lasts for the duration of the sqlite3_backup_step() call. +** ^Because the source database is not locked between calls to +** sqlite3_backup_step(), the source database may be modified mid-way +** through the backup process. ^If the source database is modified by an +** external process or via a database connection other than the one being +** used by the backup operation, then the backup will be automatically +** restarted by the next call to sqlite3_backup_step(). ^If the source +** database is modified by the using the same database connection as is used +** by the backup operation, then the backup database is automatically +** updated at the same time. +** +** sqlite3_backup_finish() +** +** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the +** application wishes to abandon the backup operation, the application +** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). +** ^The sqlite3_backup_finish() interfaces releases all +** resources associated with the [sqlite3_backup] object. +** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any +** active write-transaction on the destination database is rolled back. +** The [sqlite3_backup] object is invalid +** and may not be used following a call to sqlite3_backup_finish(). +** +** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no +** sqlite3_backup_step() errors occurred, regardless or whether or not +** sqlite3_backup_step() completed. +** ^If an out-of-memory condition or IO error occurred during any prior +** sqlite3_backup_step() call on the same [sqlite3_backup] object, then +** sqlite3_backup_finish() returns the corresponding [error code]. +** +** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() +** is not a permanent error and does not affect the return value of +** sqlite3_backup_finish(). +** +** sqlite3_backup_remaining(), sqlite3_backup_pagecount() +** +** ^Each call to sqlite3_backup_step() sets two values inside +** the [sqlite3_backup] object: the number of pages still to be backed +** up and the total number of pages in the source databae file. +** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces +** retrieve these two values, respectively. +** +** ^The values returned by these functions are only updated by +** sqlite3_backup_step(). ^If the source database is modified during a backup +** operation, then the values are not updated to account for any extra +** pages that need to be updated or the size of the source database file +** changing. +** +** Concurrent Usage of Database Handles +** +** ^The source [database connection] may be used by the application for other +** purposes while a backup operation is underway or being initialized. +** ^If SQLite is compiled and configured to support threadsafe database +** connections, then the source database connection may be used concurrently +** from within other threads. +** +** However, the application must guarantee that the destination +** [database connection] is not passed to any other API (by any thread) after +** sqlite3_backup_init() is called and before the corresponding call to +** sqlite3_backup_finish(). SQLite does not currently check to see +** if the application incorrectly accesses the destination [database connection] +** and so no error code is reported, but the operations may malfunction +** nevertheless. Use of the destination database connection while a +** backup is in progress might also also cause a mutex deadlock. +** +** If running in [shared cache mode], the application must +** guarantee that the shared cache used by the destination database +** is not accessed while the backup is running. In practice this means +** that the application must guarantee that the disk file being +** backed up to is not accessed by any connection within the process, +** not just the specific connection that was passed to sqlite3_backup_init(). +** +** The [sqlite3_backup] object itself is partially threadsafe. Multiple +** threads may safely make multiple concurrent calls to sqlite3_backup_step(). +** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() +** APIs are not strictly speaking threadsafe. If they are invoked at the +** same time as another thread is invoking sqlite3_backup_step() it is +** possible that they return invalid values. +*/ +SQLITE_API sqlite3_backup *sqlite3_backup_init( + sqlite3 *pDest, /* Destination database handle */ + const char *zDestName, /* Destination database name */ + sqlite3 *pSource, /* Source database handle */ + const char *zSourceName /* Source database name */ +); +SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); +SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); +SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); +SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); + +/* +** CAPI3REF: Unlock Notification +** EXPERIMENTAL +** +** ^When running in shared-cache mode, a database operation may fail with +** an [SQLITE_LOCKED] error if the required locks on the shared-cache or +** individual tables within the shared-cache cannot be obtained. See +** [SQLite Shared-Cache Mode] for a description of shared-cache locking. +** ^This API may be used to register a callback that SQLite will invoke +** when the connection currently holding the required lock relinquishes it. +** ^This API is only available if the library was compiled with the +** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. +** +** See Also: [Using the SQLite Unlock Notification Feature]. +** +** ^Shared-cache locks are released when a database connection concludes +** its current transaction, either by committing it or rolling it back. +** +** ^When a connection (known as the blocked connection) fails to obtain a +** shared-cache lock and SQLITE_LOCKED is returned to the caller, the +** identity of the database connection (the blocking connection) that +** has locked the required resource is stored internally. ^After an +** application receives an SQLITE_LOCKED error, it may call the +** sqlite3_unlock_notify() method with the blocked connection handle as +** the first argument to register for a callback that will be invoked +** when the blocking connections current transaction is concluded. ^The +** callback is invoked from within the [sqlite3_step] or [sqlite3_close] +** call that concludes the blocking connections transaction. +** +** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, +** there is a chance that the blocking connection will have already +** concluded its transaction by the time sqlite3_unlock_notify() is invoked. +** If this happens, then the specified callback is invoked immediately, +** from within the call to sqlite3_unlock_notify().)^ +** +** ^If the blocked connection is attempting to obtain a write-lock on a +** shared-cache table, and more than one other connection currently holds +** a read-lock on the same table, then SQLite arbitrarily selects one of +** the other connections to use as the blocking connection. +** +** ^(There may be at most one unlock-notify callback registered by a +** blocked connection. If sqlite3_unlock_notify() is called when the +** blocked connection already has a registered unlock-notify callback, +** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is +** called with a NULL pointer as its second argument, then any existing +** unlock-notify callback is cancelled. ^The blocked connections +** unlock-notify callback may also be canceled by closing the blocked +** connection using [sqlite3_close()]. +** +** The unlock-notify callback is not reentrant. If an application invokes +** any sqlite3_xxx API functions from within an unlock-notify callback, a +** crash or deadlock may be the result. +** +** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always +** returns SQLITE_OK. +** +** Callback Invocation Details +** +** When an unlock-notify callback is registered, the application provides a +** single void* pointer that is passed to the callback when it is invoked. +** However, the signature of the callback function allows SQLite to pass +** it an array of void* context pointers. The first argument passed to +** an unlock-notify callback is a pointer to an array of void* pointers, +** and the second is the number of entries in the array. +** +** When a blocking connections transaction is concluded, there may be +** more than one blocked connection that has registered for an unlock-notify +** callback. ^If two or more such blocked connections have specified the +** same callback function, then instead of invoking the callback function +** multiple times, it is invoked once with the set of void* context pointers +** specified by the blocked connections bundled together into an array. +** This gives the application an opportunity to prioritize any actions +** related to the set of unblocked database connections. +** +** Deadlock Detection +** +** Assuming that after registering for an unlock-notify callback a +** database waits for the callback to be issued before taking any further +** action (a reasonable assumption), then using this API may cause the +** application to deadlock. For example, if connection X is waiting for +** connection Y's transaction to be concluded, and similarly connection +** Y is waiting on connection X's transaction, then neither connection +** will proceed and the system may remain deadlocked indefinitely. +** +** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock +** detection. ^If a given call to sqlite3_unlock_notify() would put the +** system in a deadlocked state, then SQLITE_LOCKED is returned and no +** unlock-notify callback is registered. The system is said to be in +** a deadlocked state if connection A has registered for an unlock-notify +** callback on the conclusion of connection B's transaction, and connection +** B has itself registered for an unlock-notify callback when connection +** A's transaction is concluded. ^Indirect deadlock is also detected, so +** the system is also considered to be deadlocked if connection B has +** registered for an unlock-notify callback on the conclusion of connection +** C's transaction, where connection C is waiting on connection A. ^Any +** number of levels of indirection are allowed. +** +** The "DROP TABLE" Exception +** +** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost +** always appropriate to call sqlite3_unlock_notify(). There is however, +** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, +** SQLite checks if there are any currently executing SELECT statements +** that belong to the same connection. If there are, SQLITE_LOCKED is +** returned. In this case there is no "blocking connection", so invoking +** sqlite3_unlock_notify() results in the unlock-notify callback being +** invoked immediately. If the application then re-attempts the "DROP TABLE" +** or "DROP INDEX" query, an infinite loop might be the result. +** +** One way around this problem is to check the extended error code returned +** by an sqlite3_step() call. ^(If there is a blocking connection, then the +** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in +** the special "DROP TABLE/INDEX" case, the extended error code is just +** SQLITE_LOCKED.)^ +*/ +SQLITE_API int sqlite3_unlock_notify( + sqlite3 *pBlocked, /* Waiting connection */ + void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ + void *pNotifyArg /* Argument to pass to xNotify */ +); + + +/* +** CAPI3REF: String Comparison +** EXPERIMENTAL +** +** ^The [sqlite3_strnicmp()] API allows applications and extensions to +** compare the contents of two buffers containing UTF-8 strings in a +** case-indendent fashion, using the same definition of case independence +** that SQLite uses internally when comparing identifiers. +*/ +SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); + +/* +** CAPI3REF: Error Logging Interface +** EXPERIMENTAL +** +** ^The [sqlite3_log()] interface writes a message into the error log +** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. +** ^If logging is enabled, the zFormat string and subsequent arguments are +** passed through to [sqlite3_vmprintf()] to generate the final output string. +** +** The sqlite3_log() interface is intended for use by extensions such as +** virtual tables, collating functions, and SQL functions. While there is +** nothing to prevent an application from calling sqlite3_log(), doing so +** is considered bad form. +** +** The zFormat string must not be NULL. +** +** To avoid deadlocks and other threading problems, the sqlite3_log() routine +** will not use dynamically allocated memory. The log message is stored in +** a fixed-length buffer on the stack. If the log message is longer than +** a few hundred characters, it will be truncated to the length of the +** buffer. +*/ +SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); + +/* +** Undo the hack that converts floating point types to integer for +** builds on processors without floating point support. +*/ +#ifdef SQLITE_OMIT_FLOATING_POINT +# undef double +#endif + +#ifdef __cplusplus +} /* End of the 'extern "C"' block */ +#endif +#endif + diff --git a/libraries/SQLAPI/include/ss6API.h b/libraries/SQLAPI/include/ss6API.h new file mode 100644 index 000000000..92606988d --- /dev/null +++ b/libraries/SQLAPI/include/ss6API.h @@ -0,0 +1,375 @@ +// ss6API.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__SS6API_H__) +#define __SS6API_H__ + +#include "SQLAPI.h" + +// API header(s) +#define DBNTWIN32 +#include "./ss_win/sqlfront.h" +#include "./ss_win/sqldb.h" + +extern long g_nSSDBLibDLLVersionLoaded; + +extern void AddSSDbLibSupport(); +extern void ReleaseSSDbLibSupport(); + +typedef DBERRHANDLE_PROC (SQLAPI *dberrhandle_t)(DBERRHANDLE_PROC); +typedef DBMSGHANDLE_PROC (SQLAPI *dbmsghandle_t)(DBMSGHANDLE_PROC); +typedef DBERRHANDLE_PROC (SQLAPI *dbprocerrhandle_t)(PDBHANDLE, DBERRHANDLE_PROC); +typedef DBMSGHANDLE_PROC (SQLAPI *dbprocmsghandle_t)(PDBHANDLE, DBMSGHANDLE_PROC); + +// Two-phase commit functions +typedef RETCODE (SQLAPI *abort_xact_t) (PDBPROCESS, DBINT); +typedef void (SQLAPI *build_xact_string_t) (LPCSTR, LPCSTR, DBINT, LPSTR); +typedef void (SQLAPI *close_commit_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *commit_xact_t) (PDBPROCESS, DBINT); +typedef PDBPROCESS (SQLAPI *open_commit_t) (PLOGINREC, LPCSTR); +typedef RETCODE (SQLAPI *remove_xact_t) (PDBPROCESS, DBINT, INT); +typedef RETCODE (SQLAPI *scan_xact_t) (PDBPROCESS, DBINT); +typedef DBINT (SQLAPI *start_xact_t) (PDBPROCESS, LPCSTR, LPCSTR, INT); +typedef INT (SQLAPI *stat_xact_t) (PDBPROCESS, DBINT); + +// BCP functions +typedef DBINT (SQLAPI *bcp_batch_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *bcp_bind_t) (PDBPROCESS, LPCBYTE, INT, DBINT, LPCBYTE, INT, INT, INT); +typedef RETCODE (SQLAPI *bcp_colfmt_t) (PDBPROCESS, INT, BYTE, INT, DBINT, LPCBYTE, INT, INT); +typedef RETCODE (SQLAPI *bcp_collen_t) (PDBPROCESS, DBINT, INT); +typedef RETCODE (SQLAPI *bcp_colptr_t) (PDBPROCESS, LPCBYTE, INT); +typedef RETCODE (SQLAPI *bcp_columns_t) (PDBPROCESS, INT); +typedef RETCODE (SQLAPI *bcp_control_t) (PDBPROCESS, INT, DBINT); +typedef DBINT (SQLAPI *bcp_done_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *bcp_exec_t) (PDBPROCESS, LPDBINT); +typedef RETCODE (SQLAPI *bcp_init_t) (PDBPROCESS, LPCSTR, LPCSTR, LPCSTR, INT); +typedef RETCODE (SQLAPI *bcp_moretext_t) (PDBPROCESS, DBINT, LPCBYTE); +typedef RETCODE (SQLAPI *bcp_readfmt_t) (PDBPROCESS, LPCSTR); +typedef RETCODE (SQLAPI *bcp_sendrow_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *bcp_setl_t) (PLOGINREC, BOOL); +typedef RETCODE (SQLAPI *bcp_writefmt_t) (PDBPROCESS, LPCSTR); + +// Standard DB-Library functions +typedef LPCBYTE (SQLAPI *dbadata_t) (PDBPROCESS, INT, INT); +typedef DBINT (SQLAPI *dbadlen_t) (PDBPROCESS, INT, INT); +typedef RETCODE (SQLAPI *dbaltbind_t) (PDBPROCESS, INT, INT, INT, DBINT, LPCBYTE); +typedef INT (SQLAPI *dbaltcolid_t) (PDBPROCESS, INT, INT); +typedef DBINT (SQLAPI *dbaltlen_t) (PDBPROCESS, INT, INT); +typedef INT (SQLAPI *dbaltop_t) (PDBPROCESS, INT, INT); +typedef INT (SQLAPI *dbalttype_t) (PDBPROCESS, INT, INT); +typedef DBINT (SQLAPI *dbaltutype_t) (PDBPROCESS, INT, INT); +typedef RETCODE (SQLAPI *dbanullbind_t) (PDBPROCESS, INT, INT, LPCDBINT); +typedef RETCODE (SQLAPI *dbbind_t) (PDBPROCESS, INT, INT, DBINT, LPBYTE); +typedef LPCBYTE (SQLAPI *dbbylist_t) (PDBPROCESS, INT, LPINT); +typedef RETCODE (SQLAPI *dbcancel_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbcanquery_t) (PDBPROCESS); +typedef LPCSTR (SQLAPI *dbchange_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbclose_t) (PDBPROCESS); +typedef void (SQLAPI *dbclrbuf_t) (PDBPROCESS, DBINT); +typedef RETCODE (SQLAPI *dbclropt_t) (PDBPROCESS, INT, LPCSTR); +typedef RETCODE (SQLAPI *dbcmd_t) (PDBPROCESS, LPCSTR); +typedef RETCODE (SQLAPI *dbcmdrow_t) (PDBPROCESS); +typedef BOOL (SQLAPI *dbcolbrowse_t) (PDBPROCESS, INT); +typedef RETCODE (SQLAPI *dbcolinfo_t) (PDBHANDLE, INT, INT, INT, LPDBCOL); +typedef DBINT (SQLAPI *dbcollen_t) (PDBPROCESS, INT); +typedef LPCSTR (SQLAPI *dbcolname_t) (PDBPROCESS, INT); +typedef LPCSTR (SQLAPI *dbcolsource_t) (PDBPROCESS, INT); +typedef INT (SQLAPI *dbcoltype_t) (PDBPROCESS, INT); +typedef DBINT (SQLAPI *dbcolutype_t) (PDBPROCESS, INT); +typedef INT (SQLAPI *dbconvert_t) (PDBPROCESS, INT, LPCBYTE, DBINT, INT, LPBYTE, DBINT); +typedef DBINT (SQLAPI *dbcount_t) (PDBPROCESS); +typedef INT (SQLAPI *dbcurcmd_t) (PDBPROCESS); +typedef DBINT (SQLAPI *dbcurrow_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbcursor_t) (PDBCURSOR, INT, INT, LPCSTR, LPCSTR); +typedef RETCODE (SQLAPI *dbcursorbind_t) (PDBCURSOR, INT, INT, DBINT, LPDBINT, LPBYTE); +typedef RETCODE (SQLAPI *dbcursorclose_t) (PDBHANDLE); +typedef RETCODE (SQLAPI *dbcursorcolinfo_t) (PDBCURSOR, INT, LPSTR, LPINT, LPDBINT, LPINT); +typedef RETCODE (SQLAPI *dbcursorfetch_t) (PDBCURSOR, INT, INT); +typedef RETCODE (SQLAPI *dbcursorfetchex_t) (PDBCURSOR, INT, DBINT, DBINT, DBINT); +typedef RETCODE (SQLAPI *dbcursorinfo_t) (PDBCURSOR, LPINT, LPDBINT); +typedef RETCODE (SQLAPI *dbcursorinfoex_t) (PDBCURSOR, LPDBCURSORINFO); +typedef PDBCURSOR (SQLAPI *dbcursoropen_t) (PDBPROCESS, LPCSTR, INT, INT,UINT, LPDBINT); +typedef LPCBYTE (SQLAPI *dbdata_t) (PDBPROCESS, INT); +typedef BOOL (SQLAPI *dbdataready_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbdatecrack_t) (PDBPROCESS, LPDBDATEREC, LPCDBDATETIME); +typedef DBINT (SQLAPI *dbdatlen_t) (PDBPROCESS, INT); +typedef BOOL (SQLAPI *dbdead_t) (PDBPROCESS); +typedef void (SQLAPI *dbexit_t) (void); +typedef RETCODE (SQLAPI *dbenlisttrans_t) (PDBPROCESS, LPVOID); +typedef RETCODE (SQLAPI *dbenlistxatrans_t) (PDBPROCESS, BOOL); +typedef RETCODE (SQLAPI *dbfcmd_t) (PDBPROCESS, LPCSTR, ...); +typedef DBINT (SQLAPI *dbfirstrow_t) (PDBPROCESS); +typedef void (SQLAPI *dbfreebuf_t) (PDBPROCESS); +typedef void (SQLAPI *dbfreelogin_t) (PLOGINREC); +typedef void (SQLAPI *dbfreequal_t) (LPCSTR); +typedef LPSTR (SQLAPI *dbgetchar_t) (PDBPROCESS, INT); +typedef SHORT (SQLAPI *dbgetmaxprocs_t) (void); +typedef INT (SQLAPI *dbgetoff_t) (PDBPROCESS, DBUSMALLINT, INT); +typedef UINT (SQLAPI *dbgetpacket_t) (PDBPROCESS); +typedef STATUS (SQLAPI *dbgetrow_t) (PDBPROCESS, DBINT); +typedef INT (SQLAPI *dbgettime_t) (void); +typedef LPVOID (SQLAPI *dbgetuserdata_t) (PDBPROCESS); +typedef BOOL (SQLAPI *dbhasretstat_t) (PDBPROCESS); +typedef LPCSTR (SQLAPI *dbinit_t) (void); +typedef BOOL (SQLAPI *dbisavail_t) (PDBPROCESS); +typedef BOOL (SQLAPI *dbiscount_t) (PDBPROCESS); +typedef BOOL (SQLAPI *dbisopt_t) (PDBPROCESS, INT, LPCSTR); +typedef DBINT (SQLAPI *dblastrow_t) (PDBPROCESS); +typedef PLOGINREC (SQLAPI *dblogin_t) (void); +typedef RETCODE (SQLAPI *dbmorecmds_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbmoretext_t) (PDBPROCESS, DBINT, LPCBYTE); +typedef LPCSTR (SQLAPI *dbname_t) (PDBPROCESS); +typedef STATUS (SQLAPI *dbnextrow_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbnullbind_t) (PDBPROCESS, INT, LPCDBINT); +typedef INT (SQLAPI *dbnumalts_t) (PDBPROCESS, INT); +typedef INT (SQLAPI *dbnumcols_t) (PDBPROCESS); +typedef INT (SQLAPI *dbnumcompute_t) (PDBPROCESS); +typedef INT (SQLAPI *dbnumorders_t) (PDBPROCESS); +typedef INT (SQLAPI *dbnumrets_t) (PDBPROCESS); +typedef PDBPROCESS (SQLAPI *dbopen_t) (PLOGINREC, LPCSTR); +typedef INT (SQLAPI *dbordercol_t) (PDBPROCESS, INT); +typedef RETCODE (SQLAPI *dbprocinfo_t) (PDBPROCESS, LPDBPROCINFO); +typedef void (SQLAPI *dbprhead_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbprrow_t) (PDBPROCESS); +typedef LPCSTR (SQLAPI *dbprtype_t) (INT); +typedef LPCSTR (SQLAPI *dbqual_t) (PDBPROCESS, INT, LPCSTR); +typedef DBINT (SQLAPI *dbreadpage_t) (PDBPROCESS, LPCSTR, DBINT, LPBYTE); +typedef DBINT (SQLAPI *dbreadtext_t) (PDBPROCESS, LPVOID, DBINT); +typedef RETCODE (SQLAPI *dbresults_t) (PDBPROCESS); +typedef LPCBYTE (SQLAPI *dbretdata_t) (PDBPROCESS, INT); +typedef DBINT (SQLAPI *dbretlen_t) (PDBPROCESS, INT); +typedef LPCSTR (SQLAPI *dbretname_t) (PDBPROCESS, INT); +typedef DBINT (SQLAPI *dbretstatus_t) (PDBPROCESS); +typedef INT (SQLAPI *dbrettype_t) (PDBPROCESS, INT); +typedef RETCODE (SQLAPI *dbrows_t) (PDBPROCESS); +typedef STATUS (SQLAPI *dbrowtype_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbrpcinit_t) (PDBPROCESS, LPCSTR, DBSMALLINT); +typedef RETCODE (SQLAPI *dbrpcparam_t) (PDBPROCESS, LPCSTR, BYTE, INT, DBINT, DBINT, LPCBYTE); +typedef RETCODE (SQLAPI *dbrpcsend_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbrpcexec_t) (PDBPROCESS); +typedef void (SQLAPI *dbrpwclr_t) (PLOGINREC); +typedef RETCODE (SQLAPI *dbrpwset_t) (PLOGINREC, LPCSTR, LPCSTR, INT); +typedef INT (SQLAPI *dbserverenum_t) (USHORT, LPSTR, USHORT, LPUSHORT); +typedef void (SQLAPI *dbsetavail_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbsetmaxprocs_t) (SHORT); +typedef RETCODE (SQLAPI *dbsetlname_t) (PLOGINREC, LPCSTR, INT); +typedef RETCODE (SQLAPI *dbsetlogintime_t) (INT); +typedef RETCODE (SQLAPI *dbsetlpacket_t) (PLOGINREC, USHORT); +typedef RETCODE (SQLAPI *dbsetnull_t) (PDBPROCESS, INT, INT, LPCBYTE); +typedef RETCODE (SQLAPI *dbsetopt_t) (PDBPROCESS, INT, LPCSTR); +typedef RETCODE (SQLAPI *dbsettime_t) (INT); +typedef void (SQLAPI *dbsetuserdata_t) (PDBPROCESS, LPVOID); +typedef RETCODE (SQLAPI *dbsqlexec_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbsqlok_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbsqlsend_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbstrcpy_t) (PDBPROCESS, INT, INT, LPSTR); +typedef INT (SQLAPI *dbstrlen_t) (PDBPROCESS); +typedef BOOL (SQLAPI *dbtabbrowse_t) (PDBPROCESS, INT); +typedef INT (SQLAPI *dbtabcount_t) (PDBPROCESS); +typedef LPCSTR (SQLAPI *dbtabname_t) (PDBPROCESS, INT); +typedef LPCSTR (SQLAPI *dbtabsource_t) (PDBPROCESS, INT, LPINT); +typedef INT (SQLAPI *dbtsnewlen_t) (PDBPROCESS); +typedef LPCDBBINARY (SQLAPI *dbtsnewval_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbtsput_t) (PDBPROCESS, LPCDBBINARY, INT, INT, LPCSTR); +typedef LPCDBBINARY (SQLAPI *dbtxptr_t) (PDBPROCESS, INT); +typedef LPCDBBINARY (SQLAPI *dbtxtimestamp_t) (PDBPROCESS, INT); +typedef LPCDBBINARY (SQLAPI *dbtxtsnewval_t) (PDBPROCESS); +typedef RETCODE (SQLAPI *dbtxtsput_t) (PDBPROCESS, LPCDBBINARY, INT); +typedef RETCODE (SQLAPI *dbuse_t) (PDBPROCESS, LPCSTR); +typedef BOOL (SQLAPI *dbvarylen_t) (PDBPROCESS, INT); +typedef BOOL (SQLAPI *dbwillconvert_t) (INT, INT); +typedef RETCODE (SQLAPI *dbwritepage_t) (PDBPROCESS, LPCSTR, DBINT, DBINT, LPBYTE); +typedef RETCODE (SQLAPI *dbwritetext_t) (PDBPROCESS, LPCSTR, LPCDBBINARY, DBTINYINT, LPCDBBINARY, BOOL, DBINT, LPCBYTE); +typedef RETCODE (SQLAPI *dbupdatetext_t) (PDBPROCESS, LPCSTR, LPCDBBINARY, LPCDBBINARY, INT, DBINT, DBINT, LPCSTR, DBINT, LPCDBBINARY); + +// API declarations +class ssAPI : public saAPI +{ +public: + ssAPI(); + + dberrhandle_t dberrhandle; + dbmsghandle_t dbmsghandle; + dbprocerrhandle_t dbprocerrhandle; + dbprocmsghandle_t dbprocmsghandle; + + // Two-phase commit functions + abort_xact_t abort_xact; + build_xact_string_t build_xact_string; + close_commit_t close_commit; + commit_xact_t commit_xact; + open_commit_t open_commit; + remove_xact_t remove_xact; + scan_xact_t scan_xact; + start_xact_t start_xact; + stat_xact_t stat_xact; + + // BCP functions + bcp_batch_t bcp_batch; + bcp_bind_t bcp_bind; + bcp_colfmt_t bcp_colfmt; + bcp_collen_t bcp_collen; + bcp_colptr_t bcp_colptr; + bcp_columns_t bcp_columns; + bcp_control_t bcp_control; + bcp_done_t bcp_done; + bcp_exec_t bcp_exec; + bcp_init_t bcp_init; + bcp_moretext_t bcp_moretext; + bcp_readfmt_t bcp_readfmt; + bcp_sendrow_t bcp_sendrow; + bcp_setl_t bcp_setl; + bcp_writefmt_t bcp_writefmt; + + // Standard DB-Library functions + dbadata_t dbadata; + dbadlen_t dbadlen; + dbaltbind_t dbaltbind; + dbaltcolid_t dbaltcolid; + dbaltlen_t dbaltlen; + dbaltop_t dbaltop; + dbalttype_t dbalttype; + dbaltutype_t dbaltutype; + dbanullbind_t dbanullbind; + dbbind_t dbbind; + dbbylist_t dbbylist; + dbcancel_t dbcancel; + dbcanquery_t dbcanquery; + dbchange_t dbchange; + dbclose_t dbclose; + dbclrbuf_t dbclrbuf; + dbclropt_t dbclropt; + dbcmd_t dbcmd; + dbcmdrow_t dbcmdrow; + dbcolbrowse_t dbcolbrowse; + dbcolinfo_t dbcolinfo; + dbcollen_t dbcollen; + dbcolname_t dbcolname; + dbcolsource_t dbcolsource; + dbcoltype_t dbcoltype; + dbcolutype_t dbcolutype; + dbconvert_t dbconvert; + dbcount_t dbcount; + dbcurcmd_t dbcurcmd; + dbcurrow_t dbcurrow; + dbcursor_t dbcursor; + dbcursorbind_t dbcursorbind; + dbcursorclose_t dbcursorclose; + dbcursorcolinfo_t dbcursorcolinfo; + dbcursorfetch_t dbcursorfetch; + dbcursorfetchex_t dbcursorfetchex; + dbcursorinfo_t dbcursorinfo; + dbcursorinfoex_t dbcursorinfoex; + dbcursoropen_t dbcursoropen; + dbdata_t dbdata; + dbdataready_t dbdataready; + dbdatecrack_t dbdatecrack; + dbdatlen_t dbdatlen; + dbdead_t dbdead; + dbexit_t dbexit; + dbenlisttrans_t dbenlisttrans; + dbenlistxatrans_t dbenlistxatrans; + dbfcmd_t dbfcmd; + dbfirstrow_t dbfirstrow; + dbfreebuf_t dbfreebuf; + dbfreelogin_t dbfreelogin; + dbfreequal_t dbfreequal; + dbgetchar_t dbgetchar; + dbgetmaxprocs_t dbgetmaxprocs; + dbgetoff_t dbgetoff; + dbgetpacket_t dbgetpacket; + dbgetrow_t dbgetrow; + dbgettime_t dbgettime; + dbgetuserdata_t dbgetuserdata; + dbhasretstat_t dbhasretstat; + dbinit_t dbinit; + dbisavail_t dbisavail; + dbiscount_t dbiscount; + dbisopt_t dbisopt; + dblastrow_t dblastrow; + dblogin_t dblogin; + dbmorecmds_t dbmorecmds; + dbmoretext_t dbmoretext; + dbname_t dbname; + dbnextrow_t dbnextrow; + dbnullbind_t dbnullbind; + dbnumalts_t dbnumalts; + dbnumcols_t dbnumcols; + dbnumcompute_t dbnumcompute; + dbnumorders_t dbnumorders; + dbnumrets_t dbnumrets; + dbopen_t dbopen; + dbordercol_t dbordercol; + dbprocinfo_t dbprocinfo; + dbprhead_t dbprhead; + dbprrow_t dbprrow; + dbprtype_t dbprtype; + dbqual_t dbqual; + dbreadpage_t dbreadpage; + dbreadtext_t dbreadtext; + dbresults_t dbresults; + dbretdata_t dbretdata; + dbretlen_t dbretlen; + dbretname_t dbretname; + dbretstatus_t dbretstatus; + dbrettype_t dbrettype; + dbrows_t dbrows; + dbrowtype_t dbrowtype; + dbrpcinit_t dbrpcinit; + dbrpcparam_t dbrpcparam; + dbrpcsend_t dbrpcsend; + dbrpcexec_t dbrpcexec; + dbrpwclr_t dbrpwclr; + dbrpwset_t dbrpwset; + dbserverenum_t dbserverenum; + dbsetavail_t dbsetavail; + dbsetmaxprocs_t dbsetmaxprocs; + dbsetlname_t dbsetlname; + dbsetlogintime_t dbsetlogintime; + dbsetlpacket_t dbsetlpacket; + dbsetnull_t dbsetnull; + dbsetopt_t dbsetopt; + dbsettime_t dbsettime; + dbsetuserdata_t dbsetuserdata; + dbsqlexec_t dbsqlexec; + dbsqlok_t dbsqlok; + dbsqlsend_t dbsqlsend; + dbstrcpy_t dbstrcpy; + dbstrlen_t dbstrlen; + dbtabbrowse_t dbtabbrowse; + dbtabcount_t dbtabcount; + dbtabname_t dbtabname; + dbtabsource_t dbtabsource; + dbtsnewlen_t dbtsnewlen; + dbtsnewval_t dbtsnewval; + dbtsput_t dbtsput; + dbtxptr_t dbtxptr; + dbtxtimestamp_t dbtxtimestamp; + dbtxtsnewval_t dbtxtsnewval; + dbtxtsput_t dbtxtsput; + dbuse_t dbuse; + dbvarylen_t dbvarylen; + dbwillconvert_t dbwillconvert; + dbwritepage_t dbwritepage; + dbwritetext_t dbwritetext; + dbupdatetext_t dbupdatetext; +}; + +class SQLAPI_API ssConnectionHandles : public saConnectionHandles +{ +public: + ssConnectionHandles(); + + PDBPROCESS m_dbproc; +}; + +class SQLAPI_API ssCommandHandles : public saCommandHandles +{ +public: + ssCommandHandles(); +}; + +extern ssAPI g_ssAPI; + +#endif // !defined(__SS6API_H__) diff --git a/libraries/SQLAPI/include/ssNcliAPI.h b/libraries/SQLAPI/include/ssNcliAPI.h new file mode 100644 index 000000000..700e8a3aa --- /dev/null +++ b/libraries/SQLAPI/include/ssNcliAPI.h @@ -0,0 +1,561 @@ +// SQL Server Native API +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__SSNCLIAPI_H__) +#define __SSNCLIAPI_H__ + +#include "SQLAPI.h" + +// MSVC++ 6.0 doesn't have this +#ifdef SQLAPI_WINDOWS +#ifndef DBROWCOUNT +#ifdef _WIN64 +typedef LONGLONG DBROWCOUNT; +#else +typedef LONG DBROWCOUNT; +#endif +#endif +#ifndef DBCOUNTITEM +#ifdef _WIN64 +typedef ULONGLONG DBCOUNTITEM; +#else +typedef ULONG DBCOUNTITEM; +#endif +#endif +#ifndef DBORDINAL +#ifdef _WIN64 +typedef ULONGLONG DBORDINAL; +#else +typedef ULONG DBORDINAL; +#endif +#endif +#ifndef DB_UPARAMS +#ifdef _WIN64 +typedef ULONGLONG DB_UPARAMS; +#else +typedef ULONG DB_UPARAMS; +#endif +#endif +#ifndef SQLLEN +#ifdef _WIN64 +typedef INT64 SQLLEN; +#else +#define SQLLEN SQLINTEGER +#endif +#endif +#ifndef SQLULEN +#ifdef _WIN64 +typedef UINT64 SQLULEN; +#else +#define SQLULEN SQLUINTEGER +#endif +#endif +#ifndef SQLSETPOSIROW +#ifdef _WIN64 +typedef UINT64 SQLSETPOSIROW; +#else +#define SQLSETPOSIROW SQLUSMALLINT +#endif +#endif +#endif + +#define SQLNCLI_NO_BCP +#define _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_ +#define _SQLUSERINSTANCE_H_ +#ifndef __deref_out +#define __deref_out +#define __in_bcount +#define __in_z +#define __in +#endif + +// API header(s) +#include +#include +#ifdef SQLAPI_WINDOWS +#include +#else +#include +#endif + +extern void AddNCliSupport(const SAConnection *pCon); +extern void ReleaseNCliSupport(); + +typedef SQLRETURN (SQL_API *SQLAllocHandle_t)(SQLSMALLINT HandleType, + SQLHANDLE InputHandle, SQLHANDLE *OutputHandle); +typedef SQLRETURN (SQL_API *SQLBindCol_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValue, + SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLBindParameter_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT fParamType, + SQLSMALLINT fCType, + SQLSMALLINT fSqlType, + SQLULEN cbColDef, + SQLSMALLINT ibScale, + SQLPOINTER rgbValue, + SQLLEN cbValueMax, + SQLLEN *pcbValue); +typedef SQLRETURN (SQL_API *SQLBulkOperations_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT Operation); +typedef SQLRETURN (SQL_API *SQLBrowseConnectW_t)( + SQLHDBC hdbc, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut); +typedef SQLRETURN (SQL_API *SQLCancel_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLCloseCursor_t)(SQLHSTMT StatementHandle); +#if defined(_WIN64) || defined(SA_64BIT) +typedef SQLRETURN (SQL_API *SQLColAttributeW_t)( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLLEN *pNumAttr); +#else +typedef SQLRETURN (SQL_API *SQLColAttributeW_t)( + SQLHSTMT hstmt, + SQLUSMALLINT iCol, + SQLUSMALLINT iField, + SQLPOINTER pCharAttr, + SQLSMALLINT cbCharAttrMax, + SQLSMALLINT *pcbCharAttr, + SQLPOINTER pNumAttr); +#endif +typedef SQLRETURN (SQL_API *SQLColumnPrivilegesW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLColumnsW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLConnectW_t)( + SQLHDBC hdbc, + SQLWCHAR *szDSN, + SQLSMALLINT cbDSN, + SQLWCHAR *szUID, + SQLSMALLINT cbUID, + SQLWCHAR *szAuthStr, + SQLSMALLINT cbAuthStr); +typedef SQLRETURN (SQL_API *SQLCopyDesc_t)(SQLHDESC SourceDescHandle, + SQLHDESC TargetDescHandle); +typedef SQLRETURN (SQL_API *SQLDescribeColW_t)( + SQLHSTMT hstmt, + SQLUSMALLINT icol, + SQLWCHAR *szColName, + SQLSMALLINT cbColNameMax, + SQLSMALLINT *pcbColName, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbColDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); +typedef SQLRETURN (SQL_API *SQLDescribeParam_t)( + SQLHSTMT hstmt, + SQLUSMALLINT ipar, + SQLSMALLINT *pfSqlType, + SQLULEN *pcbParamDef, + SQLSMALLINT *pibScale, + SQLSMALLINT *pfNullable); +typedef SQLRETURN (SQL_API *SQLDisconnect_t)(SQLHDBC ConnectionHandle); +typedef SQLRETURN (SQL_API *SQLDriverConnectW_t)( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLWCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLWCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion); +typedef SQLRETURN (SQL_API *SQLEndTran_t)(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT CompletionType); +typedef SQLRETURN (SQL_API *SQLExecDirectW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); +typedef SQLRETURN (SQL_API *SQLExecute_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLExtendedFetch_t)( + SQLHSTMT hstmt, + SQLUSMALLINT fFetchType, + SQLLEN irow, + SQLULEN *pcrow, + SQLUSMALLINT *rgfRowStatus); +typedef SQLRETURN (SQL_API *SQLFetch_t)(SQLHSTMT StatementHandle); +typedef SQLRETURN (SQL_API *SQLFetchScroll_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, + SQLLEN FetchOffset); +typedef SQLRETURN (SQL_API *SQLFreeHandle_t)(SQLSMALLINT HandleType, SQLHANDLE Handle); +typedef SQLRETURN (SQL_API *SQLFreeStmt_t)(SQLHSTMT StatementHandle, + SQLUSMALLINT Option); +typedef SQLRETURN (SQL_API *SQLForeignKeysW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szPkCatalogName, + SQLSMALLINT cbPkCatalogName, + SQLWCHAR *szPkSchemaName, + SQLSMALLINT cbPkSchemaName, + SQLWCHAR *szPkTableName, + SQLSMALLINT cbPkTableName, + SQLWCHAR *szFkCatalogName, + SQLSMALLINT cbFkCatalogName, + SQLWCHAR *szFkSchemaName, + SQLSMALLINT cbFkSchemaName, + SQLWCHAR *szFkTableName, + SQLSMALLINT cbFkTableName); +typedef SQLRETURN (SQL_API *SQLGetConnectAttrW_t)( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); +typedef SQLRETURN (SQL_API *SQLGetConnectOptionW_t)( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLPOINTER pvParam); +typedef SQLRETURN (SQL_API *SQLGetCursorNameW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursorMax, + SQLSMALLINT *pcbCursor); +typedef SQLRETURN (SQL_API *SQLGetData_t)( + SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValue, + SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLGetDescFieldW_t)( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLSMALLINT iField, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); +typedef SQLRETURN (SQL_API *SQLGetDescRecW_t)( + SQLHDESC hdesc, + SQLSMALLINT iRecord, + SQLWCHAR *szName, + SQLSMALLINT cbNameMax, + SQLSMALLINT *pcbName, + SQLSMALLINT *pfType, + SQLSMALLINT *pfSubType, + SQLLEN *pLength, + SQLSMALLINT *pPrecision, + SQLSMALLINT *pScale, + SQLSMALLINT *pNullable); +typedef SQLRETURN (SQL_API *SQLGetDiagFieldW_t)( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLSMALLINT fDiagField, + SQLPOINTER rgbDiagInfo, + SQLSMALLINT cbDiagInfoMax, + SQLSMALLINT *pcbDiagInfo); +typedef SQLRETURN (SQL_API *SQLGetDiagRecW_t)( + SQLSMALLINT fHandleType, + SQLHANDLE handle, + SQLSMALLINT iRecord, + SQLWCHAR *szSqlState, + SQLINTEGER *pfNativeError, + SQLWCHAR *szErrorMsg, + SQLSMALLINT cbErrorMsgMax, + SQLSMALLINT *pcbErrorMsg); +typedef SQLRETURN (SQL_API *SQLGetEnvAttr_t)( + SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, + SQLPOINTER Value, + SQLINTEGER BufferLength, + SQLINTEGER *StringLength); +typedef SQLRETURN (SQL_API *SQLGetFunctions_t)( + SQLHDBC ConnectionHandle, + SQLUSMALLINT FunctionId, + SQLUSMALLINT *Supported); +typedef SQLRETURN (SQL_API *SQLGetInfoW_t)( + SQLHDBC hdbc, + SQLUSMALLINT fInfoType, + SQLPOINTER rgbInfoValue, + SQLSMALLINT cbInfoValueMax, + SQLSMALLINT *pcbInfoValue); +typedef SQLRETURN (SQL_API *SQLGetTypeInfoW_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT DataType); +typedef SQLRETURN (SQL_API *SQLGetStmtAttrW_t)( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax, + SQLINTEGER *pcbValue); +typedef SQLRETURN (SQL_API *SQLMoreResults_t)( + SQLHSTMT hstmt); +typedef SQLRETURN (SQL_API *SQLNativeSqlW_t)( + SQLHDBC hdbc, + SQLWCHAR *szSqlStrIn, + SQLINTEGER cbSqlStrIn, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStrMax, + SQLINTEGER *pcbSqlStr); +typedef SQLRETURN (SQL_API *SQLNumParams_t)( + SQLHSTMT hstmt, + SQLSMALLINT *pcpar); +typedef SQLRETURN (SQL_API *SQLNumResultCols_t)( + SQLHSTMT StatementHandle, + SQLSMALLINT *ColumnCount); +typedef SQLRETURN (SQL_API *SQLParamData_t)( + SQLHSTMT StatementHandle, + SQLPOINTER *Value); +typedef SQLRETURN (SQL_API *SQLParamOptions_t)( + SQLHSTMT hstmt, + SQLULEN crow, + SQLULEN *pirow); +typedef SQLRETURN (SQL_API *SQLPrepareW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szSqlStr, + SQLINTEGER cbSqlStr); +typedef SQLRETURN (SQL_API *SQLPrimaryKeysW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API *SQLProcedureColumnsW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName, + SQLWCHAR *szColumnName, + SQLSMALLINT cbColumnName); +typedef SQLRETURN (SQL_API *SQLProceduresW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szProcName, + SQLSMALLINT cbProcName); +typedef SQLRETURN (SQL_API *SQLPutData_t)( + SQLHSTMT StatementHandle, + SQLPOINTER Data, + SQLLEN StrLen_or_Ind); +typedef SQLRETURN (SQL_API *SQLRowCount_t)( + SQLHSTMT StatementHandle, + SQLLEN *RowCount); +typedef SQLRETURN (SQL_API *SQLSetConnectAttrW_t)( + SQLHDBC hdbc, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValue); +typedef SQLRETURN (SQL_API *SQLSetConnectOptionW_t)( + SQLHDBC hdbc, + SQLUSMALLINT fOption, + SQLULEN vParam); +typedef SQLRETURN (SQL_API *SQLSetCursorNameW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCursor, + SQLSMALLINT cbCursor); +typedef SQLRETURN (SQL_API *SQLSetDescFieldW_t)( + SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER Value, + SQLINTEGER BufferLength); +typedef SQLRETURN (SQL_API *SQLSetDescRec_t)( + SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT Type, + SQLSMALLINT SubType, + SQLLEN Length, + SQLSMALLINT Precision, + SQLSMALLINT Scale, + SQLPOINTER Data, + SQLLEN *StringLength, + SQLLEN *Indicator); +typedef SQLRETURN (SQL_API *SQLSetEnvAttr_t)(SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength); +typedef SQLRETURN (SQL_API *SQLSetPos_t)( + SQLHSTMT hstmt, + SQLSETPOSIROW irow, + SQLUSMALLINT fOption, + SQLUSMALLINT fLock); +typedef SQLRETURN (SQL_API *SQLSetScrollOptions_t)( + SQLHSTMT hstmt, + SQLUSMALLINT fConcurrency, + SQLLEN crowKeyset, + SQLUSMALLINT crowRowset); +typedef SQLRETURN (SQL_API *SQLSetStmtAttrW_t)( + SQLHSTMT hstmt, + SQLINTEGER fAttribute, + SQLPOINTER rgbValue, + SQLINTEGER cbValueMax); +typedef SQLRETURN (SQL_API *SQLSpecialColumnsW_t)( + SQLHSTMT hstmt, + SQLUSMALLINT fColType, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fScope, + SQLUSMALLINT fNullable); +typedef SQLRETURN (SQL_API *SQLStatisticsW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLUSMALLINT fUnique, + SQLUSMALLINT fAccuracy); +typedef SQLRETURN (SQL_API *SQLTablePrivilegesW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName); +typedef SQLRETURN (SQL_API *SQLTablesW_t)( + SQLHSTMT hstmt, + SQLWCHAR *szCatalogName, + SQLSMALLINT cbCatalogName, + SQLWCHAR *szSchemaName, + SQLSMALLINT cbSchemaName, + SQLWCHAR *szTableName, + SQLSMALLINT cbTableName, + SQLWCHAR *szTableType, + SQLSMALLINT cbTableType); + +#ifdef SQLAPI_WINDOWS +typedef HANDLE (_stdcall *OpenSqlFilestream_t) ( + LPCWSTR FilestreamPath, + SQL_FILESTREAM_DESIRED_ACCESS DesiredAccess, + ULONG OpenOptions, + LPBYTE FilestreamTransactionContext, + SSIZE_T FilestreamTransactionContextLength, + PLARGE_INTEGER AllocationSize); +#endif + +class SQLAPI_API ssNCliAPI : public saAPI +{ +public: + ssNCliAPI(); + + SQLAllocHandle_t SQLAllocHandle; // 3.0 + SQLBindCol_t SQLBindCol; // 1.0 + SQLBindParameter_t SQLBindParameter; // 2.0 + SQLBulkOperations_t SQLBulkOperations; // 3.0 + SQLBrowseConnectW_t SQLBrowseConnectW; // 3.0 + SQLCancel_t SQLCancel; // 1.0 + SQLCloseCursor_t SQLCloseCursor; // 3.0 + SQLColAttributeW_t SQLColAttributeW; + SQLColumnPrivilegesW_t SQLColumnPrivilegesW; + SQLColumnsW_t SQLColumnsW; + SQLConnectW_t SQLConnectW; + SQLCopyDesc_t SQLCopyDesc; // 3.0 + SQLDescribeColW_t SQLDescribeColW; // 1.0 + SQLDescribeParam_t SQLDescribeParam; // 1.0 + SQLDisconnect_t SQLDisconnect; // 1.0 + SQLDriverConnectW_t SQLDriverConnectW; // 1.0 + SQLEndTran_t SQLEndTran; // 3.0 + SQLExecDirectW_t SQLExecDirectW; + SQLExecute_t SQLExecute; // 1.0 + SQLExtendedFetch_t SQLExtendedFetch; // 1.0 + SQLFetch_t SQLFetch; // 1.0 + SQLFetchScroll_t SQLFetchScroll; // 1.0 + SQLForeignKeysW_t SQLForeignKeysW; + SQLFreeHandle_t SQLFreeHandle; // 3.0 + SQLFreeStmt_t SQLFreeStmt; // 1.0 + SQLGetConnectAttrW_t SQLGetConnectAttrW; // 3.0 + SQLGetConnectOptionW_t SQLGetConnectOptionW; + SQLGetCursorNameW_t SQLGetCursorNameW; + SQLGetData_t SQLGetData; // 1.0 + SQLGetDescFieldW_t SQLGetDescFieldW; + SQLGetDescRecW_t SQLGetDescRecW; + SQLGetDiagFieldW_t SQLGetDiagFieldW; + SQLGetDiagRecW_t SQLGetDiagRecW; // 3.0 + SQLGetEnvAttr_t SQLGetEnvAttr; // 3.0 + SQLGetFunctions_t SQLGetFunctions; // 1.0 + SQLGetInfoW_t SQLGetInfoW; // 1.0 + SQLGetStmtAttrW_t SQLGetStmtAttrW; // 3.0 + SQLGetTypeInfoW_t SQLGetTypeInfoW; + SQLMoreResults_t SQLMoreResults; // 1.0 + SQLNativeSqlW_t SQLNativeSqlW; + SQLNumParams_t SQLNumParams; // 1.0 + SQLNumResultCols_t SQLNumResultCols; // 1.0 + SQLParamData_t SQLParamData; // 1.0 + SQLParamOptions_t SQLParamOptions; // 1.0 + SQLPrepareW_t SQLPrepareW; // 1.0 + SQLPrimaryKeysW_t SQLPrimaryKeysW; + SQLProcedureColumnsW_t SQLProcedureColumnsW;// 1.0 + SQLProceduresW_t SQLProceduresW; // 1.0 + SQLPutData_t SQLPutData; // 1.0 + SQLRowCount_t SQLRowCount; // 1.0 + SQLSetConnectAttrW_t SQLSetConnectAttrW; // 3.0 + SQLSetConnectOptionW_t SQLSetConnectOptionW;// 1.0 + SQLSetCursorNameW_t SQLSetCursorNameW; // 1.0 + SQLSetDescFieldW_t SQLSetDescFieldW; // 3.0 + SQLSetDescRec_t SQLSetDescRec; // 3.0 + SQLSetEnvAttr_t SQLSetEnvAttr; // 3.0 + SQLSetPos_t SQLSetPos; // 1.0 + SQLSetScrollOptions_t SQLSetScrollOptions;// 1.0 + SQLSetStmtAttrW_t SQLSetStmtAttrW; // 3.0 + SQLSpecialColumnsW_t SQLSpecialColumnsW; // 1.0 + SQLStatisticsW_t SQLStatisticsW; // 1.0 + SQLTablePrivilegesW_t SQLTablePrivilegesW;// 1.0 + SQLTablesW_t SQLTablesW; // 1.0 + +#ifdef SQLAPI_WINDOWS + OpenSqlFilestream_t OpenSqlFilestream; +#endif +}; + +class SQLAPI_API ssNCliConnectionHandles : public saConnectionHandles +{ +public: + ssNCliConnectionHandles(); + + SQLHENV m_hevn; + SQLHDBC m_hdbc; +}; + +class SQLAPI_API ssNCliCommandHandles : public saCommandHandles +{ +public: + ssNCliCommandHandles(); + + SQLHSTMT m_hstmt; +}; + +extern ssNCliAPI g_ssNCliAPI; + +#endif // !defined(__SSNCLIAPI_H__) diff --git a/libraries/SQLAPI/include/ssOleDbAPI.h b/libraries/SQLAPI/include/ssOleDbAPI.h new file mode 100644 index 000000000..a925e00a5 --- /dev/null +++ b/libraries/SQLAPI/include/ssOleDbAPI.h @@ -0,0 +1,46 @@ +// ssOleDbAPI.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__SSOLEDBAPI_H__) +#define __SSOLEDBAPI_H__ + +#include "SQLAPI.h" + +// API header(s) +#include + +extern void AddSSOleDbSupport(); +extern void ReleaseSSOleDbSupport(); + +// API declarations +class ssOleDbAPI : public saAPI +{ +public: + ssOleDbAPI(); +}; + +class SQLAPI_API ssOleDbConnectionHandles : public saConnectionHandles +{ +public: + ssOleDbConnectionHandles(); + + IDBInitialize *pIDBInitialize; + IDBCreateCommand *pIDBCreateCommand; + ITransactionLocal *pITransactionLocal; + IDBDataSourceAdmin *pIDBDataSourceAdmin; +}; + +class SQLAPI_API ssOleDbCommandHandles : public saCommandHandles +{ +public: + ssOleDbCommandHandles(); + + ICommandText *pICommandText; + IMultipleResults *pIMultipleResults; + IRowset *pIRowset; +}; + +extern ssOleDbAPI g_ssOleDbAPI; + +#endif // !defined(__SSOLEDBAPI_H__) diff --git a/libraries/SQLAPI/include/ss_win/sqldb.h b/libraries/SQLAPI/include/ss_win/sqldb.h new file mode 100644 index 000000000..209fdd2aa --- /dev/null +++ b/libraries/SQLAPI/include/ss_win/sqldb.h @@ -0,0 +1,255 @@ +#ifndef _INC_SQLDB +#define _INC_SQLDB + +#ifdef __cplusplus + extern "C" { +#endif + +/***************************************************************************** +* * +* SQLDB.H - DB-Library header file for the Microsoft SQL Server. * +* * +* Copyright (c) 1989 - 1995 by Microsoft Corp. All rights reserved. * +* * +*****************************************************************************/ + +// Macros for setting the PLOGINREC +#define DBSETLHOST(a,b) dbsetlname ((a), (b), DBSETHOST) +#define DBSETLUSER(a,b) dbsetlname ((a), (b), DBSETUSER) +#define DBSETLPWD(a,b) dbsetlname ((a), (b), DBSETPWD) +#define DBSETLAPP(a,b) dbsetlname ((a), (b), DBSETAPP) +#define BCP_SETL(a,b) bcp_setl ((a), (b)) +#define DBSETLNATLANG(a,b) dbsetlname ((a), (b), DBSETLANG) +#define DBSETLPACKET(a,b) dbsetlpacket ((a), (b)) +#define DBSETLSECURE(a) dbsetlname ((a), 0, DBSETSECURE) +#define DBSETLVERSION(a,b) dbsetlname ((a), 0, (b)) +#define DBSETLTIME(a,b) dbsetlname ((a), (LPCSTR)(ULONG)(b), DBSETLOGINTIME) +#define DBSETLFALLBACK(a,b) dbsetlname ((a), (b), DBSETFALLBACK) + +/***************************************************************************** +* Windows 3.x and Non-Windows 3.x differences. * +*****************************************************************************/ + +#ifdef DBMSWIN + +extern void SQLAPI dbwinexit(void); + +void SQLAPI dblocklib (void); +void SQLAPI dbunlocklib (void); + +#define DBLOCKLIB() dblocklib() +#define DBUNLOCKLIB() dbunlocklib() + +#define DBERRHANDLE_PROC FARPROC +#define DBMSGHANDLE_PROC FARPROC + +extern DBERRHANDLE_PROC dberrhandle (DBERRHANDLE_PROC); +extern DBMSGHANDLE_PROC dbmsghandle (DBMSGHANDLE_PROC); + +#else + +#define dbwinexit() + +#define DBLOCKLIB() +#define DBUNLOCKLIB() + +typedef INT (SQLAPI *DBERRHANDLE_PROC)(PDBPROCESS, INT, INT, INT, LPCSTR, LPCSTR); +typedef INT (SQLAPI *DBMSGHANDLE_PROC)(PDBPROCESS, DBINT, INT, INT, LPCSTR, LPCSTR, LPCSTR, DBUSMALLINT); + +extern DBERRHANDLE_PROC SQLAPI dberrhandle(DBERRHANDLE_PROC); +extern DBMSGHANDLE_PROC SQLAPI dbmsghandle(DBMSGHANDLE_PROC); + +extern DBERRHANDLE_PROC SQLAPI dbprocerrhandle(PDBHANDLE, DBERRHANDLE_PROC); +extern DBMSGHANDLE_PROC SQLAPI dbprocmsghandle(PDBHANDLE, DBMSGHANDLE_PROC); + + +#endif + + +/***************************************************************************** +* Function Prototypes * +*****************************************************************************/ + +// Functions macros +#define DBCMDROW(a) dbcmdrow(a) +#define DBCOUNT(a) dbcount (a) +#define DBCURCMD(a) dbcurcmd(a) +#define DBCURROW(a) dbcurrow(a) +#define DBDEAD(a) dbdead(a) +#define DBFIRSTROW(a) dbfirstrow(a) +#define DBGETTIME() dbgettime() +#define DBISAVAIL(a) dbisavail(a) +#define DBLASTROW(a) dblastrow(a) +#define DBMORECMDS(a) dbmorecmds(a) +#define DBNUMORDERS(a) dbnumorders(a) +#define dbrbuf(a) ((DBINT)dbdataready(a)) +#define DBRBUF(a) ((DBINT)dbdataready(a)) +#define DBROWS(a) dbrows (a) +#define DBROWTYPE(a) dbrowtype (a) + +// Two-phase commit functions +extern RETCODE SQLAPI abort_xact (PDBPROCESS, DBINT); +extern void SQLAPI build_xact_string (LPCSTR, LPCSTR, DBINT, LPSTR); +extern void SQLAPI close_commit (PDBPROCESS); +extern RETCODE SQLAPI commit_xact (PDBPROCESS, DBINT); +extern PDBPROCESS SQLAPI open_commit (PLOGINREC, LPCSTR); +extern RETCODE SQLAPI remove_xact (PDBPROCESS, DBINT, INT); +extern RETCODE SQLAPI scan_xact (PDBPROCESS, DBINT); +extern DBINT SQLAPI start_xact (PDBPROCESS, LPCSTR, LPCSTR, INT); +extern INT SQLAPI stat_xact (PDBPROCESS, DBINT); + +// BCP functions +extern DBINT SQLAPI bcp_batch (PDBPROCESS); +extern RETCODE SQLAPI bcp_bind (PDBPROCESS, LPCBYTE, INT, DBINT, LPCBYTE, INT, INT, INT); +extern RETCODE SQLAPI bcp_colfmt (PDBPROCESS, INT, BYTE, INT, DBINT, LPCBYTE, INT, INT); +extern RETCODE SQLAPI bcp_collen (PDBPROCESS, DBINT, INT); +extern RETCODE SQLAPI bcp_colptr (PDBPROCESS, LPCBYTE, INT); +extern RETCODE SQLAPI bcp_columns (PDBPROCESS, INT); +extern RETCODE SQLAPI bcp_control (PDBPROCESS, INT, DBINT); +extern DBINT SQLAPI bcp_done (PDBPROCESS); +extern RETCODE SQLAPI bcp_exec (PDBPROCESS, LPDBINT); +extern RETCODE SQLAPI bcp_init (PDBPROCESS, LPCSTR, LPCSTR, LPCSTR, INT); +extern RETCODE SQLAPI bcp_moretext (PDBPROCESS, DBINT, LPCBYTE); +extern RETCODE SQLAPI bcp_readfmt (PDBPROCESS, LPCSTR); +extern RETCODE SQLAPI bcp_sendrow (PDBPROCESS); +extern RETCODE SQLAPI bcp_setl (PLOGINREC, BOOL); +extern RETCODE SQLAPI bcp_writefmt (PDBPROCESS, LPCSTR); + +// Standard DB-Library functions +extern LPCBYTE SQLAPI dbadata (PDBPROCESS, INT, INT); +extern DBINT SQLAPI dbadlen (PDBPROCESS, INT, INT); +extern RETCODE SQLAPI dbaltbind (PDBPROCESS, INT, INT, INT, DBINT, LPCBYTE); +extern INT SQLAPI dbaltcolid (PDBPROCESS, INT, INT); +extern DBINT SQLAPI dbaltlen (PDBPROCESS, INT, INT); +extern INT SQLAPI dbaltop (PDBPROCESS, INT, INT); +extern INT SQLAPI dbalttype (PDBPROCESS, INT, INT); +extern DBINT SQLAPI dbaltutype (PDBPROCESS, INT, INT); +extern RETCODE SQLAPI dbanullbind (PDBPROCESS, INT, INT, LPCDBINT); +extern RETCODE SQLAPI dbbind (PDBPROCESS, INT, INT, DBINT, LPBYTE); +extern LPCBYTE SQLAPI dbbylist (PDBPROCESS, INT, LPINT); +extern RETCODE SQLAPI dbcancel (PDBPROCESS); +extern RETCODE SQLAPI dbcanquery (PDBPROCESS); +extern LPCSTR SQLAPI dbchange (PDBPROCESS); +extern RETCODE SQLAPI dbclose (PDBPROCESS); +extern void SQLAPI dbclrbuf (PDBPROCESS, DBINT); +extern RETCODE SQLAPI dbclropt (PDBPROCESS, INT, LPCSTR); +extern RETCODE SQLAPI dbcmd (PDBPROCESS, LPCSTR); +extern RETCODE SQLAPI dbcmdrow (PDBPROCESS); +extern BOOL SQLAPI dbcolbrowse (PDBPROCESS, INT); +extern RETCODE SQLAPI dbcolinfo (PDBHANDLE, INT, INT, INT, LPDBCOL); +extern DBINT SQLAPI dbcollen (PDBPROCESS, INT); +extern LPCSTR SQLAPI dbcolname (PDBPROCESS, INT); +extern LPCSTR SQLAPI dbcolsource (PDBPROCESS, INT); +extern INT SQLAPI dbcoltype (PDBPROCESS, INT); +extern DBINT SQLAPI dbcolutype (PDBPROCESS, INT); +extern INT SQLAPI dbconvert (PDBPROCESS, INT, LPCBYTE, DBINT, INT, LPBYTE, DBINT); +extern DBINT SQLAPI dbcount (PDBPROCESS); +extern INT SQLAPI dbcurcmd (PDBPROCESS); +extern DBINT SQLAPI dbcurrow (PDBPROCESS); +extern RETCODE SQLAPI dbcursor (PDBCURSOR, INT, INT, LPCSTR, LPCSTR); +extern RETCODE SQLAPI dbcursorbind (PDBCURSOR, INT, INT, DBINT, LPDBINT, LPBYTE); +extern RETCODE SQLAPI dbcursorclose (PDBHANDLE); +extern RETCODE SQLAPI dbcursorcolinfo (PDBCURSOR, INT, LPSTR, LPINT, LPDBINT, LPINT); +extern RETCODE SQLAPI dbcursorfetch (PDBCURSOR, INT, INT); +extern RETCODE SQLAPI dbcursorfetchex (PDBCURSOR, INT, DBINT, DBINT, DBINT); +extern RETCODE SQLAPI dbcursorinfo (PDBCURSOR, LPINT, LPDBINT); +extern RETCODE SQLAPI dbcursorinfoex (PDBCURSOR, LPDBCURSORINFO); +extern PDBCURSOR SQLAPI dbcursoropen (PDBPROCESS, LPCSTR, INT, INT,UINT, LPDBINT); +extern LPCBYTE SQLAPI dbdata (PDBPROCESS, INT); +extern BOOL SQLAPI dbdataready (PDBPROCESS); +extern RETCODE SQLAPI dbdatecrack (PDBPROCESS, LPDBDATEREC, LPCDBDATETIME); +extern DBINT SQLAPI dbdatlen (PDBPROCESS, INT); +extern BOOL SQLAPI dbdead (PDBPROCESS); +extern void SQLAPI dbexit (void); +extern RETCODE SQLAPI dbenlisttrans(PDBPROCESS, LPVOID); +extern RETCODE SQLAPI dbenlistxatrans(PDBPROCESS, BOOL); +extern RETCODE SQLAPI dbfcmd (PDBPROCESS, LPCSTR, ...); +extern DBINT SQLAPI dbfirstrow (PDBPROCESS); +extern void SQLAPI dbfreebuf (PDBPROCESS); +extern void SQLAPI dbfreelogin (PLOGINREC); +extern void SQLAPI dbfreequal (LPCSTR); +extern LPSTR SQLAPI dbgetchar (PDBPROCESS, INT); +extern SHORT SQLAPI dbgetmaxprocs (void); +extern INT SQLAPI dbgetoff (PDBPROCESS, DBUSMALLINT, INT); +extern UINT SQLAPI dbgetpacket (PDBPROCESS); +extern STATUS SQLAPI dbgetrow (PDBPROCESS, DBINT); +extern INT SQLAPI dbgettime (void); +extern LPVOID SQLAPI dbgetuserdata (PDBPROCESS); +extern BOOL SQLAPI dbhasretstat (PDBPROCESS); +extern LPCSTR SQLAPI dbinit (void); +extern BOOL SQLAPI dbisavail (PDBPROCESS); +extern BOOL SQLAPI dbiscount (PDBPROCESS); +extern BOOL SQLAPI dbisopt (PDBPROCESS, INT, LPCSTR); +extern DBINT SQLAPI dblastrow (PDBPROCESS); +extern PLOGINREC SQLAPI dblogin (void); +extern RETCODE SQLAPI dbmorecmds (PDBPROCESS); +extern RETCODE SQLAPI dbmoretext (PDBPROCESS, DBINT, LPCBYTE); +extern LPCSTR SQLAPI dbname (PDBPROCESS); +extern STATUS SQLAPI dbnextrow (PDBPROCESS); +extern RETCODE SQLAPI dbnullbind (PDBPROCESS, INT, LPCDBINT); +extern INT SQLAPI dbnumalts (PDBPROCESS, INT); +extern INT SQLAPI dbnumcols (PDBPROCESS); +extern INT SQLAPI dbnumcompute (PDBPROCESS); +extern INT SQLAPI dbnumorders (PDBPROCESS); +extern INT SQLAPI dbnumrets (PDBPROCESS); +extern PDBPROCESS SQLAPI dbopen (PLOGINREC, LPCSTR); +extern INT SQLAPI dbordercol (PDBPROCESS, INT); +extern RETCODE SQLAPI dbprocinfo (PDBPROCESS, LPDBPROCINFO); +extern void SQLAPI dbprhead (PDBPROCESS); +extern RETCODE SQLAPI dbprrow (PDBPROCESS); +extern LPCSTR SQLAPI dbprtype (INT); +extern LPCSTR SQLAPI dbqual (PDBPROCESS, INT, LPCSTR); +extern DBINT SQLAPI dbreadpage (PDBPROCESS, LPCSTR, DBINT, LPBYTE); +extern DBINT SQLAPI dbreadtext (PDBPROCESS, LPVOID, DBINT); +extern RETCODE SQLAPI dbresults (PDBPROCESS); +extern LPCBYTE SQLAPI dbretdata (PDBPROCESS, INT); +extern DBINT SQLAPI dbretlen (PDBPROCESS, INT); +extern LPCSTR SQLAPI dbretname (PDBPROCESS, INT); +extern DBINT SQLAPI dbretstatus (PDBPROCESS); +extern INT SQLAPI dbrettype (PDBPROCESS, INT); +extern RETCODE SQLAPI dbrows (PDBPROCESS); +extern STATUS SQLAPI dbrowtype (PDBPROCESS); +extern RETCODE SQLAPI dbrpcinit (PDBPROCESS, LPCSTR, DBSMALLINT); +extern RETCODE SQLAPI dbrpcparam (PDBPROCESS, LPCSTR, BYTE, INT, DBINT, DBINT, LPCBYTE); +extern RETCODE SQLAPI dbrpcsend (PDBPROCESS); +extern RETCODE SQLAPI dbrpcexec (PDBPROCESS); +extern void SQLAPI dbrpwclr (PLOGINREC); +extern RETCODE SQLAPI dbrpwset (PLOGINREC, LPCSTR, LPCSTR, INT); +extern INT SQLAPI dbserverenum (USHORT, LPSTR, USHORT, LPUSHORT); +extern void SQLAPI dbsetavail (PDBPROCESS); +extern RETCODE SQLAPI dbsetmaxprocs (SHORT); +extern RETCODE SQLAPI dbsetlname (PLOGINREC, LPCSTR, INT); +extern RETCODE SQLAPI dbsetlogintime (INT); +extern RETCODE SQLAPI dbsetlpacket (PLOGINREC, USHORT); +extern RETCODE SQLAPI dbsetnull (PDBPROCESS, INT, INT, LPCBYTE); +extern RETCODE SQLAPI dbsetopt (PDBPROCESS, INT, LPCSTR); +extern RETCODE SQLAPI dbsettime (INT); +extern void SQLAPI dbsetuserdata (PDBPROCESS, LPVOID); +extern RETCODE SQLAPI dbsqlexec (PDBPROCESS); +extern RETCODE SQLAPI dbsqlok (PDBPROCESS); +extern RETCODE SQLAPI dbsqlsend (PDBPROCESS); +extern RETCODE SQLAPI dbstrcpy (PDBPROCESS, INT, INT, LPSTR); +extern INT SQLAPI dbstrlen (PDBPROCESS); +extern BOOL SQLAPI dbtabbrowse (PDBPROCESS, INT); +extern INT SQLAPI dbtabcount (PDBPROCESS); +extern LPCSTR SQLAPI dbtabname (PDBPROCESS, INT); +extern LPCSTR SQLAPI dbtabsource (PDBPROCESS, INT, LPINT); +extern INT SQLAPI dbtsnewlen (PDBPROCESS); +extern LPCDBBINARY SQLAPI dbtsnewval (PDBPROCESS); +extern RETCODE SQLAPI dbtsput (PDBPROCESS, LPCDBBINARY, INT, INT, LPCSTR); +extern LPCDBBINARY SQLAPI dbtxptr (PDBPROCESS, INT); +extern LPCDBBINARY SQLAPI dbtxtimestamp (PDBPROCESS, INT); +extern LPCDBBINARY SQLAPI dbtxtsnewval (PDBPROCESS); +extern RETCODE SQLAPI dbtxtsput (PDBPROCESS, LPCDBBINARY, INT); +extern RETCODE SQLAPI dbuse (PDBPROCESS, LPCSTR); +extern BOOL SQLAPI dbvarylen (PDBPROCESS, INT); +extern BOOL SQLAPI dbwillconvert (INT, INT); +extern RETCODE SQLAPI dbwritepage (PDBPROCESS, LPCSTR, DBINT, DBINT, LPBYTE); +extern RETCODE SQLAPI dbwritetext (PDBPROCESS, LPCSTR, LPCDBBINARY, DBTINYINT, LPCDBBINARY, BOOL, DBINT, LPCBYTE); +extern RETCODE SQLAPI dbupdatetext(PDBPROCESS, LPCSTR, LPCDBBINARY, LPCDBBINARY, INT, DBINT, DBINT, LPCSTR, DBINT, LPCDBBINARY); + +#ifdef __cplusplus +} +#endif + +#endif // _INC_SQLDB diff --git a/libraries/SQLAPI/include/ss_win/sqlfront.h b/libraries/SQLAPI/include/ss_win/sqlfront.h new file mode 100644 index 000000000..e804da972 --- /dev/null +++ b/libraries/SQLAPI/include/ss_win/sqlfront.h @@ -0,0 +1,795 @@ +#ifndef _INC_SQLFRONT +#define _INC_SQLFRONT + +#ifdef DBNTWIN32 + #ifndef _WINDOWS_ + #pragma message (__FILE__ " : db-library error: windows.h must be included before sqlfront.h.") + #endif +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/***************************************************************************** +* * +* SQLFRONT.H - DB-Library header file for the Microsoft SQL Server. * +* * +* Copyright (c) 1989 - 1995 by Microsoft Corp. All rights reserved. * +* * +* All constant and macro definitions for DB-Library applications programming * +* are contained in this file. This file must be included before SQLDB.H and * +* one of the following #defines must be made, depending on the operating * +* system: DBMSDOS, DBMSWIN or DBNTWIN32. * +* * +*****************************************************************************/ + + +/***************************************************************************** +* Datatype definitions * +*****************************************************************************/ + +// Note this has changed because Windows 3.1 defines API as 'pascal far' + +#if !defined(M_I86SM) && !defined(DBNTWIN32) +#define SQLAPI cdecl far +#else +#define SQLAPI _cdecl +#endif + +#ifndef API +#define API SQLAPI +#endif + +#ifndef DOUBLE +typedef double DOUBLE; +#endif + + +/***************************************************************************** +* DBPROCESS, LOGINREC and DBCURSOR * +*****************************************************************************/ + +#define DBPROCESS void // dbprocess structure type +#define LOGINREC void // login record type +#define DBCURSOR void // cursor record type +#define DBHANDLE void // generic handle + +// DOS Specific +#ifdef DBMSDOS +typedef DBPROCESS * PDBPROCESS; +typedef LOGINREC * PLOGINREC; +typedef DBCURSOR * PDBCURSOR; +typedef DBHANDLE * PDBHANDLE; +#define PTR * +#endif + + +// WIN 3.x Specific. The handle pointers are near for Windows 3.x +#ifdef DBMSWIN +typedef DBPROCESS near * PDBPROCESS; +typedef LOGINREC near * PLOGINREC; +typedef DBCURSOR near * PDBCURSOR; +typedef DBHANDLE near * PDBHANDLE; +#define PTR far * +#endif + + +// Windows NT Specific +#ifdef DBNTWIN32 +typedef DBPROCESS * PDBPROCESS; +typedef LOGINREC * PLOGINREC; +typedef DBCURSOR * PDBCURSOR; +typedef DBHANDLE * PDBHANDLE; +#define PTR * +typedef int (SQLAPI *SQLFARPROC)(); +#else +typedef long (far pascal *LGFARPROC)(); // Windows loadable driver fp +#endif + + +/***************************************************************************** +* Win32 compatibility datatype definitions * +* Note: The following datatypes are provided for Win32 compatibility. * +* Since some of the datatypes are already defined in unrelated include files * +* there may definition duplication. Every attempt has been made to check * +* for such problems. * +*****************************************************************************/ + +#ifndef DBNTWIN32 + +#ifndef SHORT +typedef short SHORT; +#endif + +#ifndef INT +typedef int INT; +#endif + +#ifndef UINT +typedef unsigned int UINT; +#endif + +#ifndef USHORT +typedef unsigned short USHORT; +#endif + +#ifndef ULONG +typedef unsigned long ULONG; +#endif + +#ifndef CHAR +typedef char CHAR; +#endif + +#ifndef LPINT +typedef INT PTR LPINT; +#endif + +typedef unsigned char BYTE; + +typedef CHAR PTR LPSTR; +typedef BYTE PTR LPBYTE; +typedef void PTR LPVOID; +typedef const CHAR PTR LPCSTR; + +typedef int BOOL; + +#endif + + +/***************************************************************************** +* DB-Library datatype definitions * +*****************************************************************************/ + +#define DBMAXCHAR 256 // Max length of DBVARBINARY and DBVARCHAR, etc. + +#ifndef DBTYPEDEFS // srv.h (Open Server include) not already included + +#define DBTYPEDEFS + +#define RETCODE INT +#define STATUS INT + +// DB-Library datatypes +typedef char DBCHAR; +typedef unsigned char DBBINARY; +typedef unsigned char DBTINYINT; +typedef short DBSMALLINT; +typedef unsigned short DBUSMALLINT; +typedef long DBINT; +typedef double DBFLT8; +typedef unsigned char DBBIT; +typedef unsigned char DBBOOL; +typedef float DBFLT4; +typedef long DBMONEY4; + +typedef DBFLT4 DBREAL; +typedef UINT DBUBOOL; + +typedef struct dbdatetime4 +{ + USHORT numdays; // No of days since Jan-1-1900 + USHORT nummins; // No. of minutes since midnight +} DBDATETIM4; + + +typedef struct dbvarychar +{ + DBSMALLINT len; + DBCHAR str[DBMAXCHAR]; +} DBVARYCHAR; + +typedef struct dbvarybin +{ + DBSMALLINT len; + BYTE array[DBMAXCHAR]; +} DBVARYBIN; + +typedef struct dbmoney +{ + DBINT mnyhigh; + ULONG mnylow; +} DBMONEY; + +typedef struct dbdatetime +{ + DBINT dtdays; + ULONG dttime; +} DBDATETIME; + +// DBDATEREC structure used by dbdatecrack +typedef struct dbdaterec +{ + INT year; // 1753 - 9999 + INT quarter; // 1 - 4 + INT month; // 1 - 12 + INT dayofyear; // 1 - 366 + INT day; // 1 - 31 + INT week; // 1 - 54 (for leap years) + INT weekday; // 1 - 7 (Mon - Sun) + INT hour; // 0 - 23 + INT minute; // 0 - 59 + INT second; // 0 - 59 + INT millisecond; // 0 - 999 +} DBDATEREC; + +#define MAXNUMERICLEN 16 +#define MAXNUMERICDIG 38 + +#define DEFAULTPRECISION 18 +#define DEFAULTSCALE 0 + +typedef struct dbnumeric +{ + BYTE precision; + BYTE scale; + BYTE sign; // 1 = Positive, 0 = Negative + BYTE val[MAXNUMERICLEN]; +} DBNUMERIC; + +typedef DBNUMERIC DBDECIMAL; + + +// Pack the following structures on a word boundary +#ifdef __BORLANDC__ +#pragma option -a2 +#else + #ifndef DBLIB_SKIP_PRAGMA_PACK // Define this if your compiler does not support #pragma pack() + #pragma pack(2) + #endif +#endif + +#define MAXCOLNAMELEN 30 +#define MAXTABLENAME 30 + +typedef struct +{ + DBINT SizeOfStruct; + CHAR Name[MAXCOLNAMELEN+1]; + CHAR ActualName[MAXCOLNAMELEN+1]; + CHAR TableName[MAXTABLENAME+1]; + SHORT Type; + DBINT UserType; + DBINT MaxLength; + BYTE Precision; + BYTE Scale; + BOOL VarLength; // TRUE, FALSE + BYTE Null; // TRUE, FALSE or DBUNKNOWN + BYTE CaseSensitive; // TRUE, FALSE or DBUNKNOWN + BYTE Updatable; // TRUE, FALSE or DBUNKNOWN + BOOL Identity; // TRUE, FALSE +} DBCOL, PTR LPDBCOL; + + +#define MAXSERVERNAME 30 +#define MAXNETLIBNAME 255 +#define MAXNETLIBCONNSTR 255 + +typedef struct +{ + DBINT SizeOfStruct; + BYTE ServerType; + USHORT ServerMajor; + USHORT ServerMinor; + USHORT ServerRevision; + CHAR ServerName[MAXSERVERNAME+1]; + CHAR NetLibName[MAXNETLIBNAME+1]; + CHAR NetLibConnStr[MAXNETLIBCONNSTR+1]; +} DBPROCINFO, PTR LPDBPROCINFO; + +typedef struct +{ + DBINT SizeOfStruct; // Use sizeof(DBCURSORINFO) + ULONG TotCols; // Total Columns in cursor + ULONG TotRows; // Total Rows in cursor + ULONG CurRow; // Current actual row in server + ULONG TotRowsFetched; // Total rows actually fetched + ULONG Type; // See CU_... + ULONG Status; // See CU_... +} DBCURSORINFO, PTR LPDBCURSORINFO; + +#define INVALID_UROWNUM ((ULONG)(-1)) + +// Reset default alignment +#ifdef __BORLANDC__ +#pragma option -a- +#else + #ifndef DBLIB_SKIP_PRAGMA_PACK // Define this if your compiler does not support #pragma pack() + #pragma pack() + #endif +#endif + + +#endif // End DBTYPEDEFS + + +/***************************************************************************** +* Pointer Datatypes * +*****************************************************************************/ + +typedef const LPINT LPCINT; +typedef const LPBYTE LPCBYTE ; +typedef USHORT PTR LPUSHORT; +typedef const LPUSHORT LPCUSHORT; +typedef DBINT PTR LPDBINT; +typedef const LPDBINT LPCDBINT; +typedef DBBINARY PTR LPDBBINARY; +typedef const LPDBBINARY LPCDBBINARY; +typedef DBDATEREC PTR LPDBDATEREC; +typedef const LPDBDATEREC LPCDBDATEREC; +typedef DBDATETIME PTR LPDBDATETIME; +typedef const LPDBDATETIME LPCDBDATETIME; + + +/***************************************************************************** +* General #defines * +*****************************************************************************/ + +#define TIMEOUT_IGNORE (ULONG)-1 +#define TIMEOUT_INFINITE (ULONG)0 +#define TIMEOUT_MAXIMUM (ULONG)1200 // 20 minutes maximum timeout value + +// Used for ServerType in dbgetprocinfo +#define SERVTYPE_UNKNOWN 0 +#define SERVTYPE_MICROSOFT 1 + +// Used by dbcolinfo +enum CI_TYPES { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 }; + +// Bulk Copy Definitions (bcp) +#define DB_IN 1 // Transfer from client to server +#define DB_OUT 2 // Transfer from server to client + +#define BCPMAXERRS 1 // bcp_control parameter +#define BCPFIRST 2 // bcp_control parameter +#define BCPLAST 3 // bcp_control parameter +#define BCPBATCH 4 // bcp_control parameter +#define BCPKEEPNULLS 5 // bcp_control parameter +#define BCPABORT 6 // bcp_control parameter + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#define TINYBIND 1 +#define SMALLBIND 2 +#define INTBIND 3 +#define CHARBIND 4 +#define BINARYBIND 5 +#define BITBIND 6 +#define DATETIMEBIND 7 +#define MONEYBIND 8 +#define FLT8BIND 9 +#define STRINGBIND 10 +#define NTBSTRINGBIND 11 +#define VARYCHARBIND 12 +#define VARYBINBIND 13 +#define FLT4BIND 14 +#define SMALLMONEYBIND 15 +#define SMALLDATETIBIND 16 +#define DECIMALBIND 17 +#define NUMERICBIND 18 +#define SRCDECIMALBIND 19 +#define SRCNUMERICBIND 20 +#define MAXBIND SRCNUMERICBIND + +#define DBSAVE 1 +#define DBNOSAVE 0 + +#define DBNOERR -1 +#define DBFINDONE 0x04 // Definately done +#define DBMORE 0x10 // Maybe more commands waiting +#define DBMORE_ROWS 0x20 // This command returned rows + +#define MAXNAME 31 + + +#define DBTXTSLEN 8 // Timestamp length + +#define DBTXPLEN 16 // Text pointer length + +// Error code returns +#define INT_EXIT 0 +#define INT_CONTINUE 1 +#define INT_CANCEL 2 + + +// dboptions +#define DBBUFFER 0 +#define DBOFFSET 1 +#define DBROWCOUNT 2 +#define DBSTAT 3 +#define DBTEXTLIMIT 4 +#define DBTEXTSIZE 5 +#define DBARITHABORT 6 +#define DBARITHIGNORE 7 +#define DBNOAUTOFREE 8 +#define DBNOCOUNT 9 +#define DBNOEXEC 10 +#define DBPARSEONLY 11 +#define DBSHOWPLAN 12 +#define DBSTORPROCID 13 + +#if defined(DBMSWIN) || defined(DBNTWIN32) +#define DBANSItoOEM 14 +#endif + +#ifdef DBNTWIN32 +#define DBOEMtoANSI 15 +#endif + +#define DBCLIENTCURSORS 16 +#define DBSETTIME 17 +#define DBQUOTEDIDENT 18 + + +// Data Type Tokens +#define SQLVOID 0x1f +#define SQLTEXT 0x23 +#define SQLVARBINARY 0x25 +#define SQLINTN 0x26 +#define SQLVARCHAR 0x27 +#define SQLBINARY 0x2d +#define SQLIMAGE 0x22 +#define SQLCHAR 0x2f +#define SQLINT1 0x30 +#define SQLBIT 0x32 +#define SQLINT2 0x34 +#define SQLINT4 0x38 +#define SQLMONEY 0x3c +#define SQLDATETIME 0x3d +#define SQLFLT8 0x3e +#define SQLFLTN 0x6d +#define SQLMONEYN 0x6e +#define SQLDATETIMN 0x6f +#define SQLFLT4 0x3b +#define SQLMONEY4 0x7a +#define SQLDATETIM4 0x3a +#define SQLDECIMAL 0x6a +#define SQLNUMERIC 0x6c + +// Data stream tokens +#define SQLCOLFMT 0xa1 +#define OLD_SQLCOLFMT 0x2a +#define SQLPROCID 0x7c +#define SQLCOLNAME 0xa0 +#define SQLTABNAME 0xa4 +#define SQLCOLINFO 0xa5 +#define SQLALTNAME 0xa7 +#define SQLALTFMT 0xa8 +#define SQLERROR 0xaa +#define SQLINFO 0xab +#define SQLRETURNVALUE 0xac +#define SQLRETURNSTATUS 0x79 +#define SQLRETURN 0xdb +#define SQLCONTROL 0xae +#define SQLALTCONTROL 0xaf +#define SQLROW 0xd1 +#define SQLALTROW 0xd3 +#define SQLDONE 0xfd +#define SQLDONEPROC 0xfe +#define SQLDONEINPROC 0xff +#define SQLOFFSET 0x78 +#define SQLORDER 0xa9 +#define SQLLOGINACK 0xad // NOTICE: change to real value + +// Ag op tokens +#define SQLAOPCNT 0x4b +#define SQLAOPSUM 0x4d +#define SQLAOPAVG 0x4f +#define SQLAOPMIN 0x51 +#define SQLAOPMAX 0x52 +#define SQLAOPANY 0x53 +#define SQLAOPNOOP 0x56 + +// Error numbers (dberrs) DB-Library error codes +#define SQLEMEM 10000 +#define SQLENULL 10001 +#define SQLENLOG 10002 +#define SQLEPWD 10003 +#define SQLECONN 10004 +#define SQLEDDNE 10005 +#define SQLENULLO 10006 +#define SQLESMSG 10007 +#define SQLEBTOK 10008 +#define SQLENSPE 10009 +#define SQLEREAD 10010 +#define SQLECNOR 10011 +#define SQLETSIT 10012 +#define SQLEPARM 10013 +#define SQLEAUTN 10014 +#define SQLECOFL 10015 +#define SQLERDCN 10016 +#define SQLEICN 10017 +#define SQLECLOS 10018 +#define SQLENTXT 10019 +#define SQLEDNTI 10020 +#define SQLETMTD 10021 +#define SQLEASEC 10022 +#define SQLENTLL 10023 +#define SQLETIME 10024 +#define SQLEWRIT 10025 +#define SQLEMODE 10026 +#define SQLEOOB 10027 +#define SQLEITIM 10028 +#define SQLEDBPS 10029 +#define SQLEIOPT 10030 +#define SQLEASNL 10031 +#define SQLEASUL 10032 +#define SQLENPRM 10033 +#define SQLEDBOP 10034 +#define SQLENSIP 10035 +#define SQLECNULL 10036 +#define SQLESEOF 10037 +#define SQLERPND 10038 +#define SQLECSYN 10039 +#define SQLENONET 10040 +#define SQLEBTYP 10041 +#define SQLEABNC 10042 +#define SQLEABMT 10043 +#define SQLEABNP 10044 +#define SQLEBNCR 10045 +#define SQLEAAMT 10046 +#define SQLENXID 10047 +#define SQLEIFNB 10048 +#define SQLEKBCO 10049 +#define SQLEBBCI 10050 +#define SQLEKBCI 10051 +#define SQLEBCWE 10052 +#define SQLEBCNN 10053 +#define SQLEBCOR 10054 +#define SQLEBCPI 10055 +#define SQLEBCPN 10056 +#define SQLEBCPB 10057 +#define SQLEVDPT 10058 +#define SQLEBIVI 10059 +#define SQLEBCBC 10060 +#define SQLEBCFO 10061 +#define SQLEBCVH 10062 +#define SQLEBCUO 10063 +#define SQLEBUOE 10064 +#define SQLEBWEF 10065 +#define SQLEBTMT 10066 +#define SQLEBEOF 10067 +#define SQLEBCSI 10068 +#define SQLEPNUL 10069 +#define SQLEBSKERR 10070 +#define SQLEBDIO 10071 +#define SQLEBCNT 10072 +#define SQLEMDBP 10073 +#define SQLINIT 10074 +#define SQLCRSINV 10075 +#define SQLCRSCMD 10076 +#define SQLCRSNOIND 10077 +#define SQLCRSDIS 10078 +#define SQLCRSAGR 10079 +#define SQLCRSORD 10080 +#define SQLCRSMEM 10081 +#define SQLCRSBSKEY 10082 +#define SQLCRSNORES 10083 +#define SQLCRSVIEW 10084 +#define SQLCRSBUFR 10085 +#define SQLCRSFROWN 10086 +#define SQLCRSBROL 10087 +#define SQLCRSFRAND 10088 +#define SQLCRSFLAST 10089 +#define SQLCRSRO 10090 +#define SQLCRSTAB 10091 +#define SQLCRSUPDTAB 10092 +#define SQLCRSUPDNB 10093 +#define SQLCRSVIIND 10094 +#define SQLCRSNOUPD 10095 +#define SQLCRSOS2 10096 +#define SQLEBCSA 10097 +#define SQLEBCRO 10098 +#define SQLEBCNE 10099 +#define SQLEBCSK 10100 +#define SQLEUVBF 10101 +#define SQLEBIHC 10102 +#define SQLEBWFF 10103 +#define SQLNUMVAL 10104 +#define SQLEOLDVR 10105 +#define SQLEBCPS 10106 +#define SQLEDTC 10107 +#define SQLENOTIMPL 10108 +#define SQLENONFLOAT 10109 +#define SQLECONNFB 10110 + + +// The severity levels are defined here +#define EXINFO 1 // Informational, non-error +#define EXUSER 2 // User error +#define EXNONFATAL 3 // Non-fatal error +#define EXCONVERSION 4 // Error in DB-LIBRARY data conversion +#define EXSERVER 5 // The Server has returned an error flag +#define EXTIME 6 // We have exceeded our timeout period while + // waiting for a response from the Server - the + // DBPROCESS is still alive +#define EXPROGRAM 7 // Coding error in user program +#define EXRESOURCE 8 // Running out of resources - the DBPROCESS may be dead +#define EXCOMM 9 // Failure in communication with Server - the DBPROCESS is dead +#define EXFATAL 10 // Fatal error - the DBPROCESS is dead +#define EXCONSISTENCY 11 // Internal software error - notify MS Technical Supprt + +// Offset identifiers +#define OFF_SELECT 0x16d +#define OFF_FROM 0x14f +#define OFF_ORDER 0x165 +#define OFF_COMPUTE 0x139 +#define OFF_TABLE 0x173 +#define OFF_PROCEDURE 0x16a +#define OFF_STATEMENT 0x1cb +#define OFF_PARAM 0x1c4 +#define OFF_EXEC 0x12c + +// Print lengths for certain fixed length data types +#define PRINT4 11 +#define PRINT2 6 +#define PRINT1 3 +#define PRFLT8 20 +#define PRMONEY 26 +#define PRBIT 3 +#define PRDATETIME 27 +#define PRDECIMAL (MAXNUMERICDIG + 2) +#define PRNUMERIC (MAXNUMERICDIG + 2) + +#define SUCCEED 1 +#define FAIL 0 +#define SUCCEED_ABORT 2 + +#define DBUNKNOWN 2 + +#define MORE_ROWS -1 +#define NO_MORE_ROWS -2 +#define REG_ROW MORE_ROWS +#define BUF_FULL -3 + +// Status code for dbresults(). Possible return values are +// SUCCEED, FAIL, and NO_MORE_RESULTS. +#define NO_MORE_RESULTS 2 +#define NO_MORE_RPC_RESULTS 3 + +// Macros for dbsetlname() +#define DBSETHOST 1 +#define DBSETUSER 2 +#define DBSETPWD 3 +#define DBSETAPP 4 +#define DBSETID 5 +#define DBSETLANG 6 +#define DBSETSECURE 7 +#define DBVER42 8 +#define DBVER60 9 +#define DBSETLOGINTIME 10 +#define DBSETFALLBACK 12 + +// Standard exit and error values +#define STDEXIT 0 +#define ERREXIT -1 + +// dbrpcinit flags +#define DBRPCRECOMPILE 0x0001 +#define DBRPCRESET 0x0004 +#define DBRPCCURSOR 0x0008 + +// dbrpcparam flags +#define DBRPCRETURN 0x1 +#define DBRPCDEFAULT 0x2 + + +// Cursor related constants + +// Following flags are used in the concuropt parameter in the dbcursoropen function +#define CUR_READONLY 1 // Read only cursor, no data modifications +#define CUR_LOCKCC 2 // Intent to update, all fetched data locked when + // dbcursorfetch is called inside a transaction block +#define CUR_OPTCC 3 // Optimistic concurrency control, data modifications + // succeed only if the row hasn't been updated since + // the last fetch. +#define CUR_OPTCCVAL 4 // Optimistic concurrency control based on selected column values + +// Following flags are used in the scrollopt parameter in dbcursoropen +#define CUR_FORWARD 0 // Forward only scrolling +#define CUR_KEYSET -1 // Keyset driven scrolling +#define CUR_DYNAMIC 1 // Fully dynamic +#define CUR_INSENSITIVE -2 // Server-side cursors only + +// Following flags define the fetchtype in the dbcursorfetch function +#define FETCH_FIRST 1 // Fetch first n rows +#define FETCH_NEXT 2 // Fetch next n rows +#define FETCH_PREV 3 // Fetch previous n rows +#define FETCH_RANDOM 4 // Fetch n rows beginning with given row # +#define FETCH_RELATIVE 5 // Fetch relative to previous fetch row # +#define FETCH_LAST 6 // Fetch the last n rows + +// Following flags define the per row status as filled by dbcursorfetch and/or dbcursorfetchex +#define FTC_EMPTY 0x00 // No row available +#define FTC_SUCCEED 0x01 // Fetch succeeded, (failed if not set) +#define FTC_MISSING 0x02 // The row is missing +#define FTC_ENDOFKEYSET 0x04 // End of the keyset reached +#define FTC_ENDOFRESULTS 0x08 // End of results set reached + +// Following flags define the operator types for the dbcursor function +#define CRS_UPDATE 1 // Update operation +#define CRS_DELETE 2 // Delete operation +#define CRS_INSERT 3 // Insert operation +#define CRS_REFRESH 4 // Refetch given row +#define CRS_LOCKCC 5 // Lock given row + +// Following value can be passed to the dbcursorbind function for NOBIND type +#define NOBIND -2 // Return length and pointer to data + +// Following are values used by DBCURSORINFO's Type parameter +#define CU_CLIENT 0x00000001 +#define CU_SERVER 0x00000002 +#define CU_KEYSET 0x00000004 +#define CU_MIXED 0x00000008 +#define CU_DYNAMIC 0x00000010 +#define CU_FORWARD 0x00000020 +#define CU_INSENSITIVE 0x00000040 +#define CU_READONLY 0x00000080 +#define CU_LOCKCC 0x00000100 +#define CU_OPTCC 0x00000200 +#define CU_OPTCCVAL 0x00000400 + +// Following are values used by DBCURSORINFO's Status parameter +#define CU_FILLING 0x00000001 +#define CU_FILLED 0x00000002 + + +// Following are values used by dbupdatetext's type parameter +#define UT_TEXTPTR 0x0001 +#define UT_TEXT 0x0002 +#define UT_MORETEXT 0x0004 +#define UT_DELETEONLY 0x0008 +#define UT_LOG 0x0010 + + +// The following values are passed to dbserverenum for searching criteria. +#define NET_SEARCH 0x0001 +#define LOC_SEARCH 0x0002 + +// These constants are the possible return values from dbserverenum. +#define ENUM_SUCCESS 0x0000 +#define MORE_DATA 0x0001 +#define NET_NOT_AVAIL 0x0002 +#define OUT_OF_MEMORY 0x0004 +#define NOT_SUPPORTED 0x0008 +#define ENUM_INVALID_PARAM 0x0010 + + +// Netlib Error problem codes. ConnectionError() should return one of +// these as the dblib-mapped problem code, so the corresponding string +// is sent to the dblib app's error handler as dberrstr. Return NE_E_NOMAP +// for a generic DB-Library error string (as in prior versions of dblib). + +#define NE_E_NOMAP 0 // No string; uses dblib default. +#define NE_E_NOMEMORY 1 // Insufficient memory. +#define NE_E_NOACCESS 2 // Access denied. +#define NE_E_CONNBUSY 3 // Connection is busy. +#define NE_E_CONNBROKEN 4 // Connection broken. +#define NE_E_TOOMANYCONN 5 // Connection limit exceeded. +#define NE_E_SERVERNOTFOUND 6 // Specified SQL server not found. +#define NE_E_NETNOTSTARTED 7 // The network has not been started. +#define NE_E_NORESOURCE 8 // Insufficient network resources. +#define NE_E_NETBUSY 9 // Network is busy. +#define NE_E_NONETACCESS 10 // Network access denied. +#define NE_E_GENERAL 11 // General network error. Check your documentation. +#define NE_E_CONNMODE 12 // Incorrect connection mode. +#define NE_E_NAMENOTFOUND 13 // Name not found in directory service. +#define NE_E_INVALIDCONN 14 // Invalid connection. +#define NE_E_NETDATAERR 15 // Error reading or writing network data. +#define NE_E_TOOMANYFILES 16 // Too many open file handles. +#define NE_E_CANTCONNECT 17 // SQL Server does not exist or access denied. + +#define NE_MAX_NETERROR 17 + +#ifdef __cplusplus +} +#endif + +#endif // _INC_SQLFRONT diff --git a/libraries/SQLAPI/include/ss_win/sqlncli.h b/libraries/SQLAPI/include/ss_win/sqlncli.h new file mode 100644 index 000000000..b10e4272b --- /dev/null +++ b/libraries/SQLAPI/include/ss_win/sqlncli.h @@ -0,0 +1,4645 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* Compiler settings for sqlncli.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __sqlncli_h__ +#define __sqlncli_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ICommandWithParameters_FWD_DEFINED__ +#define __ICommandWithParameters_FWD_DEFINED__ +typedef interface ICommandWithParameters ICommandWithParameters; +#endif /* __ICommandWithParameters_FWD_DEFINED__ */ + + +#ifndef __IUMSInitialize_FWD_DEFINED__ +#define __IUMSInitialize_FWD_DEFINED__ +typedef interface IUMSInitialize IUMSInitialize; +#endif /* __IUMSInitialize_FWD_DEFINED__ */ + + +#ifndef __ISQLServerErrorInfo_FWD_DEFINED__ +#define __ISQLServerErrorInfo_FWD_DEFINED__ +typedef interface ISQLServerErrorInfo ISQLServerErrorInfo; +#endif /* __ISQLServerErrorInfo_FWD_DEFINED__ */ + + +#ifndef __IRowsetFastLoad_FWD_DEFINED__ +#define __IRowsetFastLoad_FWD_DEFINED__ +typedef interface IRowsetFastLoad IRowsetFastLoad; +#endif /* __IRowsetFastLoad_FWD_DEFINED__ */ + + +#ifndef __ISchemaLock_FWD_DEFINED__ +#define __ISchemaLock_FWD_DEFINED__ +typedef interface ISchemaLock ISchemaLock; +#endif /* __ISchemaLock_FWD_DEFINED__ */ + + +#ifndef __IBCPSession_FWD_DEFINED__ +#define __IBCPSession_FWD_DEFINED__ +typedef interface IBCPSession IBCPSession; +#endif /* __IBCPSession_FWD_DEFINED__ */ + + +#ifndef __IBCPSession2_FWD_DEFINED__ +#define __IBCPSession2_FWD_DEFINED__ +typedef interface IBCPSession2 IBCPSession2; +#endif /* __IBCPSession2_FWD_DEFINED__ */ + + +#ifndef __ISSAbort_FWD_DEFINED__ +#define __ISSAbort_FWD_DEFINED__ +typedef interface ISSAbort ISSAbort; +#endif /* __ISSAbort_FWD_DEFINED__ */ + + +#ifndef __ISSCommandWithParameters_FWD_DEFINED__ +#define __ISSCommandWithParameters_FWD_DEFINED__ +typedef interface ISSCommandWithParameters ISSCommandWithParameters; +#endif /* __ISSCommandWithParameters_FWD_DEFINED__ */ + + +#ifndef __IDBAsynchStatus_FWD_DEFINED__ +#define __IDBAsynchStatus_FWD_DEFINED__ +typedef interface IDBAsynchStatus IDBAsynchStatus; +#endif /* __IDBAsynchStatus_FWD_DEFINED__ */ + + +#ifndef __ISSAsynchStatus_FWD_DEFINED__ +#define __ISSAsynchStatus_FWD_DEFINED__ +typedef interface ISSAsynchStatus ISSAsynchStatus; +#endif /* __ISSAsynchStatus_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "unknwn.h" +#include "oaidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_sqlncli_0000_0000 */ +/* [local] */ + +//----------------------------------------------------------------------------- +// File: sqlncli.h +// +// Copyright: Copyright (c) Microsoft Corporation +// +// Contents: SQL Server Native Client OLEDB provider and ODBC driver specific +// definitions. +// +//----------------------------------------------------------------------------- + +#if !defined(SQLNCLI_VER) +#define SQLNCLI_VER 1100 +#endif + +#if SQLNCLI_VER >= 1100 + +#define SQLNCLI_PRODUCT_NAME_FULL_VER_ANSI "Microsoft SQL Server Native Client 11.0" +#define SQLNCLI_PRODUCT_NAME_FULL_ANSI "Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_VER_ANSI "SQL Server Native Client 11.0" +#define SQLNCLI_PRODUCT_NAME_SHORT_ANSI "SQL Server Native Client" + +#define SQLNCLI_FILE_NAME_ANSI "sqlncli" +#define SQLNCLI_FILE_NAME_VER_ANSI "sqlncli11" +#define SQLNCLI_FILE_NAME_FULL_ANSI "sqlncli11.dll" + +#define SQLNCLI_PRODUCT_NAME_FULL_VER_UNICODE L"Microsoft SQL Server Native Client 11.0" +#define SQLNCLI_PRODUCT_NAME_FULL_UNICODE L"Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_VER_UNICODE L"SQL Server Native Client 11.0" +#define SQLNCLI_PRODUCT_NAME_SHORT_UNICODE L"SQL Server Native Client" + +#define SQLNCLI_FILE_NAME_UNICODE L"sqlncli" +#define SQLNCLI_FILE_NAME_VER_UNICODE L"sqlncli11" +#define SQLNCLI_FILE_NAME_FULL_UNICODE L"sqlncli11.dll" + +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#define SQLNCLI_VI_PROG_ID_ANSI "SQLNCLI11" +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_ANSI "SQLNCLI11.ErrorLookup" +#define SQLNCLI_VI_ENUMERATOR_PROG_ID_ANSI "SQLNCLI11.Enumerator" + +#define SQLNCLI_PROG_ID_ANSI "SQLNCLI11.1" +#define SQLNCLI_ERROR_LOOKUP_PROG_ID_ANSI "SQLNCLI11.ErrorLookup.1" +#define SQLNCLI_ENUMERATOR_PROG_ID_ANSI "SQLNCLI11.Enumerator.1" + +#define SQLNCLI_VI_PROG_ID_UNICODE L"SQLNCLI11" +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_UNICODE L"SQLNCLI11.ErrorLookup" +#define SQLNCLI_VI_ENUMERATOR_PROG_ID_UNICODE L"SQLNCLI11.Enumerator" + +#define SQLNCLI_PROG_ID_UNICODE L"SQLNCLI11.1" +#define SQLNCLI_ERROR_LOOKUP_PROG_ID_UNICODE L"SQLNCLI11.ErrorLookup.1" +#define SQLNCLI_ENUMERATOR_PROG_ID_UNICODE L"SQLNCLI11.Enumerator.1" + +#define SQLNCLI_CLSID CLSID_SQLNCLI11 +#define SQLNCLI_ERROR_CLSID CLSID_SQLNCLI11_ERROR +#define SQLNCLI_ENUMERATOR_CLSID CLSID_SQLNCLI11_ENUMERATOR + +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#elif SQLNCLI_VER >= 1000 + +#define SQLNCLI_PRODUCT_NAME_FULL_VER_ANSI "Microsoft SQL Server Native Client 10.0" +#define SQLNCLI_PRODUCT_NAME_FULL_ANSI "Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_VER_ANSI "SQL Server Native Client 10.0" +#define SQLNCLI_PRODUCT_NAME_SHORT_ANSI "SQL Server Native Client" + +#define SQLNCLI_FILE_NAME_ANSI "sqlncli" +#define SQLNCLI_FILE_NAME_VER_ANSI "sqlncli10" +#define SQLNCLI_FILE_NAME_FULL_ANSI "sqlncli10.dll" + +#define SQLNCLI_PRODUCT_NAME_FULL_VER_UNICODE L"Microsoft SQL Server Native Client 10.0" +#define SQLNCLI_PRODUCT_NAME_FULL_UNICODE L"Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_VER_UNICODE L"SQL Server Native Client 10.0" +#define SQLNCLI_PRODUCT_NAME_SHORT_UNICODE L"SQL Server Native Client" + +#define SQLNCLI_FILE_NAME_UNICODE L"sqlncli" +#define SQLNCLI_FILE_NAME_VER_UNICODE L"sqlncli10" +#define SQLNCLI_FILE_NAME_FULL_UNICODE L"sqlncli10.dll" + +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#define SQLNCLI_VI_PROG_ID_ANSI "SQLNCLI10" +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_ANSI "SQLNCLI10 ErrorLookup" +#define SQLNCLI_VI_ENUMERATOR_PROG_ID_ANSI "SQLNCLI10 Enumerator" + +#define SQLNCLI_PROG_ID_ANSI "SQLNCLI10.1" +#define SQLNCLI_ERROR_LOOKUP_PROG_ID_ANSI "SQLNCLI10 ErrorLookup.1" +#define SQLNCLI_ENUMERATOR_PROG_ID_ANSI "SQLNCLI10 Enumerator.1" + +#define SQLNCLI_VI_PROG_ID_UNICODE L"SQLNCLI10" +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_UNICODE L"SQLNCLI10 ErrorLookup" +#define SQLNCLI_VI_ENUMERATOR_PROG_ID_UNICODE L"SQLNCLI10 Enumerator" + +#define SQLNCLI_PROG_ID_UNICODE L"SQLNCLI10.1" +#define SQLNCLI_ERROR_LOOKUP_PROG_ID_UNICODE L"SQLNCLI10 ErrorLookup.1" +#define SQLNCLI_ENUMERATOR_PROG_ID_UNICODE L"SQLNCLI10 Enumerator.1" + +#define SQLNCLI_CLSID CLSID_SQLNCLI10 +#define SQLNCLI_ERROR_CLSID CLSID_SQLNCLI10_ERROR +#define SQLNCLI_ENUMERATOR_CLSID CLSID_SQLNCLI10_ENUMERATOR + +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#else + +#define SQLNCLI_PRODUCT_NAME_FULL_VER_ANSI "Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_FULL_ANSI "Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_VER_ANSI "SQL Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_ANSI "SQL Native Client" + +#define SQLNCLI_FILE_NAME_ANSI "sqlncli" +#define SQLNCLI_FILE_NAME_VER_ANSI "sqlncli" +#define SQLNCLI_FILE_NAME_FULL_ANSI "sqlncli.dll" + +#define SQLNCLI_PRODUCT_NAME_FULL_VER_UNICODE L"Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_FULL_UNICODE L"Microsoft SQL Server Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_VER_UNICODE L"SQL Native Client" +#define SQLNCLI_PRODUCT_NAME_SHORT_UNICODE L"SQL Native Client" + +#define SQLNCLI_FILE_NAME_UNICODE L"sqlncli" +#define SQLNCLI_FILE_NAME_VER_UNICODE L"sqlncli" +#define SQLNCLI_FILE_NAME_FULL_UNICODE L"sqlncli.dll" + +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#define SQLNCLI_VI_PROG_ID_ANSI "SQLNCLI" +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_ANSI "SQLNCLI ErrorLookup" +#define SQLNCLI_VI_ENUMERATOR_PROG_ID_ANSI "SQLNCLI Enumerator" + +#define SQLNCLI_PROG_ID_ANSI "SQLNCLI.1" +#define SQLNCLI_ERROR_LOOKUP_PROG_ID_ANSI "SQLNCLI ErrorLookup.1" +#define SQLNCLI_ENUMERATOR_PROG_ID_ANSI "SQLNCLI Enumerator.1" + +#define SQLNCLI_VI_PROG_ID_UNICODE L"SQLNCLI" +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_UNICODE L"SQLNCLI ErrorLookup" +#define SQLNCLI_VI_ENUMERATOR_PROG_ID_UNICODE L"SQLNCLI Enumerator" + +#define SQLNCLI_PROG_ID_UNICODE L"SQLNCLI.1" +#define SQLNCLI_ERROR_LOOKUP_PROG_ID_UNICODE L"SQLNCLI ErrorLookup.1" +#define SQLNCLI_ENUMERATOR_PROG_ID_UNICODE L"SQLNCLI Enumerator.1" + +#define SQLNCLI_CLSID CLSID_SQLNCLI +#define SQLNCLI_ERROR_CLSID CLSID_SQLNCLI_ERROR +#define SQLNCLI_ENUMERATOR_CLSID CLSID_SQLNCLI_ENUMERATOR + +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#endif // SQLNCLI_VER >= 1100 + +// define the character type agnostic constants +#if defined(_UNICODE) || defined(UNICODE) + +#define SQLNCLI_PRODUCT_NAME_FULL_VER SQLNCLI_PRODUCT_NAME_FULL_VER_UNICODE +#define SQLNCLI_PRODUCT_NAME_FULL SQLNCLI_PRODUCT_NAME_FULL_UNICODE +#define SQLNCLI_PRODUCT_NAME_SHORT_VER SQLNCLI_PRODUCT_NAME_SHORT_VER_UNICODE +#define SQLNCLI_PRODUCT_NAME_SHORT SQLNCLI_PRODUCT_NAME_SHORT_UNICODE + +#define SQLNCLI_FILE_NAME SQLNCLI_FILE_NAME_UNICODE +#define SQLNCLI_FILE_NAME_VER SQLNCLI_FILE_NAME_VER_UNICODE +#define SQLNCLI_FILE_NAME_FULL SQLNCLI_FILE_NAME_FULL_UNICODE + +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#define SQLNCLI_VI_PROG_ID SQLNCLI_VI_PROG_ID_UNICODE +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_UNICODE +#define SQLNCLI_VI_ENUMERATOR_PROG_ID SQLNCLI_VI_ENUMERATOR_PROG_ID_UNICODE + +#define SQLNCLI_PROG_ID SQLNCLI_PROG_ID_UNICODE +#define SQLNCLI_ERROR_LOOKUP_PROG_ID SQLNCLI_ERROR_LOOKUP_PROG_ID_UNICODE +#define SQLNCLI_ENUMERATOR_PROG_ID SQLNCLI_ENUMERATOR_PROG_ID_UNICODE + +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#else // _UNICODE || UNICODE + +#define SQLNCLI_PRODUCT_NAME_FULL_VER SQLNCLI_PRODUCT_NAME_FULL_VER_ANSI +#define SQLNCLI_PRODUCT_NAME_FULL SQLNCLI_PRODUCT_NAME_FULL_ANSI +#define SQLNCLI_PRODUCT_NAME_SHORT_VER SQLNCLI_PRODUCT_NAME_SHORT_VER_ANSI +#define SQLNCLI_PRODUCT_NAME_SHORT SQLNCLI_PRODUCT_NAME_SHORT_ANSI + +#define SQLNCLI_FILE_NAME SQLNCLI_FILE_NAME_ANSI +#define SQLNCLI_FILE_NAME_VER SQLNCLI_FILE_NAME_VER_ANSI +#define SQLNCLI_FILE_NAME_FULL SQLNCLI_FILE_NAME_FULL_ANSI + +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#define SQLNCLI_VI_PROG_ID SQLNCLI_VI_PROG_ID_ANSI +#define SQLNCLI_VI_ERROR_LOOKUP_PROG_ID SQLNCLI_VI_ERROR_LOOKUP_PROG_ID_ANSI +#define SQLNCLI_VI_ENUMERATOR_PROG_ID SQLNCLI_VI_ENUMERATOR_PROG_ID_ANSI + +#define SQLNCLI_PROG_ID SQLNCLI_PROG_ID_ANSI +#define SQLNCLI_ERROR_LOOKUP_PROG_ID SQLNCLI_ERROR_LOOKUP_PROG_ID_ANSI +#define SQLNCLI_ENUMERATOR_PROG_ID SQLNCLI_ENUMERATOR_PROG_ID_ANSI + +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +#endif // _UNICODE || UNICODE + +#if defined(_SQLNCLI_ODBC_) || !defined(_SQLNCLI_OLEDB_) + +#define SQLNCLI_DRIVER_NAME SQLNCLI_PRODUCT_NAME_SHORT_VER + +#endif + +// OLEDB part of SQL Server Native Client header - begin here +#if defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) +#ifndef __oledb_h__ +#include +#endif /*__oledb_h__*/ + +#if 0 // This is already defined in oledb.h + +#ifdef _WIN64 + +// Length of a non-character object, size +typedef ULONGLONG DBLENGTH; + +// Offset within a rowset +typedef LONGLONG DBROWOFFSET; + +// Number of rows +typedef LONGLONG DBROWCOUNT; + +typedef ULONGLONG DBCOUNTITEM; + +// Ordinal (column number, etc.) +typedef ULONGLONG DBORDINAL; + +typedef LONGLONG DB_LORDINAL; + +// Bookmarks +typedef ULONGLONG DBBKMARK; +// Offset in the buffer + +typedef ULONGLONG DBBYTEOFFSET; +// Reference count of each row/accessor handle + +typedef ULONG DBREFCOUNT; + +// Parameters +typedef ULONGLONG DB_UPARAMS; + +typedef LONGLONG DB_LPARAMS; + +// hash values corresponding to the elements (bookmarks) +typedef DWORDLONG DBHASHVALUE; + +// For reserve +typedef DWORDLONG DB_DWRESERVE; + +typedef LONGLONG DB_LRESERVE; + +typedef ULONGLONG DB_URESERVE; + +#else //_WIN64 + +// Length of a non-character object, size +typedef ULONG DBLENGTH; + +// Offset within a rowset +typedef LONG DBROWOFFSET; + +// Number of rows +typedef LONG DBROWCOUNT; + +typedef ULONG DBCOUNTITEM; + +// Ordinal (column number, etc.) +typedef ULONG DBORDINAL; + +typedef LONG DB_LORDINAL; + +// Bookmarks +typedef ULONG DBBKMARK; + +// Offset in the buffer +typedef ULONG DBBYTEOFFSET; + +// Reference count of each row handle +typedef ULONG DBREFCOUNT; + +// Parameters +typedef ULONG DB_UPARAMS; + +typedef LONG DB_LPARAMS; + +// hash values corresponding to the elements (bookmarks) +typedef DWORD DBHASHVALUE; + +// For reserve +typedef DWORD DB_DWRESERVE; + +typedef LONG DB_LRESERVE; + +typedef ULONG DB_URESERVE; + +#endif // _WIN64 +typedef DWORD DBKIND; + + +enum DBKINDENUM + { DBKIND_GUID_NAME = 0, + DBKIND_GUID_PROPID = ( DBKIND_GUID_NAME + 1 ) , + DBKIND_NAME = ( DBKIND_GUID_PROPID + 1 ) , + DBKIND_PGUID_NAME = ( DBKIND_NAME + 1 ) , + DBKIND_PGUID_PROPID = ( DBKIND_PGUID_NAME + 1 ) , + DBKIND_PROPID = ( DBKIND_PGUID_PROPID + 1 ) , + DBKIND_GUID = ( DBKIND_PROPID + 1 ) + } ; +typedef struct tagDBID + { + union + { + GUID guid; + GUID *pguid; + /* Empty union arm */ + } uGuid; + DBKIND eKind; + union + { + LPOLESTR pwszName; + ULONG ulPropid; + /* Empty union arm */ + } uName; + } DBID; + +typedef struct tagDB_NUMERIC + { + BYTE precision; + BYTE scale; + BYTE sign; + BYTE val[ 16 ]; + } DB_NUMERIC; + +typedef struct tagDBDATE + { + SHORT year; + USHORT month; + USHORT day; + } DBDATE; + +typedef struct tagDBTIME + { + USHORT hour; + USHORT minute; + USHORT second; + } DBTIME; + +typedef struct tagDBTIMESTAMP + { + SHORT year; + USHORT month; + USHORT day; + USHORT hour; + USHORT minute; + USHORT second; + ULONG fraction; + } DBTIMESTAMP; + +typedef struct tagDBOBJECT + { + DWORD dwFlags; + IID iid; + } DBOBJECT; + +typedef WORD DBTYPE; + +typedef ULONG_PTR HACCESSOR; + +typedef ULONG_PTR HCHAPTER; + +typedef DWORD DBPARAMFLAGS; + +typedef struct tagDBPARAMINFO + { + DBPARAMFLAGS dwFlags; + DBORDINAL iOrdinal; + LPOLESTR pwszName; + ITypeInfo *pTypeInfo; + DBLENGTH ulParamSize; + DBTYPE wType; + BYTE bPrecision; + BYTE bScale; + } DBPARAMINFO; + +typedef DWORD DBPROPID; + +typedef struct tagDBPROPIDSET + { + DBPROPID *rgPropertyIDs; + ULONG cPropertyIDs; + GUID guidPropertySet; + } DBPROPIDSET; + +typedef DWORD DBPROPFLAGS; + +typedef DWORD DBPROPOPTIONS; + +typedef DWORD DBPROPSTATUS; + +typedef struct tagDBPROP + { + DBPROPID dwPropertyID; + DBPROPOPTIONS dwOptions; + DBPROPSTATUS dwStatus; + DBID colid; + VARIANT vValue; + } DBPROP; + +typedef struct tagDBPROPSET + { + DBPROP *rgProperties; + ULONG cProperties; + GUID guidPropertySet; + } DBPROPSET; + + + +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0000_v0_0_s_ifspec; + +#ifndef __ICommandWithParameters_INTERFACE_DEFINED__ +#define __ICommandWithParameters_INTERFACE_DEFINED__ + +/* interface ICommandWithParameters */ +/* [unique][uuid][object][local] */ + +typedef struct tagDBPARAMBINDINFO + { + LPOLESTR pwszDataSourceType; + LPOLESTR pwszName; + DBLENGTH ulParamSize; + DBPARAMFLAGS dwFlags; + BYTE bPrecision; + BYTE bScale; + } DBPARAMBINDINFO; + + +EXTERN_C const IID IID_ICommandWithParameters; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0c733a64-2a1c-11ce-ade5-00aa0044773d") + ICommandWithParameters : public IUnknown + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetParameterInfo( + /* [out][in] */ DB_UPARAMS *pcParams, + /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo, + /* [out] */ OLECHAR **ppNamesBuffer) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE MapParameterNames( + /* [in] */ DB_UPARAMS cParamNames, + /* [size_is][in] */ const OLECHAR *rgParamNames[ ], + /* [size_is][out] */ DB_LPARAMS rgParamOrdinals[ ]) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetParameterInfo( + /* [in] */ DB_UPARAMS cParams, + /* [size_is][unique][in] */ const DB_UPARAMS rgParamOrdinals[ ], + /* [size_is][unique][in] */ const DBPARAMBINDINFO rgParamBindInfo[ ]) = 0; + + }; + +#else /* C style interface */ + + typedef struct ICommandWithParametersVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICommandWithParameters * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICommandWithParameters * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICommandWithParameters * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetParameterInfo )( + ICommandWithParameters * This, + /* [out][in] */ DB_UPARAMS *pcParams, + /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo, + /* [out] */ OLECHAR **ppNamesBuffer); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *MapParameterNames )( + ICommandWithParameters * This, + /* [in] */ DB_UPARAMS cParamNames, + /* [size_is][in] */ const OLECHAR *rgParamNames[ ], + /* [size_is][out] */ DB_LPARAMS rgParamOrdinals[ ]); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetParameterInfo )( + ICommandWithParameters * This, + /* [in] */ DB_UPARAMS cParams, + /* [size_is][unique][in] */ const DB_UPARAMS rgParamOrdinals[ ], + /* [size_is][unique][in] */ const DBPARAMBINDINFO rgParamBindInfo[ ]); + + END_INTERFACE + } ICommandWithParametersVtbl; + + interface ICommandWithParameters + { + CONST_VTBL struct ICommandWithParametersVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICommandWithParameters_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ICommandWithParameters_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ICommandWithParameters_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ICommandWithParameters_GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer) \ + ( (This)->lpVtbl -> GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer) ) + +#define ICommandWithParameters_MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals) \ + ( (This)->lpVtbl -> MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals) ) + +#define ICommandWithParameters_SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo) \ + ( (This)->lpVtbl -> SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [call_as] */ HRESULT STDMETHODCALLTYPE ICommandWithParameters_RemoteGetParameterInfo_Proxy( + ICommandWithParameters * This, + /* [out][in] */ DB_UPARAMS *pcParams, + /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo, + /* [size_is][size_is][out] */ DBBYTEOFFSET **prgNameOffsets, + /* [out][in] */ DBLENGTH *pcbNamesBuffer, + /* [size_is][size_is][unique][out][in] */ OLECHAR **ppNamesBuffer, + /* [out] */ IErrorInfo **ppErrorInfoRem); + + +void __RPC_STUB ICommandWithParameters_RemoteGetParameterInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [call_as] */ HRESULT STDMETHODCALLTYPE ICommandWithParameters_RemoteMapParameterNames_Proxy( + ICommandWithParameters * This, + /* [in] */ DB_UPARAMS cParamNames, + /* [size_is][in] */ LPCOLESTR *rgParamNames, + /* [size_is][out] */ DB_LPARAMS *rgParamOrdinals, + /* [out] */ IErrorInfo **ppErrorInfoRem); + + +void __RPC_STUB ICommandWithParameters_RemoteMapParameterNames_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [call_as] */ HRESULT STDMETHODCALLTYPE ICommandWithParameters_RemoteSetParameterInfo_Proxy( + ICommandWithParameters * This, + /* [in] */ DB_UPARAMS cParams, + /* [size_is][unique][in] */ const DB_UPARAMS *rgParamOrdinals, + /* [size_is][unique][in] */ const DBPARAMBINDINFO *rgParamBindInfo, + /* [out] */ IErrorInfo **ppErrorInfoRem); + + +void __RPC_STUB ICommandWithParameters_RemoteSetParameterInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ICommandWithParameters_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sqlncli_0000_0001 */ +/* [local] */ + +typedef DWORD DBASYNCHOP; + +typedef DWORD DBASYNCHPHASE; + +#endif // This is already defined in oledb.h + +#ifndef _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_ + #define _SQLNCLI_OLEDB_DEPRECATE_WARNING __declspec(deprecated("The SQL Server Native Client OLEDB provider is deprecated and will be removed in a future release of SQL Server Native Client. To disable this warning, define the following symbol in your application: _SQLNCLI_OLEDB_IGNORE_DEPRECATION_WARNING_")) +#else + #define _SQLNCLI_OLEDB_DEPRECATE_WARNING +#endif +//------------------------------------------------------------------- +// Variant Access macros, similar to ole automation. +//------------------------------------------------------------------- +#define V_SS_VT(X) ((X)->vt) +#define V_SS_UNION(X, Y) ((X)->Y) + +#define V_SS_UI1(X) V_SS_UNION(X, bTinyIntVal) +#define V_SS_I2(X) V_SS_UNION(X, sShortIntVal) +#define V_SS_I4(X) V_SS_UNION(X, lIntVal) +#define V_SS_I8(X) V_SS_UNION(X, llBigIntVal) + +#define V_SS_R4(X) V_SS_UNION(X, fltRealVal) +#define V_SS_R8(X) V_SS_UNION(X, dblFloatVal) +#define V_SS_UI4(X) V_SS_UNION(X, ulVal) + +#define V_SS_MONEY(X) V_SS_UNION(X, cyMoneyVal) +#define V_SS_SMALLMONEY(X) V_SS_UNION(X, cyMoneyVal) + +#define V_SS_WSTRING(X) V_SS_UNION(X, NCharVal) +#define V_SS_WVARSTRING(X) V_SS_UNION(X, NCharVal) + +#define V_SS_STRING(X) V_SS_UNION(X, CharVal) +#define V_SS_VARSTRING(X) V_SS_UNION(X, CharVal) + +#define V_SS_BIT(X) V_SS_UNION(X, fBitVal) +#define V_SS_GUID(X) V_SS_UNION(X, rgbGuidVal) + +#define V_SS_NUMERIC(X) V_SS_UNION(X, numNumericVal) +#define V_SS_DECIMAL(X) V_SS_UNION(X, numNumericVal) + +#define V_SS_BINARY(X) V_SS_UNION(X, BinaryVal) +#define V_SS_VARBINARY(X) V_SS_UNION(X, BinaryVal) + +#define V_SS_DATETIME(X) V_SS_UNION(X, tsDateTimeVal) +#define V_SS_SMALLDATETIME(X) V_SS_UNION(X, tsDateTimeVal) + +#define V_SS_UNKNOWN(X) V_SS_UNION(X, UnknownType) + +//Text and image types. +#define V_SS_IMAGE(X) V_SS_UNION(X, ImageVal) +#define V_SS_TEXT(X) V_SS_UNION(X, TextVal) +#define V_SS_NTEXT(X) V_SS_UNION(X, NTextVal) + +//Microsoft SQL Server 2008 datetime. +#define V_SS_DATE(X) V_SS_UNION(X, dDateVal) +#define V_SS_TIME2(X) V_SS_UNION(X, Time2Val) +#define V_SS_DATETIME2(X) V_SS_UNION(X, DateTimeVal) +#define V_SS_DATETIMEOFFSET(X) V_SS_UNION(X, DateTimeOffsetVal) + +//------------------------------------------------------------------- +// define SQL Server specific types. +//------------------------------------------------------------------- +typedef enum DBTYPEENUM EOledbTypes; +#define DBTYPE_XML ((EOledbTypes) 141) // introduced in SQL 2005 +#define DBTYPE_TABLE ((EOledbTypes) 143) // introduced in SQL 2008 +#define DBTYPE_DBTIME2 ((EOledbTypes) 145) // introduced in SQL 2008 +#define DBTYPE_DBTIMESTAMPOFFSET ((EOledbTypes) 146) // introduced in SQL 2008 +#ifdef _SQLOLEDB_H_ +#undef DBTYPE_SQLVARIANT +#endif //_SQLOLEDB_H_ +#define DBTYPE_SQLVARIANT ((EOledbTypes) 144) // introduced in MDAC 2.5 + + +#ifndef _SQLOLEDB_H_ +enum SQLVARENUM + { + VT_SS_EMPTY = DBTYPE_EMPTY, + VT_SS_NULL = DBTYPE_NULL, + VT_SS_UI1 = DBTYPE_UI1, + VT_SS_I2 = DBTYPE_I2, + VT_SS_I4 = DBTYPE_I4, + VT_SS_I8 = DBTYPE_I8, + + //Floats + VT_SS_R4 = DBTYPE_R4, + VT_SS_R8 = DBTYPE_R8, + + //Money + VT_SS_MONEY = DBTYPE_CY, + VT_SS_SMALLMONEY = 200, + + //Strings + VT_SS_WSTRING = 201, + VT_SS_WVARSTRING = 202, + + VT_SS_STRING = 203, + VT_SS_VARSTRING = 204, + + //Bit + VT_SS_BIT = DBTYPE_BOOL, + + //Guid + VT_SS_GUID = DBTYPE_GUID, + + //Exact precision + VT_SS_NUMERIC = DBTYPE_NUMERIC, + VT_SS_DECIMAL = 205, + + //Datetime + VT_SS_DATETIME = DBTYPE_DBTIMESTAMP, + VT_SS_SMALLDATETIME =206, + + //Binary + VT_SS_BINARY =207, + VT_SS_VARBINARY = 208, + //Future + VT_SS_UNKNOWN = 209, + + //Additional datetime + VT_SS_DATE = DBTYPE_DBDATE, + VT_SS_TIME2 = DBTYPE_DBTIME2, + VT_SS_DATETIME2 = 212, + VT_SS_DATETIMEOFFSET = DBTYPE_DBTIMESTAMPOFFSET, + }; +typedef unsigned short SSVARTYPE; + + +enum DBPARAMFLAGSENUM_SS_100 + { DBPARAMFLAGS_SS_ISVARIABLESCALE = 0x40000000 + } ; +enum DBCOLUMNFLAGSENUM_SS_100 + { DBCOLUMNFLAGS_SS_ISVARIABLESCALE = 0x40000000, + DBCOLUMNFLAGS_SS_ISCOLUMNSET = 0x80000000 + } ; + +//------------------------------------------------------------------- +// Class Factory Interface used to initialize pointer to UMS. +//------------------------------------------------------------------- + + +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0001_v0_0_s_ifspec; + +#ifndef __IUMSInitialize_INTERFACE_DEFINED__ +#define __IUMSInitialize_INTERFACE_DEFINED__ + +/* interface IUMSInitialize */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IUMSInitialize; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5cf4ca14-ef21-11d0-97e7-00c04fc2ad98") + IUMSInitialize : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Initialize( + /* [in] */ void *pUMS) = 0; + + }; + +#else /* C style interface */ + + typedef struct IUMSInitializeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IUMSInitialize * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IUMSInitialize * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IUMSInitialize * This); + + HRESULT ( STDMETHODCALLTYPE *Initialize )( + IUMSInitialize * This, + /* [in] */ void *pUMS); + + END_INTERFACE + } IUMSInitializeVtbl; + + interface IUMSInitialize + { + CONST_VTBL struct IUMSInitializeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IUMSInitialize_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IUMSInitialize_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IUMSInitialize_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IUMSInitialize_Initialize(This,pUMS) \ + ( (This)->lpVtbl -> Initialize(This,pUMS) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IUMSInitialize_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sqlncli_0000_0002 */ +/* [local] */ + + +// the structure returned by ISQLServerErrorInfo::GetSQLServerInfo +typedef struct tagSSErrorInfo + { + LPOLESTR pwszMessage; + LPOLESTR pwszServer; + LPOLESTR pwszProcedure; + LONG lNative; + BYTE bState; + BYTE bClass; + WORD wLineNumber; + } SSERRORINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0002_v0_0_s_ifspec; + +#ifndef __ISQLServerErrorInfo_INTERFACE_DEFINED__ +#define __ISQLServerErrorInfo_INTERFACE_DEFINED__ + +/* interface ISQLServerErrorInfo */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_ISQLServerErrorInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5CF4CA12-EF21-11d0-97E7-00C04FC2AD98") + ISQLServerErrorInfo : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetErrorInfo( + /* [out] */ SSERRORINFO **ppErrorInfo, + /* [annotation][out] */ + __deref_out OLECHAR **ppStringsBuffer) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISQLServerErrorInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISQLServerErrorInfo * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISQLServerErrorInfo * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISQLServerErrorInfo * This); + + HRESULT ( STDMETHODCALLTYPE *GetErrorInfo )( + ISQLServerErrorInfo * This, + /* [out] */ SSERRORINFO **ppErrorInfo, + /* [annotation][out] */ + __deref_out OLECHAR **ppStringsBuffer); + + END_INTERFACE + } ISQLServerErrorInfoVtbl; + + interface ISQLServerErrorInfo + { + CONST_VTBL struct ISQLServerErrorInfoVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISQLServerErrorInfo_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISQLServerErrorInfo_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISQLServerErrorInfo_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ISQLServerErrorInfo_GetErrorInfo(This,ppErrorInfo,ppStringsBuffer) \ + ( (This)->lpVtbl -> GetErrorInfo(This,ppErrorInfo,ppStringsBuffer) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISQLServerErrorInfo_INTERFACE_DEFINED__ */ + + +#ifndef __IRowsetFastLoad_INTERFACE_DEFINED__ +#define __IRowsetFastLoad_INTERFACE_DEFINED__ + +/* interface IRowsetFastLoad */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IRowsetFastLoad; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5CF4CA13-EF21-11d0-97E7-00C04FC2AD98") + IRowsetFastLoad : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InsertRow( + /* [in] */ HACCESSOR hAccessor, + /* [in] */ void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( + /* [in] */ BOOL fDone) = 0; + + }; + +#else /* C style interface */ + + typedef struct IRowsetFastLoadVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IRowsetFastLoad * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IRowsetFastLoad * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IRowsetFastLoad * This); + + HRESULT ( STDMETHODCALLTYPE *InsertRow )( + IRowsetFastLoad * This, + /* [in] */ HACCESSOR hAccessor, + /* [in] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + IRowsetFastLoad * This, + /* [in] */ BOOL fDone); + + END_INTERFACE + } IRowsetFastLoadVtbl; + + interface IRowsetFastLoad + { + CONST_VTBL struct IRowsetFastLoadVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IRowsetFastLoad_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IRowsetFastLoad_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IRowsetFastLoad_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IRowsetFastLoad_InsertRow(This,hAccessor,pData) \ + ( (This)->lpVtbl -> InsertRow(This,hAccessor,pData) ) + +#define IRowsetFastLoad_Commit(This,fDone) \ + ( (This)->lpVtbl -> Commit(This,fDone) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IRowsetFastLoad_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sqlncli_0000_0004 */ +/* [local] */ + +#include // 8-byte structure packing + +typedef struct tagDBTIME2 + { + USHORT hour; + USHORT minute; + USHORT second; + ULONG fraction; + } DBTIME2; + +typedef struct tagDBTIMESTAMPOFFSET + { + SHORT year; + USHORT month; + USHORT day; + USHORT hour; + USHORT minute; + USHORT second; + ULONG fraction; + SHORT timezone_hour; + SHORT timezone_minute; + } DBTIMESTAMPOFFSET; + +#include // restore original structure packing + +struct SSVARIANT + { + SSVARTYPE vt; + DWORD dwReserved1; + DWORD dwReserved2; + union + { + BYTE bTinyIntVal; + SHORT sShortIntVal; + LONG lIntVal; + LONGLONG llBigIntVal; + FLOAT fltRealVal; + DOUBLE dblFloatVal; + CY cyMoneyVal; + VARIANT_BOOL fBitVal; + BYTE rgbGuidVal[ 16 ]; + DB_NUMERIC numNumericVal; + DBDATE dDateVal; + DBTIMESTAMP tsDateTimeVal; + struct _Time2Val + { + DBTIME2 tTime2Val; + BYTE bScale; + } Time2Val; + struct _DateTimeVal + { + DBTIMESTAMP tsDateTimeVal; + BYTE bScale; + } DateTimeVal; + struct _DateTimeOffsetVal + { + DBTIMESTAMPOFFSET tsoDateTimeOffsetVal; + BYTE bScale; + } DateTimeOffsetVal; + struct _NCharVal + { + SHORT sActualLength; + SHORT sMaxLength; + WCHAR *pwchNCharVal; + BYTE rgbReserved[ 5 ]; + DWORD dwReserved; + WCHAR *pwchReserved; + } NCharVal; + struct _CharVal + { + SHORT sActualLength; + SHORT sMaxLength; + CHAR *pchCharVal; + BYTE rgbReserved[ 5 ]; + DWORD dwReserved; + WCHAR *pwchReserved; + } CharVal; + struct _BinaryVal + { + SHORT sActualLength; + SHORT sMaxLength; + BYTE *prgbBinaryVal; + DWORD dwReserved; + } BinaryVal; + struct _UnknownType + { + DWORD dwActualLength; + BYTE rgMetadata[ 16 ]; + BYTE *pUnknownData; + } UnknownType; + struct _BLOBType + { + DBOBJECT dbobj; + IUnknown *pUnk; + } BLOBType; + } ; + } ; +typedef DWORD LOCKMODE; + + +enum LOCKMODEENUM + { LOCKMODE_INVALID = 0, + LOCKMODE_EXCLUSIVE = ( LOCKMODE_INVALID + 1 ) , + LOCKMODE_SHARED = ( LOCKMODE_EXCLUSIVE + 1 ) + } ; + + +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0004_v0_0_s_ifspec; + +#ifndef __ISchemaLock_INTERFACE_DEFINED__ +#define __ISchemaLock_INTERFACE_DEFINED__ + +/* interface ISchemaLock */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_ISchemaLock; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4C2389FB-2511-11d4-B258-00C04F7971CE") + ISchemaLock : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSchemaLock( + /* [in] */ DBID *pTableID, + /* [in] */ LOCKMODE lmMode, + /* [out] */ HANDLE *phLockHandle, + /* [out] */ ULONGLONG *pTableVersion) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseSchemaLock( + /* [in] */ HANDLE hLockHandle) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISchemaLockVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISchemaLock * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISchemaLock * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISchemaLock * This); + + HRESULT ( STDMETHODCALLTYPE *GetSchemaLock )( + ISchemaLock * This, + /* [in] */ DBID *pTableID, + /* [in] */ LOCKMODE lmMode, + /* [out] */ HANDLE *phLockHandle, + /* [out] */ ULONGLONG *pTableVersion); + + HRESULT ( STDMETHODCALLTYPE *ReleaseSchemaLock )( + ISchemaLock * This, + /* [in] */ HANDLE hLockHandle); + + END_INTERFACE + } ISchemaLockVtbl; + + interface ISchemaLock + { + CONST_VTBL struct ISchemaLockVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISchemaLock_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISchemaLock_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISchemaLock_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ISchemaLock_GetSchemaLock(This,pTableID,lmMode,phLockHandle,pTableVersion) \ + ( (This)->lpVtbl -> GetSchemaLock(This,pTableID,lmMode,phLockHandle,pTableVersion) ) + +#define ISchemaLock_ReleaseSchemaLock(This,hLockHandle) \ + ( (This)->lpVtbl -> ReleaseSchemaLock(This,hLockHandle) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISchemaLock_INTERFACE_DEFINED__ */ + + +#ifndef __IBCPSession_INTERFACE_DEFINED__ +#define __IBCPSession_INTERFACE_DEFINED__ + +/* interface IBCPSession */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IBCPSession; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("88352D80-42D1-42f0-A170-AB0F8B45B939") + IBCPSession : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE BCPColFmt( + /* [in] */ DBORDINAL idxUserDataCol, + /* [in] */ int eUserDataType, + /* [in] */ int cbIndicator, + /* [in] */ int cbUserData, + /* [size_is][in] */ BYTE *pbUserDataTerm, + /* [in] */ int cbUserDataTerm, + /* [in] */ DBORDINAL idxServerCol) = 0; + + virtual HRESULT STDMETHODCALLTYPE BCPColumns( + /* [in] */ DBCOUNTITEM nColumns) = 0; + + virtual HRESULT STDMETHODCALLTYPE BCPControl( + /* [in] */ int eOption, + /* [in] */ void *iValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE BCPDone( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE BCPExec( + /* [out] */ DBROWCOUNT *pRowsCopied) = 0; + + virtual HRESULT STDMETHODCALLTYPE BCPInit( + /* [string][in] */ const wchar_t *pwszTable, + /* [string][in] */ const wchar_t *pwszDataFile, + /* [string][in] */ const wchar_t *pwszErrorFile, + /* [in] */ int eDirection) = 0; + + virtual HRESULT STDMETHODCALLTYPE BCPReadFmt( + /* [string][in] */ const wchar_t *pwszFormatFile) = 0; + + virtual HRESULT STDMETHODCALLTYPE BCPWriteFmt( + /* [string][in] */ const wchar_t *pwszFormatFile) = 0; + + }; + +#else /* C style interface */ + + typedef struct IBCPSessionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBCPSession * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBCPSession * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBCPSession * This); + + HRESULT ( STDMETHODCALLTYPE *BCPColFmt )( + IBCPSession * This, + /* [in] */ DBORDINAL idxUserDataCol, + /* [in] */ int eUserDataType, + /* [in] */ int cbIndicator, + /* [in] */ int cbUserData, + /* [size_is][in] */ BYTE *pbUserDataTerm, + /* [in] */ int cbUserDataTerm, + /* [in] */ DBORDINAL idxServerCol); + + HRESULT ( STDMETHODCALLTYPE *BCPColumns )( + IBCPSession * This, + /* [in] */ DBCOUNTITEM nColumns); + + HRESULT ( STDMETHODCALLTYPE *BCPControl )( + IBCPSession * This, + /* [in] */ int eOption, + /* [in] */ void *iValue); + + HRESULT ( STDMETHODCALLTYPE *BCPDone )( + IBCPSession * This); + + HRESULT ( STDMETHODCALLTYPE *BCPExec )( + IBCPSession * This, + /* [out] */ DBROWCOUNT *pRowsCopied); + + HRESULT ( STDMETHODCALLTYPE *BCPInit )( + IBCPSession * This, + /* [string][in] */ const wchar_t *pwszTable, + /* [string][in] */ const wchar_t *pwszDataFile, + /* [string][in] */ const wchar_t *pwszErrorFile, + /* [in] */ int eDirection); + + HRESULT ( STDMETHODCALLTYPE *BCPReadFmt )( + IBCPSession * This, + /* [string][in] */ const wchar_t *pwszFormatFile); + + HRESULT ( STDMETHODCALLTYPE *BCPWriteFmt )( + IBCPSession * This, + /* [string][in] */ const wchar_t *pwszFormatFile); + + END_INTERFACE + } IBCPSessionVtbl; + + interface IBCPSession + { + CONST_VTBL struct IBCPSessionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBCPSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBCPSession_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBCPSession_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBCPSession_BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol) \ + ( (This)->lpVtbl -> BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol) ) + +#define IBCPSession_BCPColumns(This,nColumns) \ + ( (This)->lpVtbl -> BCPColumns(This,nColumns) ) + +#define IBCPSession_BCPControl(This,eOption,iValue) \ + ( (This)->lpVtbl -> BCPControl(This,eOption,iValue) ) + +#define IBCPSession_BCPDone(This) \ + ( (This)->lpVtbl -> BCPDone(This) ) + +#define IBCPSession_BCPExec(This,pRowsCopied) \ + ( (This)->lpVtbl -> BCPExec(This,pRowsCopied) ) + +#define IBCPSession_BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection) \ + ( (This)->lpVtbl -> BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection) ) + +#define IBCPSession_BCPReadFmt(This,pwszFormatFile) \ + ( (This)->lpVtbl -> BCPReadFmt(This,pwszFormatFile) ) + +#define IBCPSession_BCPWriteFmt(This,pwszFormatFile) \ + ( (This)->lpVtbl -> BCPWriteFmt(This,pwszFormatFile) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBCPSession_INTERFACE_DEFINED__ */ + + +#ifndef __IBCPSession2_INTERFACE_DEFINED__ +#define __IBCPSession2_INTERFACE_DEFINED__ + +/* interface IBCPSession2 */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IBCPSession2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AD79D3B6-59DD-46a3-BFC6-E62A65FF3523") + IBCPSession2 : public IBCPSession + { + public: + virtual HRESULT STDMETHODCALLTYPE BCPSetBulkMode( + /* [in] */ int property, + /* [size_is][in] */ void *pField, + /* [in] */ int cbField, + /* [size_is][in] */ void *pRow, + /* [in] */ int cbRow) = 0; + + }; + +#else /* C style interface */ + + typedef struct IBCPSession2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBCPSession2 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBCPSession2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBCPSession2 * This); + + HRESULT ( STDMETHODCALLTYPE *BCPColFmt )( + IBCPSession2 * This, + /* [in] */ DBORDINAL idxUserDataCol, + /* [in] */ int eUserDataType, + /* [in] */ int cbIndicator, + /* [in] */ int cbUserData, + /* [size_is][in] */ BYTE *pbUserDataTerm, + /* [in] */ int cbUserDataTerm, + /* [in] */ DBORDINAL idxServerCol); + + HRESULT ( STDMETHODCALLTYPE *BCPColumns )( + IBCPSession2 * This, + /* [in] */ DBCOUNTITEM nColumns); + + HRESULT ( STDMETHODCALLTYPE *BCPControl )( + IBCPSession2 * This, + /* [in] */ int eOption, + /* [in] */ void *iValue); + + HRESULT ( STDMETHODCALLTYPE *BCPDone )( + IBCPSession2 * This); + + HRESULT ( STDMETHODCALLTYPE *BCPExec )( + IBCPSession2 * This, + /* [out] */ DBROWCOUNT *pRowsCopied); + + HRESULT ( STDMETHODCALLTYPE *BCPInit )( + IBCPSession2 * This, + /* [string][in] */ const wchar_t *pwszTable, + /* [string][in] */ const wchar_t *pwszDataFile, + /* [string][in] */ const wchar_t *pwszErrorFile, + /* [in] */ int eDirection); + + HRESULT ( STDMETHODCALLTYPE *BCPReadFmt )( + IBCPSession2 * This, + /* [string][in] */ const wchar_t *pwszFormatFile); + + HRESULT ( STDMETHODCALLTYPE *BCPWriteFmt )( + IBCPSession2 * This, + /* [string][in] */ const wchar_t *pwszFormatFile); + + HRESULT ( STDMETHODCALLTYPE *BCPSetBulkMode )( + IBCPSession2 * This, + /* [in] */ int property, + /* [size_is][in] */ void *pField, + /* [in] */ int cbField, + /* [size_is][in] */ void *pRow, + /* [in] */ int cbRow); + + END_INTERFACE + } IBCPSession2Vtbl; + + interface IBCPSession2 + { + CONST_VTBL struct IBCPSession2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBCPSession2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBCPSession2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBCPSession2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBCPSession2_BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol) \ + ( (This)->lpVtbl -> BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol) ) + +#define IBCPSession2_BCPColumns(This,nColumns) \ + ( (This)->lpVtbl -> BCPColumns(This,nColumns) ) + +#define IBCPSession2_BCPControl(This,eOption,iValue) \ + ( (This)->lpVtbl -> BCPControl(This,eOption,iValue) ) + +#define IBCPSession2_BCPDone(This) \ + ( (This)->lpVtbl -> BCPDone(This) ) + +#define IBCPSession2_BCPExec(This,pRowsCopied) \ + ( (This)->lpVtbl -> BCPExec(This,pRowsCopied) ) + +#define IBCPSession2_BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection) \ + ( (This)->lpVtbl -> BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection) ) + +#define IBCPSession2_BCPReadFmt(This,pwszFormatFile) \ + ( (This)->lpVtbl -> BCPReadFmt(This,pwszFormatFile) ) + +#define IBCPSession2_BCPWriteFmt(This,pwszFormatFile) \ + ( (This)->lpVtbl -> BCPWriteFmt(This,pwszFormatFile) ) + + +#define IBCPSession2_BCPSetBulkMode(This,property,pField,cbField,pRow,cbRow) \ + ( (This)->lpVtbl -> BCPSetBulkMode(This,property,pField,cbField,pRow,cbRow) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBCPSession2_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sqlncli_0000_0007 */ +/* [local] */ + + +#endif //_SQLOLEDB_H_ + +#define ISOLATIONLEVEL_SNAPSHOT ((ISOLATIONLEVEL)(0x01000000)) // Changes made in other transactions can not be seen. + +#define DBPROPVAL_TI_SNAPSHOT 0x01000000L + + + +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0007_v0_0_s_ifspec; + +#ifndef __ISSAbort_INTERFACE_DEFINED__ +#define __ISSAbort_INTERFACE_DEFINED__ + +/* interface ISSAbort */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_ISSAbort; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5CF4CA15-EF21-11d0-97E7-00C04FC2AD98") + ISSAbort : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISSAbortVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISSAbort * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISSAbort * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISSAbort * This); + + HRESULT ( STDMETHODCALLTYPE *Abort )( + ISSAbort * This); + + END_INTERFACE + } ISSAbortVtbl; + + interface ISSAbort + { + CONST_VTBL struct ISSAbortVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISSAbort_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISSAbort_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISSAbort_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ISSAbort_Abort(This) \ + ( (This)->lpVtbl -> Abort(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISSAbort_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sqlncli_0000_0008 */ +/* [local] */ + + +enum DBBINDFLAGENUM90 + { DBBINDFLAG_OBJECT = 0x2 + } ; + +enum SSACCESSORFLAGS + { SSACCESSOR_ROWDATA = 0x100 + } ; + +enum DBPROPFLAGSENUM90 + { DBPROPFLAGS_PARAMETER = 0x10000 + } ; +typedef struct tagSSPARAMPROPS + { + DBORDINAL iOrdinal; + ULONG cPropertySets; + DBPROPSET *rgPropertySets; + } SSPARAMPROPS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0008_v0_0_s_ifspec; + +#ifndef __ISSCommandWithParameters_INTERFACE_DEFINED__ +#define __ISSCommandWithParameters_INTERFACE_DEFINED__ + +/* interface ISSCommandWithParameters */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_ISSCommandWithParameters; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("eec30162-6087-467c-b995-7c523ce96561") + ISSCommandWithParameters : public ICommandWithParameters + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetParameterProperties( + /* [out][in] */ DB_UPARAMS *pcParams, + /* [size_is][size_is][out] */ SSPARAMPROPS **prgParamProperties) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetParameterProperties( + /* [in] */ DB_UPARAMS cParams, + /* [size_is][unique][in] */ SSPARAMPROPS rgParamProperties[ ]) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISSCommandWithParametersVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISSCommandWithParameters * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISSCommandWithParameters * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISSCommandWithParameters * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetParameterInfo )( + ISSCommandWithParameters * This, + /* [out][in] */ DB_UPARAMS *pcParams, + /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo, + /* [out] */ OLECHAR **ppNamesBuffer); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *MapParameterNames )( + ISSCommandWithParameters * This, + /* [in] */ DB_UPARAMS cParamNames, + /* [size_is][in] */ const OLECHAR *rgParamNames[ ], + /* [size_is][out] */ DB_LPARAMS rgParamOrdinals[ ]); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetParameterInfo )( + ISSCommandWithParameters * This, + /* [in] */ DB_UPARAMS cParams, + /* [size_is][unique][in] */ const DB_UPARAMS rgParamOrdinals[ ], + /* [size_is][unique][in] */ const DBPARAMBINDINFO rgParamBindInfo[ ]); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetParameterProperties )( + ISSCommandWithParameters * This, + /* [out][in] */ DB_UPARAMS *pcParams, + /* [size_is][size_is][out] */ SSPARAMPROPS **prgParamProperties); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetParameterProperties )( + ISSCommandWithParameters * This, + /* [in] */ DB_UPARAMS cParams, + /* [size_is][unique][in] */ SSPARAMPROPS rgParamProperties[ ]); + + END_INTERFACE + } ISSCommandWithParametersVtbl; + + interface ISSCommandWithParameters + { + CONST_VTBL struct ISSCommandWithParametersVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISSCommandWithParameters_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISSCommandWithParameters_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISSCommandWithParameters_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ISSCommandWithParameters_GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer) \ + ( (This)->lpVtbl -> GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer) ) + +#define ISSCommandWithParameters_MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals) \ + ( (This)->lpVtbl -> MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals) ) + +#define ISSCommandWithParameters_SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo) \ + ( (This)->lpVtbl -> SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo) ) + + +#define ISSCommandWithParameters_GetParameterProperties(This,pcParams,prgParamProperties) \ + ( (This)->lpVtbl -> GetParameterProperties(This,pcParams,prgParamProperties) ) + +#define ISSCommandWithParameters_SetParameterProperties(This,cParams,rgParamProperties) \ + ( (This)->lpVtbl -> SetParameterProperties(This,cParams,rgParamProperties) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISSCommandWithParameters_INTERFACE_DEFINED__ */ + + +#ifndef __IDBAsynchStatus_INTERFACE_DEFINED__ +#define __IDBAsynchStatus_INTERFACE_DEFINED__ + +/* interface IDBAsynchStatus */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IDBAsynchStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0c733a95-2a1c-11ce-ade5-00aa0044773d") + IDBAsynchStatus : public IUnknown + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE Abort( + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetStatus( + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation, + /* [out] */ DBCOUNTITEM *pulProgress, + /* [out] */ DBCOUNTITEM *pulProgressMax, + /* [out] */ DBASYNCHPHASE *peAsynchPhase, + /* [out] */ LPOLESTR *ppwszStatusText) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDBAsynchStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDBAsynchStatus * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDBAsynchStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDBAsynchStatus * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Abort )( + IDBAsynchStatus * This, + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetStatus )( + IDBAsynchStatus * This, + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation, + /* [out] */ DBCOUNTITEM *pulProgress, + /* [out] */ DBCOUNTITEM *pulProgressMax, + /* [out] */ DBASYNCHPHASE *peAsynchPhase, + /* [out] */ LPOLESTR *ppwszStatusText); + + END_INTERFACE + } IDBAsynchStatusVtbl; + + interface IDBAsynchStatus + { + CONST_VTBL struct IDBAsynchStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDBAsynchStatus_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDBAsynchStatus_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDBAsynchStatus_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDBAsynchStatus_Abort(This,hChapter,eOperation) \ + ( (This)->lpVtbl -> Abort(This,hChapter,eOperation) ) + +#define IDBAsynchStatus_GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText) \ + ( (This)->lpVtbl -> GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [call_as] */ HRESULT STDMETHODCALLTYPE IDBAsynchStatus_RemoteAbort_Proxy( + IDBAsynchStatus * This, + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation, + /* [out] */ IErrorInfo **ppErrorInfoRem); + + +void __RPC_STUB IDBAsynchStatus_RemoteAbort_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [call_as] */ HRESULT STDMETHODCALLTYPE IDBAsynchStatus_RemoteGetStatus_Proxy( + IDBAsynchStatus * This, + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation, + /* [unique][out][in] */ DBCOUNTITEM *pulProgress, + /* [unique][out][in] */ DBCOUNTITEM *pulProgressMax, + /* [unique][out][in] */ DBASYNCHPHASE *peAsynchPhase, + /* [unique][out][in] */ LPOLESTR *ppwszStatusText, + /* [out] */ IErrorInfo **ppErrorInfoRem); + + +void __RPC_STUB IDBAsynchStatus_RemoteGetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDBAsynchStatus_INTERFACE_DEFINED__ */ + + +#ifndef __ISSAsynchStatus_INTERFACE_DEFINED__ +#define __ISSAsynchStatus_INTERFACE_DEFINED__ + +/* interface ISSAsynchStatus */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_ISSAsynchStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1FF1F743-8BB0-4c00-ACC4-C10E43B08FC1") + ISSAsynchStatus : public IDBAsynchStatus + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE WaitForAsynchCompletion( + /* [in] */ DWORD dwMillisecTimeOut) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISSAsynchStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISSAsynchStatus * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISSAsynchStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISSAsynchStatus * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Abort )( + ISSAsynchStatus * This, + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISSAsynchStatus * This, + /* [in] */ HCHAPTER hChapter, + /* [in] */ DBASYNCHOP eOperation, + /* [out] */ DBCOUNTITEM *pulProgress, + /* [out] */ DBCOUNTITEM *pulProgressMax, + /* [out] */ DBASYNCHPHASE *peAsynchPhase, + /* [out] */ LPOLESTR *ppwszStatusText); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForAsynchCompletion )( + ISSAsynchStatus * This, + /* [in] */ DWORD dwMillisecTimeOut); + + END_INTERFACE + } ISSAsynchStatusVtbl; + + interface ISSAsynchStatus + { + CONST_VTBL struct ISSAsynchStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISSAsynchStatus_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISSAsynchStatus_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISSAsynchStatus_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ISSAsynchStatus_Abort(This,hChapter,eOperation) \ + ( (This)->lpVtbl -> Abort(This,hChapter,eOperation) ) + +#define ISSAsynchStatus_GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText) \ + ( (This)->lpVtbl -> GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText) ) + + +#define ISSAsynchStatus_WaitForAsynchCompletion(This,dwMillisecTimeOut) \ + ( (This)->lpVtbl -> WaitForAsynchCompletion(This,dwMillisecTimeOut) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISSAsynchStatus_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sqlncli_0000_0011 */ +/* [local] */ + +//---------------------------------------------------------------------------- +// Values for STATUS bitmask for DBSCHEMA_TABLES & DBSCHEMA_TABLES_INFO +#define TABLE_HAS_UPDATE_INSTEAD_OF_TRIGGER 0x00000001 //table has IOT defined +#define TABLE_HAS_DELETE_INSTEAD_OF_TRIGGER 0x00000002 //table has IOT defined +#define TABLE_HAS_INSERT_INSTEAD_OF_TRIGGER 0x00000004 //table has IOT defined +#define TABLE_HAS_AFTER_UPDATE_TRIGGER 0x00000008 //table has update trigger +#define TABLE_HAS_AFTER_DELETE_TRIGGER 0x00000010 //table has delete trigger +#define TABLE_HAS_AFTER_INSERT_TRIGGER 0x00000020 //table has insert trigger +#define TABLE_HAS_CASCADE_UPDATE 0x00000040 //table has cascade update +#define TABLE_HAS_CASCADE_DELETE 0x00000080 //table has cascade delete + +//---------------------------------------------------------------------------- +// PropIds for DBPROP_INIT_GENERALTIMEOUT +#if (OLEDBVER >= 0x0210) +#define DBPROP_INIT_GENERALTIMEOUT 0x11cL +#endif + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERDATASOURCE +#define SSPROP_ENABLEFASTLOAD 2 +#define SSPROP_ENABLEBULKCOPY 3 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERDATASOURCEINFO +#define SSPROP_UNICODELCID 2 +#define SSPROP_UNICODECOMPARISONSTYLE 3 +#define SSPROP_COLUMNLEVELCOLLATION 4 +#define SSPROP_CHARACTERSET 5 +#define SSPROP_SORTORDER 6 +#define SSPROP_CURRENTCOLLATION 7 +#define SSPROP_INTEGRATEDAUTHENTICATIONMETHOD 8 +#define SSPROP_MUTUALLYAUTHENTICATED 9 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERDBINIT +#define SSPROP_INIT_CURRENTLANGUAGE 4 +#define SSPROP_INIT_NETWORKADDRESS 5 +#define SSPROP_INIT_NETWORKLIBRARY 6 +#define SSPROP_INIT_USEPROCFORPREP 7 +#define SSPROP_INIT_AUTOTRANSLATE 8 +#define SSPROP_INIT_PACKETSIZE 9 +#define SSPROP_INIT_APPNAME 10 +#define SSPROP_INIT_WSID 11 +#define SSPROP_INIT_FILENAME 12 +#define SSPROP_INIT_ENCRYPT 13 +#define SSPROP_AUTH_REPL_SERVER_NAME 14 +#define SSPROP_INIT_TAGCOLUMNCOLLATION 15 +#define SSPROP_INIT_MARSCONNECTION 16 +#define SSPROP_INIT_FAILOVERPARTNER 18 +#define SSPROP_AUTH_OLD_PASSWORD 19 +#define SSPROP_INIT_DATATYPECOMPATIBILITY 20 +#define SSPROP_INIT_TRUST_SERVER_CERTIFICATE 21 +#define SSPROP_INIT_SERVERSPN 22 +#define SSPROP_INIT_FAILOVERPARTNERSPN 23 +#define SSPROP_INIT_APPLICATIONINTENT 24 + +//----------------------------------------------------------------------------- +// Values for SSPROP_INIT_USEPROCFORPREP +#define SSPROPVAL_USEPROCFORPREP_OFF 0 +#define SSPROPVAL_USEPROCFORPREP_ON 1 +#define SSPROPVAL_USEPROCFORPREP_ON_DROP 2 + +//----------------------------------------------------------------------------- +// Values for SSPROP_INIT_DATATYPECOMPATIBILITY +#define SSPROPVAL_DATATYPECOMPATIBILITY_SQL2000 80 +#define SSPROPVAL_DATATYPECOMPATIBILITY_DEFAULT 0 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERSESSION +#define SSPROP_QUOTEDCATALOGNAMES 2 +#define SSPROP_ALLOWNATIVEVARIANT 3 +#define SSPROP_SQLXMLXPROGID 4 +#define SSPROP_ASYNCH_BULKCOPY 5 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERROWSET +#define SSPROP_MAXBLOBLENGTH 8 +#define SSPROP_FASTLOADOPTIONS 9 +#define SSPROP_FASTLOADKEEPNULLS 10 +#define SSPROP_FASTLOADKEEPIDENTITY 11 +#define SSPROP_CURSORAUTOFETCH 12 +#define SSPROP_DEFERPREPARE 13 +#define SSPROP_IRowsetFastLoad 14 +#define SSPROP_QP_NOTIFICATION_TIMEOUT 17 +#define SSPROP_QP_NOTIFICATION_MSGTEXT 18 +#define SSPROP_QP_NOTIFICATION_OPTIONS 19 +#define SSPROP_NOCOUNT_STATUS 20 +#define SSPROP_COMPUTE_ID 21 +#define SSPROP_COLUMN_ID 22 +#define SSPROP_COMPUTE_BYLIST 23 +#define SSPROP_ISSAsynchStatus 24 + +//----------------------------------------------------------------------------- +// Values for SSPROP_QP_NOTIFICATION_TIMEOUT +#define SSPROPVAL_DEFAULT_NOTIFICATION_TIMEOUT 432000 /* in sec */ +#define SSPROPVAL_MAX_NOTIFICATION_TIMEOUT 0x7FFFFFFF /* in sec */ +#define MAX_NOTIFICATION_LEN 2000 /* NVARCHAR [2000] for both ID & DELIVERY_QUEUE */ + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERCOLUMN +#define SSPROP_COL_COLLATIONNAME 14 +#define SSPROP_COL_UDT_CATALOGNAME 31 +#define SSPROP_COL_UDT_SCHEMANAME 32 +#define SSPROP_COL_UDT_NAME 33 +#define SSPROP_COL_XML_SCHEMACOLLECTION_CATALOGNAME 34 +#define SSPROP_COL_XML_SCHEMACOLLECTION_SCHEMANAME 35 +#define SSPROP_COL_XML_SCHEMACOLLECTIONNAME 36 +#define SSPROP_COL_COMPUTED 37 + + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERSTREAM +#define SSPROP_STREAM_XMLROOT 19 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERPARAMETER +#define SSPROP_PARAM_XML_SCHEMACOLLECTION_CATALOGNAME 24 +#define SSPROP_PARAM_XML_SCHEMACOLLECTION_SCHEMANAME 25 +#define SSPROP_PARAM_XML_SCHEMACOLLECTIONNAME 26 +#define SSPROP_PARAM_UDT_CATALOGNAME 27 +#define SSPROP_PARAM_UDT_SCHEMANAME 28 +#define SSPROP_PARAM_UDT_NAME 29 +#define SSPROP_PARAM_TYPE_CATALOGNAME 38 +#define SSPROP_PARAM_TYPE_SCHEMANAME 39 +#define SSPROP_PARAM_TYPE_TYPENAME 40 +#define SSPROP_PARAM_TABLE_DEFAULT_COLUMNS 41 +#define SSPROP_PARAM_TABLE_COLUMN_SORT_ORDER 42 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERINDEX +#define SSPROP_INDEX_XML 1 + +//----------------------------------------------------------------------------- +// +#define BCP_TYPE_DEFAULT 0x00 +#define BCP_TYPE_SQLTEXT 0x23 +#define BCP_TYPE_SQLVARBINARY 0x25 +#define BCP_TYPE_SQLINTN 0x26 +#define BCP_TYPE_SQLVARCHAR 0x27 +#define BCP_TYPE_SQLBINARY 0x2d +#define BCP_TYPE_SQLIMAGE 0x22 +#define BCP_TYPE_SQLCHARACTER 0x2f +#define BCP_TYPE_SQLINT1 0x30 +#define BCP_TYPE_SQLBIT 0x32 +#define BCP_TYPE_SQLINT2 0x34 +#define BCP_TYPE_SQLINT4 0x38 +#define BCP_TYPE_SQLMONEY 0x3c +#define BCP_TYPE_SQLDATETIME 0x3d +#define BCP_TYPE_SQLFLT8 0x3e +#define BCP_TYPE_SQLFLTN 0x6d +#define BCP_TYPE_SQLMONEYN 0x6e +#define BCP_TYPE_SQLDATETIMN 0x6f +#define BCP_TYPE_SQLFLT4 0x3b +#define BCP_TYPE_SQLMONEY4 0x7a +#define BCP_TYPE_SQLDATETIM4 0x3a +#define BCP_TYPE_SQLDECIMAL 0x6a +#define BCP_TYPE_SQLNUMERIC 0x6c +#define BCP_TYPE_SQLUNIQUEID 0x24 +#define BCP_TYPE_SQLBIGCHAR 0xaf +#define BCP_TYPE_SQLBIGVARCHAR 0xa7 +#define BCP_TYPE_SQLBIGBINARY 0xad +#define BCP_TYPE_SQLBIGVARBINARY 0xa5 +#define BCP_TYPE_SQLBITN 0x68 +#define BCP_TYPE_SQLNCHAR 0xef +#define BCP_TYPE_SQLNVARCHAR 0xe7 +#define BCP_TYPE_SQLNTEXT 0x63 +#define BCP_TYPE_SQLDECIMALN 0x6a +#define BCP_TYPE_SQLNUMERICN 0x6c +#define BCP_TYPE_SQLINT8 0x7f +#define BCP_TYPE_SQLVARIANT 0x62 +#define BCP_TYPE_SQLUDT 0xf0 +#define BCP_TYPE_SQLXML 0xf1 +#define BCP_TYPE_SQLDATE 0x28 +#define BCP_TYPE_SQLTIME 0x29 +#define BCP_TYPE_SQLDATETIME2 0x2a +#define BCP_TYPE_SQLDATETIMEOFFSET 0x2b + +#define BCP_DIRECTION_IN 1 +#define BCP_DIRECTION_OUT 2 + +#define BCP_OPTION_MAXERRS 1 +#define BCP_OPTION_FIRST 2 +#define BCP_OPTION_LAST 3 +#define BCP_OPTION_BATCH 4 +#define BCP_OPTION_KEEPNULLS 5 +#define BCP_OPTION_ABORT 6 +#define BCP_OPTION_KEEPIDENTITY 8 +#define BCP_OPTION_HINTSA 10 +#define BCP_OPTION_HINTSW 11 +#define BCP_OPTION_FILECP 12 +#define BCP_OPTION_UNICODEFILE 13 +#define BCP_OPTION_TEXTFILE 14 +#define BCP_OPTION_FILEFMT 15 +#define BCP_OPTION_FMTXML 16 +#define BCP_OPTION_FIRSTEX 17 +#define BCP_OPTION_LASTEX 18 +#define BCP_OPTION_ROWCOUNT 19 +#define BCP_OPTION_DELAYREADFMT 20 + +#define BCP_OUT_CHARACTER_MODE 0x01 +#define BCP_OUT_WIDE_CHARACTER_MODE 0x02 +#define BCP_OUT_NATIVE_TEXT_MODE 0x03 +#define BCP_OUT_NATIVE_MODE 0x04 + +#define BCP_FILECP_ACP 0 +#define BCP_FILECP_OEMCP 1 +#define BCP_FILECP_RAW (-1) + +#ifdef UNICODE +#define BCP_OPTION_HINTS BCP_OPTION_HINTSW +#else +#define BCP_OPTION_HINTS BCP_OPTION_HINTSA +#endif + +#define BCP_PREFIX_DEFAULT (-10) + +#define BCP_LENGTH_NULL (-1) +#define BCP_LENGTH_VARIABLE (-10) +// +//----------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------- +// Provider-specific Class Ids +// + +#if SQLNCLI_VER >= 1100 + +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI11 = {0x397C2819L,0x8272,0x4532,{0xAD,0x3A,0xFB,0x5E,0x43,0xBE,0xAA,0x39}}; +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI11_ERROR = {0xCA99D701L,0xE6E7,0x4db4,{0xA5,0xCC,0x81,0x54,0x1C,0x75,0x18,0x8A}}; +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI11_ENUMERATOR = {0x8F612DD2L,0x7E28,0x424f,{0xA2,0xFD,0xC2,0xEE,0xCC,0x31,0x4A,0xA2}}; + +#endif + +#if SQLNCLI_VER >= 1000 + +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI10 = {0x8F4A6B68L,0x4F36,0x4e3c,{0xBE,0x81,0xBC,0x7C,0xA4,0xE9,0xC4,0x5C}}; +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI10_ERROR = {0x53F9C3BCL,0x275F,0x4FA5,{0xB3,0xE6,0x25,0xED,0xCD,0x51,0x20,0x23}}; +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI10_ENUMERATOR = {0x91E4F2A5L,0x1B07,0x45f6,{0x86,0xBF,0x92,0x03,0xC7,0xC7,0x2B,0xE3}}; + +#endif + +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI = {0x85ecafccL,0xbdd9,0x4b03,{0x97,0xa8,0xfa,0x65,0xcb,0xe3,0x85,0x9b}}; +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI_ERROR = {0xe8bc0a7aL,0xea71,0x4263,{0x8c,0xda,0x94,0xf3,0x88,0xb8,0xed,0x10}}; +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_SQLNCLI_ENUMERATOR = {0x4898ad37L,0xfe05,0x42df,{0x92,0xf9,0xe8,0x57,0xdd,0xfe,0xe7,0x30}}; +extern const GUID OLEDBDECLSPEC _SQLNCLI_OLEDB_DEPRECATE_WARNING CLSID_ROWSET_TVP = {0xc7ef28d5L,0x7bee,0x443f,{0x86,0xda,0xe3,0x98,0x4f,0xcd,0x4d,0xf9}}; + +//---------------------------------------------------------------------------- +// Provider-specific Interface Ids +// +#ifndef _SQLOLEDB_H_ +extern const GUID OLEDBDECLSPEC IID_ISQLServerErrorInfo = {0x5cf4ca12,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC IID_IRowsetFastLoad = {0x5cf4ca13,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC IID_IUMSInitialize = {0x5cf4ca14,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC IID_ISchemaLock = {0x4c2389fb,0x2511,0x11d4,{0xb2,0x58,0x0,0xc0,0x4f,0x79,0x71,0xce}}; +extern const GUID OLEDBDECLSPEC IID_ISQLXMLHelper = {0xd22a7678L,0xf860,0x40cd,{0xa5,0x67,0x15,0x63,0xde,0xb4,0x6d,0x49}}; +#endif //_SQLOLEDB_H_ +extern const GUID OLEDBDECLSPEC IID_ISSAbort = {0x5cf4ca15,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC IID_IBCPSession = {0x88352D80,0x42D1,0x42f0,{0xA1,0x70,0xAB,0x0F,0x8B,0x45,0xB9,0x39}}; +extern const GUID OLEDBDECLSPEC IID_IBCPSession2 = {0xad79d3b6,0x59dd,0x46a3,{0xbf,0xc6,0xe6,0x2a,0x65,0xff,0x35,0x23}}; +extern const GUID OLEDBDECLSPEC IID_ISSCommandWithParameters = {0xeec30162,0x6087,0x467c,{0xb9,0x95,0x7c,0x52,0x3c,0xe9,0x65,0x61}}; +extern const GUID OLEDBDECLSPEC IID_ISSAsynchStatus = {0x1FF1F743,0x8BB0, 0x4c00,{0xAC,0xC4,0xC1,0x0E,0x43,0xB0,0x8F,0xC1}}; + + +//---------------------------------------------------------------------------- +// Provider-specific schema rowsets +// +#ifndef _SQLOLEDB_H_ +extern const GUID OLEDBDECLSPEC DBSCHEMA_LINKEDSERVERS = {0x9093caf4,0x2eac,0x11d1,{0x98,0x9,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +#endif //_SQLOLEDB_H_ +extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_ASSEMBLIES = {0x7c1112c8, 0xc2d3, 0x4f6e, {0x94, 0x9a, 0x98, 0x3d, 0x38, 0xa5, 0x8f, 0x46}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_ASSEMBLY_DEPENDENCIES = {0xcb0f837b, 0x974c, 0x41b8, {0x90, 0x9d, 0x64, 0x9c, 0xaf, 0x45, 0xad, 0x2f}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_USER_TYPES = {0xf1198bd8, 0xa424, 0x4ea3, {0x8d, 0x4c, 0x60, 0x7e, 0xee, 0x2b, 0xab, 0x60}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_XML_COLLECTIONS = {0x56bfad8c, 0x6e8f, 0x480d, {0x91, 0xde, 0x35, 0x16, 0xd9, 0x9a, 0x5d, 0x10}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_TABLE_TYPES = {0x4e26cde7, 0xaaa4, 0x41ed, {0x93, 0xdd, 0x37, 0x6e, 0x6d, 0x40, 0x9c, 0x17}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_TABLE_TYPE_PRIMARY_KEYS = {0x9738faea, 0x31e8, 0x4f63, {0xae, 0xd, 0x61, 0x33, 0x16, 0x41, 0x8c, 0xdd}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_TABLE_TYPE_COLUMNS = {0xa663d94b, 0xddf7, 0x4a7f, {0xa5, 0x37, 0xd6, 0x1f, 0x12, 0x36, 0x5d, 0x7c}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_COLUMNS_EXTENDED = {0x66462f01, 0x633a, 0x44d9, {0xb0, 0xd0, 0xfe, 0x66, 0xf2, 0x1a, 0x0d, 0x24}}; +extern const GUID OLEDBDECLSPEC DBSCHEMA_SPARSE_COLUMN_SET = {0x31a4837c, 0xf9ff, 0x405f, {0x89, 0x82, 0x02, 0x19, 0xaa, 0xaa, 0x4a, 0x12}}; + + +#ifndef CRESTRICTIONS_DBSCHEMA_LINKEDSERVERS +#define CRESTRICTIONS_DBSCHEMA_LINKEDSERVERS 1 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_ASSEMBLIES +#define CRESTRICTIONS_DBSCHEMA_SQL_ASSEMBLIES 4 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_ASSEMBLY_DEPENDENCIES +#define CRESTRICTIONS_DBSCHEMA_SQL_ASSEMBLY_DEPENDENCIES 4 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_USER_TYPES +#define CRESTRICTIONS_DBSCHEMA_SQL_USER_TYPES 3 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_XML_COLLECTIONS +#define CRESTRICTIONS_DBSCHEMA_XML_COLLECTIONS 4 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPES +#define CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPES 3 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_PRIMARY_KEYS +#define CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_PRIMARY_KEYS 3 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_COLUMNS +#define CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_COLUMNS 4 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_COLUMNS_EXTENDED +#define CRESTRICTIONS_DBSCHEMA_COLUMNS_EXTENDED 4 +#endif + +#ifndef CRESTRICTIONS_DBSCHEMA_SPARSE_COLUMN_SET +#define CRESTRICTIONS_DBSCHEMA_SPARSE_COLUMN_SET 4 +#endif + + +//---------------------------------------------------------------------------- +// Provider-specific property sets +// +#ifndef _SQLOLEDB_H_ +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERDATASOURCE = {0x28efaee4,0x2d2c,0x11d1,{0x98,0x7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERDATASOURCEINFO= {0xdf10cb94,0x35f6,0x11d2,{0x9c,0x54,0x0,0xc0,0x4f,0x79,0x71,0xd3}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERDBINIT = {0x5cf4ca10,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERROWSET = {0x5cf4ca11,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERSESSION = {0x28efaee5,0x2d2c,0x11d1,{0x98,0x7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERCOLUMN = {0x3b63fb5e,0x3fbb,0x11d3,{0x9f,0x29,0x0,0xc0,0x4f,0x8e,0xe9,0xdc}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERSTREAM = {0x9f79c073,0x8a6d,0x4bca,{0xa8,0xa8,0xc9,0xb7,0x9a,0x9b,0x96,0x2d}}; +#endif //_SQLOLEDB_H_ +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERPARAMETER = {0xfee09128,0xa67d,0x47ea,{0x8d,0x40,0x24,0xa1,0xd4,0x73,0x7e,0x8d}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERINDEX = {0xE428B84E,0xA6B7,0x413a,{0x94,0x65,0x56,0x23,0x2E,0x0D,0x2B,0xEB}}; +extern const GUID OLEDBDECLSPEC DBPROPSET_PARAMETERALL = {0x2cd2b7d8,0xe7c2,0x4f6c,{0x9b,0x30,0x75,0xe2,0x58,0x46,0x10,0x97}}; + + +//---------------------------------------------------------------------------- +// Provider-specific columns for IColumnsRowset +// +#define DBCOLUMN_SS_X_GUID {0x627bd890,0xed54,0x11d2,{0xb9,0x94,0x0,0xc0,0x4f,0x8c,0xa8,0x2c}} +// +#ifndef _SQLOLEDB_H_ +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_COMPFLAGS = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)100}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_SORTID = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)101}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_BASETABLEINSTANCE = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)102}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_TDSCOLLATION = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)103}; +#endif //_SQLOLEDB_H_ +extern const DBID OLEDBDECLSPEC DBCOLUMN_BASESERVERNAME = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)104}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_XML_SCHEMACOLLECTION_CATALOGNAME= {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)105}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_XML_SCHEMACOLLECTION_SCHEMANAME = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)106}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_XML_SCHEMACOLLECTIONNAME = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)107}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_UDT_CATALOGNAME = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)108}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_UDT_SCHEMANAME = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)109}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_UDT_NAME = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)110}; +extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_ASSEMBLY_TYPENAME= {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)111}; + +// OLEDB part of SQL Server Native Client header - end here! +#endif // defined(_SQLNCLI_OLEDB_) || !defined(_SQLNCLI_ODBC_) + +// ODBC part of SQL Server Native Client header - begin here! +#if defined(_SQLNCLI_ODBC_) || !defined(_SQLNCLI_OLEDB_) +#ifdef ODBCVER + +// max SQL Server identifier length +#define SQL_MAX_SQLSERVERNAME 128 + +// SQLSetConnectAttr driver specific defines. +// Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server Native Client driver usage. +// Connection attributes +#define SQL_COPT_SS_BASE 1200 +#define SQL_COPT_SS_REMOTE_PWD (SQL_COPT_SS_BASE+1) // dbrpwset SQLSetConnectOption only +#define SQL_COPT_SS_USE_PROC_FOR_PREP (SQL_COPT_SS_BASE+2) // Use create proc for SQLPrepare +#define SQL_COPT_SS_INTEGRATED_SECURITY (SQL_COPT_SS_BASE+3) // Force integrated security on login +#define SQL_COPT_SS_PRESERVE_CURSORS (SQL_COPT_SS_BASE+4) // Preserve server cursors after SQLTransact +#define SQL_COPT_SS_USER_DATA (SQL_COPT_SS_BASE+5) // dbgetuserdata/dbsetuserdata +#define SQL_COPT_SS_ENLIST_IN_DTC SQL_ATTR_ENLIST_IN_DTC // Enlist in a DTC transaction +#define SQL_COPT_SS_ENLIST_IN_XA SQL_ATTR_ENLIST_IN_XA // Enlist in a XA transaction +#define SQL_COPT_SS_FALLBACK_CONNECT (SQL_COPT_SS_BASE+10) // Enables FallBack connections +#define SQL_COPT_SS_PERF_DATA (SQL_COPT_SS_BASE+11) // Used to access SQL Server ODBC driver performance data +#define SQL_COPT_SS_PERF_DATA_LOG (SQL_COPT_SS_BASE+12) // Used to set the logfile name for the Performance data +#define SQL_COPT_SS_PERF_QUERY_INTERVAL (SQL_COPT_SS_BASE+13) // Used to set the query logging threshold in milliseconds. +#define SQL_COPT_SS_PERF_QUERY_LOG (SQL_COPT_SS_BASE+14) // Used to set the logfile name for saving queryies. +#define SQL_COPT_SS_PERF_QUERY (SQL_COPT_SS_BASE+15) // Used to start and stop query logging. +#define SQL_COPT_SS_PERF_DATA_LOG_NOW (SQL_COPT_SS_BASE+16) // Used to make a statistics log entry to disk. +#define SQL_COPT_SS_QUOTED_IDENT (SQL_COPT_SS_BASE+17) // Enable/Disable Quoted Identifiers +#define SQL_COPT_SS_ANSI_NPW (SQL_COPT_SS_BASE+18) // Enable/Disable ANSI NULL, Padding and Warnings +#define SQL_COPT_SS_BCP (SQL_COPT_SS_BASE+19) // Allow BCP usage on connection +#define SQL_COPT_SS_TRANSLATE (SQL_COPT_SS_BASE+20) // Perform code page translation +#define SQL_COPT_SS_ATTACHDBFILENAME (SQL_COPT_SS_BASE+21) // File name to be attached as a database +#define SQL_COPT_SS_CONCAT_NULL (SQL_COPT_SS_BASE+22) // Enable/Disable CONCAT_NULL_YIELDS_NULL +#define SQL_COPT_SS_ENCRYPT (SQL_COPT_SS_BASE+23) // Allow strong encryption for data +#define SQL_COPT_SS_MARS_ENABLED (SQL_COPT_SS_BASE+24) // Multiple active result set per connection +#define SQL_COPT_SS_FAILOVER_PARTNER (SQL_COPT_SS_BASE+25) // Failover partner server +#define SQL_COPT_SS_OLDPWD (SQL_COPT_SS_BASE+26) // Old Password, used when changing password during login +#define SQL_COPT_SS_TXN_ISOLATION (SQL_COPT_SS_BASE+27) // Used to set/get any driver-specific or ODBC-defined TXN iso level +#define SQL_COPT_SS_TRUST_SERVER_CERTIFICATE (SQL_COPT_SS_BASE+28) // Trust server certificate +#define SQL_COPT_SS_SERVER_SPN (SQL_COPT_SS_BASE+29) // Server SPN +#define SQL_COPT_SS_FAILOVER_PARTNER_SPN (SQL_COPT_SS_BASE+30) // Failover partner server SPN +#define SQL_COPT_SS_INTEGRATED_AUTHENTICATION_METHOD (SQL_COPT_SS_BASE+31) // The integrated authentication method used for the connection +#define SQL_COPT_SS_MUTUALLY_AUTHENTICATED (SQL_COPT_SS_BASE+32) // Used to decide if the connection is mutually authenticated +#define SQL_COPT_SS_CLIENT_CONNECTION_ID (SQL_COPT_SS_BASE+33) // Post connection attribute used to get the ConnectionID +#define SQL_COPT_SS_MAX_USED SQL_COPT_SS_CLIENT_CONNECTION_ID +// Define old names +#define SQL_REMOTE_PWD SQL_COPT_SS_REMOTE_PWD +#define SQL_USE_PROCEDURE_FOR_PREPARE SQL_COPT_SS_USE_PROC_FOR_PREP +#define SQL_INTEGRATED_SECURITY SQL_COPT_SS_INTEGRATED_SECURITY +#define SQL_PRESERVE_CURSORS SQL_COPT_SS_PRESERVE_CURSORS + +// SQLSetStmtAttr SQL Server Native Client driver specific defines. +// Statement attributes +#define SQL_SOPT_SS_BASE 1225 +#define SQL_SOPT_SS_TEXTPTR_LOGGING (SQL_SOPT_SS_BASE+0) // Text pointer logging +#define SQL_SOPT_SS_CURRENT_COMMAND (SQL_SOPT_SS_BASE+1) // dbcurcmd SQLGetStmtOption only +#define SQL_SOPT_SS_HIDDEN_COLUMNS (SQL_SOPT_SS_BASE+2) // Expose FOR BROWSE hidden columns +#define SQL_SOPT_SS_NOBROWSETABLE (SQL_SOPT_SS_BASE+3) // Set NOBROWSETABLE option +#define SQL_SOPT_SS_REGIONALIZE (SQL_SOPT_SS_BASE+4) // Regionalize output character conversions +#define SQL_SOPT_SS_CURSOR_OPTIONS (SQL_SOPT_SS_BASE+5) // Server cursor options +#define SQL_SOPT_SS_NOCOUNT_STATUS (SQL_SOPT_SS_BASE+6) // Real vs. Not Real row count indicator +#define SQL_SOPT_SS_DEFER_PREPARE (SQL_SOPT_SS_BASE+7) // Defer prepare until necessary +#define SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT (SQL_SOPT_SS_BASE+8) // Notification timeout +#define SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT (SQL_SOPT_SS_BASE+9) // Notification message text +#define SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS (SQL_SOPT_SS_BASE+10)// SQL service broker name +#define SQL_SOPT_SS_PARAM_FOCUS (SQL_SOPT_SS_BASE+11)// Direct subsequent calls to parameter related methods to set properties on constituent columns/parameters of container types +#define SQL_SOPT_SS_NAME_SCOPE (SQL_SOPT_SS_BASE+12)// Sets name scope for subsequent catalog function calls +#define SQL_SOPT_SS_MAX_USED SQL_SOPT_SS_NAME_SCOPE +// Define old names +#define SQL_TEXTPTR_LOGGING SQL_SOPT_SS_TEXTPTR_LOGGING +#define SQL_COPT_SS_BASE_EX 1240 +#define SQL_COPT_SS_BROWSE_CONNECT (SQL_COPT_SS_BASE_EX+1) // Browse connect mode of operation +#define SQL_COPT_SS_BROWSE_SERVER (SQL_COPT_SS_BASE_EX+2) // Single Server browse request. +#define SQL_COPT_SS_WARN_ON_CP_ERROR (SQL_COPT_SS_BASE_EX+3) // Issues warning when data from the server had a loss during code page conversion. +#define SQL_COPT_SS_CONNECTION_DEAD (SQL_COPT_SS_BASE_EX+4) // dbdead SQLGetConnectOption only. It will try to ping the server. Expensive connection check +#define SQL_COPT_SS_BROWSE_CACHE_DATA (SQL_COPT_SS_BASE_EX+5) // Determines if we should cache browse info. Used when returned buffer is greater then ODBC limit (32K) +#define SQL_COPT_SS_RESET_CONNECTION (SQL_COPT_SS_BASE_EX+6) // When this option is set, we will perform connection reset on next packet +#define SQL_COPT_SS_APPLICATION_INTENT (SQL_COPT_SS_BASE_EX+7) // Application Intent +#define SQL_COPT_SS_MULTISUBNET_FAILOVER (SQL_COPT_SS_BASE_EX+8) // Multi-subnet Failover +#define SQL_COPT_SS_EX_MAX_USED SQL_COPT_SS_MULTISUBNET_FAILOVER + +// SQLColAttributes driver specific defines. +// SQLSetDescField/SQLGetDescField driver specific defines. +// Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server Native Client driver usage. +#define SQL_CA_SS_BASE 1200 +#define SQL_CA_SS_COLUMN_SSTYPE (SQL_CA_SS_BASE+0) // dbcoltype/dbalttype +#define SQL_CA_SS_COLUMN_UTYPE (SQL_CA_SS_BASE+1) // dbcolutype/dbaltutype +#define SQL_CA_SS_NUM_ORDERS (SQL_CA_SS_BASE+2) // dbnumorders +#define SQL_CA_SS_COLUMN_ORDER (SQL_CA_SS_BASE+3) // dbordercol +#define SQL_CA_SS_COLUMN_VARYLEN (SQL_CA_SS_BASE+4) // dbvarylen +#define SQL_CA_SS_NUM_COMPUTES (SQL_CA_SS_BASE+5) // dbnumcompute +#define SQL_CA_SS_COMPUTE_ID (SQL_CA_SS_BASE+6) // dbnextrow status return +#define SQL_CA_SS_COMPUTE_BYLIST (SQL_CA_SS_BASE+7) // dbbylist +#define SQL_CA_SS_COLUMN_ID (SQL_CA_SS_BASE+8) // dbaltcolid +#define SQL_CA_SS_COLUMN_OP (SQL_CA_SS_BASE+9) // dbaltop +#define SQL_CA_SS_COLUMN_SIZE (SQL_CA_SS_BASE+10) // dbcollen +#define SQL_CA_SS_COLUMN_HIDDEN (SQL_CA_SS_BASE+11) // Column is hidden (FOR BROWSE) +#define SQL_CA_SS_COLUMN_KEY (SQL_CA_SS_BASE+12) // Column is key column (FOR BROWSE) +//#define SQL_DESC_BASE_COLUMN_NAME_OLD (SQL_CA_SS_BASE+13) // This is defined at another location. +#define SQL_CA_SS_COLUMN_COLLATION (SQL_CA_SS_BASE+14) // Column collation (only for chars) +#define SQL_CA_SS_VARIANT_TYPE (SQL_CA_SS_BASE+15) +#define SQL_CA_SS_VARIANT_SQL_TYPE (SQL_CA_SS_BASE+16) +#define SQL_CA_SS_VARIANT_SERVER_TYPE (SQL_CA_SS_BASE+17) + +// XML, CLR UDT, and table valued parameter related metadata +#define SQL_CA_SS_UDT_CATALOG_NAME (SQL_CA_SS_BASE+18) // UDT catalog name +#define SQL_CA_SS_UDT_SCHEMA_NAME (SQL_CA_SS_BASE+19) // UDT schema name +#define SQL_CA_SS_UDT_TYPE_NAME (SQL_CA_SS_BASE+20) // UDT type name +#define SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME (SQL_CA_SS_BASE+21) // Qualified name of the assembly containing the UDT class +#define SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME (SQL_CA_SS_BASE+22) // Name of the catalog that contains XML Schema collection +#define SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME (SQL_CA_SS_BASE+23) // Name of the schema that contains XML Schema collection +#define SQL_CA_SS_XML_SCHEMACOLLECTION_NAME (SQL_CA_SS_BASE+24) // Name of the XML Schema collection +#define SQL_CA_SS_CATALOG_NAME (SQL_CA_SS_BASE+25) // Catalog name +#define SQL_CA_SS_SCHEMA_NAME (SQL_CA_SS_BASE+26) // Schema name +#define SQL_CA_SS_TYPE_NAME (SQL_CA_SS_BASE+27) // Type name + +// table valued parameter related metadata +#define SQL_CA_SS_COLUMN_COMPUTED (SQL_CA_SS_BASE+29) // column is computed +#define SQL_CA_SS_COLUMN_IN_UNIQUE_KEY (SQL_CA_SS_BASE+30) // column is part of a unique key +#define SQL_CA_SS_COLUMN_SORT_ORDER (SQL_CA_SS_BASE+31) // column sort order +#define SQL_CA_SS_COLUMN_SORT_ORDINAL (SQL_CA_SS_BASE+32) // column sort ordinal +#define SQL_CA_SS_COLUMN_HAS_DEFAULT_VALUE (SQL_CA_SS_BASE+33) // column has default value for all rows of the table valued parameter + +// sparse column related metadata +#define SQL_CA_SS_IS_COLUMN_SET (SQL_CA_SS_BASE+34) // column is a column-set column for sparse columns + +// Legacy datetime related metadata +#define SQL_CA_SS_SERVER_TYPE (SQL_CA_SS_BASE+35) // column type to send on the wire for datetime types + +#define SQL_CA_SS_MAX_USED (SQL_CA_SS_BASE+36) + +// Defines returned by SQL_ATTR_CURSOR_TYPE/SQL_CURSOR_TYPE +#define SQL_CURSOR_FAST_FORWARD_ONLY 8 // Only returned by SQLGetStmtAttr/Option +// Defines for use with SQL_COPT_SS_USE_PROC_FOR_PREP +#define SQL_UP_OFF 0L // Procedures won't be used for prepare +#define SQL_UP_ON 1L // Procedures will be used for prepare +#define SQL_UP_ON_DROP 2L // Temp procedures will be explicitly dropped +#define SQL_UP_DEFAULT SQL_UP_ON +// Defines for use with SQL_COPT_SS_INTEGRATED_SECURITY - Pre-Connect Option only +#define SQL_IS_OFF 0L // Integrated security isn't used +#define SQL_IS_ON 1L // Integrated security is used +#define SQL_IS_DEFAULT SQL_IS_OFF +// Defines for use with SQL_COPT_SS_PRESERVE_CURSORS +#define SQL_PC_OFF 0L // Cursors are closed on SQLTransact +#define SQL_PC_ON 1L // Cursors remain open on SQLTransact +#define SQL_PC_DEFAULT SQL_PC_OFF +// Defines for use with SQL_COPT_SS_USER_DATA +#define SQL_UD_NOTSET NULL // No user data pointer set +// Defines for use with SQL_COPT_SS_TRANSLATE +#define SQL_XL_OFF 0L // Code page translation is not performed +#define SQL_XL_ON 1L // Code page translation is performed +#define SQL_XL_DEFAULT SQL_XL_ON +// Defines for use with SQL_COPT_SS_FALLBACK_CONNECT - Pre-Connect Option only +#define SQL_FB_OFF 0L // FallBack connections are disabled +#define SQL_FB_ON 1L // FallBack connections are enabled +#define SQL_FB_DEFAULT SQL_FB_OFF +// Defines for use with SQL_COPT_SS_BCP - Pre-Connect Option only +#define SQL_BCP_OFF 0L // BCP is not allowed on connection +#define SQL_BCP_ON 1L // BCP is allowed on connection +#define SQL_BCP_DEFAULT SQL_BCP_OFF +// Defines for use with SQL_COPT_SS_QUOTED_IDENT +#define SQL_QI_OFF 0L // Quoted identifiers are enable +#define SQL_QI_ON 1L // Quoted identifiers are disabled +#define SQL_QI_DEFAULT SQL_QI_ON +// Defines for use with SQL_COPT_SS_ANSI_NPW - Pre-Connect Option only +#define SQL_AD_OFF 0L // ANSI NULLs, Padding and Warnings are enabled +#define SQL_AD_ON 1L // ANSI NULLs, Padding and Warnings are disabled +#define SQL_AD_DEFAULT SQL_AD_ON +// Defines for use with SQL_COPT_SS_CONCAT_NULL - Pre-Connect Option only +#define SQL_CN_OFF 0L // CONCAT_NULL_YIELDS_NULL is off +#define SQL_CN_ON 1L // CONCAT_NULL_YIELDS_NULL is on +#define SQL_CN_DEFAULT SQL_CN_ON +// Defines for use with SQL_SOPT_SS_TEXTPTR_LOGGING +#define SQL_TL_OFF 0L // No logging on text pointer ops +#define SQL_TL_ON 1L // Logging occurs on text pointer ops +#define SQL_TL_DEFAULT SQL_TL_ON +// Defines for use with SQL_SOPT_SS_HIDDEN_COLUMNS +#define SQL_HC_OFF 0L // FOR BROWSE columns are hidden +#define SQL_HC_ON 1L // FOR BROWSE columns are exposed +#define SQL_HC_DEFAULT SQL_HC_OFF +// Defines for use with SQL_SOPT_SS_NOBROWSETABLE +#define SQL_NB_OFF 0L // NO_BROWSETABLE is off +#define SQL_NB_ON 1L // NO_BROWSETABLE is on +#define SQL_NB_DEFAULT SQL_NB_OFF +// Defines for use with SQL_SOPT_SS_REGIONALIZE +#define SQL_RE_OFF 0L // No regionalization occurs on output character conversions +#define SQL_RE_ON 1L // Regionalization occurs on output character conversions +#define SQL_RE_DEFAULT SQL_RE_OFF +// Defines for use with SQL_SOPT_SS_CURSOR_OPTIONS +#define SQL_CO_OFF 0L // Clear all cursor options +#define SQL_CO_FFO 1L // Fast-forward cursor will be used +#define SQL_CO_AF 2L // Autofetch on cursor open +#define SQL_CO_FFO_AF (SQL_CO_FFO|SQL_CO_AF) // Fast-forward cursor with autofetch +#define SQL_CO_FIREHOSE_AF 4L // Auto fetch on fire-hose cursors +#define SQL_CO_DEFAULT SQL_CO_OFF +//SQL_SOPT_SS_NOCOUNT_STATUS +#define SQL_NC_OFF 0L +#define SQL_NC_ON 1L +//SQL_SOPT_SS_DEFER_PREPARE +#define SQL_DP_OFF 0L +#define SQL_DP_ON 1L +//SQL_SOPT_SS_NAME_SCOPE +#define SQL_SS_NAME_SCOPE_TABLE 0L +#define SQL_SS_NAME_SCOPE_TABLE_TYPE 1L +#define SQL_SS_NAME_SCOPE_EXTENDED 2L +#define SQL_SS_NAME_SCOPE_SPARSE_COLUMN_SET 3L +#define SQL_SS_NAME_SCOPE_DEFAULT SQL_SS_NAME_SCOPE_TABLE +//SQL_COPT_SS_ENCRYPT +#define SQL_EN_OFF 0L +#define SQL_EN_ON 1L +//SQL_COPT_SS_TRUST_SERVER_CERTIFICATE +#define SQL_TRUST_SERVER_CERTIFICATE_NO 0L +#define SQL_TRUST_SERVER_CERTIFICATE_YES 1L +//SQL_COPT_SS_BROWSE_CONNECT +#define SQL_MORE_INFO_NO 0L +#define SQL_MORE_INFO_YES 1L +//SQL_COPT_SS_BROWSE_CACHE_DATA +#define SQL_CACHE_DATA_NO 0L +#define SQL_CACHE_DATA_YES 1L +//SQL_COPT_SS_RESET_CONNECTION +#define SQL_RESET_YES 1L +//SQL_COPT_SS_WARN_ON_CP_ERROR +#define SQL_WARN_NO 0L +#define SQL_WARN_YES 1L +//SQL_COPT_SS_MARS_ENABLED +#define SQL_MARS_ENABLED_NO 0L +#define SQL_MARS_ENABLED_YES 1L +/* SQL_TXN_ISOLATION_OPTION bitmasks */ +#define SQL_TXN_SS_SNAPSHOT 0x00000020L + +// The following are defines for SQL_CA_SS_COLUMN_SORT_ORDER +#define SQL_SS_ORDER_UNSPECIFIED 0L +#define SQL_SS_DESCENDING_ORDER 1L +#define SQL_SS_ASCENDING_ORDER 2L +#define SQL_SS_ORDER_DEFAULT SQL_SS_ORDER_UNSPECIFIED + +// Driver specific SQL data type defines. +// Microsoft has -150 thru -199 reserved for Microsoft SQL Server Native Client driver usage. +#define SQL_SS_VARIANT (-150) +#define SQL_SS_UDT (-151) +#define SQL_SS_XML (-152) +#define SQL_SS_TABLE (-153) +#define SQL_SS_TIME2 (-154) +#define SQL_SS_TIMESTAMPOFFSET (-155) + +// Local types to be used with SQL_CA_SS_SERVER_TYPE +#define SQL_SS_TYPE_DEFAULT 0L +#define SQL_SS_TYPE_SMALLDATETIME 1L +#define SQL_SS_TYPE_DATETIME 2L + +// Extended C Types range 4000 and above. Range of -100 thru 200 is reserved by Driver Manager. +#define SQL_C_TYPES_EXTENDED 0x04000L +#define SQL_C_SS_TIME2 (SQL_C_TYPES_EXTENDED+0) +#define SQL_C_SS_TIMESTAMPOFFSET (SQL_C_TYPES_EXTENDED+1) + +#ifndef SQLNCLI_NO_BCP +// Define the symbol SQLNCLI_NO_BCP if you are not using BCP in your application +// and you want to exclude the BCP-related definitions in this header file. + +// SQL Server Data Type defines. +// New types for SQL 6.0 and later servers +#define SQLTEXT 0x23 +#define SQLVARBINARY 0x25 +#define SQLINTN 0x26 +#define SQLVARCHAR 0x27 +#define SQLBINARY 0x2d +#define SQLIMAGE 0x22 +#define SQLCHARACTER 0x2f +#define SQLINT1 0x30 +#define SQLBIT 0x32 +#define SQLINT2 0x34 +#define SQLINT4 0x38 +#define SQLMONEY 0x3c +#define SQLDATETIME 0x3d +#define SQLFLT8 0x3e +#define SQLFLTN 0x6d +#define SQLMONEYN 0x6e +#define SQLDATETIMN 0x6f +#define SQLFLT4 0x3b +#define SQLMONEY4 0x7a +#define SQLDATETIM4 0x3a +// New types for SQL 6.0 and later servers +#define SQLDECIMAL 0x6a +#define SQLNUMERIC 0x6c +// New types for SQL 7.0 and later servers +#define SQLUNIQUEID 0x24 +#define SQLBIGCHAR 0xaf +#define SQLBIGVARCHAR 0xa7 +#define SQLBIGBINARY 0xad +#define SQLBIGVARBINARY 0xa5 +#define SQLBITN 0x68 +#define SQLNCHAR 0xef +#define SQLNVARCHAR 0xe7 +#define SQLNTEXT 0x63 +// New types for SQL 2000 and later servers +#define SQLINT8 0x7f +#define SQLVARIANT 0x62 +// New types for SQL 2005 and later servers +#define SQLUDT 0xf0 +#define SQLXML 0xf1 +// New types for SQL 2008 and later servers +#define SQLTABLE 0xf3 +#define SQLDATEN 0x28 +#define SQLTIMEN 0x29 +#define SQLDATETIME2N 0x2a +#define SQLDATETIMEOFFSETN 0x2b +// Define old names +#define SQLDECIMALN 0x6a +#define SQLNUMERICN 0x6c +#endif // SQLNCLI_NO_BCP + +// SQL_SS_LENGTH_UNLIMITED is used to describe the max length of +// VARCHAR(max), VARBINARY(max), NVARCHAR(max), and XML columns +#define SQL_SS_LENGTH_UNLIMITED 0 + +// User Data Type definitions. +// Returned by SQLColAttributes/SQL_CA_SS_COLUMN_UTYPE. +#define SQLudtBINARY 3 +#define SQLudtBIT 16 +#define SQLudtBITN 0 +#define SQLudtCHAR 1 +#define SQLudtDATETIM4 22 +#define SQLudtDATETIME 12 +#define SQLudtDATETIMN 15 +#define SQLudtDECML 24 +#define SQLudtDECMLN 26 +#define SQLudtFLT4 23 +#define SQLudtFLT8 8 +#define SQLudtFLTN 14 +#define SQLudtIMAGE 20 +#define SQLudtINT1 5 +#define SQLudtINT2 6 +#define SQLudtINT4 7 +#define SQLudtINTN 13 +#define SQLudtMONEY 11 +#define SQLudtMONEY4 21 +#define SQLudtMONEYN 17 +#define SQLudtNUM 10 +#define SQLudtNUMN 25 +#define SQLudtSYSNAME 18 +#define SQLudtTEXT 19 +#define SQLudtTIMESTAMP 80 +#define SQLudtUNIQUEIDENTIFIER 0 +#define SQLudtVARBINARY 4 +#define SQLudtVARCHAR 2 +#define MIN_USER_DATATYPE 256 +// Aggregate operator types. +// Returned by SQLColAttributes/SQL_CA_SS_COLUMN_OP. +#define SQLAOPSTDEV 0x30 // Standard deviation +#define SQLAOPSTDEVP 0x31 // Standard deviation population +#define SQLAOPVAR 0x32 // Variance +#define SQLAOPVARP 0x33 // Variance population +#define SQLAOPCNT 0x4b // Count +#define SQLAOPSUM 0x4d // Sum +#define SQLAOPAVG 0x4f // Average +#define SQLAOPMIN 0x51 // Min +#define SQLAOPMAX 0x52 // Max +#define SQLAOPANY 0x53 // Any +#define SQLAOPNOOP 0x56 // None +// SQLGetInfo driver specific defines. +// Microsoft has 1151 thru 1200 reserved for Microsoft SQL Server Native Client driver usage. +#define SQL_INFO_SS_FIRST 1199 +#define SQL_INFO_SS_NETLIB_NAMEW (SQL_INFO_SS_FIRST+0) // dbprocinfo +#define SQL_INFO_SS_NETLIB_NAMEA (SQL_INFO_SS_FIRST+1) // dbprocinfo +#define SQL_INFO_SS_MAX_USED SQL_INFO_SS_NETLIB_NAMEA +#ifdef UNICODE +#define SQL_INFO_SS_NETLIB_NAME SQL_INFO_SS_NETLIB_NAMEW +#else +#define SQL_INFO_SS_NETLIB_NAME SQL_INFO_SS_NETLIB_NAMEA +#endif +// SQLGetDiagField driver specific defines. +// Microsoft has -1150 thru -1199 reserved for Microsoft SQL Server Native Client driver usage. +#define SQL_DIAG_SS_BASE (-1150) +#define SQL_DIAG_SS_MSGSTATE (SQL_DIAG_SS_BASE) +#define SQL_DIAG_SS_SEVERITY (SQL_DIAG_SS_BASE-1) +#define SQL_DIAG_SS_SRVNAME (SQL_DIAG_SS_BASE-2) +#define SQL_DIAG_SS_PROCNAME (SQL_DIAG_SS_BASE-3) +#define SQL_DIAG_SS_LINE (SQL_DIAG_SS_BASE-4) +// SQLGetDiagField/SQL_DIAG_DYNAMIC_FUNCTION_CODE driver specific defines. +// Microsoft has -200 thru -299 reserved for Microsoft SQL Server Native Client driver usage. +#define SQL_DIAG_DFC_SS_BASE (-200) +#define SQL_DIAG_DFC_SS_ALTER_DATABASE (SQL_DIAG_DFC_SS_BASE-0) +#define SQL_DIAG_DFC_SS_CHECKPOINT (SQL_DIAG_DFC_SS_BASE-1) +#define SQL_DIAG_DFC_SS_CONDITION (SQL_DIAG_DFC_SS_BASE-2) +#define SQL_DIAG_DFC_SS_CREATE_DATABASE (SQL_DIAG_DFC_SS_BASE-3) +#define SQL_DIAG_DFC_SS_CREATE_DEFAULT (SQL_DIAG_DFC_SS_BASE-4) +#define SQL_DIAG_DFC_SS_CREATE_PROCEDURE (SQL_DIAG_DFC_SS_BASE-5) +#define SQL_DIAG_DFC_SS_CREATE_RULE (SQL_DIAG_DFC_SS_BASE-6) +#define SQL_DIAG_DFC_SS_CREATE_TRIGGER (SQL_DIAG_DFC_SS_BASE-7) +#define SQL_DIAG_DFC_SS_CURSOR_DECLARE (SQL_DIAG_DFC_SS_BASE-8) +#define SQL_DIAG_DFC_SS_CURSOR_OPEN (SQL_DIAG_DFC_SS_BASE-9) +#define SQL_DIAG_DFC_SS_CURSOR_FETCH (SQL_DIAG_DFC_SS_BASE-10) +#define SQL_DIAG_DFC_SS_CURSOR_CLOSE (SQL_DIAG_DFC_SS_BASE-11) +#define SQL_DIAG_DFC_SS_DEALLOCATE_CURSOR (SQL_DIAG_DFC_SS_BASE-12) +#define SQL_DIAG_DFC_SS_DBCC (SQL_DIAG_DFC_SS_BASE-13) +#define SQL_DIAG_DFC_SS_DISK (SQL_DIAG_DFC_SS_BASE-14) +#define SQL_DIAG_DFC_SS_DROP_DATABASE (SQL_DIAG_DFC_SS_BASE-15) +#define SQL_DIAG_DFC_SS_DROP_DEFAULT (SQL_DIAG_DFC_SS_BASE-16) +#define SQL_DIAG_DFC_SS_DROP_PROCEDURE (SQL_DIAG_DFC_SS_BASE-17) +#define SQL_DIAG_DFC_SS_DROP_RULE (SQL_DIAG_DFC_SS_BASE-18) +#define SQL_DIAG_DFC_SS_DROP_TRIGGER (SQL_DIAG_DFC_SS_BASE-19) +#define SQL_DIAG_DFC_SS_DUMP_DATABASE (SQL_DIAG_DFC_SS_BASE-20) +#define SQL_DIAG_DFC_SS_BACKUP_DATABASE (SQL_DIAG_DFC_SS_BASE-20) +#define SQL_DIAG_DFC_SS_DUMP_TABLE (SQL_DIAG_DFC_SS_BASE-21) +#define SQL_DIAG_DFC_SS_DUMP_TRANSACTION (SQL_DIAG_DFC_SS_BASE-22) +#define SQL_DIAG_DFC_SS_BACKUP_TRANSACTION (SQL_DIAG_DFC_SS_BASE-22) +#define SQL_DIAG_DFC_SS_GOTO (SQL_DIAG_DFC_SS_BASE-23) +#define SQL_DIAG_DFC_SS_INSERT_BULK (SQL_DIAG_DFC_SS_BASE-24) +#define SQL_DIAG_DFC_SS_KILL (SQL_DIAG_DFC_SS_BASE-25) +#define SQL_DIAG_DFC_SS_LOAD_DATABASE (SQL_DIAG_DFC_SS_BASE-26) +#define SQL_DIAG_DFC_SS_RESTORE_DATABASE (SQL_DIAG_DFC_SS_BASE-26) +#define SQL_DIAG_DFC_SS_LOAD_HEADERONLY (SQL_DIAG_DFC_SS_BASE-27) +#define SQL_DIAG_DFC_SS_RESTORE_HEADERONLY (SQL_DIAG_DFC_SS_BASE-27) +#define SQL_DIAG_DFC_SS_LOAD_TABLE (SQL_DIAG_DFC_SS_BASE-28) +#define SQL_DIAG_DFC_SS_LOAD_TRANSACTION (SQL_DIAG_DFC_SS_BASE-29) +#define SQL_DIAG_DFC_SS_RESTORE_TRANSACTION (SQL_DIAG_DFC_SS_BASE-29) +#define SQL_DIAG_DFC_SS_PRINT (SQL_DIAG_DFC_SS_BASE-30) +#define SQL_DIAG_DFC_SS_RAISERROR (SQL_DIAG_DFC_SS_BASE-31) +#define SQL_DIAG_DFC_SS_READTEXT (SQL_DIAG_DFC_SS_BASE-32) +#define SQL_DIAG_DFC_SS_RECONFIGURE (SQL_DIAG_DFC_SS_BASE-33) +#define SQL_DIAG_DFC_SS_RETURN (SQL_DIAG_DFC_SS_BASE-34) +#define SQL_DIAG_DFC_SS_SELECT_INTO (SQL_DIAG_DFC_SS_BASE-35) +#define SQL_DIAG_DFC_SS_SET (SQL_DIAG_DFC_SS_BASE-36) +#define SQL_DIAG_DFC_SS_SET_IDENTITY_INSERT (SQL_DIAG_DFC_SS_BASE-37) +#define SQL_DIAG_DFC_SS_SET_ROW_COUNT (SQL_DIAG_DFC_SS_BASE-38) +#define SQL_DIAG_DFC_SS_SET_STATISTICS (SQL_DIAG_DFC_SS_BASE-39) +#define SQL_DIAG_DFC_SS_SET_TEXTSIZE (SQL_DIAG_DFC_SS_BASE-40) +#define SQL_DIAG_DFC_SS_SETUSER (SQL_DIAG_DFC_SS_BASE-41) +#define SQL_DIAG_DFC_SS_SHUTDOWN (SQL_DIAG_DFC_SS_BASE-42) +#define SQL_DIAG_DFC_SS_TRANS_BEGIN (SQL_DIAG_DFC_SS_BASE-43) +#define SQL_DIAG_DFC_SS_TRANS_COMMIT (SQL_DIAG_DFC_SS_BASE-44) +#define SQL_DIAG_DFC_SS_TRANS_PREPARE (SQL_DIAG_DFC_SS_BASE-45) +#define SQL_DIAG_DFC_SS_TRANS_ROLLBACK (SQL_DIAG_DFC_SS_BASE-46) +#define SQL_DIAG_DFC_SS_TRANS_SAVE (SQL_DIAG_DFC_SS_BASE-47) +#define SQL_DIAG_DFC_SS_TRUNCATE_TABLE (SQL_DIAG_DFC_SS_BASE-48) +#define SQL_DIAG_DFC_SS_UPDATE_STATISTICS (SQL_DIAG_DFC_SS_BASE-49) +#define SQL_DIAG_DFC_SS_UPDATETEXT (SQL_DIAG_DFC_SS_BASE-50) +#define SQL_DIAG_DFC_SS_USE (SQL_DIAG_DFC_SS_BASE-51) +#define SQL_DIAG_DFC_SS_WAITFOR (SQL_DIAG_DFC_SS_BASE-52) +#define SQL_DIAG_DFC_SS_WRITETEXT (SQL_DIAG_DFC_SS_BASE-53) +#define SQL_DIAG_DFC_SS_DENY (SQL_DIAG_DFC_SS_BASE-54) +#define SQL_DIAG_DFC_SS_SET_XCTLVL (SQL_DIAG_DFC_SS_BASE-55) +#define SQL_DIAG_DFC_SS_MERGE (SQL_DIAG_DFC_SS_BASE-56) + +// Severity codes for SQL_DIAG_SS_SEVERITY +#define EX_ANY 0 +#define EX_INFO 10 +#define EX_MAXISEVERITY EX_INFO +#define EX_MISSING 11 +#define EX_TYPE 12 +#define EX_DEADLOCK 13 +#define EX_PERMIT 14 +#define EX_SYNTAX 15 +#define EX_USER 16 +#define EX_RESOURCE 17 +#define EX_INTOK 18 +#define MAXUSEVERITY EX_INTOK +#define EX_LIMIT 19 +#define EX_CMDFATAL 20 +#define MINFATALERR EX_CMDFATAL +#define EX_DBFATAL 21 +#define EX_TABCORRUPT 22 +#define EX_DBCORRUPT 23 +#define EX_HARDWARE 24 +#define EX_CONTROL 25 +// Internal server datatypes - used when binding to SQL_C_BINARY +#ifndef MAXNUMERICLEN // Resolve ODS/DBLib conflicts +// DB-Library datatypes +#define DBMAXCHAR (8000+1) // Max length of DBVARBINARY and DBVARCHAR, etc. +1 for zero byte +#define MAXNAME (SQL_MAX_SQLSERVERNAME+1) // Max server identifier length including zero byte +#ifdef UNICODE +typedef wchar_t DBCHAR; +#else +typedef char DBCHAR; + +#endif +typedef short SQLSMALLINT; + +typedef unsigned short SQLUSMALLINT; + +typedef unsigned char DBBINARY; + +typedef unsigned char DBTINYINT; + +typedef short DBSMALLINT; + +typedef unsigned short DBUSMALLINT; + +typedef double DBFLT8; + +typedef unsigned char DBBIT; + +typedef unsigned char DBBOOL; + +typedef float DBFLT4; + +typedef DBFLT4 DBREAL; + +typedef UINT DBUBOOL; + +typedef struct dbmoney + { + LONG mnyhigh; + ULONG mnylow; + } DBMONEY; + +typedef struct dbdatetime + { + LONG dtdays; + ULONG dttime; + } DBDATETIME; + +typedef struct dbdatetime4 + { + USHORT numdays; + USHORT nummins; + } DBDATETIM4; + +typedef LONG DBMONEY4; + +#include // 8-byte structure packing + +// New Date Time Structures +// New Structure for TIME2 +typedef struct tagSS_TIME2_STRUCT +{ + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + SQLUINTEGER fraction; +} SQL_SS_TIME2_STRUCT; +// New Structure for TIMESTAMPOFFSET +typedef struct tagSS_TIMESTAMPOFFSET_STRUCT +{ + SQLSMALLINT year; + SQLUSMALLINT month; + SQLUSMALLINT day; + SQLUSMALLINT hour; + SQLUSMALLINT minute; + SQLUSMALLINT second; + SQLUINTEGER fraction; + SQLSMALLINT timezone_hour; + SQLSMALLINT timezone_minute; +} SQL_SS_TIMESTAMPOFFSET_STRUCT; +#include // restore original structure packing + +// Money value *10,000 +#define DBNUM_PREC_TYPE BYTE +#define DBNUM_SCALE_TYPE BYTE +#define DBNUM_VAL_TYPE BYTE + +#if (ODBCVER < 0x0300) +#define MAXNUMERICLEN 16 +typedef struct dbnumeric // Internal representation of NUMERIC data type +{ + DBNUM_PREC_TYPE precision; // Precision + DBNUM_SCALE_TYPE scale; // Scale + BYTE sign; // Sign (1 if positive, 0 if negative) + DBNUM_VAL_TYPE val[MAXNUMERICLEN];// Value +} DBNUMERIC; +typedef DBNUMERIC DBDECIMAL;// Internal representation of DECIMAL data type +#else // Use ODBC 3.0 definitions since same as DBLib +#define MAXNUMERICLEN SQL_MAX_NUMERIC_LEN +typedef SQL_NUMERIC_STRUCT DBNUMERIC; +typedef SQL_NUMERIC_STRUCT DBDECIMAL; +#endif // ODCBVER +#endif // MAXNUMERICLEN + +#ifndef INT +typedef int INT; +typedef long DBINT; +typedef DBINT * LPDBINT; +#ifndef _LPCBYTE_DEFINED +#define _LPCBYTE_DEFINED +typedef BYTE const* LPCBYTE; +#endif //_LPCBYTE_DEFINED +#endif // INT +/************************************************************************** +This struct is a global used for gathering statistical data on the driver. +Access to this structure is controlled via the pStatCrit; +***************************************************************************/ +typedef struct sqlperf +{ + // Application Profile Statistics + DWORD TimerResolution; + DWORD SQLidu; + DWORD SQLiduRows; + DWORD SQLSelects; + DWORD SQLSelectRows; + DWORD Transactions; + DWORD SQLPrepares; + DWORD ExecDirects; + DWORD SQLExecutes; + DWORD CursorOpens; + DWORD CursorSize; + DWORD CursorUsed; + LDOUBLE PercentCursorUsed; + LDOUBLE AvgFetchTime; + LDOUBLE AvgCursorSize; + LDOUBLE AvgCursorUsed; + DWORD SQLFetchTime; + DWORD SQLFetchCount; + DWORD CurrentStmtCount; + DWORD MaxOpenStmt; + DWORD SumOpenStmt; + // Connection Statistics + DWORD CurrentConnectionCount; + DWORD MaxConnectionsOpened; + DWORD SumConnectionsOpened; + DWORD SumConnectiontime; + LDOUBLE AvgTimeOpened; + // Network Statistics + DWORD ServerRndTrips; + DWORD BuffersSent; + DWORD BuffersRec; + DWORD BytesSent; + DWORD BytesRec; + // Time Statistics; + DWORD msExecutionTime; + DWORD msNetWorkServerTime; +} SQLPERF; +// The following are options for SQL_COPT_SS_PERF_DATA and SQL_COPT_SS_PERF_QUERY +#define SQL_PERF_START 1 // Starts the driver sampling performance data. +#define SQL_PERF_STOP 2 // Stops the counters from sampling performance data. +// The following are defines for SQL_COPT_SS_PERF_DATA_LOG +#define SQL_SS_DL_DEFAULT TEXT("STATS.LOG") +// The following are defines for SQL_COPT_SS_PERF_QUERY_LOG +#define SQL_SS_QL_DEFAULT TEXT("QUERY.LOG") +// The following are defines for SQL_COPT_SS_PERF_QUERY_INTERVAL +#define SQL_SS_QI_DEFAULT 30000 // 30,000 milliseconds + +#ifndef SQLNCLI_NO_BCP +// Define the symbol SQLNCLI_NO_BCP if you are not using BCP in your application +// and you want to exclude the BCP-related definitions in this header file. + +// ODBC BCP prototypes and defines +// Return codes +#define SUCCEED 1 +#define FAIL 0 +#define SUCCEED_ABORT 2 +#define SUCCEED_ASYNC 3 +// Transfer directions +#define DB_IN 1 // Transfer from client to server +#define DB_OUT 2 // Transfer from server to client +// bcp_control option +#define BCPMAXERRS 1 // Sets max errors allowed +#define BCPFIRST 2 // Sets first row to be copied out +#define BCPLAST 3 // Sets number of rows to be copied out +#define BCPBATCH 4 // Sets input batch size +#define BCPKEEPNULLS 5 // Sets to insert NULLs for empty input values +#define BCPABORT 6 // Sets to have bcpexec return SUCCEED_ABORT +#define BCPODBC 7 // Sets ODBC canonical character output +#define BCPKEEPIDENTITY 8 // Sets IDENTITY_INSERT on +#if SQLNCLI_VER < 1000 +#define BCP6xFILEFMT 9 // DEPRECATED: Sets 6x file format on +#endif +#define BCPHINTSA 10 // Sets server BCP hints (ANSI string) +#define BCPHINTSW 11 // Sets server BCP hints (UNICODE string) +#define BCPFILECP 12 // Sets clients code page for the file +#define BCPUNICODEFILE 13 // Sets that the file contains unicode header +#define BCPTEXTFILE 14 // Sets BCP mode to expect a text file and to detect Unicode or ANSI automatically +#define BCPFILEFMT 15 // Sets file format version +#define BCPFMTXML 16 // Sets the format file type to xml +#define BCPFIRSTEX 17 // Starting Row for BCP operation (64 bit) +#define BCPLASTEX 18 // Ending Row for BCP operation (64 bit) +#define BCPROWCOUNT 19 // Total Number of Rows Copied (64 bit) +#define BCPDELAYREADFMT 20 // Delay reading format file unil bcp_exec +// BCPFILECP values +// Any valid code page that is installed on the client can be passed plus: +#define BCPFILECP_ACP 0 // Data in file is in Windows code page +#define BCPFILECP_OEMCP 1 // Data in file is in OEM code page (default) +#define BCPFILECP_RAW (-1)// Data in file is in Server code page (no conversion) +// bcp_collen definition +#define SQL_VARLEN_DATA (-10) // Use default length for column +// BCP column format properties +#define BCP_FMT_TYPE 0x01 +#define BCP_FMT_INDICATOR_LEN 0x02 +#define BCP_FMT_DATA_LEN 0x03 +#define BCP_FMT_TERMINATOR 0x04 +#define BCP_FMT_SERVER_COL 0x05 +#define BCP_FMT_COLLATION 0x06 +#define BCP_FMT_COLLATION_ID 0x07 +// bcp_setbulkmode properties +#define BCP_OUT_CHARACTER_MODE 0x01 +#define BCP_OUT_WIDE_CHARACTER_MODE 0x02 +#define BCP_OUT_NATIVE_TEXT_MODE 0x03 +#define BCP_OUT_NATIVE_MODE 0x04 +// BCP functions +DBINT SQL_API bcp_batch (HDBC); +RETCODE SQL_API bcp_bind (HDBC, LPCBYTE, INT, DBINT, LPCBYTE, INT, INT, INT); +RETCODE SQL_API bcp_colfmt (HDBC, INT, BYTE, INT, DBINT, LPCBYTE, INT, INT); +RETCODE SQL_API bcp_collen (HDBC, DBINT, INT); +RETCODE SQL_API bcp_colptr (HDBC, LPCBYTE, INT); +RETCODE SQL_API bcp_columns (HDBC, INT); +RETCODE SQL_API bcp_control (HDBC, INT, void *); +DBINT SQL_API bcp_done (HDBC); +RETCODE SQL_API bcp_exec (HDBC, LPDBINT); +RETCODE SQL_API bcp_getcolfmt (HDBC, INT, INT, void *, INT, INT *); +RETCODE SQL_API bcp_initA (HDBC, LPCSTR, LPCSTR, LPCSTR, INT); +RETCODE SQL_API bcp_initW (HDBC, LPCWSTR, LPCWSTR, LPCWSTR, INT); +RETCODE SQL_API bcp_moretext (HDBC, DBINT, LPCBYTE); +RETCODE SQL_API bcp_readfmtA (HDBC, LPCSTR); +RETCODE SQL_API bcp_readfmtW (HDBC, LPCWSTR); +RETCODE SQL_API bcp_sendrow (HDBC); +RETCODE SQL_API bcp_setbulkmode (HDBC, INT, __in_bcount(cbField) void*, INT cbField, __in_bcount(cbRow) void *, INT cbRow); +RETCODE SQL_API bcp_setcolfmt (HDBC, INT, INT, void *, INT); +RETCODE SQL_API bcp_writefmtA (HDBC, LPCSTR); +RETCODE SQL_API bcp_writefmtW (HDBC, LPCWSTR); +CHAR* SQL_API dbprtypeA (INT); +WCHAR* SQL_API dbprtypeW (INT); +CHAR* SQL_API bcp_gettypenameA (INT, DBBOOL); +WCHAR* SQL_API bcp_gettypenameW (INT, DBBOOL); +#ifdef UNICODE +#define bcp_init bcp_initW +#define bcp_readfmt bcp_readfmtW +#define bcp_writefmt bcp_writefmtW +#define dbprtype dbprtypeW +#define bcp_gettypename bcp_gettypenameW +#define BCPHINTS BCPHINTSW +#else +#define bcp_init bcp_initA +#define bcp_readfmt bcp_readfmtA +#define bcp_writefmt bcp_writefmtA +#define dbprtype dbprtypeA +#define bcp_gettypename bcp_gettypenameA +#define BCPHINTS BCPHINTSA +#endif // UNICODE + +#endif // SQLNCLI_NO_BCP + +// The following options have been deprecated +#define SQL_FAST_CONNECT (SQL_COPT_SS_BASE+0) +// Defines for use with SQL_FAST_CONNECT - only useable before connecting +#define SQL_FC_OFF 0L // Fast connect is off +#define SQL_FC_ON 1L // Fast connect is on +#define SQL_FC_DEFAULT SQL_FC_OFF +#define SQL_COPT_SS_ANSI_OEM (SQL_COPT_SS_BASE+6) +#define SQL_AO_OFF 0L +#define SQL_AO_ON 1L +#define SQL_AO_DEFAULT SQL_AO_OFF +#define SQL_CA_SS_BASE_COLUMN_NAME SQL_DESC_BASE_COLUMN_NAME + +#endif // ODBCVER +#endif // defined(_SQLNCLI_ODBC_) || !defined(_SQLNCLI_OLEDB_) +// ODBC part of SQL Server Native Client header - end here! + +//The following facilitates opening a handle to a SQL filestream +typedef enum _SQL_FILESTREAM_DESIRED_ACCESS { + SQL_FILESTREAM_READ = 0, + SQL_FILESTREAM_WRITE = 1, + SQL_FILESTREAM_READWRITE = 2 +} SQL_FILESTREAM_DESIRED_ACCESS; +#define SQL_FILESTREAM_OPEN_FLAG_ASYNC 0x00000001L +#define SQL_FILESTREAM_OPEN_FLAG_NO_BUFFERING 0x00000002L +#define SQL_FILESTREAM_OPEN_FLAG_NO_WRITE_THROUGH 0x00000004L +#define SQL_FILESTREAM_OPEN_FLAG_SEQUENTIAL_SCAN 0x00000008L +#define SQL_FILESTREAM_OPEN_FLAG_RANDOM_ACCESS 0x00000010L +HANDLE __stdcall OpenSqlFilestream ( + LPCWSTR FilestreamPath, + SQL_FILESTREAM_DESIRED_ACCESS DesiredAccess, + ULONG OpenOptions, + LPBYTE FilestreamTransactionContext, + SSIZE_T FilestreamTransactionContextLength, + PLARGE_INTEGER AllocationSize); +#define FSCTL_SQL_FILESTREAM_FETCH_OLD_CONTENT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2392, METHOD_BUFFERED, FILE_ANY_ACCESS) + + + +#ifndef _SQLUSERINSTANCE_H_ +#define _SQLUSERINSTANCE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +// Recommended buffer size to store a LocalDB connection string +#define LOCALDB_MAX_SQLCONNECTION_BUFFER_SIZE 260 + +// type definition for LocalDBCreateInstance function +typedef HRESULT __cdecl FnLocalDBCreateInstance ( + // I the LocalDB version (e.g. 11.0 or 11.0.1094.2) + __in_z PCWSTR wszVersion, + // I the instance name + __in_z PCWSTR pInstanceName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags +); + +// type definition for pointer to LocalDBCreateInstance function +typedef FnLocalDBCreateInstance* PFnLocalDBCreateInstance; + +// type definition for LocalDBStartInstance function +typedef HRESULT __cdecl FnLocalDBStartInstance ( + // I the LocalDB instance name + __in_z PCWSTR pInstanceName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags, + // O the buffer to store the connection string to the LocalDB instance + __out_ecount_z_opt(*lpcchSqlConnection) LPWSTR wszSqlConnection, + // I/O on input has the size of the wszSqlConnection buffer in characters. On output, if the given buffer size is + // too small, has the buffer size required, in characters, including trailing null. + __inout_opt LPDWORD lpcchSqlConnection +); + +// type definition for pointer to LocalDBStartInstance function +typedef FnLocalDBStartInstance* PFnLocalDBStartInstance; + +// Flags for the LocalDBFormatMessage function +#define LOCALDB_TRUNCATE_ERR_MESSAGE 0x0001L + +// type definition for LocalDBFormatMessage function +typedef HRESULT __cdecl FnLocalDBFormatMessage( + // I the LocalDB error code + __in HRESULT hrLocalDB, + // I Available flags: + // LOCALDB_TRUNCATE_ERR_MESSAGE - if the input buffer is too short, + // the error message will be truncated to fit into the buffer + __in DWORD dwFlags, + // I Language desired (LCID) or 0 (in which case Win32 FormatMessage order is used) + __in DWORD dwLanguageId, + // O the buffer to store the LocalDB error message + __out_ecount_z(*lpcchMessage) LPWSTR wszMessage, + // I/O on input has the size of the wszMessage buffer in characters. On output, if the given buffer size is + // too small, has the buffer size required, in characters, including trailing null. If the function succeeds + // contains the number of characters in the message, excluding the trailing null + __inout LPDWORD lpcchMessage +); + +// type definition for function pointer to LocalDBFormatMessage function +typedef FnLocalDBFormatMessage* PFnLocalDBFormatMessage; + + +// MessageId: LOCALDB_ERROR_NOT_INSTALLED +// +// MessageText: +// +// LocalDB is not installed. +// +#define LOCALDB_ERROR_NOT_INSTALLED ((HRESULT)0x89C50116L) + +//--------------------------------------------------------------------- +// Function: LocalDBCreateInstance +// +// Description: This function will create the new LocalDB instance. +// +// Available Flags: +// No flags available. Reserved for future use. +// +// Return Values: +// S_OK, if the function succeeds +// LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid +// LOCALDB_ERROR_INVALID_PARAM_VERSION, if the version parameter is invalid +// LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid +// LOCALDB_ERROR_INVALID_OPERATION, if the user tries to create a default instance +// LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG, if the path where instance should be stored is longer than MAX_PATH +// LOCALDB_ERROR_VERSION_REQUESTED_NOT_INSTALLED, if the specified patch level is not installed +// LOCALDB_ERROR_INSTANCE_FOLDER_ALREADY_EXISTS, if the instance folder already exists and is not empty +// LOCALDB_ERROR_INSTANCE_EXISTS_WITH_LOWER_VERSION, if the specified instance already exists but with lower version +// LOCALDB_ERROR_CANNOT_CREATE_INSTANCE_FOLDER, if a folder cannot be created under %userprofile% +// LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER, if a user profile folder cannot be retrieved +// LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER, if a instance folder cannot be accessed +// LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY, if a instance registry cannot be accessed +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details +// LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY, if an instance registry cannot be modified +// LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS, if a process for Sql Server cannot be created +// LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED, if a Sql Server process is started but Sql Server startup failed. +// LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT, if a instance configuration is corrupted +// +FnLocalDBCreateInstance LocalDBCreateInstance; + +//--------------------------------------------------------------------- +// Function: LocalDBStartInstance +// +// Description: This function will start the given LocalDB instance. +// +// Return Values: +// S_OK, if the function succeeds +// LOCALDB_ERROR_UNKNOWN_INSTANCE, if the specified instance doesn't exist +// LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid +// LOCALDB_ERROR_INVALID_PARAM_CONNECTION, if the wszSqlConnection parameter is NULL +// LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid +// LOCALDB_ERROR_INSUFFICIENT_BUFFER, if the buffer wszSqlConnection is too small +// LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG, if the path where instance should be stored is longer than MAX_PATH + +// LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER, if a user profile folder cannot be retrieved +// LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER, if a instance folder cannot be accessed +// LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY, if a instance registry cannot be accessed +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details +// LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY, if an instance registry cannot be modified +// LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS, if a process for Sql Server cannot be created +// LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED, if a Sql Server process is started but Sql Server startup failed. +// LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT, if a instance configuration is corrupted +// +FnLocalDBStartInstance LocalDBStartInstance; + +// type definition for LocalDBStopInstance function +typedef HRESULT __cdecl FnLocalDBStopInstance ( + // I the LocalDB instance name + __in_z PCWSTR pInstanceName, + // I Available flags: + // LOCALDB_SHUTDOWN_KILL_PROCESS - force the instance to stop immediately + // LOCALDB_SHUTDOWN_WITH_NOWAIT - shutdown the instance with NOWAIT option + __in DWORD dwFlags, + // I the time in seconds to wait this operation to complete. If this value is 0, this function will return immediately + // without waiting for LocalDB instance to stop + __in ULONG ulTimeout +); + +// type definition for pointer to LocalDBStopInstance function +typedef FnLocalDBStopInstance* PFnLocalDBStopInstance; + +// Flags for the StopLocalDBInstance function +#define LOCALDB_SHUTDOWN_KILL_PROCESS 0x0001L +#define LOCALDB_SHUTDOWN_WITH_NOWAIT 0x0002L + +//--------------------------------------------------------------------- +// Function: LocalDBStopInstance +// +// Description: This function will shutdown the given LocalDB instance. +// If the flag LOCALDB_SHUTDOWN_KILL_PROCESS is set, the LocalDB instance will be killed immediately. +// IF the flag LOCALDB_SHUTDOWN_WITH_NOWAIT is set, the LocalDB instance will shutdown with NOWAIT option. +// +// Return Values: +// S_OK, if the function succeeds +// LOCALDB_ERROR_UNKNOWN_INSTANCE, if the specified instance doesn't exist +// LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid +// LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid +// LOCALDB_ERROR_WAIT_TIMEOUT - if this function has not finished in given time +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details +// +FnLocalDBStopInstance LocalDBStopInstance; + +// type definition for LocalDBDeleteInstance function +typedef HRESULT __cdecl FnLocalDBDeleteInstance ( + // I the LocalDB instance name + __in_z PCWSTR pInstanceName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags +); + +// type definition for pointer to LocalDBDeleteInstance function +typedef FnLocalDBDeleteInstance* PFnLocalDBDeleteInstance; + +//--------------------------------------------------------------------- +// Function: LocalDBDeleteInstance +// +// Description: This function will remove the given LocalDB instance. If the given instance is running this function will +// fail with the error code LOCALDB_ERROR_INSTANCE_BUSY. +// +// Return Values: +// S_OK, if the function succeeds +// LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid +// LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid +// LOCALDB_ERROR_UNKNOWN_INSTANCE, if the specified instance doesn't exist +// LOCALDB_ERROR_INSTANCE_BUSY, if the given instance is running +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details +// +FnLocalDBDeleteInstance LocalDBDeleteInstance; + +// Function: LocalDBFormatMessage +// +// Description: This function will return the localized textual description for the given LocalDB error +// +// Available Flags: +// LOCALDB_TRUNCATE_ERR_MESSAGE - the error message should be truncated to fit into the provided buffer +// +// Return Value: +// S_OK, if the function succeeds +// +// LOCALDB_ERROR_UNKNOWN_HRESULT, if the given HRESULT is unknown +// LOCALDB_ERROR_UNKNOWN_LANGUAGE_ID, if the given language id is unknown (0 is recommended for the // default language) +// LOCALDB_ERROR_UNKNOWN_ERROR_CODE, if the LocalDB error code is unknown +// LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid +// LOCALDB_ERROR_INSUFFICIENT_BUFFER, if the input buffer is too short and LOCALDB_TRUNCATE_ERR_MESSAGE flag +// is not set +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details +// +FnLocalDBFormatMessage LocalDBFormatMessage; + +#define MAX_LOCALDB_INSTANCE_NAME_LENGTH 128 +#define MAX_LOCALDB_PARENT_INSTANCE_LENGTH MAX_INSTANCE_NAME + +typedef WCHAR TLocalDBInstanceName[MAX_LOCALDB_INSTANCE_NAME_LENGTH + 1]; +typedef TLocalDBInstanceName* PTLocalDBInstanceName; + +// type definition for LocalDBGetInstances function +typedef HRESULT __cdecl FnLocalDBGetInstances( + // O buffer for a LocalDB instance names + __out PTLocalDBInstanceName pInstanceNames, + // I/O on input has the number slots for instance names in the pInstanceNames buffer. On output, + // has the number of existing LocalDB instances + __inout LPDWORD lpdwNumberOfInstances +); + +// type definition for pointer to LocalDBGetInstances function +typedef FnLocalDBGetInstances* PFnLocalDBGetInstances; + +// Function: LocalDBGetInstances +// +// Description: This function returns names for all existing Local DB instances +// +// Usage Example: +// DWORD dwN = 0; +// LocalDBGetInstances(NULL, &dwN); + +// PTLocalDBInstanceName insts = (PTLocalDBInstanceName) malloc(dwN * sizeof(TLocalDBInstanceName)); +// LocalDBGetInstances(insts, &dwN); + +// for (int i = 0; i < dwN; i++) +// wprintf(L"%s\n", insts[i]); +// +// Return values: +// S_OK, if the function succeeds +// +// LOCALDB_ERROR_INSUFFICIENT_BUFFER, the given buffer is to small +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details +// +FnLocalDBGetInstances LocalDBGetInstances; + +// SID string format: S - Revision(1B) - Authority ID (6B) {- Sub authority ID (4B)} * max 15 sub-authorities = 1 + 1 + 3 + 1 + 15 + (1 + 10) * 15 +#define MAX_STRING_SID_LENGTH 186 + +#pragma pack(push) +#pragma pack(8) + +// DEVNOTE: If you want to modify this structure please read DEVNOTEs on top of function LocalDBGetInstanceInfo in sqluserinstance.cpp file. +// +typedef struct _LocalDBInstanceInfo +{ + DWORD cbLocalDBInstanceInfoSize; + TLocalDBInstanceName wszInstanceName; + BOOL bExists; + BOOL bConfigurationCorrupted; + BOOL bIsRunning; + DWORD dwMajor; + DWORD dwMinor; + DWORD dwBuild; + DWORD dwRevision; + FILETIME ftLastStartDateUTC; + WCHAR wszConnection[LOCALDB_MAX_SQLCONNECTION_BUFFER_SIZE]; + BOOL bIsShared; + TLocalDBInstanceName wszSharedInstanceName; + WCHAR wszOwnerSID[MAX_STRING_SID_LENGTH + 1]; + BOOL bIsAutomatic; +} LocalDBInstanceInfo; + +#pragma pack(pop) + +typedef LocalDBInstanceInfo* PLocalDBInstanceInfo; + +// type definition for LocalDBGetInstanceInfo function +typedef HRESULT __cdecl FnLocalDBGetInstanceInfo( + // I the LocalDB instance name + __in_z PCWSTR wszInstanceName, + // O instance information + __out PLocalDBInstanceInfo pInfo, + // I Size of LocalDBInstanceInfo structure in bytes + __in DWORD cbInfo); + +// type definition for pointer to LocalDBGetInstances function +typedef FnLocalDBGetInstanceInfo* PFnLocalDBGetInstanceInfo; + +// Function: LocalDBGetInstanceInfo +// +// Description: This function returns information about the given instance. +// +// Return values: +// S_OK, if the function succeeds +// +// ERROR_INVALID_PARAMETER, if some of the parameters is invalid +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details +// +FnLocalDBGetInstanceInfo LocalDBGetInstanceInfo; + +// Version has format: Major.Minor[.Build[.Revision]]. Each of components is 32bit integer which is at most 40 digits and 3 dots +// +#define MAX_LOCALDB_VERSION_LENGTH 43 + +typedef WCHAR TLocalDBVersion[MAX_LOCALDB_VERSION_LENGTH + 1]; +typedef TLocalDBVersion* PTLocalDBVersion; + +// type definition for LocalDBGetVersions function +typedef HRESULT __cdecl FnLocalDBGetVersions( + // O buffer for installed LocalDB versions + __out PTLocalDBVersion pVersions, + // I/O on input has the number slots for versions in the pVersions buffer. On output, + // has the number of existing LocalDB versions + __inout LPDWORD lpdwNumberOfVersions +); + +// type definition for pointer to LocalDBGetVersions function +typedef FnLocalDBGetVersions* PFnLocalDBGetVersions; + +// Function: LocalDBGetVersions +// +// Description: This function returns all installed LocalDB versions. Returned versions will be in format Major.Minor +// +// Usage Example: +// DWORD dwN = 0; +// LocalDBGetVersions(NULL, &dwN); + +// PTLocalDBVersion versions = (PTLocalDBVersion) malloc(dwN * sizeof(TLocalDBVersion)); +// LocalDBGetVersions(insts, &dwN); + +// for (int i = 0; i < dwN; i++) +// wprintf(L"%s\n", insts[i]); +// +// Return values: +// S_OK, if the function succeeds +// +// LOCALDB_ERROR_INSUFFICIENT_BUFFER, the given buffer is to small +// LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurs. +// +FnLocalDBGetVersions LocalDBGetVersions; + +#pragma pack(push) +#pragma pack(8) + +// DEVNOTE: If you want to modify this structure please read DEVNOTEs on top of function LocalDBGetVersionInfo in sqluserinstance.cpp file. +// +typedef struct _LocalDBVersionInfo +{ + DWORD cbLocalDBVersionInfoSize; + TLocalDBVersion wszVersion; + BOOL bExists; + DWORD dwMajor; + DWORD dwMinor; + DWORD dwBuild; + DWORD dwRevision; +} LocalDBVersionInfo; + +#pragma pack(pop) + +typedef LocalDBVersionInfo* PLocalDBVersionInfo; + +// type definition for LocalDBGetVersionInfo function +typedef HRESULT __cdecl FnLocalDBGetVersionInfo( + // I LocalDB version string + __in_z PCWSTR wszVersion, + // O version information + __out PLocalDBVersionInfo pVersionInfo, + // I Size of LocalDBVersionInfo structure in bytes + __in DWORD cbVersionInfo +); + +// type definition for pointer to LocalDBGetVersionInfo function +typedef FnLocalDBGetVersionInfo* PFnLocalDBGetVersionInfo; + +// Function: LocalDBGetVersionInfo +// +// Description: This function returns information about the given LocalDB version +// +// Return values: +// S_OK, if the function succeeds +// LOCALDB_ERROR_INTERNAL_ERROR, if some internal error occurred +// LOCALDB_ERROR_INVALID_PARAMETER, if a input parameter is invalid +// +FnLocalDBGetVersionInfo LocalDBGetVersionInfo; + +typedef HRESULT __cdecl FnLocalDBStartTracing(); +typedef FnLocalDBStartTracing* PFnLocalDBStartTracing; + +// Function: LocalDBStartTracing +// +// Description: This function will write in registry that Tracing sessions should be started for the current user. +// +// Return values: +// S_OK - on success +// Propper HRESULT in case of failure +// +FnLocalDBStartTracing LocalDBStartTracing; + +typedef HRESULT __cdecl FnLocalDBStopTracing(); +typedef FnLocalDBStopTracing* PFnFnLocalDBStopTracing; + +// Function: LocalDBStopTracing +// +// Description: This function will write in registry that Tracing sessions should be stopped for the current user. +// +// Return values: +// S_OK - on success +// Propper HRESULT in case of failure +// +FnLocalDBStopTracing LocalDBStopTracing; + +// type definition for LocalDBShareInstance function +typedef HRESULT __cdecl FnLocalDBShareInstance( + // I the SID of the LocalDB instance owner + __in_opt PSID pOwnerSID, + // I the private name of LocalDB instance which should be shared + __in_z PCWSTR wszPrivateLocalDBInstanceName, + // I the public shared name + __in_z PCWSTR wszSharedName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags); + +// type definition for pointer to LocalDBShareInstance function +typedef FnLocalDBShareInstance* PFnLocalDBShareInstance; + +// Function: LocalDBShareInstance +// +// Description: This function will share the given private instance of the given user with the given shared name. +// This function has to be executed elevated. +// +// Return values: +// HRESULT +// +FnLocalDBShareInstance LocalDBShareInstance; + +// type definition for LocalDBUnshareInstance function +typedef HRESULT __cdecl FnLocalDBUnshareInstance( + // I the LocalDB instance name + __in_z PCWSTR pInstanceName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags); + +// type definition for pointer to LocalDBUnshareInstance function +typedef FnLocalDBUnshareInstance* PFnLocalDBUnshareInstance; + +// Function: LocalDBUnshareInstance +// +// Description: This function unshares the given LocalDB instance. +// If a shared name is given then that shared instance will be unshared. +// If a private name is given then we will check if the caller +// shares a private instance with the given private name and unshare it. +// +// Return values: +// HRESULT +// +FnLocalDBUnshareInstance LocalDBUnshareInstance; + +#ifdef __cplusplus +} // extern "C" +#endif + +#if defined(LOCALDB_DEFINE_PROXY_FUNCTIONS) +//--------------------------------------------------------------------- +// The following section is enabled only if the constant LOCALDB_DEFINE_PROXY_FUNCTIONS +// is defined. It provides an implementation of proxies for each of the LocalDB APIs. +// The proxy implementations use a common function to bind to entry points in the +// latest installed SqlUserInstance DLL, and then forward the requests. +// +// The current implementation loads the SqlUserInstance DLL on the first call into +// a proxy function. There is no provision for unloading the DLL. Note that if the +// process includes multiple binaries (EXE and one or more DLLs), each of them could +// load a separate instance of the SqlUserInstance DLL. +// +// For future consideration: allow the SqlUserInstance DLL to be unloaded dynamically. +// +// WARNING: these functions must not be called in DLL initialization, since a deadlock +// could result loading dependent DLLs. +//--------------------------------------------------------------------- + +// This macro provides the body for each proxy function. +// +#define LOCALDB_PROXY(LocalDBFn) static Fn##LocalDBFn* pfn##LocalDBFn = NULL; if (!pfn##LocalDBFn) {HRESULT hr = LocalDBGetPFn(#LocalDBFn, (FARPROC *)&pfn##LocalDBFn); if (FAILED(hr)) return hr;} return (*pfn##LocalDBFn) + +// Structure and function to parse the "Installed Versions" registry subkeys +// +typedef struct { + DWORD dwComponent[2]; + WCHAR wszKeyName[256]; +} Version; + +// The following algorithm is intended to match, in part, the .NET Version class. +// A maximum of two components are allowed, which must be separated with a period. +// Valid: "11", "11.0" +// Invalid: "", ".0", "11.", "11.0." +// +static BOOL ParseVersion(Version * pVersion) +{ + pVersion->dwComponent[0] = 0; + pVersion->dwComponent[1] = 0; + WCHAR * pwch = pVersion->wszKeyName; + + for (int i = 0; i<2; i++) + { + LONGLONG llVal = 0; + BOOL fHaveDigit = FALSE; + + while (*pwch >= L'0' && *pwch <= L'9') + { + llVal = llVal * 10 + (*pwch++ - L'0'); + fHaveDigit = TRUE; + + if (llVal > 0x7fffffff) + { + return FALSE; + } + } + + if (!fHaveDigit) + return FALSE; + + pVersion->dwComponent[i] = (DWORD) llVal; + + if (*pwch == L'\0') + return TRUE; + + if (*pwch != L'.') + return FALSE; + + pwch++; + } + // If we get here, the version string was terminated with L'.', which is not valid + // + return FALSE; +} + +#include + +// This function loads the correct LocalDB API DLL (if required) and returns a pointer to a procedure. +// Note that the first-loaded API DLL for the process will be used until process termination: installation of +// a new version of the API will not be recognized after first load. +// +static HRESULT LocalDBGetPFn(LPCSTR szLocalDBFn, FARPROC *pfnLocalDBFn) +{ + static volatile HMODULE hLocalDBDll = NULL; + + if (!hLocalDBDll) + { + LONG ec; + HKEY hkeyVersions = NULL; + HKEY hkeyVersion = NULL; + Version verHigh = {0}; + Version verCurrent; + DWORD cchKeyName; + DWORD dwValueType; + WCHAR wszLocalDBDll[MAX_PATH+1]; + DWORD cbLocalDBDll = sizeof(wszLocalDBDll) - sizeof(WCHAR); // to deal with RegQueryValueEx null-termination quirk + HMODULE hLocalDBDllTemp = NULL; + + if (ERROR_SUCCESS != (ec = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Microsoft SQL Server Local DB\\Installed Versions", 0, KEY_READ, &hkeyVersions))) + { + goto Cleanup; + } + + for (int i = 0; ; i++) + { + cchKeyName = 256; + if (ERROR_SUCCESS != (ec = RegEnumKeyExW(hkeyVersions, i, verCurrent.wszKeyName, &cchKeyName, 0, NULL, NULL, NULL))) + { + if (ERROR_NO_MORE_ITEMS == ec) + { + break; + } + goto Cleanup; + } + + if (!ParseVersion(&verCurrent)) + { + continue; // invalid version syntax + } + + if (verCurrent.dwComponent[0] > verHigh.dwComponent[0] || + (verCurrent.dwComponent[0] == verHigh.dwComponent[0] && verCurrent.dwComponent[1] > verHigh.dwComponent[1])) + { + verHigh = verCurrent; + } + } + if (!verHigh.wszKeyName[0]) + { + // ec must be ERROR_NO_MORE_ITEMS here + // + assert(ec == ERROR_NO_MORE_ITEMS); + + // We will change the error code to ERROR_FILE_NOT_FOUND in order to indicate that + // LocalDB instalation is not found. Registry key "SOFTWARE\\Microsoft\\Microsoft SQL Server Local DB\\Installed Versions" exists + // but it is empty. + // + ec = ERROR_FILE_NOT_FOUND; + goto Cleanup; + } + + if (ERROR_SUCCESS != (ec = RegOpenKeyExW(hkeyVersions, verHigh.wszKeyName, 0, KEY_READ, &hkeyVersion))) + { + goto Cleanup; + } + if (ERROR_SUCCESS != (ec = RegQueryValueExW(hkeyVersion, L"InstanceAPIPath", NULL, &dwValueType, (PBYTE) wszLocalDBDll, &cbLocalDBDll))) + { + goto Cleanup; + } + if (dwValueType != REG_SZ) + { + ec = ERROR_INVALID_DATA; + goto Cleanup; + } + // Ensure string value null-terminated + // Note that we left a spare character in the output buffer for RegQueryValueEx for this purpose + // + wszLocalDBDll[cbLocalDBDll/sizeof(WCHAR)] = L'\0'; + + hLocalDBDllTemp = LoadLibraryW(wszLocalDBDll); + if (NULL == hLocalDBDllTemp) + { + ec = GetLastError(); + goto Cleanup; + } + if (NULL == InterlockedCompareExchangePointer((volatile PVOID *)&hLocalDBDll, hLocalDBDllTemp, NULL)) + { + // We were the winner: we gave away our DLL handle + // + hLocalDBDllTemp = NULL; + } + ec = ERROR_SUCCESS; +Cleanup: + if (hLocalDBDllTemp) + FreeLibrary(hLocalDBDllTemp); + if (hkeyVersion) + RegCloseKey(hkeyVersion); + if (hkeyVersions) + RegCloseKey(hkeyVersions); + + // Error code ERROR_FILE_NOT_FOUND can occure if registry hive with installed LocalDB versions is missing. + // In that case we should return the LocalDB specific error code + // + if (ec == ERROR_FILE_NOT_FOUND) + return LOCALDB_ERROR_NOT_INSTALLED; + + if (ec != ERROR_SUCCESS) + return HRESULT_FROM_WIN32(ec); + } + + FARPROC pfn = GetProcAddress(hLocalDBDll, szLocalDBFn); + + if (!pfn) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + *pfnLocalDBFn = pfn; + return S_OK; +} + +// The following proxy functions forward calls to the latest LocalDB API DLL. +// + +HRESULT __cdecl +LocalDBCreateInstance ( + // I the LocalDB version (e.g. 11.0 or 11.0.1094.2) + __in_z PCWSTR wszVersion, + // I the instance name + __in_z PCWSTR pInstanceName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags +) +{ + LOCALDB_PROXY(LocalDBCreateInstance)(wszVersion, pInstanceName, dwFlags); +} + +HRESULT __cdecl +LocalDBStartInstance( + // I the instance name + __in_z PCWSTR pInstanceName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags, + // O the buffer to store the connection string to the LocalDB instance + __out_ecount_z_opt(*lpcchSqlConnection) LPWSTR wszSqlConnection, + // I/O on input has the size of the wszSqlConnection buffer in characters. On output, if the given buffer size is + // too small, has the buffer size required, in characters, including trailing null. + __inout_opt LPDWORD lpcchSqlConnection +) +{ + LOCALDB_PROXY(LocalDBStartInstance)(pInstanceName, dwFlags, wszSqlConnection, lpcchSqlConnection); +} + +HRESULT __cdecl +LocalDBStopInstance ( + // I the instance name + __in_z PCWSTR pInstanceName, + // I Available flags: + // LOCALDB_SHUTDOWN_KILL_PROCESS - force the instance to stop immediately + // LOCALDB_SHUTDOWN_WITH_NOWAIT - shutdown the instance with NOWAIT option + __in DWORD dwFlags, + // I the time in seconds to wait this operation to complete. If this value is 0, this function will return immediately + // without waiting for LocalDB instance to stop + __in ULONG ulTimeout +) +{ + LOCALDB_PROXY(LocalDBStopInstance)(pInstanceName, dwFlags, ulTimeout); +} + +HRESULT __cdecl +LocalDBDeleteInstance ( + // I the instance name + __in_z PCWSTR pInstanceName, + // reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags +) +{ + LOCALDB_PROXY(LocalDBDeleteInstance)(pInstanceName, dwFlags); +} + +HRESULT __cdecl +LocalDBFormatMessage( + // I the LocalDB error code + __in HRESULT hrLocalDB, + // I Available flags: + // LOCALDB_TRUNCATE_ERR_MESSAGE - if the input buffer is too short, + // the error message will be truncated to fit into the buffer + __in DWORD dwFlags, + // I Language desired (LCID) or 0 (in which case Win32 FormatMessage order is used) + __in DWORD dwLanguageId, + // O the buffer to store the LocalDB error message + __out_ecount_z(*lpcchMessage) LPWSTR wszMessage, + // I/O on input has the size of the wszMessage buffer in characters. On output, if the given buffer size is + // too small, has the buffer size required, in characters, including trailing null. If the function succeeds + // contains the number of characters in the message, excluding the trailing null + __inout LPDWORD lpcchMessage +) +{ + LOCALDB_PROXY(LocalDBFormatMessage)(hrLocalDB, dwFlags, dwLanguageId, wszMessage, lpcchMessage); +} + +HRESULT __cdecl +LocalDBGetInstances( + // O buffer with instance names + __out PTLocalDBInstanceName pInstanceNames, + // I/O on input has the number slots for instance names in the pInstanceNames buffer. On output, + // has the number of existing LocalDB instances + __inout LPDWORD lpdwNumberOfInstances +) +{ + LOCALDB_PROXY(LocalDBGetInstances)(pInstanceNames, lpdwNumberOfInstances); +} + +HRESULT __cdecl +LocalDBGetInstanceInfo( + // I the instance name + __in_z PCWSTR wszInstanceName, + // O instance information + __out PLocalDBInstanceInfo pInfo, + // I Size of LocalDBInstanceInfo structure in bytes + __in DWORD cbInfo +) +{ + LOCALDB_PROXY(LocalDBGetInstanceInfo)(wszInstanceName, pInfo, cbInfo); +} + +HRESULT __cdecl +LocalDBStartTracing() +{ + LOCALDB_PROXY(LocalDBStartTracing)(); +} + +HRESULT __cdecl +LocalDBStopTracing() +{ + LOCALDB_PROXY(LocalDBStopTracing)(); +} + +HRESULT __cdecl +LocalDBShareInstance( + // I the SID of the LocalDB instance owner + __in_opt PSID pOwnerSID, + // I the private name of LocalDB instance which should be shared + __in_z PCWSTR wszLocalDBInstancePrivateName, + // I the public shared name + __in_z PCWSTR wszSharedName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags) +{ + LOCALDB_PROXY(LocalDBShareInstance)(pOwnerSID, wszLocalDBInstancePrivateName, wszSharedName, dwFlags); +} + +HRESULT __cdecl +LocalDBGetVersions( + // O buffer for installed LocalDB versions + __out PTLocalDBVersion pVersions, + // I/O on input has the number slots for versions in the pVersions buffer. On output, + // has the number of existing LocalDB versions + __inout LPDWORD lpdwNumberOfVersions +) +{ + LOCALDB_PROXY(LocalDBGetVersions)(pVersions, lpdwNumberOfVersions); +} + +HRESULT __cdecl +LocalDBUnshareInstance( + // I the LocalDB instance name + __in_z PCWSTR pInstanceName, + // I reserved for the future use. Currently should be set to 0. + __in DWORD dwFlags) +{ + LOCALDB_PROXY(LocalDBUnshareInstance)(pInstanceName, dwFlags); +} + +HRESULT __cdecl +LocalDBGetVersionInfo( + // I LocalDB version string + __in_z PCWSTR wszVersion, + // O version information + __out PLocalDBVersionInfo pVersionInfo, + // I Size of LocalDBVersionInfo structure in bytes + __in DWORD cbVersionInfo) +{ + LOCALDB_PROXY(LocalDBGetVersionInfo)(wszVersion, pVersionInfo, cbVersionInfo); +} + +#endif + +#endif // _SQLUSERINSTANCE_H_ + +//----------------------------------------------------------------------------- +// File: sqluserinstancemsgs.mc +// +// Copyright: Copyright (c) Microsoft Corporation +//----------------------------------------------------------------------------- +#ifndef _LOCALDB_MESSAGES_H_ +#define _LOCALDB_MESSAGES_H_ +// Header section +// +// Section with the LocalDB messages +// +// +// Values are 32 bit values laid out as follows: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +-+-+-+-+-+---------------------+-------------------------------+ +// |S|R|C|N|r| Facility | Code | +// +-+-+-+-+-+---------------------+-------------------------------+ +// +// where +// +// S - Severity - indicates success/fail +// +// 0 - Success +// 1 - Fail (COERROR) +// +// R - reserved portion of the facility code, corresponds to NT's +// second severity bit. +// +// C - reserved portion of the facility code, corresponds to NT's +// C field. +// +// N - reserved portion of the facility code. Used to indicate a +// mapped NT status value. +// +// r - reserved portion of the facility code. Reserved for internal +// use. Used to indicate HRESULT values that are not status +// values, but are instead message ids for display strings. +// +// Facility - is the facility code +// +// Code - is the facility's status code +// +// +// Define the facility codes +// +#define FACILITY_LOCALDB 0x9C5 + + +// +// Define the severity codes +// +#define LOCALDB_SEVERITY_SUCCESS 0x0 +#define LOCALDB_SEVERITY_ERROR 0x2 + + +// +// MessageId: LOCALDB_ERROR_CANNOT_CREATE_INSTANCE_FOLDER +// +// MessageText: +// +// Cannot create folder for the LocalDB instance at: %%LOCALAPPDATA%%\Microsoft\Microsoft SQL Server Local DB\Instances\. +// +#define LOCALDB_ERROR_CANNOT_CREATE_INSTANCE_FOLDER ((HRESULT)0x89C50100L) + +// +// MessageId: LOCALDB_ERROR_INVALID_PARAMETER +// +// MessageText: +// +// The parameter for the LocalDB Instance API method is incorrect. Consult the API documentation. +// +#define LOCALDB_ERROR_INVALID_PARAMETER ((HRESULT)0x89C50101L) + +// +// MessageId: LOCALDB_ERROR_INSTANCE_EXISTS_WITH_LOWER_VERSION +// +// MessageText: +// +// Unable to create the LocalDB instance with specified version. An instance with the same name already exists, but it has lower version than the specified version. +// +#define LOCALDB_ERROR_INSTANCE_EXISTS_WITH_LOWER_VERSION ((HRESULT)0x89C50102L) + +// +// MessageId: LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER +// +// MessageText: +// +// Cannot access the user profile folder for local application data (%%LOCALAPPDATA%%). +// +#define LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER ((HRESULT)0x89C50103L) + +// +// MessageId: LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG +// +// MessageText: +// +// The full path length of the LocalDB instance folder is longer than MAX_PATH. The instance must be stored in folder: %%LOCALAPPDATA%%\Microsoft\Microsoft SQL Server Local DB\Instances\. +// +#define LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG ((HRESULT)0x89C50104L) + +// +// MessageId: LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER +// +// MessageText: +// +// Cannot access LocalDB instance folder: %%LOCALAPPDATA%%\Microsoft\Microsoft SQL Server Local DB\Instances\. +// +#define LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER ((HRESULT)0x89C50105L) + +// +// MessageId: LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY +// +// MessageText: +// +// Unexpected error occurred while trying to access the LocalDB instance registry configuration. See the Windows Application event log for error details. +// +#define LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY ((HRESULT)0x89C50106L) + +// +// MessageId: LOCALDB_ERROR_UNKNOWN_INSTANCE +// +// MessageText: +// +// The specified LocalDB instance does not exist. +// +#define LOCALDB_ERROR_UNKNOWN_INSTANCE ((HRESULT)0x89C50107L) + +// +// MessageId: LOCALDB_ERROR_INTERNAL_ERROR +// +// MessageText: +// +// Unexpected error occurred inside a LocalDB instance API method call. See the Windows Application event log for error details. +// +#define LOCALDB_ERROR_INTERNAL_ERROR ((HRESULT)0x89C50108L) + +// +// MessageId: LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY +// +// MessageText: +// +// Unexpected error occurred while trying to modify the registry configuration for the LocalDB instance. See the Windows Application event log for error details. +// +#define LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY ((HRESULT)0x89C50109L) + +// +// MessageId: LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED +// +// MessageText: +// +// Error occurred during LocalDB instance startup: SQL Server process failed to start. +// +#define LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED ((HRESULT)0x89C5010AL) + +// +// MessageId: LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT +// +// MessageText: +// +// LocalDB instance is corrupted. See the Windows Application event log for error details. +// +#define LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT ((HRESULT)0x89C5010BL) + +// +// MessageId: LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS +// +// MessageText: +// +// Error occurred during LocalDB instance startup: unable to create the SQL Server process. +// +#define LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS ((HRESULT)0x89C5010CL) + +// +// MessageId: LOCALDB_ERROR_UNKNOWN_VERSION +// +// MessageText: +// +// The specified LocalDB version is not available on this computer. +// +#define LOCALDB_ERROR_UNKNOWN_VERSION ((HRESULT)0x89C5010DL) + +// +// MessageId: LOCALDB_ERROR_UNKNOWN_LANGUAGE_ID +// +// MessageText: +// +// Error getting the localized error message. The language specified by 'Language ID' parameter is unknown. +// +#define LOCALDB_ERROR_UNKNOWN_LANGUAGE_ID ((HRESULT)0x89C5010EL) + +// +// MessageId: LOCALDB_ERROR_INSTANCE_STOP_FAILED +// +// MessageText: +// +// Stop operation for LocalDB instance failed to complete within the specified time. +// +#define LOCALDB_ERROR_INSTANCE_STOP_FAILED ((HRESULT)0x89C5010FL) + +// +// MessageId: LOCALDB_ERROR_UNKNOWN_ERROR_CODE +// +// MessageText: +// +// Error getting the localized error message. The specified error code is unknown. +// +#define LOCALDB_ERROR_UNKNOWN_ERROR_CODE ((HRESULT)0x89C50110L) + +// +// MessageId: LOCALDB_ERROR_VERSION_REQUESTED_NOT_INSTALLED +// +// MessageText: +// +// The LocalDB version available on this workstation is lower than the requested LocalDB version. +// +#define LOCALDB_ERROR_VERSION_REQUESTED_NOT_INSTALLED ((HRESULT)0x89C50111L) + +// +// MessageId: LOCALDB_ERROR_INSTANCE_BUSY +// +// MessageText: +// +// Requested operation on LocalDB instance cannot be performed because specified instance is currently in use. Stop the instance and try again. +// +#define LOCALDB_ERROR_INSTANCE_BUSY ((HRESULT)0x89C50112L) + +// +// MessageId: LOCALDB_ERROR_INVALID_OPERATION +// +// MessageText: +// +// Default LocalDB instances cannot be created, stopped or deleted manually. +// +#define LOCALDB_ERROR_INVALID_OPERATION ((HRESULT)0x89C50113L) + +// +// MessageId: LOCALDB_ERROR_INSUFFICIENT_BUFFER +// +// MessageText: +// +// The buffer passed to the LocalDB instance API method has insufficient size. +// +#define LOCALDB_ERROR_INSUFFICIENT_BUFFER ((HRESULT)0x89C50114L) + +// +// MessageId: LOCALDB_ERROR_WAIT_TIMEOUT +// +// MessageText: +// +// Timeout occurred inside the LocalDB instance API method. +// +#define LOCALDB_ERROR_WAIT_TIMEOUT ((HRESULT)0x89C50115L) + +// MessageId=0x0116 message id is reserved. This message ID will be used for error LOCALDB_ERROR_NOT_INSTALLED. +// This message is specific since it has to be present in SqlUserIntsnace.h because it can be returned by discovery API. +// +// +// MessageId: LOCALDB_ERROR_XEVENT_FAILED +// +// MessageText: +// +// Failed to start XEvent engine within the LocalDB Instance API. +// +#define LOCALDB_ERROR_XEVENT_FAILED ((HRESULT)0x89C50117L) + +// +// MessageId: LOCALDB_ERROR_AUTO_INSTANCE_CREATE_FAILED +// +// MessageText: +// +// Cannot create an automatic instance. See the Windows Application event log for error details. +// +#define LOCALDB_ERROR_AUTO_INSTANCE_CREATE_FAILED ((HRESULT)0x89C50118L) + +// +// MessageId: LOCALDB_ERROR_SHARED_NAME_TAKEN +// +// MessageText: +// +// Cannot create a shared instance. The specified shared instance name is already in use. +// +#define LOCALDB_ERROR_SHARED_NAME_TAKEN ((HRESULT)0x89C50119L) + +// +// MessageId: LOCALDB_ERROR_CALLER_IS_NOT_OWNER +// +// MessageText: +// +// API caller is not LocalDB instance owner. +// +#define LOCALDB_ERROR_CALLER_IS_NOT_OWNER ((HRESULT)0x89C5011AL) + +// +// MessageId: LOCALDB_ERROR_INVALID_INSTANCE_NAME +// +// MessageText: +// +// Specified LocalDB instance name is invalid. +// +#define LOCALDB_ERROR_INVALID_INSTANCE_NAME ((HRESULT)0x89C5011BL) + +// +// MessageId: LOCALDB_ERROR_INSTANCE_ALREADY_SHARED +// +// MessageText: +// +// The specified LocalDB instance is already shared with different shared name. +// +#define LOCALDB_ERROR_INSTANCE_ALREADY_SHARED ((HRESULT)0x89C5011CL) + +// +// MessageId: LOCALDB_ERROR_INSTANCE_NOT_SHARED +// +// MessageText: +// +// The specified LocalDB instance is not shared. +// +#define LOCALDB_ERROR_INSTANCE_NOT_SHARED ((HRESULT)0x89C5011DL) + +// +// MessageId: LOCALDB_ERROR_ADMIN_RIGHTS_REQUIRED +// +// MessageText: +// +// Administrator privileges are required in order to execute this operation. +// +#define LOCALDB_ERROR_ADMIN_RIGHTS_REQUIRED ((HRESULT)0x89C5011EL) + +// +// MessageId: LOCALDB_ERROR_TOO_MANY_SHARED_INSTANCES +// +// MessageText: +// +// Unable to share a LocalDB instance - maximum number of shared LocalDB instances reached. +// +#define LOCALDB_ERROR_TOO_MANY_SHARED_INSTANCES ((HRESULT)0x89C5011FL) + +// +// MessageId: LOCALDB_ERROR_CANNOT_GET_LOCAL_APP_DATA_PATH +// +// MessageText: +// +// Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user. +// +#define LOCALDB_ERROR_CANNOT_GET_LOCAL_APP_DATA_PATH ((HRESULT)0x89C50120L) + +// +// MessageId: LOCALDB_ERROR_CANNOT_LOAD_RESOURCES +// +// MessageText: +// +// Cannot load resources for this DLL. Resources for this DLL should be stored in a subfolder Resources, with the same file name as this DLL and the extension ".RLL". +// +#define LOCALDB_ERROR_CANNOT_LOAD_RESOURCES ((HRESULT)0x89C50121L) + + // Detailed error descriptions +// +// MessageId: LOCALDB_EDETAIL_DATADIRECTORY_IS_MISSING +// +// MessageText: +// +// The "DataDirectory" registry value is missing in the LocalDB instance registry key: %1 +// +#define LOCALDB_EDETAIL_DATADIRECTORY_IS_MISSING ((HRESULT)0x89C50200L) + +// +// MessageId: LOCALDB_EDETAIL_CANNOT_ACCESS_INSTANCE_FOLDER +// +// MessageText: +// +// Cannot access LocalDB instance folder: %1 +// +#define LOCALDB_EDETAIL_CANNOT_ACCESS_INSTANCE_FOLDER ((HRESULT)0x89C50201L) + +// +// MessageId: LOCALDB_EDETAIL_DATADIRECTORY_IS_TOO_LONG +// +// MessageText: +// +// The "DataDirectory" registry value is too long in the LocalDB instance registry key: %1 +// +#define LOCALDB_EDETAIL_DATADIRECTORY_IS_TOO_LONG ((HRESULT)0x89C50202L) + +// +// MessageId: LOCALDB_EDETAIL_PARENT_INSTANCE_IS_MISSING +// +// MessageText: +// +// The "Parent Instance" registry value is missing in the LocalDB instance registry key: %1 +// +#define LOCALDB_EDETAIL_PARENT_INSTANCE_IS_MISSING ((HRESULT)0x89C50203L) + +// +// MessageId: LOCALDB_EDETAIL_PARENT_INSTANCE_IS_TOO_LONG +// +// MessageText: +// +// The "Parent Instance" registry value is too long in the LocalDB instance registry key: %1 +// +#define LOCALDB_EDETAIL_PARENT_INSTANCE_IS_TOO_LONG ((HRESULT)0x89C50204L) + +// +// MessageId: LOCALDB_EDETAIL_DATA_DIRECTORY_INVALID +// +// MessageText: +// +// Data directory for LocalDB instance is invalid: %1 +// +#define LOCALDB_EDETAIL_DATA_DIRECTORY_INVALID ((HRESULT)0x89C50205L) + +// +// MessageId: LOCALDB_EDETAIL_XEVENT_ASSERT +// +// MessageText: +// +// LocalDB instance API: XEvent engine assert: %1 in %2:%3 (%4) +// +#define LOCALDB_EDETAIL_XEVENT_ASSERT ((HRESULT)0x89C50206L) + +// +// MessageId: LOCALDB_EDETAIL_XEVENT_ERROR +// +// MessageText: +// +// LocalDB instance API: XEvent error: %1 +// +#define LOCALDB_EDETAIL_XEVENT_ERROR ((HRESULT)0x89C50207L) + +// +// MessageId: LOCALDB_EDETAIL_INSTALLATION_CORRUPTED +// +// MessageText: +// +// LocalDB installation is corrupted. Reinstall the LocalDB. +// +#define LOCALDB_EDETAIL_INSTALLATION_CORRUPTED ((HRESULT)0x89C50208L) + +// +// MessageId: LOCALDB_EDETAIL_CANNOT_GET_PROGRAM_FILES_LOCATION +// +// MessageText: +// +// LocalDB XEvent error: cannot determine %ProgramFiles% folder location. +// +#define LOCALDB_EDETAIL_CANNOT_GET_PROGRAM_FILES_LOCATION ((HRESULT)0x89C50209L) + +// +// MessageId: LOCALDB_EDETAIL_XEVENT_CANNOT_INITIALIZE +// +// MessageText: +// +// LocalDB XEvent error: Cannot initialize XEvent engine. +// +#define LOCALDB_EDETAIL_XEVENT_CANNOT_INITIALIZE ((HRESULT)0x89C5020AL) + +// +// MessageId: LOCALDB_EDETAIL_XEVENT_CANNOT_FIND_CONF_FILE +// +// MessageText: +// +// LocalDB XEvent error: Cannot find XEvents configuration file: %1 +// +#define LOCALDB_EDETAIL_XEVENT_CANNOT_FIND_CONF_FILE ((HRESULT)0x89C5020BL) + +// +// MessageId: LOCALDB_EDETAIL_XEVENT_CANNOT_CONFIGURE +// +// MessageText: +// +// LocalDB XEvent error: Cannot configure XEvents engine with the configuration file: %1 +// HRESULT returned: %2 +// +#define LOCALDB_EDETAIL_XEVENT_CANNOT_CONFIGURE ((HRESULT)0x89C5020CL) + +// +// MessageId: LOCALDB_EDETAIL_XEVENT_CONF_FILE_NAME_TOO_LONG +// +// MessageText: +// +// LocalDB XEvent error: XEvents engine configuration file too long +// +#define LOCALDB_EDETAIL_XEVENT_CONF_FILE_NAME_TOO_LONG ((HRESULT)0x89C5020DL) + +// +// MessageId: LOCALDB_EDETAIL_COINITIALIZEEX_FAILED +// +// MessageText: +// +// CoInitializeEx API failed. HRESULT returned: %1 +// +#define LOCALDB_EDETAIL_COINITIALIZEEX_FAILED ((HRESULT)0x89C5020EL) + +// +// MessageId: LOCALDB_EDETAIL_PARENT_INSTANCE_VERSION_INVALID +// +// MessageText: +// +// LocalDB parent instance version is invalid: %1 +// +#define LOCALDB_EDETAIL_PARENT_INSTANCE_VERSION_INVALID ((HRESULT)0x89C5020FL) + +// +// MessageId: LOCALDB_EDETAIL_WINAPI_ERROR +// +// MessageText: +// +// Windows API call %1 returned error code: %2. Windows system error message is: %3Reported at line: %4. %5 +// +#define LOCALDB_EDETAIL_WINAPI_ERROR ((HRESULT)0xC9C50210L) + +// +// MessageId: LOCALDB_EDETAIL_UNEXPECTED_RESULT +// +// MessageText: +// +// Function %1 returned %2 at line %3. +// +#define LOCALDB_EDETAIL_UNEXPECTED_RESULT ((HRESULT)0x89C50211L) + +// +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0011_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqlncli_0000_0011_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/libraries/SQLAPI/include/ss_win/sqloledb.h b/libraries/SQLAPI/include/ss_win/sqloledb.h new file mode 100644 index 000000000..c6e2e5f6e --- /dev/null +++ b/libraries/SQLAPI/include/ss_win/sqloledb.h @@ -0,0 +1,867 @@ +//-------------------------------------------------------------------- +// Microsoft OLE DB Provider for SQL Server +// (C) Copyright 1997 By Microsoft Corporation. +// +// @doc +// +// @module SQLOLEDB.H | Provider Specific definitions +// +//-------------------------------------------------------------------- + +#ifndef _SQLOLEDB_H_ +#define _SQLOLEDB_H_ + +#ifndef __oledb_h__ +#include "oledb.h" +#endif /* __oledb_h__ */ + +//---------------------------------------------------------------------------- +// Provider-specific Class Ids +#ifdef DBINITCONSTANTS +// Provider CLSID {0C7FF16C-38E3-11d0-97AB-00C04FC2AD98} +extern const GUID CLSID_SQLOLEDB = {0xc7ff16cL,0x38e3,0x11d0,{0x97,0xab,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +// Error Lookup CLSID {C0932C62-38E5-11d0-97AB-00C04FC2AD98} +extern const GUID CLSID_SQLOLEDB_ERROR = {0xc0932c62L,0x38e5,0x11d0,{0x97,0xab,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +// Enumerator CLSID {DFA22B8E-E68D-11d0-97E4-00C04FC2AD98} +extern const GUID CLSID_SQLOLEDB_ENUMERATOR = {0xdfa22b8eL,0xe68d,0x11d0,{0x97,0xe4,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +#else // !DBINITCONSTANTS +extern const GUID CLSID_SQLOLEDB; +extern const GUID CLSID_SQLOLEDB_ERROR; +extern const GUID CLSID_SQLOLEDB_ENUMERATOR; +#endif // DBINITCONSTANTS + +//---------------------------------------------------------------------------- +// Provider-specific Interface Ids +#ifdef DBINITCONSTANTS +extern const GUID IID_ISQLServerErrorInfo = {0x5cf4ca12,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID IID_IRowsetFastLoad = {0x5cf4ca13,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID IID_IUMSInitialize = {0x5cf4ca14,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +// {4C2389FB-2511-11d4-B258-00C04F7971CE} +extern const GUID IID_ISchemaLock = {0x4c2389fb,0x2511,0x11d4,{0xb2,0x58,0x0,0xc0,0x4f,0x79,0x71,0xce}}; + +extern const GUID DBGUID_MSSQLXML = {0x5d531cb2L,0xe6ed,0x11d2,{0xb2,0x52,0x00,0xc0,0x4f,0x68,0x1b,0x71}}; +extern const GUID DBGUID_XPATH = {0xec2a4293L,0xe898,0x11d2,{0xb1,0xb7,0x00,0xc0,0x4f,0x68,0x0c,0x56}}; +// This IID_ICommandStream definition is available in later versions of +// UUID.LIB. It is also already an extern defined in oledb.h. +// +#if _MSC_VER < 1300 +extern const IID IID_ICommandStream = {0x0c733abfL,0x2a1c,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}; +#endif // _MSC_VER +extern const IID IID_ISQLXMLHelper = {0xd22a7678L,0xf860,0x40cd,{0xa5,0x67,0x15,0x63,0xde,0xb4,0x6d,0x49}}; +#else // !DBINITCONSTANTS +extern const GUID IID_ISQLServerErrorInfo; +extern const GUID IID_IRowsetFastLoad; +extern const GUID IID_IUMSInitialize; +extern const GUID IID_ISchemaLock; + +extern const GUID DBGUID_MSSQLXML; +extern const GUID DBGUID_XPATH; +extern const IID IID_ISQLXMLHelper; +#endif // DBINITCONSTANTS + +//---------------------------------------------------------------------------- +// Provider-specific schema rowsets +#ifdef DBINITCONSTANTS +extern const GUID DBSCHEMA_LINKEDSERVERS = {0x9093caf4,0x2eac,0x11d1,{0x98,0x9,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +#else // !DBINITCONSTANTS +extern const GUID DBSCHEMA_LINKEDSERVERS; +#endif // DBINITCONSTANTS + +#define CRESTRICTIONS_DBSCHEMA_LINKEDSERVERS 1 + +//---------------------------------------------------------------------------- +// Provider-specific property sets +#ifdef DBINITCONSTANTS +extern const GUID DBPROPSET_SQLSERVERDATASOURCE = {0x28efaee4,0x2d2c,0x11d1,{0x98,0x7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID DBPROPSET_SQLSERVERDATASOURCEINFO = {0xdf10cb94,0x35f6,0x11d2,{0x9c,0x54,0x0,0xc0,0x4f,0x79,0x71,0xd3}}; +extern const GUID DBPROPSET_SQLSERVERDBINIT = {0x5cf4ca10,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID DBPROPSET_SQLSERVERROWSET = {0x5cf4ca11,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID DBPROPSET_SQLSERVERSESSION = {0x28efaee5,0x2d2c,0x11d1,{0x98,0x7,0x0,0xc0,0x4f,0xc2,0xad,0x98}}; +extern const GUID DBPROPSET_SQLSERVERCOLUMN = {0x3b63fb5e,0x3fbb,0x11d3,{0x9f,0x29,0x0,0xc0,0x4f,0x8e,0xe9,0xdc}}; +extern const GUID DBPROPSET_SQLSERVERSTREAM = {0x9f79c073,0x8a6d,0x4bca,{0xa8,0xa8,0xc9,0xb7,0x9a,0x9b,0x96,0x2d}}; + + +#else // !DBINITCONSTANTS +extern const GUID DBPROPSET_SQLSERVERDATASOURCE; +extern const GUID DBPROPSET_SQLSERVERDATASOURCEINFO; +extern const GUID DBPROPSET_SQLSERVERDBINIT; +extern const GUID DBPROPSET_SQLSERVERROWSET; +extern const GUID DBPROPSET_SQLSERVERSESSION; +extern const GUID DBPROPSET_SQLSERVERCOLUMN; +extern const GUID DBPROPSET_SQLSERVERSTREAM; +#endif // DBINITCONSTANTS + + +//This is a guid candidate : ; +//---------------------------------------------------------------------------- +// Provider-specific columns for IColumnsRowset +#ifdef DBINITCONSTANTS +extern const DBID DBCOLUMN_SS_COMPFLAGS = {{0x627bd890,0xed54,0x11d2,{0xb9,0x94,0x0,0xc0,0x4f,0x8c,0xa8,0x2c}}, DBKIND_GUID_PROPID, (LPOLESTR)100}; +extern const DBID DBCOLUMN_SS_SORTID = {{0x627bd890,0xed54,0x11d2,{0xb9,0x94,0x0,0xc0,0x4f,0x8c,0xa8,0x2c}}, DBKIND_GUID_PROPID, (LPOLESTR)101}; +extern const DBID DBCOLUMN_BASETABLEINSTANCE = {{0x627bd890,0xed54,0x11d2,{0xb9,0x94,0x0,0xc0,0x4f,0x8c,0xa8,0x2c}}, DBKIND_GUID_PROPID, (LPOLESTR)102}; +extern const DBID DBCOLUMN_SS_TDSCOLLATION = {{0x627bd890,0xed54,0x11d2,{0xb9,0x94,0x0,0xc0,0x4f,0x8c,0xa8,0x2c}}, DBKIND_GUID_PROPID, (LPOLESTR)103}; +#else // !DBINITCONSTANTS +extern const DBID DBCOLUMN_SS_COMPFLAGS; +extern const DBID DBCOLUMN_SS_SORTID; +extern const DBID DBCOLUMN_BASETABLEINSTANCE; +extern const DBID DBCOLUMN_SS_TDSCOLLATION; +#endif // DBINITCONSTANTS + +//---------------------------------------------------------------------------- +// PropIds for DBPROP_INIT_GENERALTIMEOUT +#if ( OLEDBVER == 0x0210 ) +#define DBPROP_INIT_GENERALTIMEOUT 0x11cL +#endif + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERDATASOURCE +#define SSPROP_ENABLEFASTLOAD 2 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERDATASOURCEINFO +#define SSPROP_UNICODELCID 2 +#define SSPROP_UNICODECOMPARISONSTYLE 3 +#define SSPROP_COLUMNLEVELCOLLATION 4 +#define SSPROP_CHARACTERSET 5 +#define SSPROP_SORTORDER 6 +#define SSPROP_CURRENTCOLLATION 7 +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERDBINIT +#define SSPROP_INIT_CURRENTLANGUAGE 4 +#define SSPROP_INIT_NETWORKADDRESS 5 +#define SSPROP_INIT_NETWORKLIBRARY 6 +#define SSPROP_INIT_USEPROCFORPREP 7 +#define SSPROP_INIT_AUTOTRANSLATE 8 +#define SSPROP_INIT_PACKETSIZE 9 +#define SSPROP_INIT_APPNAME 10 +#define SSPROP_INIT_WSID 11 +#define SSPROP_INIT_FILENAME 12 +#define SSPROP_INIT_ENCRYPT 13 +#define SSPROP_AUTH_REPL_SERVER_NAME 14 +#define SSPROP_INIT_TAGCOLUMNCOLLATION 15 + +//----------------------------------------------------------------------------- +// Values for SSPROP_USEPROCFORPREP +#define SSPROPVAL_USEPROCFORPREP_OFF 0 +#define SSPROPVAL_USEPROCFORPREP_ON 1 +#define SSPROPVAL_USEPROCFORPREP_ON_DROP 2 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERSESSION +#define SSPROP_QUOTEDCATALOGNAMES 2 +#define SSPROP_ALLOWNATIVEVARIANT 3 +#define SSPROP_SQLXMLXPROGID 4 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERROWSET +#define SSPROP_MAXBLOBLENGTH 8 +#define SSPROP_FASTLOADOPTIONS 9 +#define SSPROP_FASTLOADKEEPNULLS 10 +#define SSPROP_FASTLOADKEEPIDENTITY 11 +#define SSPROP_CURSORAUTOFETCH 12 +#define SSPROP_DEFERPREPARE 13 +#define SSPROP_IRowsetFastLoad 14 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERCOLUMN +#define SSPROP_COL_COLLATIONNAME 14 + +//---------------------------------------------------------------------------- +// PropIds for DBPROPSET_SQLSERVERSTREAM +#define SSPROP_STREAM_MAPPINGSCHEMA 15 +#define SSPROP_STREAM_XSL 16 +#define SSPROP_STREAM_BASEPATH 17 +#define SSPROP_STREAM_COMMANDTYPE 18 +#define SSPROP_STREAM_XMLROOT 19 +#define SSPROP_STREAM_FLAGS 20 +#define SSPROP_STREAM_CONTENTTYPE 23 + +//---------------------------------------------------------------------------- +// Possible values for SSPROP_STREAM_FLAGS +#define STREAM_FLAGS_DISALLOW_URL 0x00000001 +#define STREAM_FLAGS_DISALLOW_ABSOLUTE_PATH 0x00000002 +#define STREAM_FLAGS_DISALLOW_QUERY 0x00000004 +#define STREAM_FLAGS_DONTCACHEMAPPINGSCHEMA 0x00000008 +#define STREAM_FLAGS_DONTCACHETEMPLATE 0x00000010 +#define STREAM_FLAGS_DONTCACHEXSL 0x00000020 +#define STREAM_FLAGS_DISALLOW_UPDATEGRAMS 0x00000040 +#define STREAM_FLAGS_RESERVED 0xffff0000 + +// Values for SSPROPVAL_COMMANDTYPE + +#define SSPROPVAL_COMMANDTYPE_REGULAR 21 +#define SSPROPVAL_COMMANDTYPE_BULKLOAD 22 + +//------------------------------------------------------------------- +// Variant Access macros, similar to ole automation. +//------------------------------------------------------------------- + +#define V_SS_VT(X) ((X)->vt) +#define V_SS_UNION(X, Y) ((X)->Y) + +#define V_SS_UI1(X) V_SS_UNION(X, bTinyIntVal) +#define V_SS_I2(X) V_SS_UNION(X, sShortIntVal) +#define V_SS_I4(X) V_SS_UNION(X, lIntVal) +#define V_SS_I8(X) V_SS_UNION(X, llBigIntVal) + +#define V_SS_R4(X) V_SS_UNION(X, fltRealVal) +#define V_SS_R8(X) V_SS_UNION(X, dblFloatVal) +#define V_SS_UI4(X) V_SS_UNION(X, ulVal) + +#define V_SS_MONEY(X) V_SS_UNION(X, cyMoneyVal) +#define V_SS_SMALLMONEY(X) V_SS_UNION(X, cyMoneyVal) + +#define V_SS_WSTRING(X) V_SS_UNION(X, NCharVal) +#define V_SS_WVARSTRING(X) V_SS_UNION(X, NCharVal) + +#define V_SS_STRING(X) V_SS_UNION(X, CharVal) +#define V_SS_VARSTRING(X) V_SS_UNION(X, CharVal) + +#define V_SS_BIT(X) V_SS_UNION(X, fBitVal) +#define V_SS_GUID(X) V_SS_UNION(X, rgbGuidVal) + +#define V_SS_NUMERIC(X) V_SS_UNION(X, numNumericVal) +#define V_SS_DECIMAL(X) V_SS_UNION(X, numNumericVal) + +#define V_SS_BINARY(X) V_SS_UNION(X, BinaryVal) +#define V_SS_VARBINARY(X) V_SS_UNION(X, BinaryVal) + +#define V_SS_DATETIME(X) V_SS_UNION(X, tsDateTimeVal) +#define V_SS_SMALLDATETIME(X) V_SS_UNION(X, tsDateTimeVal) + +#define V_SS_UNKNOWN(X) V_SS_UNION(X, UnknownType) + +//For next release. +#define V_SS_IMAGE(X) V_SS_UNION(X, ImageVal) +#define V_SS_TEXT(X) V_SS_UNION(X, TextVal) +#define V_SS_NTEXT(X) V_SS_UNION(X, NTextVal) + +//------------------------------------------------------------------- +// define SQL Server Spefific Variant Type +//------------------------------------------------------------------- +#define DBTYPE_SQLVARIANT 144 + +enum SQLVARENUM + { + VT_SS_EMPTY = DBTYPE_EMPTY, + VT_SS_NULL = DBTYPE_NULL, + VT_SS_UI1 = DBTYPE_UI1, + VT_SS_I2 = DBTYPE_I2, + VT_SS_I4 = DBTYPE_I4, + VT_SS_I8 = DBTYPE_I8, + + //Floats + VT_SS_R4 = DBTYPE_R4, + VT_SS_R8 = DBTYPE_R8, + + //Money + VT_SS_MONEY = DBTYPE_CY, + VT_SS_SMALLMONEY = 200, + + //Strings + VT_SS_WSTRING = 201, + VT_SS_WVARSTRING = 202, + + VT_SS_STRING =203, + VT_SS_VARSTRING =204, + + //Bit + VT_SS_BIT =DBTYPE_BOOL, + + //Guid + VT_SS_GUID =DBTYPE_GUID, + + //Exact precision + VT_SS_NUMERIC =DBTYPE_NUMERIC, + VT_SS_DECIMAL =205, + + //Datetime + VT_SS_DATETIME = DBTYPE_DBTIMESTAMP, + VT_SS_SMALLDATETIME =206, + + //Binary + VT_SS_BINARY =207, + VT_SS_VARBINARY =208, + //Future + VT_SS_UNKNOWN = 209, + }; + +typedef unsigned short SSVARTYPE; + + +//Hungarian : ssv (Sql Server Variant) +struct SSVARIANT + { + SSVARTYPE vt; + DWORD dwReserved1; + DWORD dwReserved2; + union + { + BYTE bTinyIntVal; + SHORT sShortIntVal; + LONG lIntVal; + LONGLONG llBigIntVal; + + FLOAT fltRealVal; + DOUBLE dblFloatVal; + + CY cyMoneyVal; + + struct _NCharVal + { + SHORT sActualLength; + SHORT sMaxLength; + WCHAR * pwchNCharVal; + BYTE rgbReserved[5]; + DWORD dwReserved; + WCHAR * pwchReserved; + } NCharVal; + + + struct _CharVal + { + SHORT sActualLength; + SHORT sMaxLength; + CHAR * pchCharVal; + BYTE rgbReserved[5]; + DWORD dwReserved; + WCHAR * pwchReserved; + } CharVal; + + VARIANT_BOOL fBitVal; + BYTE rgbGuidVal [16]; + + DB_NUMERIC numNumericVal; + + struct _BinaryVal + { + SHORT sActualLength; + SHORT sMaxLength; + BYTE * prgbBinaryVal; + DWORD dwReserved; + } BinaryVal; + + DBTIMESTAMP tsDateTimeVal; + + struct _UnknownType + { + DWORD dwActualLength; + BYTE rgMetadata [16]; + BYTE * pUnknownData; + } UnknownType; + + struct _BLOBType + { + DBOBJECT dbobj; + IUnknown * pUnk; + } BLOBType; + }; + + }; + + +#if defined(__cplusplus) && !defined(CINTERFACE) + +//----------------------------------------------------------------- +// Class Factory Interface used to initialize pointer to UMS. +// +interface IUMSInitialize : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE Initialize (VOID * pUMS) = 0; +}; + + +//----------------------------------------------------------------- +// Interface used to communicate with UMS. +// +interface IUMS +{ +public: + virtual VOID STDMETHODCALLTYPE SqlUmsSuspend (ULONG ticks) = 0; + virtual VOID STDMETHODCALLTYPE SqlUmsYield (ULONG ticks) = 0; + virtual VOID STDMETHODCALLTYPE SqlUmsSwitchPremptive () = 0; + virtual VOID STDMETHODCALLTYPE SqlUmsSwitchNonPremptive() = 0; + virtual BOOL STDMETHODCALLTYPE SqlUmsFIsPremptive() = 0; +}; + +#endif + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 3.03.0110 */ +/* at Tue May 09 16:41:59 2000 + */ +/* Compiler settings for sqloledb.idl: + Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: none +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __sqloledb_h__ +#define __sqloledb_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __ISQLServerErrorInfo_FWD_DEFINED__ +#define __ISQLServerErrorInfo_FWD_DEFINED__ +typedef interface ISQLServerErrorInfo ISQLServerErrorInfo; +#endif /* __ISQLServerErrorInfo_FWD_DEFINED__ */ + + +#ifndef __IRowsetFastLoad_FWD_DEFINED__ +#define __IRowsetFastLoad_FWD_DEFINED__ +typedef interface IRowsetFastLoad IRowsetFastLoad; +#endif /* __IRowsetFastLoad_FWD_DEFINED__ */ + + +#ifndef __ISchemaLock_FWD_DEFINED__ +#define __ISchemaLock_FWD_DEFINED__ +typedef interface ISchemaLock ISchemaLock; +#endif /* __ISchemaLock_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "unknwn.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +/**************************************** + * Generated header for interface: __MIDL_itf_sqloledb_0000 + * at Tue May 09 16:41:59 2000 + * using MIDL 3.03.0110 + ****************************************/ +/* [local] */ + + +// the structure returned by ISQLServerErrorInfo::GetSQLServerInfo +typedef struct tagSSErrorInfo + { + LPOLESTR pwszMessage; + LPOLESTR pwszServer; + LPOLESTR pwszProcedure; + LONG lNative; + BYTE bState; + BYTE bClass; + WORD wLineNumber; + } SSERRORINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sqloledb_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqloledb_0000_v0_0_s_ifspec; + +#ifndef __ISQLServerErrorInfo_INTERFACE_DEFINED__ +#define __ISQLServerErrorInfo_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ISQLServerErrorInfo + * at Tue May 09 16:41:59 2000 + * using MIDL 3.03.0110 + ****************************************/ +/* [unique][object][local][uuid] */ + + + +EXTERN_C const IID IID_ISQLServerErrorInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5CF4CA12-EF21-11d0-97E7-00C04FC2AD98") + ISQLServerErrorInfo : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetErrorInfo( + /* [out] */ SSERRORINFO __RPC_FAR *__RPC_FAR *ppErrorInfo, + /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppStringsBuffer) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISQLServerErrorInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ISQLServerErrorInfo __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ISQLServerErrorInfo __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ISQLServerErrorInfo __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorInfo )( + ISQLServerErrorInfo __RPC_FAR * This, + /* [out] */ SSERRORINFO __RPC_FAR *__RPC_FAR *ppErrorInfo, + /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppStringsBuffer); + + END_INTERFACE + } ISQLServerErrorInfoVtbl; + + interface ISQLServerErrorInfo + { + CONST_VTBL struct ISQLServerErrorInfoVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISQLServerErrorInfo_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISQLServerErrorInfo_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISQLServerErrorInfo_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISQLServerErrorInfo_GetErrorInfo(This,ppErrorInfo,ppStringsBuffer) \ + (This)->lpVtbl -> GetErrorInfo(This,ppErrorInfo,ppStringsBuffer) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISQLServerErrorInfo_GetErrorInfo_Proxy( + ISQLServerErrorInfo __RPC_FAR * This, + /* [out] */ SSERRORINFO __RPC_FAR *__RPC_FAR *ppErrorInfo, + /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppStringsBuffer); + + +void __RPC_STUB ISQLServerErrorInfo_GetErrorInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISQLServerErrorInfo_INTERFACE_DEFINED__ */ + + +/**************************************** + * Generated header for interface: __MIDL_itf_sqloledb_0006 + * at Tue May 09 16:41:59 2000 + * using MIDL 3.03.0110 + ****************************************/ +/* [local] */ + +#ifdef _WIN64 +typedef ULONG_PTR HACCESSOR; +#else +typedef ULONG HACCESSOR; +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sqloledb_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqloledb_0006_v0_0_s_ifspec; + +#ifndef __IRowsetFastLoad_INTERFACE_DEFINED__ +#define __IRowsetFastLoad_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: IRowsetFastLoad + * at Tue May 09 16:41:59 2000 + * using MIDL 3.03.0110 + ****************************************/ +/* [unique][object][local][uuid] */ + + + +EXTERN_C const IID IID_IRowsetFastLoad; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5CF4CA13-EF21-11d0-97E7-00C04FC2AD98") + IRowsetFastLoad : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InsertRow( + /* [in] */ HACCESSOR hAccessor, + /* [in] */ void __RPC_FAR *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( + /* [in] */ BOOL fDone) = 0; + + }; + +#else /* C style interface */ + + typedef struct IRowsetFastLoadVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IRowsetFastLoad __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IRowsetFastLoad __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IRowsetFastLoad __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InsertRow )( + IRowsetFastLoad __RPC_FAR * This, + /* [in] */ HACCESSOR hAccessor, + /* [in] */ void __RPC_FAR *pData); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Commit )( + IRowsetFastLoad __RPC_FAR * This, + /* [in] */ BOOL fDone); + + END_INTERFACE + } IRowsetFastLoadVtbl; + + interface IRowsetFastLoad + { + CONST_VTBL struct IRowsetFastLoadVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IRowsetFastLoad_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IRowsetFastLoad_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IRowsetFastLoad_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IRowsetFastLoad_InsertRow(This,hAccessor,pData) \ + (This)->lpVtbl -> InsertRow(This,hAccessor,pData) + +#define IRowsetFastLoad_Commit(This,fDone) \ + (This)->lpVtbl -> Commit(This,fDone) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IRowsetFastLoad_InsertRow_Proxy( + IRowsetFastLoad __RPC_FAR * This, + /* [in] */ HACCESSOR hAccessor, + /* [in] */ void __RPC_FAR *pData); + + +void __RPC_STUB IRowsetFastLoad_InsertRow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IRowsetFastLoad_Commit_Proxy( + IRowsetFastLoad __RPC_FAR * This, + /* [in] */ BOOL fDone); + + +void __RPC_STUB IRowsetFastLoad_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IRowsetFastLoad_INTERFACE_DEFINED__ */ + + +/**************************************** + * Generated header for interface: __MIDL_itf_sqloledb_0007 + * at Tue May 09 16:41:59 2000 + * using MIDL 3.03.0110 + ****************************************/ +/* [local] */ + +typedef DWORD LOCKMODE; + +enum LOCKMODEENUM + { LOCKMODE_INVALID = 0, + LOCKMODE_EXCLUSIVE = LOCKMODE_INVALID + 1, + LOCKMODE_SHARED = LOCKMODE_EXCLUSIVE + 1 + }; + +extern RPC_IF_HANDLE __MIDL_itf_sqloledb_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sqloledb_0007_v0_0_s_ifspec; + +#ifndef __ISchemaLock_INTERFACE_DEFINED__ +#define __ISchemaLock_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ISchemaLock + * at Tue May 09 16:41:59 2000 + * using MIDL 3.03.0110 + ****************************************/ +/* [unique][object][local][uuid] */ + + + +EXTERN_C const IID IID_ISchemaLock; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4C2389FB-2511-11d4-B258-00C04F7971CE") + ISchemaLock : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSchemaLock( + /* [in] */ DBID __RPC_FAR *pTableID, + /* [in] */ LOCKMODE lmMode, + /* [out] */ HANDLE __RPC_FAR *phLockHandle, + /* [out] */ ULONGLONG __RPC_FAR *pTableVersion) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseSchemaLock( + /* [in] */ HANDLE hLockHandle) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISchemaLockVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ISchemaLock __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ISchemaLock __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ISchemaLock __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSchemaLock )( + ISchemaLock __RPC_FAR * This, + /* [in] */ DBID __RPC_FAR *pTableID, + /* [in] */ LOCKMODE lmMode, + /* [out] */ HANDLE __RPC_FAR *phLockHandle, + /* [out] */ ULONGLONG __RPC_FAR *pTableVersion); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ReleaseSchemaLock )( + ISchemaLock __RPC_FAR * This, + /* [in] */ HANDLE hLockHandle); + + END_INTERFACE + } ISchemaLockVtbl; + + interface ISchemaLock + { + CONST_VTBL struct ISchemaLockVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISchemaLock_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISchemaLock_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISchemaLock_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISchemaLock_GetSchemaLock(This,pTableID,lmMode,phLockHandle,pTableVersion) \ + (This)->lpVtbl -> GetSchemaLock(This,pTableID,lmMode,phLockHandle,pTableVersion) + +#define ISchemaLock_ReleaseSchemaLock(This,hLockHandle) \ + (This)->lpVtbl -> ReleaseSchemaLock(This,hLockHandle) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISchemaLock_GetSchemaLock_Proxy( + ISchemaLock __RPC_FAR * This, + /* [in] */ DBID __RPC_FAR *pTableID, + /* [in] */ LOCKMODE lmMode, + /* [out] */ HANDLE __RPC_FAR *phLockHandle, + /* [out] */ ULONGLONG __RPC_FAR *pTableVersion); + + +void __RPC_STUB ISchemaLock_GetSchemaLock_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISchemaLock_ReleaseSchemaLock_Proxy( + ISchemaLock __RPC_FAR * This, + /* [in] */ HANDLE hLockHandle); + + +void __RPC_STUB ISchemaLock_ReleaseSchemaLock_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISchemaLock_INTERFACE_DEFINED__ */ + + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + +#endif //_SQLOLEDB_H_ diff --git a/libraries/SQLAPI/include/sybAPI.h b/libraries/SQLAPI/include/sybAPI.h new file mode 100644 index 000000000..a6863ce3f --- /dev/null +++ b/libraries/SQLAPI/include/sybAPI.h @@ -0,0 +1,649 @@ +// sybAPI.h +// +////////////////////////////////////////////////////////////////////// + +#if !defined(__SYBAPI_H__) +#define __SYBAPI_H__ + +#include "SQLAPI.h" + +// API header(s) +#include + +//! Sybase client and server messages handling callback +typedef void (SQLAPI_CALLBACK *saSybMsgHandler_t)(void *pMessageStruct, bool bIsServerMessage, void *pAddInfo); + +class SQLAPI_API SASybErrInfo : public SAMutex +{ +public: + SASybErrInfo(); + +public: + CS_MSGNUM msgnumber; + CS_CHAR msgstring[CS_MAX_MSG]; + CS_INT line; + + saSybMsgHandler_t fMsgHandler; + void * pMsgAddInfo; +} ; + +extern void AddSybSupport(const SAConnection *pCon); +extern void ReleaseSybSupport(); + +typedef CS_RETCODE (CS_PUBLIC *ct_debug_t)( + CS_CONTEXT *context, + CS_CONNECTION *connection, + CS_INT operation, + CS_INT flag, + CS_CHAR *filename, + CS_INT fnamelen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_bind_t)( + CS_COMMAND *cmd, + CS_INT item, + CS_DATAFMT *datafmt, + CS_VOID *buf, + CS_INT *outputlen, + CS_SMALLINT *indicator + ); +typedef CS_RETCODE (CS_PUBLIC *ct_br_column_t)( + CS_COMMAND *cmd, + CS_INT colnum, + CS_BROWSEDESC *browsedesc + ); +typedef CS_RETCODE (CS_PUBLIC *ct_br_table_t)( + CS_COMMAND *cmd, + CS_INT tabnum, + CS_INT type, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_callback_t)( + CS_CONTEXT *context, + CS_CONNECTION *connection, + CS_INT action, + CS_INT type, + CS_VOID *func + ); +typedef CS_RETCODE (CS_PUBLIC *ct_cancel_t)( + CS_CONNECTION *connection, + CS_COMMAND *cmd, + CS_INT type + ); +typedef CS_RETCODE (CS_PUBLIC *ct_capability_t)( + CS_CONNECTION *connection, + CS_INT action, + CS_INT type, + CS_INT capability, + CS_VOID *val + ); +typedef CS_RETCODE (CS_PUBLIC *ct_compute_info_t)( + CS_COMMAND *cmd, + CS_INT type, + CS_INT colnum, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_close_t)( + CS_CONNECTION *connection, + CS_INT option + ); +typedef CS_RETCODE (CS_PUBLIC *ct_cmd_alloc_t)( + CS_CONNECTION *connection, + CS_COMMAND **cmdptr + ); +typedef CS_RETCODE (CS_PUBLIC *ct_cmd_drop_t)( + CS_COMMAND *cmd + ); +typedef CS_RETCODE (CS_PUBLIC *ct_cmd_props_t)( + CS_COMMAND *cmd, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_command_t)( + CS_COMMAND *cmd, + CS_INT type, + CS_CHAR *buf, + CS_INT buflen, + CS_INT option + ); +typedef CS_RETCODE (CS_PUBLIC *ct_con_alloc_t)( + CS_CONTEXT *context, + CS_CONNECTION **connection + ); +typedef CS_RETCODE (CS_PUBLIC *ct_con_drop_t)( + CS_CONNECTION *connection + ); +typedef CS_RETCODE (CS_PUBLIC *ct_con_props_t)( + CS_CONNECTION *connection, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_connect_t)( + CS_CONNECTION *connection, + CS_CHAR *server_name, + CS_INT snamelen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_config_t)( + CS_CONTEXT *context, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_cursor_t)( + CS_COMMAND *cmd, + CS_INT type, + CS_CHAR *name, + CS_INT namelen, + CS_CHAR *text, + CS_INT tlen, + CS_INT option + ); +typedef CS_RETCODE (CS_PUBLIC *ct_dyndesc_t)( + CS_COMMAND *cmd, + CS_CHAR *descriptor, + CS_INT desclen, + CS_INT operation, + CS_INT idx, + CS_DATAFMT *datafmt, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *copied, + CS_SMALLINT *indicator + ); +typedef CS_RETCODE (CS_PUBLIC *ct_describe_t)( + CS_COMMAND *cmd, + CS_INT item, + CS_DATAFMT *datafmt + ); +typedef CS_RETCODE (CS_PUBLIC *ct_diag_t)( + CS_CONNECTION *connection, + CS_INT operation, + CS_INT type, + CS_INT idx, + CS_VOID *buffer + ); +typedef CS_RETCODE (CS_PUBLIC *ct_dynamic_t)( + CS_COMMAND *cmd, + CS_INT type, + CS_CHAR *id, + CS_INT idlen, + CS_CHAR *buf, + CS_INT buflen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_dynsqlda_t)( + CS_COMMAND *cmd, + CS_INT type, + SQLDA *dap, + CS_INT operation + ); +typedef CS_RETCODE (CS_PUBLIC *ct_exit_t)( + CS_CONTEXT *context, + CS_INT option + ); +typedef CS_RETCODE (CS_PUBLIC *ct_fetch_t)( + CS_COMMAND *cmd, + CS_INT type, + CS_INT offset, + CS_INT option, + CS_INT *count + ); +typedef CS_RETCODE (CS_PUBLIC *ct_getformat_t)( + CS_COMMAND *cmd, + CS_INT colnum, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_keydata_t)( + CS_COMMAND *cmd, + CS_INT action, + CS_INT colnum, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_init_t)( + CS_CONTEXT *context, + CS_INT version + ); +typedef CS_RETCODE (CS_PUBLIC *ct_options_t)( + CS_CONNECTION *connection, + CS_INT action, + CS_INT option, + CS_VOID *param, + CS_INT paramlen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *syb_ct_param_t)( + CS_COMMAND *cmd, + CS_DATAFMT *datafmt, + CS_VOID *data, + CS_INT datalen, + CS_SMALLINT indicator + ); +typedef CS_RETCODE (CS_PUBLIC *ct_getloginfo_t)( + CS_CONNECTION *connection, + CS_LOGINFO **logptr + ); +typedef CS_RETCODE (CS_PUBLIC *ct_setloginfo_t)( + CS_CONNECTION *connection, + CS_LOGINFO *loginfo + ); +typedef CS_RETCODE (CS_PUBLIC *ct_recvpassthru_t)( + CS_COMMAND *cmd, + CS_VOID **recvptr + ); +typedef CS_RETCODE (CS_PUBLIC *ct_sendpassthru_t)( + CS_COMMAND *cmd, + CS_VOID *send_bufp + ); +typedef CS_RETCODE (CS_PUBLIC *ct_poll_t)( + CS_CONTEXT *context, + CS_CONNECTION *connection, + CS_INT milliseconds, + CS_CONNECTION **compconn, + CS_COMMAND **compcmd, + CS_INT *compid, + CS_INT *compstatus + ); +typedef CS_RETCODE (CS_PUBLIC *ct_remote_pwd_t)( + CS_CONNECTION *connection, + CS_INT action, + CS_CHAR *server_name, + CS_INT snamelen, + CS_CHAR *password, + CS_INT pwdlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_results_t)( + CS_COMMAND *cmd, + CS_INT *result_type + ); +typedef CS_RETCODE (CS_PUBLIC *ct_res_info_t)( + CS_COMMAND *cmd, + CS_INT operation, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_send_t)( + CS_COMMAND *cmd + ); +typedef CS_RETCODE (CS_PUBLIC *ct_get_data_t)( + CS_COMMAND *cmd, + CS_INT colnum, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_send_data_t)( + CS_COMMAND *cmd, + CS_VOID *buf, + CS_INT buflen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_data_info_t)( + CS_COMMAND *cmd, + CS_INT action, + CS_INT colnum, + CS_IODESC *iodesc + ); +typedef CS_RETCODE (CS_PUBLIC *ct_wakeup_t)( + CS_CONNECTION *connection, + CS_COMMAND *cmd, + CS_INT func_id, + CS_RETCODE status + ); +typedef CS_RETCODE (CS_PUBLIC *ct_labels_t)( + CS_CONNECTION *connection, + CS_INT action, + CS_CHAR *labelname, + CS_INT namelen, + CS_CHAR *labelvalue, + CS_INT valuelen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_ds_lookup_t)( + CS_CONNECTION *connection, + CS_INT action, + CS_INT *reqidp, + CS_DS_LOOKUP_INFO *lookupinfo, + CS_VOID *userdatap + ); +typedef CS_RETCODE (CS_PUBLIC *ct_ds_dropobj_t)( + CS_CONNECTION *connection, + CS_DS_OBJECT *object + ); +typedef CS_RETCODE (CS_PUBLIC *ct_ds_objinfo_t)( + CS_DS_OBJECT *objclass, + CS_INT action, + CS_INT objinfo, + CS_INT number, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *ct_setparam_t)( + CS_COMMAND *cmd, + CS_DATAFMT *datafmt, + CS_VOID *data, + CS_INT *datalenp, + CS_SMALLINT *indp + ); + +typedef CS_RETCODE (CS_PUBLIC *cs_calc_t)( + CS_CONTEXT *context, + CS_INT op, + CS_INT datatype, + CS_VOID *var1, + CS_VOID *var2, + CS_VOID *dest + ); +typedef CS_RETCODE (CS_PUBLIC *cs_cmp_t)( + CS_CONTEXT *context, + CS_INT datatype, + CS_VOID *var1, + CS_VOID *var2, + CS_INT *result + ); +typedef CS_RETCODE (CS_PUBLIC *cs_convert_t)( + CS_CONTEXT *context, + CS_DATAFMT *srcfmt, + CS_VOID *srcdata, + CS_DATAFMT *destfmt, + CS_VOID *destdata, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *cs_will_convert_t)( + CS_CONTEXT *context, + CS_INT srctype, + CS_INT desttype, + CS_BOOL *result + ); +typedef CS_RETCODE (CS_PUBLIC *cs_set_convert_t)( + CS_CONTEXT *context, + CS_INT action, + CS_INT srctype, + CS_INT desttype, + CS_CONV_FUNC *buffer + ); +typedef CS_RETCODE (CS_PUBLIC *cs_setnull_t)( + CS_CONTEXT *context, + CS_DATAFMT *datafmt, + CS_VOID *buf, + CS_INT buflen + ); +typedef CS_RETCODE (CS_PUBLIC *cs_config_t)( + CS_CONTEXT *context, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *cs_ctx_alloc_t)( + CS_INT version, + CS_CONTEXT **outptr + ); +typedef CS_RETCODE (CS_PUBLIC *cs_ctx_drop_t)( + CS_CONTEXT *context + ); +typedef CS_RETCODE (CS_PUBLIC *cs_ctx_global_t)( + CS_INT version, + CS_CONTEXT **outptr + ); +typedef CS_RETCODE (CS_PUBLIC *cs_objects_t)( + CS_CONTEXT *context, + CS_INT action, + CS_OBJNAME *objname, + CS_OBJDATA *objdata + ); +typedef CS_RETCODE (CS_PUBLIC *cs_diag_t)( + CS_CONTEXT *context, + CS_INT operation, + CS_INT type, + CS_INT idx, + CS_VOID *buffer + ); +typedef CS_RETCODE (CS_PUBLIC *cs_dt_crack_t)( + CS_CONTEXT *context, + CS_INT datetype, + CS_VOID *dateval, + CS_DATEREC *daterec + ); +typedef CS_RETCODE (CS_PUBLIC *cs_dt_info_t)( + CS_CONTEXT *context, + CS_INT action, + CS_LOCALE *locale, + CS_INT type, + CS_INT item, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *cs_locale_t)( + CS_CONTEXT *context, + CS_INT action, + CS_LOCALE *locale, + CS_INT type, + CS_CHAR *buffer, + CS_INT buflen, + CS_INT *outlen + ); +typedef CS_RETCODE (CS_PUBLIC *cs_loc_alloc_t)( + CS_CONTEXT *context, + CS_LOCALE **loc_pointer + ); +typedef CS_RETCODE (CS_PUBLIC *cs_loc_drop_t)( + CS_CONTEXT *context, + CS_LOCALE *locale + ); +#ifdef CS__INTERNAL_STRUCTS +typedef CS_RETCODE (CS_VARARGS *cs_strbuild_t)( + CS_CONTEXT *context, + ... + ); +#else +typedef CS_RETCODE (CS_VARARGS *cs_strbuild_t)( + CS_CONTEXT *context, + CS_CHAR *buf, + CS_INT buflen, + CS_INT *outlen, + CS_CHAR *text, + CS_INT textlen, + ... + ); +#endif /* CS__INTERNAL_STRUCTS */ +typedef CS_RETCODE (CS_PUBLIC *cs_strcmp_t)( + CS_CONTEXT *context, + CS_LOCALE *locale, + CS_INT type, + CS_CHAR *str1, + CS_INT len1, + CS_CHAR *str2, + CS_INT len2, + CS_INT *result + ); +typedef CS_RETCODE (CS_PUBLIC *cs_time_t)( + CS_CONTEXT *context, + CS_LOCALE *locale, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen, + CS_DATEREC *drec + ); +typedef CS_RETCODE (CS_PUBLIC *cs_manage_convert_t)( + CS_CONTEXT *context, + CS_INT action, + CS_INT srctype, + CS_CHAR *srcname, + CS_INT srcnamelen, + CS_INT desttype, + CS_CHAR *destname, + CS_INT destnamelen, + CS_INT *maxmultiplier, + CS_CONV_FUNC *func + ); +typedef CS_RETCODE (CS_PUBLIC *cs_conv_mult_t)( + CS_CONTEXT *context, + CS_LOCALE *srcloc, + CS_LOCALE *destloc, + CS_INT *multiplier + ); + +typedef CS_RETCODE (CS_PUBLIC *ct_scroll_fetch_t)( + CS_COMMAND *cmd, + CS_INT type, + CS_INT offset, + CS_INT option, + CS_INT *count + ); + +// API declarations +class SQLAPI_API sybAPI : public saAPI +{ +public: + sybAPI(); + + ct_debug_t ct_debug; + ct_bind_t ct_bind; + ct_br_column_t ct_br_column; + ct_br_table_t ct_br_table; + ct_callback_t ct_callback; + ct_cancel_t ct_cancel; + ct_capability_t ct_capability; + ct_compute_info_t ct_compute_info; + ct_close_t ct_close; + ct_cmd_alloc_t ct_cmd_alloc; + ct_cmd_drop_t ct_cmd_drop; + ct_cmd_props_t ct_cmd_props; + ct_command_t ct_command; + ct_con_alloc_t ct_con_alloc; + ct_con_drop_t ct_con_drop; + ct_con_props_t ct_con_props; + ct_connect_t ct_connect; + ct_config_t ct_config; + ct_cursor_t ct_cursor; + ct_dyndesc_t ct_dyndesc; + ct_describe_t ct_describe; + ct_diag_t ct_diag; + ct_dynamic_t ct_dynamic; + ct_dynsqlda_t ct_dynsqlda; + ct_exit_t ct_exit; + ct_fetch_t ct_fetch; + ct_getformat_t ct_getformat; + ct_keydata_t ct_keydata; + ct_init_t ct_init; + ct_options_t ct_options; + syb_ct_param_t ct_param; + ct_getloginfo_t ct_getloginfo; + ct_setloginfo_t ct_setloginfo; + ct_recvpassthru_t ct_recvpassthru; + ct_sendpassthru_t ct_sendpassthru; + ct_poll_t ct_poll; + ct_remote_pwd_t ct_remote_pwd; + ct_results_t ct_results; + ct_res_info_t ct_res_info; + ct_send_t ct_send; + ct_get_data_t ct_get_data; + ct_send_data_t ct_send_data; + ct_data_info_t ct_data_info; + ct_wakeup_t ct_wakeup; + ct_labels_t ct_labels; + ct_ds_lookup_t ct_ds_lookup; + ct_ds_dropobj_t ct_ds_dropobj; + ct_ds_objinfo_t ct_ds_objinfo; + ct_setparam_t ct_setparam; + + cs_calc_t cs_calc; + cs_cmp_t cs_cmp; + cs_convert_t cs_convert; + cs_will_convert_t cs_will_convert; + cs_set_convert_t cs_set_convert; + cs_setnull_t cs_setnull; + cs_config_t cs_config; + cs_ctx_alloc_t cs_ctx_alloc; + cs_ctx_drop_t cs_ctx_drop; + cs_ctx_global_t cs_ctx_global; + cs_objects_t cs_objects; + cs_diag_t cs_diag; + cs_dt_crack_t cs_dt_crack; + cs_dt_info_t cs_dt_info; + cs_locale_t cs_locale; + cs_loc_alloc_t cs_loc_alloc; + cs_loc_drop_t cs_loc_drop; + cs_strbuild_t cs_strbuild; + cs_strcmp_t cs_strcmp; + cs_time_t cs_time; + cs_manage_convert_t cs_manage_convert; + cs_conv_mult_t cs_conv_mult; + + ct_scroll_fetch_t ct_scroll_fetch; + + static void SetMessageCallback(saSybMsgHandler_t fHandler, void *pAddInfo, SAConnection *pCon = NULL); + static int& DefaultLongMaxLength(); + + SASybErrInfo errorInfo; +}; + +class SQLAPI_API sybConnectionHandles : public saConnectionHandles +{ +public: + sybConnectionHandles(); + + CS_CONTEXT *m_context; + CS_CONNECTION *m_connection; + CS_LOCALE* m_locale; +}; + +class SQLAPI_API sybCommandHandles : public saCommandHandles +{ +public: + sybCommandHandles(); + + CS_COMMAND *m_command; +}; + +class SQLAPI_API sybExternalConnection +{ + bool m_bAttached; + + SAConnection *m_pCon; + CS_CONTEXT *m_contextSaved; + CS_CONNECTION *m_connectionSaved; + + CS_CONTEXT *m_context; + CS_CONNECTION *m_connection; + CS_VOID *m_ExternalContextClientMsg_cb; + CS_VOID *m_ExternalContextServerMsg_cb; + CS_VOID *m_ExternalConnectionClientMsg_cb; + CS_VOID *m_ExternalConnectionServerMsg_cb; + CS_INT m_nExternalUserDataLen; + CS_VOID *m_pExternalUserData; + CS_INT m_nExternalUserDataAllocated; + SASybErrInfo m_SybErrInfo; + +public: + sybExternalConnection( + SAConnection *pCon, + CS_CONTEXT *context, + CS_CONNECTION *connection); + void Attach(); + void Detach(); + ~sybExternalConnection(); +}; + + + +extern sybAPI g_sybAPI; + +#endif // !defined(__SYBAPI_H__) diff --git a/libraries/SQLAPI/include/sybase/bkpublic.h b/libraries/SQLAPI/include/sybase/bkpublic.h new file mode 100644 index 000000000..94abeed72 --- /dev/null +++ b/libraries/SQLAPI/include/sybase/bkpublic.h @@ -0,0 +1,291 @@ +/* +** SAP OpenClient +** Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved. +*/ + +/* +** blkpublic.h - for the bulk copy library API routines +*/ +#ifndef __BKPUBLIC_H__ + +#define __BKPUBLIC_H__ + + +#ifndef __NO_INCLUDE__ +#include +#endif /* __NO_INCLUDE__ */ + +/***************************************************************************** +** +** defines used in BLK-Lib applications +** +*****************************************************************************/ + +/* +** Define for a constant to differentiate the +** blklib api's/ +*/ +#define BLK_API_CONT (CS_INT) 500 +/* +** define for each BLK-Lib API +*/ + +#define BLK_NOAPI ((CS_INT) 0 + BLK_API_CONT) +#define BLK_BIND ((CS_INT) 1 + BLK_API_CONT) +#define BLK_DESCRIBE ((CS_INT) 2 + BLK_API_CONT) +#define BLK_DEFAULT ((CS_INT) 3 + BLK_API_CONT) +#define BLK_INIT ((CS_INT) 4 + BLK_API_CONT) +#define BLK_DONE ((CS_INT) 5 + BLK_API_CONT) +#define BLK_ROWXFER ((CS_INT) 6 + BLK_API_CONT) +#define BLK_TEXTXFER ((CS_INT) 7 + BLK_API_CONT) +#define BLK_SENDROW ((CS_INT) 8 + BLK_API_CONT) +#define BLK_SENDTEXT ((CS_INT) 9 + BLK_API_CONT) +#define BLK_DROP ((CS_INT) 10 + BLK_API_CONT) +#define BLK_GETROW ((CS_INT) 11 + BLK_API_CONT) +#define BLK_COLVAL ((CS_INT) 12 + BLK_API_CONT) +#define BLK_GETTEXT ((CS_INT) 13 + BLK_API_CONT) +#define BLK_PROPS ((CS_INT) 14 + BLK_API_CONT) + + +/* +** The direction of the bulk copy - set in blk_init() +*/ +#define CS_BLK_IN (CS_INT) 1 +#define CS_BLK_OUT (CS_INT) 2 + +/* +** For the blk_done - +** just send a batch of records over +** end the bulk copy operation +** Cancel the bulk copy operation +*/ +#define CS_BLK_BATCH (CS_INT) 1 +#define CS_BLK_ALL (CS_INT) 2 +#define CS_BLK_CANCEL (CS_INT) 3 + +/* +** For blk_default when there is no default value for the column +*/ +#define CS_NO_DEFAULT (CS_INT) (-999) + + +#ifndef BLK_VERSION_100 +#define BLK_VERSION_100 CS_VERSION_100 +#define BLK_VERSION_100_NO_LRGID CS_VERSION_100_NO_LRGID +#endif /* BLK_VERSION_100 */ + +/* +** define BLK_VERSION_110 as BLK_VERSION_100 +*/ +#ifndef BLK_VERSION_110 +#define BLK_VERSION_110 BLK_VERSION_100 +#define BLK_VERSION_110_NO_LRGID BLK_VERSION_100_NO_LRGID +#endif /* BLK_VERSION_110 */ + +/* +** define BLK_VERSION_120 as BLK_VERSION_100 +*/ +#ifndef BLK_VERSION_120 +#define BLK_VERSION_120 BLK_VERSION_100 +#define BLK_VERSION_12_NO_LRGID0 BLK_VERSION_100_NO_LRGID +#endif /* BLK_VERSION_120 */ + +/* +** define BLK_VERSION_125 as CS_VERSION_125 +*/ +#ifndef BLK_VERSION_125 +#define BLK_VERSION_125 CS_VERSION_125 +#define BLK_VERSION_125_NO_LRGID CS_VERSION_125_NO_LRGID +#endif /* BLK_VERSION_125 */ + +/* +** define BLK_VERSION_150 as CS_VERSION_150 +*/ +#ifndef BLK_VERSION_150 +#define BLK_VERSION_150 CS_VERSION_150 +#define BLK_VERSION_150_NO_LRGID CS_VERSION_150_NO_LRGID +#endif /* BLK_VERSION_150 */ + +/* +** define BLK_VERSION_155 as CS_VERSION_155 +*/ +#ifndef BLK_VERSION_155 +#define BLK_VERSION_155 CS_VERSION_155 +#endif /* BLK_VERSION_155 */ + +/* +** define BLK_VERSION_157 as CS_VERSION_157 +*/ +#ifndef BLK_VERSION_157 +#define BLK_VERSION_157 CS_VERSION_157 +#endif /* BLK_VERSION_157 */ + +/* +** define BLK_VERSION_160 as CS_VERSION_160 +*/ +#ifndef BLK_VERSION_160 +#define BLK_VERSION_160 CS_VERSION_160 +#endif /* BLK_VERSION_160 */ + +/* +** For the bulk copy options - used with blk_props() +*/ +#define BLK_IDENTITY (CS_INT) (1) +#define BLK_SENSITIVITY_LBL (CS_INT) (2) +#define BLK_NOAPI_CHK (CS_INT) (3) +#define BLK_SLICENUM (CS_INT) (4) +#define BLK_IDSTARTNUM (CS_INT) (5) +#define BLK_ARRAY_INSERT (CS_INT) (6) +#define ARRAY_INSERT BLK_ARRAY_INSERT +#define BLK_CONV (CS_INT) (7) +#define BLK_PARTITION (CS_INT) (8) +#define BLK_CUSTOM_CLAUSE (CS_INT) (9) + +/* +** Special value for datafmt.status in blklib with array binding +*/ +#define CS_BLK_ARRAY_MAXLEN (CS_INT)0x1000 + +/***************************************************************************** +** +** define all user accessable functions here +** +*****************************************************************************/ + +/* +** declare all functions +*/ + +CS_START_EXTERN_C + +extern CS_RETCODE CS_PUBLIC blk_alloc PROTOTYPE(( + CS_CONNECTION *connection, + CS_INT version, + CS_BLKDESC **blkdesc + )); + +extern CS_RETCODE CS_PUBLIC blk_bind PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_INT colnum, + CS_DATAFMT *datafmt, + CS_VOID *buf, + CS_INT *datalen, + CS_SMALLINT *indicator + )); + +extern CS_RETCODE CS_PUBLIC blk_colval PROTOTYPE(( + CS_VOID *srvproc, + CS_BLKDESC *blkdesc, + CS_BLK_ROW *row, + CS_INT colnum, + CS_VOID *value, + CS_INT valuelen, + CS_INT *outlen + )); + +extern CS_RETCODE CS_PUBLIC blk_default PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_INT colnum, + CS_VOID *value, + CS_INT valuelen, + CS_INT *outlen + )); + +extern CS_RETCODE CS_PUBLIC blk_describe PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_INT colnum, + CS_DATAFMT *datafmt + )); + +extern CS_RETCODE CS_PUBLIC blk_done PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_INT option, + CS_INT *outrows + )); + +extern CS_RETCODE CS_PUBLIC blk_drop PROTOTYPE(( + CS_BLKDESC *blkdesc + )); + +extern CS_RETCODE CS_PUBLIC blk_getrow PROTOTYPE(( + CS_VOID *srvproc, + CS_BLKDESC *blkdesc, + CS_BLK_ROW *row + )); + +extern CS_RETCODE CS_PUBLIC blk_gettext PROTOTYPE(( + CS_VOID *srvproc, + CS_BLKDESC *blkdesc, + CS_BLK_ROW *row, + CS_BYTE *buf, + CS_INT buflen, + CS_INT *bytes_read + )); + +extern CS_RETCODE CS_PUBLIC blk_init PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_INT direction, + CS_CHAR *tblname, + CS_INT tblnamelen + )); + +extern CS_RETCODE CS_PUBLIC blk_rowalloc PROTOTYPE(( + CS_VOID *srvproc, + CS_BLK_ROW **row + )); + +extern CS_RETCODE CS_PUBLIC blk_rowdrop PROTOTYPE(( + CS_VOID *srvproc, + CS_BLK_ROW *row + )); + +extern CS_RETCODE CS_PUBLIC blk_rowxfer PROTOTYPE(( + CS_BLKDESC *blkdesc + )); + +extern CS_RETCODE CS_PUBLIC blk_rowxfer_mult PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_INT *rowcount + )); + +extern CS_RETCODE CS_PUBLIC blk_sendrow PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_BLK_ROW *row + )); + +extern CS_RETCODE CS_PUBLIC blk_sendtext PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_BLK_ROW *row, + CS_BYTE *buf, + CS_INT buflen + )); + +extern CS_RETCODE CS_PUBLIC blk_srvinit PROTOTYPE(( + CS_VOID *srvproc, + CS_BLKDESC *blkdesc + )); + +extern CS_RETCODE CS_PUBLIC blk_textxfer PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_BYTE *buf, + CS_INT buflen, + CS_INT *outlen + )); + +extern CS_RETCODE CS_PUBLIC blk_props PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_INT action, + CS_INT property, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + )); + +extern CS_RETCODE CS_PUBLIC blk_bcp_indicator PROTOTYPE(( + CS_BLKDESC *blkdesc, + CS_BOOL action + )); + +CS_END_EXTERN_C + +#endif /* end of __BKPUBLIC_H__ */ diff --git a/libraries/SQLAPI/include/sybase/csconfig.h b/libraries/SQLAPI/include/sybase/csconfig.h new file mode 100644 index 000000000..e1e78571b --- /dev/null +++ b/libraries/SQLAPI/include/sybase/csconfig.h @@ -0,0 +1,165 @@ +/* +** SAP Open Client/Server +** Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved. +*/ + +#ifndef __CSCONFIG_H__ +#define __CSCONFIG_H__ + +/* +** This file will try to hide any interface differences found on various +** platform/compiler combinations. Any datatype or define that is +** dependant on a particular platform/compiler should have its definition +** here. +*/ + +/***************************************************************************** +** +** Function interface definitions. +** +*****************************************************************************/ + +/* +** Define the scoping rules that will be used in all libraries. These defines +** exist to support different compiler-specific keywords describing the +** calling convention of a C function. +** +** CS_PUBLIC Interface define for functions which are called +** outside of a library or DLL. +** +** CS_INTERNAL Interface define for functions which are only called +** within a library or DLL. +** +** CS_VARARGS Interface define for functions with variable argument +** lists which are called outside of a library or DLL. +** +** CS_STATIC Interface define for functions which are only called +** within a C module. +*/ + +/* +** We need to check to value of some compiler #defined macros +** but some compilers will give warnings for trying to use the +** value of a macro which has not been defined -- to avoid these +** warnings we define 'SYB' versions of the macros we need here +*/ +#if defined(_MSC_VER) +#define SYB_MSC_VER _MSC_VER +#else /* _MSC_VER */ +#define SYB_MSC_VER 0 +#endif /* _MSC_VER */ +#if defined(__STDC__) +#define SYB__STDC__ 1 +#else /* __STDC__ */ +#define SYB__STDC__ 0 +#endif /* __STDC__ */ + +#if defined(_CPROTO_) + +/* +** The _CPROTO_ ifdef allows users to have the cproto tool generate +** prototype definitions that include the scoping rules. We typedef all of +** the interface defines to allow the cproto tool to preserve the names +** (instead of replacing them with the defined values). +*/ +typedef void CS_PUBLIC; +typedef void CS_INTERNAL; +typedef void CS_VARARGS; +typedef void CS_STATIC; + +#else /* defined(_CPROTO_) */ + +#if ((SYB_MSC_VER >= 800) || defined(__BORLANDC__)) + +/* +** Defines for Windows NT calling conventions. +*/ +#define CS_PUBLIC __stdcall +#define CS_INTERNAL CS_PUBLIC +#define CS_VARARGS __stdcall +#define CS_STATIC static + +#else /* ((SYB_MSC_VER >= 800) || defined(__BORLANDC__)) */ + +/* +** Default defines for all other platform/compilers. +*/ +#define CS_PUBLIC +#define CS_INTERNAL +#define CS_VARARGS +#define CS_STATIC static + +#endif /* ((SYB_MSC_VER >= 800) || defined(__BORLANDC__)) */ + +#endif /* defined(_CPROTO_) */ + +/* +** Define wrappers to insure that all function prototypes defined in the +** Open Client and Open Server header files have the correct C function +** linkage when used with C++ compilers. +*/ +#if defined(__cplusplus) +#define CS_START_EXTERN_C extern "C" { +#define CS_END_EXTERN_C } +#else +#define CS_START_EXTERN_C +#define CS_END_EXTERN_C +#endif /* defined(__cplusplus) */ + +/* +** PROTOTYPE macro which produces the prototype +*/ +#ifndef PROTOTYPE +# define PROTOTYPE(s) s +#endif /* PROTOTYPE */ + +/* +** Define whether the compiler supports the "const" keyword. +*/ +#if (SYB__STDC__) || defined(__cplusplus) +# define CS_CONST const +#else +# define CS_CONST +#endif + +/* +** Define CS_ELLIPSE. It is used in function pointer prototypes where +** the arguments aren't known. Win3 uses ,... for CS_ELLIPSE, too. +*/ +#define CS_ELLIPSE , ... + +/***************************************************************************** +** +** Datatype definitions. +** +*****************************************************************************/ + +/* +** Certain SAP C datatypes must be defined as 4 bytes in size. The +** following insures that all platforms (including 64 bit machines) use +** the correct C native types. +*/ +#if defined( __alpha) || defined(SYB_LP64) || defined(SYB_LLP64) || defined(_AIX) +typedef int CS_INT; +typedef int CS_RETCODE; +typedef int CS_BOOL; +typedef unsigned int CS_UINT; +#else +typedef long CS_INT; +typedef long CS_RETCODE; +typedef long CS_BOOL; +typedef unsigned long CS_UINT; +#endif + +typedef void CS_VOID; +typedef void CS_THRDRES; + +typedef double CS_FLOAT; /* 8 byte float type */ + +/* +** Define the number of bits that a CS_BYTE can hold. +*/ +#define CS_BITS_PER_BYTE 8 + +#endif /* __CSCONFIG_H__ */ + diff --git a/libraries/SQLAPI/include/sybase/cspublic.h b/libraries/SQLAPI/include/sybase/cspublic.h new file mode 100644 index 000000000..2bae2014c --- /dev/null +++ b/libraries/SQLAPI/include/sybase/cspublic.h @@ -0,0 +1,1952 @@ +/* +** SAP Open Client/Server +** Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved. +*/ +#ifndef __CSPUBLIC_H__ +#define __CSPUBLIC_H__ + +#include + +/* +** Include the core header files. These files contain the defines and +** data structures that are shared by all libraries. +*/ +#ifndef __NO_INCLUDE__ +#include +#include +#endif /* __NO_INCLUDE__ */ + +/***************************************************************************** +** +** Size defines used in client/server applications. +** +*****************************************************************************/ + +/* +** Defines for the safe string funtions. +*/ +#define CS_STRLCPY cs_strlcpy +#define CS_STRLCAT cs_strlcat +#define CS_SNPRINTF cs_snprintf + +/* +** Define the maximum size of a fully qualified table name. +*/ +#define CS_OBJ_NAME (CS_INT)((CS_MAX_NAME * 3) + 4) + +/* +** The maximum number of bytes in the server message or error message +** stored in the CS_SERVERMSG and CS_CLIENTMSG structures. If the total +** message is longer than this, multiple structures will be passed to the +** application program. +*/ +#define CS_MAX_MSG (CS_INT)1024 + +/* +** The maximum number of bytes in a SAP timestamp. +*/ +#define CS_TS_SIZE (CS_INT)8 + +/* +** The maximum number of bytes in SAP text pointers. +*/ +#define CS_TP_SIZE (CS_INT)16 + +/* +** The size of the sqlstate array in the CS_SERVERMSG and CS_CLIENTMSG +** structures. Please note that this size is 2 bytes greater than what the +** standard specifies. Users should look at only the first 6 bytes in +** the array. That last 2 bytes are reserved to insure modulo 4 byte +** structure alignment. +*/ +#define CS_SQLSTATE_SIZE (CS_INT)8 + +/***************************************************************************** +** +** Defines passed into Open Client/Server APIs. +** +*****************************************************************************/ + +/* +** Define all the library versions currently supported. +** If compile flag 'CS_NO_LARGE_IDENTIFIERS' is set, we need to use +** the old values for CS_VERSION_xxx for compatibility reasons. +** The compile flag 'CS_NO_LARGE_IDENTIFIERS' isn't supported anymore +** as of CS_VERSION_155. +** We want the compiler to return errors when the CS_NO_LARGE_IDENTIFIERS +** flag is used with versions >= CS_VERSION_155 +*/ +#ifdef CS_NO_LARGE_IDENTIFIERS +#define CS_VERSION_100 (CS_INT)112 +#define CS_VERSION_110 (CS_INT)1100 +#define CS_VERSION_120 CS_VERSION_110 +#define CS_VERSION_125 (CS_INT)12500 +#define CS_VERSION_150 (CS_INT)15000 +#else +#define CS_VERSION_100 (CS_INT)113 +#define CS_VERSION_110 (CS_INT)1101 +#define CS_VERSION_120 CS_VERSION_110 +#define CS_VERSION_125 (CS_INT)12501 +#define CS_VERSION_150 (CS_INT)15001 +#define CS_VERSION_155 (CS_INT)15501 +#define CS_VERSION_157 (CS_INT)15701 +#define CS_VERSION_160 (CS_INT)16001 +#endif /* CS_NO_LARGE_IDENTIFIERS */ + +#define CS_CURRENT_VERSION CS_VERSION_160 + +/* +** Action flags used. +** CS_CACHE currently only used by OMI apis +*/ +#define CS_GET (CS_INT)33 +#define CS_SET (CS_INT)34 +#define CS_CLEAR (CS_INT)35 +#define CS_INIT (CS_INT)36 +#define CS_STATUS (CS_INT)37 +#define CS_MSGLIMIT (CS_INT)38 +#define CS_SEND (CS_INT)39 +#define CS_SUPPORTED (CS_INT)40 +#define CS_CACHE (CS_INT)41 + +/* +** Bind indicator values. These are preferred when passing data into +** Client Library or Server Library, since they add the appropriate cast. +*/ +#define CS_GOODDATA (CS_SMALLINT)0 +#define CS_NULLDATA (CS_SMALLINT)(-1) + +/* +** Define ct_debug() operations. +*/ +#define CS_SET_FLAG (CS_INT)1700 +#define CS_CLEAR_FLAG (CS_INT)1701 +#define CS_SET_DBG_FILE (CS_INT)1702 +#define CS_SET_PROTOCOL_FILE (CS_INT)1703 + +/* +** Define ct_debug() types of trace information. +*/ +#define CS_DBG_ALL (CS_INT)0x1 +#define CS_DBG_ASYNC (CS_INT)0x2 +#define CS_DBG_ERROR (CS_INT)0x4 +#define CS_DBG_MEM (CS_INT)0x8 +#define CS_DBG_PROTOCOL (CS_INT)0x10 +#define CS_DBG_PROTOCOL_STATES (CS_INT)0x20 +#define CS_DBG_API_STATES (CS_INT)0x40 +#define CS_DBG_DIAG (CS_INT)0x80 +#define CS_DBG_NETWORK (CS_INT)0x100 +#define CS_DBG_API_LOGCALL (CS_INT)0x200 +#define CS_DBG_CTL_INFO (CS_INT)0x400 +#define CS_DBG_SSL (CS_INT)0x800 + +/* +** Cancel types. +*/ +#define CS_CANCEL_CURRENT (CS_INT)6000 +#define CS_CANCEL_ALL (CS_INT)6001 +#define CS_CANCEL_ATTN (CS_INT)6002 +#define CS_CANCEL_ABORT_NOTIF (CS_INT)6003 + +/* +** Cursor fetch options. +*/ +#define CS_FIRST (CS_INT)3000 +#define CS_NEXT (CS_INT)3001 +#define CS_PREV (CS_INT)3002 +#define CS_LAST (CS_INT)3003 +#define CS_ABSOLUTE (CS_INT)3004 +#define CS_RELATIVE (CS_INT)3005 + +/* +** Op codes used in cs_calc(). +*/ +#define CS_ADD (CS_INT)1 +#define CS_SUB (CS_INT)2 +#define CS_MULT (CS_INT)3 +#define CS_DIV (CS_INT)4 +#define CS_ZERO (CS_INT)5 + +/* +** The cs_dt_info() types. +*/ +#define CS_MONTH (CS_INT)7340 +#define CS_SHORTMONTH (CS_INT)7341 +#define CS_DAYNAME (CS_INT)7342 +#define CS_DATEORDER (CS_INT)7343 +#define CS_12HOUR (CS_INT)7344 +#define CS_DT_CONVFMT (CS_INT)7345 + +/* +** The cs_strcmp() options. +*/ +#define CS_COMPARE (CS_INT)7440 +#define CS_SORT (CS_INT)7441 + +/* +** Callback types. +*/ +#define CS_COMPLETION_CB (CS_INT)1 +#define CS_SERVERMSG_CB (CS_INT)2 +#define CS_CLIENTMSG_CB (CS_INT)3 +#define CS_NOTIF_CB (CS_INT)4 +#define CS_ENCRYPT_CB (CS_INT)5 +#define CS_CHALLENGE_CB (CS_INT)6 +#define CS_DS_LOOKUP_CB (CS_INT)7 +#define CS_SECSESSION_CB (CS_INT)8 +#define CS_SSLVALIDATE_CB (CS_INT)9 +#define CS_DONEPROC_CB (CS_INT)10 +#define CS_EXTENDED_ENCRYPT_CB (CS_INT)11 +#define CS_DR_MAP_CB (CS_INT)12 + +/* +** To install a signal callback, the type needs to calculated as an +** offset of the operating-system-specific signal number and the +** following define. For example, to install a callback handler for a +** SIGALRM signal, pass (CS_SIGNAL_CB + SIGALRM) to the ct_callback() +** routine. +*/ +#define CS_SIGNAL_CB (CS_INT)100 + +/* +** Exit and close flags. +*/ +#define CS_FORCE_EXIT (CS_INT)300 +#define CS_FORCE_CLOSE (CS_INT)301 + +/* +** ct_diag() and cs_diag() type flags. +*/ +#define CS_CLIENTMSG_TYPE (CS_INT)4700 +#define CS_SERVERMSG_TYPE (CS_INT)4701 +#define CS_ALLMSG_TYPE (CS_INT)4702 +#define SQLCA_TYPE (CS_INT)4703 +#define SQLCODE_TYPE (CS_INT)4704 +#define SQLSTATE_TYPE (CS_INT)4705 + +/* +** Compute info types. +*/ +#define CS_COMP_OP (CS_INT)5350 +#define CS_COMP_ID (CS_INT)5351 +#define CS_COMP_COLID (CS_INT)5352 +#define CS_COMP_BYLIST (CS_INT)5353 +#define CS_BYLIST_LEN (CS_INT)5354 + +/* +** Compute info operators. +*/ +#define CS_OP_SUM (CS_INT)5370 +#define CS_OP_AVG (CS_INT)5371 +#define CS_OP_COUNT (CS_INT)5372 +#define CS_OP_MIN (CS_INT)5373 +#define CS_OP_MAX (CS_INT)5374 + +/* +** Browse types. +*/ +#define CS_ISBROWSE (CS_INT)9000 +#define CS_TABNUM (CS_INT)9001 +#define CS_TABNAME (CS_INT)9002 + +/* +** Result types from ct_results(). +*/ +#define CS_ROW_RESULT (CS_INT)4040 +#define CS_CURSOR_RESULT (CS_INT)4041 +#define CS_PARAM_RESULT (CS_INT)4042 +#define CS_STATUS_RESULT (CS_INT)4043 +#define CS_MSG_RESULT (CS_INT)4044 +#define CS_COMPUTE_RESULT (CS_INT)4045 +#define CS_CMD_DONE (CS_INT)4046 +#define CS_CMD_SUCCEED (CS_INT)4047 +#define CS_CMD_FAIL (CS_INT)4048 +#define CS_ROWFMT_RESULT (CS_INT)4049 +#define CS_COMPUTEFMT_RESULT (CS_INT)4050 +#define CS_DESCRIBE_RESULT (CS_INT)4051 + +/* +** Flags for getting result info using ct_res_info(). +*/ +#define CS_ROW_COUNT (CS_INT)800 +#define CS_CMD_NUMBER (CS_INT)801 +#define CS_NUM_COMPUTES (CS_INT)802 +#define CS_NUMDATA (CS_INT)803 +#define CS_ORDERBY_COLS (CS_INT)804 +#define CS_NUMORDERCOLS (CS_INT)805 +#define CS_MSGTYPE (CS_INT)806 +#define CS_BROWSE_INFO (CS_INT)807 +#define CS_TRANS_STATE (CS_INT)808 +#define CS_TOKEN_TYPE (CS_INT)809 + +/* +** Possible values for CS_TRANS_STATE. +*/ +#define CS_TRAN_UNDEFINED (CS_INT)0 +#define CS_TRAN_IN_PROGRESS (CS_INT)1 +#define CS_TRAN_COMPLETED (CS_INT)2 +#define CS_TRAN_FAIL (CS_INT)3 +#define CS_TRAN_STMT_FAIL (CS_INT)4 + +/* +** Define the invalid count that the application gets when +** ct_res_info() is called at the wrong time. +*/ +#define CS_NO_COUNT (CS_INT)-1 + +/***************************************************************************** +** +** Commands in Open Client/Server APIs. +** +*****************************************************************************/ + +/* +** ct_command() command types. +*/ +#define CS_LANG_CMD (CS_INT)148 +#define CS_RPC_CMD (CS_INT)149 +#define CS_MSG_CMD (CS_INT)150 +#define CS_SEND_DATA_CMD (CS_INT)151 +#define CS_PACKAGE_CMD (CS_INT)152 +#define CS_SEND_BULK_CMD (CS_INT)153 +#define CS_SEND_DATA_NOCMD (CS_INT)154 +#define CS_RAW_CMD (CS_INT)155 + +/* +** ct_cursor() command types. +*/ +#define CS_CURSOR_DECLARE (CS_INT)700 +#define CS_CURSOR_OPEN (CS_INT)701 +#define CS_CURSOR_ROWS (CS_INT)703 +#define CS_CURSOR_UPDATE (CS_INT)704 +#define CS_CURSOR_DELETE (CS_INT)705 +#define CS_CURSOR_CLOSE (CS_INT)706 +#define CS_CURSOR_DEALLOC (CS_INT)707 +#define CS_CURSOR_OPTION (CS_INT)725 + +/* +** Open Server-specific cursor command types. +*/ +#define CS_CURSOR_FETCH (CS_INT)708 +#define CS_CURSOR_INFO (CS_INT)709 + +/* +** ct_dyndesc() command types. +*/ +#define CS_ALLOC (CS_INT)710 +#define CS_DEALLOC (CS_INT)711 +#define CS_USE_DESC (CS_INT)712 +#define CS_GETCNT (CS_INT)713 +#define CS_SETCNT (CS_INT)714 +#define CS_GETATTR (CS_INT)715 +#define CS_SETATTR (CS_INT)716 + +/* +** ct_dynamic() command types. +*/ +#define CS_PREPARE (CS_INT)717 +#define CS_EXECUTE (CS_INT)718 +#define CS_EXEC_IMMEDIATE (CS_INT)719 +#define CS_DESCRIBE_INPUT (CS_INT)720 +#define CS_DESCRIBE_INPUTIN (CS_INT)320 /* CS_DESCRIBE_INPUT & CS_INPUT */ +#define CS_DESCRIBE_OUTPUT (CS_INT)721 +#define CS_DYN_CURSOR_DECLARE (CS_INT)722 + + +/* +** ct_dynsqlda() arguments and actions +*/ +#define CS_SQLDA_SYBASE (CS_INT)729 +#define CS_GET_IN (CS_INT)730 +#define CS_GET_OUT (CS_INT)731 +#define CS_SQLDA_BIND (CS_INT)732 +#define CS_SQLDA_PARAM (CS_INT)733 + +/* +** Open Server-specific dynamic command types. +*/ +#define CS_PROCNAME (CS_INT)723 +#define CS_ACK (CS_INT)724 + + +/* +** ct_ds_objinfo() objinfo types. +*/ +#define CS_OBJ_CLASSOID (CS_INT)725 +#define CS_OBJ_DNAME (CS_INT)726 +#define CS_OBJ_NUMATTR (CS_INT)727 +#define CS_OBJ_ATRRIBUTE (CS_INT)728 + +/* +** Command options +*/ +#define CS_RECOMPILE (CS_INT)188 +#define CS_NO_RECOMPILE (CS_INT)189 +#define CS_BULK_INIT (CS_INT)190 +#define CS_BULK_CONT (CS_INT)191 +#define CS_BULK_DATA (CS_INT)192 +#define CS_COLUMN_DATA (CS_INT)193 + +/* +** Cursor options. +*/ +#define CS_FOR_UPDATE (CS_INT)0x0001 +#define CS_READ_ONLY (CS_INT)0x0002 +#define CS_DYNAMIC (CS_INT)0x0004 /* Open Server only */ +#define CS_RESTORE_OPEN (CS_INT)0x0008 /* CT-Lib only */ +#define CS_MORE (CS_INT)0x0010 +#define CS_END (CS_INT)0x0020 +#define CS_IMPLICIT_CURSOR (CS_INT)0x0040 /* Implicit, CT-Lib */ +#define CS_SCROLL_SENSITIVE (CS_INT)0x0080 /* Scrollable cursor, reserved */ +#define CS_SCROLL_INSENSITIVE (CS_INT)0x0100 /* Scrollable cursor, as default */ +#define CS_SCROLL_SEMISENSITIVE (CS_INT)0x0200 /* Scrollable cursor */ +#define CS_SCROLL_KEYSETDRIVEN (CS_INT)0x0400 /* Scrollable cursor, reserved */ +#define CS_SCROLL_CURSOR (CS_INT)0x0800 /* "Default", internal */ +#define CS_NOSCROLL_INSENSITIVE (CS_INT)0x1000 /* Non-scroll insensitive */ +#define CS_CUR_RELLOCKS_ONCLOSE (CS_INT)0x2000 /* Release locks on curclose */ + +/* +** SAP defined message ids for CS_MSG_CMDs. +*/ +#define CS_MSG_GETLABELS (CS_INT)6 +#define CS_MSG_LABELS (CS_INT)7 +#define CS_MSG_TABLENAME (CS_INT)8 +#define CS_PARSE_TREE (CS_INT)8710 + +/* +** Minimum and maximum user-defined message id for CS_MSG_CMDs. +*/ +#define CS_USER_MSGID (CS_INT)32768 +#define CS_USER_MAX_MSGID (CS_INT)65535 + +/* +** Defines for sp_regwatch registered procedure +*/ +#define CS_NOTIFY_ONCE 0x0002 /* one-time notification request. */ +#define CS_NOTIFY_ALWAYS 0x0004 /* permanent notification request. */ +#define CS_NOTIFY_WAIT 0x0020 /* blocking notification request. */ +#define CS_NOTIFY_NOWAIT 0x0040 /* non-blocking notification request. */ + + +/***************************************************************************** +** +** Open Client properties. +** +*****************************************************************************/ + +/* +** Properties that are used in *_props() functions. +*/ +#define CS_USERNAME (CS_INT)9100 +#define CS_PASSWORD (CS_INT)9101 +#define CS_APPNAME (CS_INT)9102 +#define CS_HOSTNAME (CS_INT)9103 +#define CS_LOGIN_STATUS (CS_INT)9104 +#define CS_TDS_VERSION (CS_INT)9105 +#define CS_CHARSETCNV (CS_INT)9106 +#define CS_PACKETSIZE (CS_INT)9107 +#define CS_USERDATA (CS_INT)9108 +#define CS_COMMBLOCK (CS_INT)9109 +#define CS_NETIO (CS_INT)9110 +#define CS_NOINTERRUPT (CS_INT)9111 +#define CS_TEXTLIMIT (CS_INT)9112 +#define CS_HIDDEN_KEYS (CS_INT)9113 +#define CS_VERSION (CS_INT)9114 +#define CS_IFILE (CS_INT)9115 +#define CS_LOGIN_TIMEOUT (CS_INT)9116 +#define CS_TIMEOUT (CS_INT)9117 +#define CS_MAX_CONNECT (CS_INT)9118 +#define CS_MESSAGE_CB (CS_INT)9119 +#define CS_EXPOSE_FMTS (CS_INT)9120 +#define CS_EXTRA_INF (CS_INT)9121 +#define CS_TRANSACTION_NAME (CS_INT)9122 +#define CS_ANSI_BINDS (CS_INT)9123 +#define CS_BULK_LOGIN (CS_INT)9124 +#define CS_LOC_PROP (CS_INT)9125 +#define CS_CUR_STATUS (CS_INT)9126 +#define CS_CUR_ID (CS_INT)9127 +#define CS_CUR_NAME (CS_INT)9128 +#define CS_CUR_ROWCOUNT (CS_INT)9129 +#define CS_PARENT_HANDLE (CS_INT)9130 +#define CS_EED_CMD (CS_INT)9131 +#define CS_DIAG_TIMEOUT (CS_INT)9132 +#define CS_DISABLE_POLL (CS_INT)9133 +#define CS_NOTIF_CMD (CS_INT)9134 +#define CS_SEC_ENCRYPTION (CS_INT)9135 +#define CS_SEC_CHALLENGE (CS_INT)9136 +#define CS_SEC_NEGOTIATE (CS_INT)9137 +#define CS_MEM_POOL (CS_INT)9138 +#define CS_USER_ALLOC (CS_INT)9139 +#define CS_USER_FREE (CS_INT)9140 +#define CS_ENDPOINT (CS_INT)9141 +#define CS_NO_TRUNCATE (CS_INT)9142 +#define CS_CON_STATUS (CS_INT)9143 +#define CS_VER_STRING (CS_INT)9144 +#define CS_ASYNC_NOTIFS (CS_INT)9145 +#define CS_SERVERNAME (CS_INT)9146 +/* For CS_SERVERADDR (9206) see below */ +#define CS_THREAD_RESOURCE (CS_INT)9147 +#define CS_NOAPI_CHK (CS_INT)9148 +#define CS_SEC_APPDEFINED (CS_INT)9149 +#define CS_NOCHARSETCNV_REQD (CS_INT)9150 +#define CS_STICKY_BINDS (CS_INT)9151 +#define CS_HAVE_CMD (CS_INT)9152 +#define CS_HAVE_BINDS (CS_INT)9153 +#define CS_HAVE_CUROPEN (CS_INT)9154 +#define CS_EXTERNAL_CONFIG (CS_INT)9155 +#define CS_CONFIG_FILE (CS_INT)9156 +#define CS_CONFIG_BY_SERVERNAME (CS_INT)9157 + +/* +** Directory Service connection properties +*/ +#define CS_DS_CHAIN (CS_INT)9158 +#define CS_DS_EXPANDALIAS (CS_INT)9159 +#define CS_DS_COPY (CS_INT)9160 +#define CS_DS_LOCALSCOPE (CS_INT)9161 +#define CS_DS_PREFERCHAIN (CS_INT)9162 +#define CS_DS_SCOPE (CS_INT)9163 +#define CS_DS_SIZELIMIT (CS_INT)9164 +#define CS_DS_TIMELIMIT (CS_INT)9165 +#define CS_DS_PRINCIPAL (CS_INT)9166 +/* For CS_DS_PASSWORD (9198) see below */ +#define CS_DS_REFERRAL (CS_INT)9167 +#define CS_DS_SEARCH (CS_INT)9168 +#define CS_DS_DITBASE (CS_INT)9169 +#define CS_DS_FAILOVER (CS_INT)9170 +#define CS_NET_TRANADDR (CS_INT)9171 +#define CS_DS_PROVIDER (CS_INT)9172 +#define CS_RETRY_COUNT (CS_INT)9173 +#define CS_LOOP_DELAY (CS_INT)9174 + +/* +** Properties for Security services support +*/ +#define CS_SEC_NETWORKAUTH (CS_INT)9175 +#define CS_SEC_DELEGATION (CS_INT)9176 +#define CS_SEC_MUTUALAUTH (CS_INT)9177 +#define CS_SEC_INTEGRITY (CS_INT)9178 +#define CS_SEC_CONFIDENTIALITY (CS_INT)9179 +#define CS_SEC_CREDTIMEOUT (CS_INT)9180 +#define CS_SEC_SESSTIMEOUT (CS_INT)9181 +#define CS_SEC_DETECTREPLAY (CS_INT)9182 +#define CS_SEC_DETECTSEQ (CS_INT)9183 +#define CS_SEC_DATAORIGIN (CS_INT)9184 +#define CS_SEC_MECHANISM (CS_INT)9185 +#define CS_SEC_CREDENTIALS (CS_INT)9186 +#define CS_SEC_CHANBIND (CS_INT)9187 +#define CS_SEC_SERVERPRINCIPAL (CS_INT)9188 +#define CS_SEC_KEYTAB (CS_INT)9189 + +/* +** More properties +*/ +#define CS_ABORTCHK_INTERVAL (CS_INT)9190 +#define CS_LOGIN_TYPE (CS_INT)9191 +#define CS_CON_KEEPALIVE (CS_INT)9192 +#define CS_CON_TCP_NODELAY (CS_INT)9193 +#define CS_LOGIN_REMOTE_SERVER (CS_INT)9194 +#define CS_LOGIN_REMOTE_PASSWD (CS_INT)9195 + +/* +** Property for HA failover +*/ +#define CS_HAFAILOVER (CS_INT)9196 + +/* +** Property for reverting to behavior of earlier versions +*/ +#define CS_BEHAVIOR (CS_INT)9197 + +/* +** Property for Directory services. (belongs with CS_DS_* above) +** Added at LDAP implementation time. +*/ +#define CS_DS_PASSWORD (CS_INT)9198 + +/* +** Property for blklib user data. +*/ +#define CS_BLKDATA (CS_INT)9199 + +/* +** Properties for SSL +*/ +#define CS_PROP_SSL_PROTOVERSION (CS_INT)9200 +#define CS_PROP_SSL_CIPHER (CS_INT)9201 +#define CS_PROP_SSL_LOCALID (CS_INT)9202 +#define CS_PROP_SSL_CA (CS_INT)9203 +#define CS_PROP_TLS_KEYREGEN (CS_INT)9205 + +/* +** Property for connecting to ASE using host and port. +*/ +#define CS_SERVERADDR (CS_INT)9206 + +/* +** Properties related to use of login redirection and +** Cluster HA extensions. +*/ +#define CS_PROP_REDIRECT (CS_INT)9207 +#define CS_PROP_EXTENDEDFAILOVER (CS_INT)9208 +#define CS_DS_RAND_OFFSET (CS_INT)9209 + +/* +** Property used to retrieve the ASE database SPID +** that is returned at login time. Note that this value +** may change should migration occur! +*/ +#define CS_PROP_APPLICATION_SPID (CS_INT)9210 + +/* +** For ct_cmd_props(), scrollable cursor. +** CS_CUR_ROWPOSITION is reserved for future use. +*/ +#define CS_CUR_TOTALROWS (CS_INT)9211 +#define CS_CUR_ROWPOSITION (CS_INT)9212 + +/* +** For extended password encryption +*/ +#define CS_SEC_EXTENDED_ENCRYPTION (CS_INT)9213 +#define CS_SEC_NON_ENCRYPTION_RETRY (CS_INT)9214 + +/* +** For connection migration +*/ +#define CS_PROP_MIGRATABLE (CS_INT)9215 + +/* +** For setting sybase home and an alternate libtcl config file location. +*/ +#define CS_SYBASE_HOME (CS_INT)9216 +#define CS_LIBTCL_CFG (CS_INT)9217 + +/* +** For setting default interfaces file +*/ +#define CS_DEFAULT_IFILE (CS_INT)9218 + +/* +** To retrieve the CS_TRANADDR ct_connect successfully used to +** establish communication with the server. +*/ +#define CS_CONNECTED_ADDR (CS_INT)9219 + +/* +** The connection allows partial text/image updates. +*/ +#define CS_PARTIAL_TEXT (CS_INT)9220 + +/* +** The connection omits 'writetext' with ct_send_data(). +*/ +#define CS_SENDDATA_NOCMD (CS_INT)9221 + +/* +** When the application name was set to the executable name, this name +** will be used to parse ocs.cfg for its application specific section. +*/ +#define CS_USE_DISCOVERED_APPNAME (CS_INT)9222 + +/* +** When the application name was set to the executable name, this setting +** will indicate how to 'sanitize' that name: all upper case, all lower case +** or no sanitization. +*/ +#define CS_SANITIZE_DISC_APPNAME (CS_INT)9223 + +/* +** Allow an application to set the TCP send and receive buffer sizes. +** These are negotiated at the TCP layer and must be set before calling +** ct_connect. +*/ +#define CS_TCP_RCVBUF (CS_INT)9224 +#define CS_TCP_SNDBUF (CS_INT)9225 +#define CS_TCP_LRGBUF 2146304 + +/* +** Allow row format information to be suppressed on subsequent execution +** of a prepared statement. +*/ +#define CS_CMD_SUPPRESS_FMT (CS_INT)9226 + +/* +** The object name returned by user API ct_data_info() is bracketed. +*/ +#define CS_PROP_BRACKETED_IDENT (CS_INT)9227 + +/* +** Set connection to be read-only as defined by server +** definition of read-only. +*/ +#define CS_PROP_READONLY (CS_INT)9228 + +/* +** Allow database to be set at connection time. +** Also retrieve the name of the database currently being used on the server. +*/ +#define CS_PROP_INITIAL_DATABASE (CS_INT)9229 +#define CS_PROP_CURRENT_DATABASE (CS_INT)9230 +#define CS_PROP_USE_LAST_DATABASE (CS_INT)9231 +#define CS_PROP_FIPSMODE (CS_INT)9232 + +/* End of properties */ + +/* +** CS_DS_SCOPE Values +*/ +#define CS_SCOPE_COUNTRY (CS_INT)1 +#define CS_SCOPE_DMD (CS_INT)2 +#define CS_SCOPE_WORLD (CS_INT)3 + +/* +** CS_DS_SEARCH Values +*/ +#define CS_SEARCH_OBJECT (CS_INT)1 +#define CS_SEARCH_ONE_LEVEL (CS_INT)2 +#define CS_SEARCH_SUBTREE (CS_INT)3 + +/* +** Possible values for the CS_NETIO property. +*/ +#define CS_SYNC_IO (CS_INT)8111 +#define CS_ASYNC_IO (CS_INT)8112 +#define CS_DEFER_IO (CS_INT)8113 + +/* +** Possible bit values for the CS_LOGIN_STATUS property. +*/ +#define CS_CONSTAT_CONNECTED (CS_INT)0x1 +#define CS_CONSTAT_DEAD (CS_INT)0x2 + + +/* +** Possible bit values for the CS_CUR_STATUS property. +*/ +#define CS_CURSTAT_NONE (CS_INT)0x0000 +#define CS_CURSTAT_DECLARED (CS_INT)0x0001 +#define CS_CURSTAT_OPEN (CS_INT)0x0002 +#define CS_CURSTAT_CLOSED (CS_INT)0x0004 +#define CS_CURSTAT_RDONLY (CS_INT)0x0008 +#define CS_CURSTAT_UPDATABLE (CS_INT)0x0010 +#define CS_CURSTAT_ROWCOUNT (CS_INT)0x0020 +#define CS_CURSTAT_DEALLOC (CS_INT)0x0040 +#define CS_CURSTAT_SCROLLABLE (CS_INT)0x0080 +#define CS_CURSTAT_IMPLICIT (CS_INT)0x0100 +#define CS_CURSTAT_SENSITIVE (CS_INT)0x0200 +#define CS_CURSTAT_INSENSITIVE (CS_INT)0x0400 +#define CS_CURSTAT_SEMISENSITIVE (CS_INT)0x0800 +#define CS_CURSTAT_KEYSETDRIVEN (CS_INT)0x1000 +#define CS_CURSTAT_RELLOCKS_ONCLOSE (CS_INT)0x2000 + +/* +** Possible bit values for implicit cursor status +*/ +#define CS_IMPCURSTAT_NONE (CS_INT)0x0000 +#define CS_IMPCURSTAT_DECLARED (CS_INT)0x0001 +#define CS_IMPCURSTAT_READROWS (CS_INT)0x0002 +#define CS_IMPCURSTAT_CLOSED (CS_INT)0x0004 +#define CS_IMPCURSTAT_SENDSUCCESS (CS_INT)0x0008 +#define CS_IMPCURSTAT_FINALREAD (CS_INT)0x0010 +#define CS_IMPCURSTAT_NOSEND (CS_INT)0x0020 +#define CS_IMPCURSTAT_NOSENDDONE (CS_INT)0x0040 + +/* +** Possible values for the CS_TDS_VERSION property. +*/ +#define CS_TDS_40 (CS_INT)7360 +#define CS_TDS_42 (CS_INT)7361 +#define CS_TDS_46 (CS_INT)7362 +#define CS_TDS_495 (CS_INT)7363 +#define CS_TDS_50 (CS_INT)7364 + +/* +** Possible values for the CS_BEHAVIOR property. +*/ +#define CS_BEHAVIOR_080 (CS_INT)7369 +#define CS_BEHAVIOR_100 (CS_INT)7370 +#define CS_BEHAVIOR_110 (CS_INT)7371 +#define CS_BEHAVIOR_120 (CS_INT)7372 +#define CS_BEHAVIOR_125 (CS_INT)7373 + +/* +** Possible values for the CS_PROP_SSL_PROTOVERSION property. +** +** If 2.0 handshake is desired with SSL 3.0 or TLS 1.0, or +** CS_SSLVER_20HAND +*/ +#define CS_SSLVER_20 (CS_INT)1 +#define CS_SSLVER_30 (CS_INT)2 +#define CS_SSLVER_TLS1 (CS_INT)3 +#define CS_SSLVER_20HAND (CS_INT)0x80000000 + +/* +** Valid values for the CS_SANITIZE_DISC_APPNAME property. +*/ +typedef enum cs_sanitize_conversion +{ + CS_CNVRT_NOTHING, + CS_CNVRT_LOWERCASE, + CS_CNVRT_UPPERCASE +} CS_SANITIZE_CONVERSION; + +/* +** Structure used with the CS_PROP_SSL_LOCALID property. +*/ +typedef struct _cs_sslid +{ + CS_CHAR *identity_file; + CS_CHAR *identity_password; +} CS_SSLIDENTITY; + +/* +** Structure used to deal with certificates in the validate callback. +*/ +typedef struct _cs_sslcertfield +{ + CS_VOID *value; + CS_INT field_id; + CS_INT length; +} CS_SSLCERT_FIELD; +typedef struct _cs_sslcert +{ + CS_INT field_count; + CS_INT extension_count; + CS_UINT start_date; + CS_UINT end_date; + CS_SSLCERT_FIELD *fieldptr; + CS_SSLCERT_FIELD *extensionptr; +} CS_SSLCERT; + +typedef CS_INT (CS_PUBLIC * CS_CERT_CB) ( + CS_VOID *user_data, + CS_SSLCERT *certptr, + CS_INT cert_count, + CS_INT valid + ); + +/* +** Defines for valid certificate fields. +*/ +#define CS_SSLFLD_noMatch 0 +#define CS_SSLFLD_md2 1 +#define CS_SSLFLD_md4 2 +#define CS_SSLFLD_md5 3 +#define CS_SSLFLD_sha1 4 +#define CS_SSLFLD_rsaEncryption 5 +#define CS_SSLFLD_md2WithRSA 6 +#define CS_SSLFLD_md4WithRSA 7 +#define CS_SSLFLD_md5WithRSA 8 +#define CS_SSLFLD_sha1WithRSA 9 +#define CS_SSLFLD_dhKeyAgreement 10 +#define CS_SSLFLD_pbeWithMD2AndDES_CBC 11 +#define CS_SSLFLD_pbeWithMD5AndDES_CBC 12 +#define CS_SSLFLD_emailAddress 13 +#define CS_SSLFLD_unstructuredName 14 +#define CS_SSLFLD_contentType 15 +#define CS_SSLFLD_messageDigest 16 +#define CS_SSLFLD_signingTime 17 +#define CS_SSLFLD_counterSignature 18 +#define CS_SSLFLD_challengePassword 19 +#define CS_SSLFLD_unstructuredAddress 20 +#define CS_SSLFLD_extendedCertificateAttributes 21 +#define CS_SSLFLD_commonName 22 +#define CS_SSLFLD_surName 23 +#define CS_SSLFLD_serialNumber 24 +#define CS_SSLFLD_countryName 25 +#define CS_SSLFLD_localityName 26 +#define CS_SSLFLD_stateProvinceName 27 +#define CS_SSLFLD_streetAddress 28 +#define CS_SSLFLD_organizationName 29 +#define CS_SSLFLD_organizationalUnitName 30 +#define CS_SSLFLD_title 31 +#define CS_SSLFLD_description 32 +#define CS_SSLFLD_businessCategory 33 +#define CS_SSLFLD_postalAddress 34 +#define CS_SSLFLD_postalCode 35 +#define CS_SSLFLD_postOfficeBox 36 +#define CS_SSLFLD_physicalDeliveryOfficeName 37 +#define CS_SSLFLD_telephoneNumber 38 +#define CS_SSLFLD_telexNumber 39 +#define CS_SSLFLD_telexTerminalIdentifier 40 +#define CS_SSLFLD_facsimileTelephoneNumber 41 +#define CS_SSLFLD_x_121Address 42 +#define CS_SSLFLD_internationalISDNNumber 43 +#define CS_SSLFLD_registeredAddress 44 +#define CS_SSLFLD_destinationIndicator 45 +#define CS_SSLFLD_preferredDeliveryMethod 46 +#define CS_SSLFLD_presentationAddress 47 +#define CS_SSLFLD_supportedApplicationContext 48 +#define CS_SSLFLD_member 49 +#define CS_SSLFLD_owner 50 +#define CS_SSLFLD_roleOccupant 51 +#define CS_SSLFLD_mysteryPKCS7_PKCS5 52 +#define CS_SSLFLD_netscapeCertType 53 +#define CS_SSLFLD_netscapeBaseURL 54 +#define CS_SSLFLD_netscapeRevocationURL 55 +#define CS_SSLFLD_netscapeCARevocationURL 56 +#define CS_SSLFLD_netscapeCertRenewalURL 57 +#define CS_SSLFLD_netscapeCAPolicyURL 58 +#define CS_SSLFLD_netscapeSSLServerName 59 +#define CS_SSLFLD_netscapeComment 60 +#define CS_SSLFLD_subjectDirectoryAttributes 61 +#define CS_SSLFLD_subjectKeyIdentifier 62 +#define CS_SSLFLD_keyUsage 63 +#define CS_SSLFLD_privateKeyUsagePeriod 64 +#define CS_SSLFLD_subjectAltName 65 +#define CS_SSLFLD_issuerAltName 66 +#define CS_SSLFLD_basicConstraints 67 +#define CS_SSLFLD_crlNumber 68 +#define CS_SSLFLD_crlReason 69 +#define CS_SSLFLD_holdInstructionCode 70 +#define CS_SSLFLD_invalidityDate 71 +#define CS_SSLFLD_deltaCRLIndicator 72 +#define CS_SSLFLD_issuingDistributionPoint 73 +#define CS_SSLFLD_nameConstraints 74 +#define CS_SSLFLD_certificatePolicies 75 +#define CS_SSLFLD_policyMappings 76 +#define CS_SSLFLD_policyConstraints 77 +#define CS_SSLFLD_authorityKeyIdentifier 78 +#define CS_SSLFLD_extendedKeyUsage 79 +#define CS_SSLFLD_pkixSubjectInfoAccess 80 +#define CS_SSLFLD_pkixAuthorityInfoAccess 81 +#define CS_SSLFLD_pkixCPS 82 +#define CS_SSLFLD_pkixUserNotice 83 +#define CS_SSLFLD_pkixKPServerAuth 84 +#define CS_SSLFLD_pkixKPClientAuth 85 +#define CS_SSLFLD_pkixKPCodeSigning 86 +#define CS_SSLFLD_pkixKPEmailProtection 87 +#define CS_SSLFLD_pkixKPIPSECEndSystem 88 +#define CS_SSLFLD_pkixKPIPSECTunnel 89 +#define CS_SSLFLD_pkixKPIPSECUser 90 +#define CS_SSLFLD_pkixKPTimeStamping 91 +#define CS_SSLFLD_netscapeKPStepUp 92 +#define CS_SSLFLD_microsoftKPServerGatedCrypto 93 +#define CS_SSLFLD_sha1WithDSA 94 +#define CS_SSLFLD_dsa 95 +#define CS_SSLFLD_contentInfoData 96 +#define CS_SSLFLD_contentInfoSignedData 97 +#define CS_SSLFLD_contentInfoEnvelopedData 98 +#define CS_SSLFLD_contentInfoSignedAndEnvelopedData 99 +#define CS_SSLFLD_contentInfoDigestedData 100 +#define CS_SSLFLD_contentInfoEncryptedData 101 +#define CS_SSLFLD_keyBag 102 +#define CS_SSLFLD_pkcs8ShroudedKeyBag 103 +#define CS_SSLFLD_certBag 104 +#define CS_SSLFLD_crlBag 105 +#define CS_SSLFLD_secretBag 106 +#define CS_SSLFLD_safeContentBag 107 +#define CS_SSLFLD_pbeWithSHA1And128RC4 108 +#define CS_SSLFLD_pbeWithSHA1And40BitRC4 109 +#define CS_SSLFLD_pbeWithSHA1And3KeyTripleDESCBC 110 +#define CS_SSLFLD_pbeWithSHA1And2KeyTripleDESCBC 111 +#define CS_SSLFLD_pbeWithSHA1And128BitRC2CBC 112 +#define CS_SSLFLD_pbeWithSHA1And40BitRC2CBC 113 +#define CS_SSLFLD_desEDECBC3 114 +#define CS_SSLFLD_rc2CBC 115 +#define CS_SSLFLD_x509Certificate 116 +#define CS_SSLFLD_dhPublicNumber 117 +#define CS_SSLFLD_ecdhPublicNumber 118 +#define CS_SSLFLD_ecdhPrivateNumber 119 +#define CS_SSLFLD_ecPublicKey 120 +#define CS_SSLFLD_ecPrivateKey 121 +#define CS_SSLFLD_ecdsaWithSHA1 122 +#define CS_SSLFLD_ecdsaec163a01 123 +#define CS_SSLFLD_ecdsaec163a02 124 +#define CS_SSLFLD_ecdsaec155b01 125 +#define CS_SSLFLD_ecdsaec163b01 126 +#define CS_SSLFLD_ecdsaec210b01 127 +#define CS_SSLFLD_ecnraec163a01 128 +#define CS_SSLFLD_ecnraec163a02 129 +#define CS_SSLFLD_ecnraec155b01 130 +#define CS_SSLFLD_ecnraec163b01 131 +#define CS_SSLFLD_ecnraec210b01 132 +#define CS_SSLFLD_curve113a01 133 +#define CS_SSLFLD_curve163a01 134 +#define CS_SSLFLD_curve163a02 135 +#define CS_SSLFLD_curve163b01 136 + +/* +** Define values for SSL/TLS certificate validation checks +*/ +#define CS_SSL_VALID_CERT 0 +#define CS_SSL_INVALID_BADCHAIN 1 +#define CS_SSL_INVALID_EXPCERT 2 +#define CS_SSL_INVALID_INCOMPLETE 3 +#define CS_SSL_INVALID_UNKNOWN 4 +#define CS_SSL_INVALID_UNTRUSTED 5 +#define CS_SSL_INVALID_MISSINGNAME 6 +#define CS_SSL_INVALID_MISMATCHNAME 7 +#define CS_SSL_INVALID_CERT 8 + +/***************************************************************************** +** +** Open Client/Server options. +** +*****************************************************************************/ + +/* +** The following is the list of all valid options: +*/ +#define CS_OPT_DATEFIRST (CS_INT)5001 /* Set first day of week */ +#define CS_OPT_TEXTSIZE (CS_INT)5002 /* Text size */ +#define CS_OPT_STATS_TIME (CS_INT)5003 /* Server time statistics */ +#define CS_OPT_STATS_IO (CS_INT)5004 /* Server I/O statistics */ +#define CS_OPT_ROWCOUNT (CS_INT)5005 /* Maximum row count */ +#define CS_OPT_NATLANG (CS_INT)5006 /* National Language */ +#define CS_OPT_DATEFORMAT (CS_INT)5007 /* Date format */ +#define CS_OPT_ISOLATION (CS_INT)5008 /* Transaction isolation + ** level */ +#define CS_OPT_AUTHON (CS_INT)5009 /* Set authority level on */ +#define CS_OPT_CHARSET (CS_INT)5010 /* Character set */ +#define CS_OPT_SHOWPLAN (CS_INT)5013 /* show execution plan */ +#define CS_OPT_NOEXEC (CS_INT)5014 /* don't execute query */ +#define CS_OPT_ARITHIGNORE (CS_INT)5015 /* ignore arithmetic + ** exceptions */ +#define CS_OPT_TRUNCIGNORE (CS_INT)5016 /* support ANSI null values */ +#define CS_OPT_ARITHABORT (CS_INT)5017 /* abort on arithmetic + ** exceptions */ +#define CS_OPT_PARSEONLY (CS_INT)5018 /* parse only, return error + ** msgs */ +#define CS_OPT_GETDATA (CS_INT)5020 /* return trigger data */ +#define CS_OPT_NOCOUNT (CS_INT)5021 /* don't print done count */ +#define CS_OPT_FORCEPLAN (CS_INT)5023 /* force variable substitute + ** order */ +#define CS_OPT_FORMATONLY (CS_INT)5024 /* send format w/o row */ +#define CS_OPT_CHAINXACTS (CS_INT)5025 /* chained transaction mode */ +#define CS_OPT_CURCLOSEONXACT (CS_INT)5026 /* close cursor on end trans */ +#define CS_OPT_FIPSFLAG (CS_INT)5027 /* FIPS flag */ +#define CS_OPT_RESTREES (CS_INT)5028 /* return resolution trees */ +#define CS_OPT_IDENTITYON (CS_INT)5029 /* turn on explicit identity */ +#define CS_OPT_CURREAD (CS_INT)5030 /* Set session label @@curread */ +#define CS_OPT_CURWRITE (CS_INT)5031 /* Set session label @@curwrite */ +#define CS_OPT_IDENTITYOFF (CS_INT)5032 /* turn off explicit identity */ +#define CS_OPT_AUTHOFF (CS_INT)5033 /* Set authority level off */ +#define CS_OPT_ANSINULL (CS_INT)5034 /* ANSI NULLS behavior */ +#define CS_OPT_QUOTED_IDENT (CS_INT)5035 /* Quoted identifiers */ +#define CS_OPT_ANSIPERM (CS_INT)5036 /* ANSI permission checking */ +#define CS_OPT_STR_RTRUNC (CS_INT)5037 /* ANSI right truncation */ +#define CS_OPT_SORTMERGE (CS_INT)5038 /* Sort merge join status */ +#define CS_OPT_JTC (CS_INT)5039 /* Enable/disable JTC for session */ +#define CS_OPT_CLIENTREALNAME (CS_INT)5040 /* Set client real name */ +#define CS_OPT_CLIENTHOSTNAME (CS_INT)5041 /* Set client host name */ +#define CS_OPT_CLIENTAPPLNAME (CS_INT)5042 /* Set client appl name */ +#define CS_OPT_IDENTITYUPD_ON (CS_INT)5043 /* turn on identity update */ +#define CS_OPT_IDENTITYUPD_OFF (CS_INT)5044 /* turn off identity update */ +#define CS_OPT_NODATA (CS_INT)5045 /* turn on/off nodata option */ +#define CS_OPT_CIPHERTEXT (CS_INT)5046 /* turn on/off ciphertext + ** encryption */ +#define CS_OPT_SHOW_FI (CS_INT)5047 /* Show Functional Indexes */ +#define CS_OPT_HIDE_VCC (CS_INT)5048 /* Hide Virtual Computed Columns */ +#define CS_OPT_LOBLOCATOR (CS_INT)5049 /* Enable/disable Lob locator */ +#define CS_OPT_LOBLOCFETCHSIZE (CS_INT)5050 /* Lob locator fetch size */ + +#define CS_MIN_OPTION CS_OPT_DATEFIRST +#define CS_MAX_OPTION CS_OPT_LOBLOCFETCHSIZE + +/* +** The supported options are summarized below with their defined values +** for `ArgSize' and `OptionArg'. ArgSize specifies the domain of valid +** values that are allowed. +** +** Option ArgSize OptionArg +** --------------- --------- --------- +** CS_OPT_DATEFIRST 1 byte Defines below +** CS_OPT_TEXTSIZE 4 bytes Size in bytes +** CS_OPT_ROWCOUNT 4 bytes Number of rows +** CS_OPT_NATLANG OptionArg Len National Lang (string) +** CS_OPT_DATEFORMAT 1 byte Defines below +** CS_OPT_ISOLATION 1 byte Defines below +** CS_OPT_AUTHON OptionArg Len Table Name (string) +** CS_OPT_CHARSET OptionArg Len Character set (string) +** CS_OPT_IDENTITYON OptionArg Len Table Name (string) +** CS_OPT_CURREAD OptionArg Len Read Label(string) +** CS_OPT_CURWRITE OptionArg Len Write Label(string) +** CS_OPT_IDENTITYOFF OptionArg Len Table Name (string) +** CS_OPT_AUTHOFF OptionArg Len Table Name (string) +** CS_OPT_IDENTITYUPD_ON OptionArg Len Table Name (string) +** CS_OPT_IDENTITYUPD_OFF OptionArg Len Table Name (string) +** (All remaining options) 1 byte Boolean value +** +** All string values must be sent in 7 bit ASCII. +** +*/ + + +/* CS_OPT_DATEFIRST */ +#define CS_OPT_MONDAY (CS_INT)1 +#define CS_OPT_TUESDAY (CS_INT)2 +#define CS_OPT_WEDNESDAY (CS_INT)3 +#define CS_OPT_THURSDAY (CS_INT)4 +#define CS_OPT_FRIDAY (CS_INT)5 +#define CS_OPT_SATURDAY (CS_INT)6 +#define CS_OPT_SUNDAY (CS_INT)7 + +/* CS_OPT_DATEFORMAT */ +#define CS_OPT_FMTMDY (CS_INT)1 +#define CS_OPT_FMTDMY (CS_INT)2 +#define CS_OPT_FMTYMD (CS_INT)3 +#define CS_OPT_FMTYDM (CS_INT)4 +#define CS_OPT_FMTMYD (CS_INT)5 +#define CS_OPT_FMTDYM (CS_INT)6 + +/* CS_OPT_ISOLATION */ +#define CS_OPT_LEVEL0 (CS_INT)0 +#define CS_OPT_LEVEL1 (CS_INT)1 +#define CS_OPT_LEVEL2 (CS_INT)2 +#define CS_OPT_LEVEL3 (CS_INT)3 + +/***************************************************************************** +** +** Open Client/Server capabilities. +** +*****************************************************************************/ + +/* +** Capability types. +*/ +#define CS_CAP_REQUEST (CS_INT)1 +#define CS_CAP_RESPONSE (CS_INT)2 + +/* +** Special capability value to set/get all capability values at once. +*/ +#define CS_ALL_CAPS (CS_INT)2700 + +/* +** Capability request values. +*/ +#define CS_REQ_LANG (CS_INT)1 +#define CS_REQ_RPC (CS_INT)2 +#define CS_REQ_NOTIF (CS_INT)3 +#define CS_REQ_MSTMT (CS_INT)4 +#define CS_REQ_BCP (CS_INT)5 +#define CS_REQ_CURSOR (CS_INT)6 +#define CS_REQ_DYN (CS_INT)7 +#define CS_REQ_MSG (CS_INT)8 +#define CS_REQ_PARAM (CS_INT)9 +#define CS_DATA_INT1 (CS_INT)10 +#define CS_DATA_INT2 (CS_INT)11 +#define CS_DATA_INT4 (CS_INT)12 +#define CS_DATA_BIT (CS_INT)13 +#define CS_DATA_CHAR (CS_INT)14 +#define CS_DATA_VCHAR (CS_INT)15 +#define CS_DATA_BIN (CS_INT)16 +#define CS_DATA_VBIN (CS_INT)17 +#define CS_DATA_MNY8 (CS_INT)18 +#define CS_DATA_MNY4 (CS_INT)19 +#define CS_DATA_DATE8 (CS_INT)20 +#define CS_DATA_DATE4 (CS_INT)21 +#define CS_DATA_FLT4 (CS_INT)22 +#define CS_DATA_FLT8 (CS_INT)23 +#define CS_DATA_NUM (CS_INT)24 +#define CS_DATA_TEXT (CS_INT)25 +#define CS_DATA_IMAGE (CS_INT)26 +#define CS_DATA_DEC (CS_INT)27 +#define CS_DATA_LCHAR (CS_INT)28 +#define CS_DATA_LBIN (CS_INT)29 +#define CS_DATA_INTN (CS_INT)30 +#define CS_DATA_DATETIMEN (CS_INT)31 +#define CS_DATA_MONEYN (CS_INT)32 +#define CS_CSR_PREV (CS_INT)33 +#define CS_CSR_FIRST (CS_INT)34 +#define CS_CSR_LAST (CS_INT)35 +#define CS_CSR_ABS (CS_INT)36 +#define CS_CSR_REL (CS_INT)37 +#define CS_CSR_MULTI (CS_INT)38 +#define CS_CON_OOB (CS_INT)39 +#define CS_CON_INBAND (CS_INT)40 +#define CS_CON_LOGICAL (CS_INT)41 +#define CS_PROTO_TEXT (CS_INT)42 +#define CS_PROTO_BULK (CS_INT)43 +#define CS_REQ_URGNOTIF (CS_INT)44 +#define CS_DATA_SENSITIVITY (CS_INT)45 +#define CS_DATA_BOUNDARY (CS_INT)46 +#define CS_PROTO_DYNAMIC (CS_INT)47 +#define CS_PROTO_DYNPROC (CS_INT)48 +#define CS_DATA_FLTN (CS_INT)49 +#define CS_DATA_BITN (CS_INT)50 +#define CS_OPTION_GET (CS_INT)51 +#define CS_DATA_INT8 (CS_INT)52 +#define CS_DATA_VOID (CS_INT)53 +#define CS_DOL_BULK (CS_INT)54 +#define CS_OBJECT_JAVA1 (CS_INT)55 +#define CS_OBJECT_CHAR (CS_INT)56 +#define CS_DATA_COLUMNSTATUS (CS_INT)57 +#define CS_OBJECT_BINARY (CS_INT)58 +#define CS_REQ_RESERVED1 (CS_INT)59 +#define CS_WIDETABLES (CS_INT)60 +#define CS_REQ_RESERVED2 (CS_INT)61 +#define CS_DATA_UINT2 (CS_INT)62 +#define CS_DATA_UINT4 (CS_INT)63 +#define CS_DATA_UINT8 (CS_INT)64 +#define CS_DATA_UINTN (CS_INT)65 +#define CS_CUR_IMPLICIT (CS_INT)66 +#define CS_DATA_UCHAR (CS_INT)67 +#define CS_IMAGE_NCHAR (CS_INT)68 +#define CS_BLOB_NCHAR_16 (CS_INT)69 +#define CS_BLOB_NCHAR_8 (CS_INT)70 +#define CS_BLOB_NCHAR_SCSU (CS_INT)71 +#define CS_DATA_DATE (CS_INT)72 +#define CS_DATA_TIME (CS_INT)73 +#define CS_DATA_INTERVAL (CS_INT)74 +#define CS_CSR_SCROLL (CS_INT)75 +#define CS_CSR_SENSITIVE (CS_INT)76 +#define CS_CSR_INSENSITIVE (CS_INT)77 +#define CS_CSR_SEMISENSITIVE (CS_INT)78 +#define CS_CSR_KEYSETDRIVEN (CS_INT)79 +#define CS_REQ_SRVPKTSIZE (CS_INT)80 +#define CS_DATA_UNITEXT (CS_INT)81 +#define CS_CAP_EXTENDEDFAILOVER (CS_INT)82 +#define CS_DATA_SINT1 (CS_INT)83 +#define CS_REQ_LARGEIDENT (CS_INT)84 +#define CS_REQ_BLOB_NCHAR_16 (CS_INT)85 +#define CS_DATA_XML (CS_INT)86 +#define CS_REQ_CURINFO3 (CS_INT)87 +#define CS_REQ_DBRPC2 (CS_INT)88 +#define CS_REQ_MIGRATE (CS_INT)89 +#define CS_REQ_UNDEFINED (CS_INT)90 +#define CS_REQ_RESERVED_091 (CS_INT)91 +#define CS_REQ_RESERVED_092 (CS_INT)92 +#define CS_REQ_RESERVED_093 (CS_INT)93 +#define CS_DATA_BIGDATETIME (CS_INT)94 +#define CS_DATA_BIGTIME (CS_INT)95 +#define CS_RPCPARAM_LOB (CS_INT)96 +#define CS_REQ_INSTID (CS_INT)97 +#define CS_REQ_GRID (CS_INT)98 +#define CS_REQ_DYN_BATCH (CS_INT)99 +#define CS_REQ_LANG_BATCH (CS_INT)100 +#define CS_REQ_RPC_BATCH (CS_INT)101 +#define CS_DATA_LOBLOCATOR (CS_INT)102 +#define CS_REQ_RESERVED_103 (CS_INT)103 +#define CS_REQ_RESERVED_104 (CS_INT)104 +#define CS_REQ_DYNAMIC_SUPPRESS_PARAMFMT (CS_INT)105 +#define CS_REQ_RESERVED_106 (CS_INT)106 +#define CS_REQ_READONLY (CS_INT)107 + +/* +** Minimum and maximum request capability values. +*/ +#define CS_MIN_REQ_CAP CS_REQ_LANG +#define CS_MAX_REQ_CAP CS_REQ_READONLY + +/* +** Capability response values. +*/ +#define CS_RES_NOMSG (CS_INT)1 +#define CS_RES_NOEED (CS_INT)2 +#define CS_RES_NOPARAM (CS_INT)3 +#define CS_DATA_NOINT1 (CS_INT)4 +#define CS_DATA_NOINT2 (CS_INT)5 +#define CS_DATA_NOINT4 (CS_INT)6 +#define CS_DATA_NOBIT (CS_INT)7 +#define CS_DATA_NOCHAR (CS_INT)8 +#define CS_DATA_NOVCHAR (CS_INT)9 +#define CS_DATA_NOBIN (CS_INT)10 +#define CS_DATA_NOVBIN (CS_INT)11 +#define CS_DATA_NOMNY8 (CS_INT)12 +#define CS_DATA_NOMNY4 (CS_INT)13 +#define CS_DATA_NODATE8 (CS_INT)14 +#define CS_DATA_NODATE4 (CS_INT)15 +#define CS_DATA_NOFLT4 (CS_INT)16 +#define CS_DATA_NOFLT8 (CS_INT)17 +#define CS_DATA_NONUM (CS_INT)18 +#define CS_DATA_NOTEXT (CS_INT)19 +#define CS_DATA_NOIMAGE (CS_INT)20 +#define CS_DATA_NODEC (CS_INT)21 +#define CS_DATA_NOLCHAR (CS_INT)22 +#define CS_DATA_NOLBIN (CS_INT)23 +#define CS_DATA_NOINTN (CS_INT)24 +#define CS_DATA_NODATETIMEN (CS_INT)25 +#define CS_DATA_NOMONEYN (CS_INT)26 +#define CS_CON_NOOOB (CS_INT)27 +#define CS_CON_NOINBAND (CS_INT)28 +#define CS_PROTO_NOTEXT (CS_INT)29 +#define CS_PROTO_NOBULK (CS_INT)30 +#define CS_DATA_NOSENSITIVITY (CS_INT)31 +#define CS_DATA_NOBOUNDARY (CS_INT)32 +#define CS_RES_NOTDSDEBUG (CS_INT)33 +#define CS_RES_NOSTRIPBLANKS (CS_INT)34 +#define CS_DATA_NOINT8 (CS_INT)35 +#define CS_OBJECT_NOJAVA1 (CS_INT)36 +#define CS_OBJECT_NOCHAR (CS_INT)37 +#define CS_DATA_NOCOLUMNSTATUS (CS_INT)38 +#define CS_OBJECT_NOBINARY (CS_INT)39 +#define CS_RES_RESERVED (CS_INT)40 +#define CS_DATA_NOUINT2 (CS_INT)41 +#define CS_DATA_NOUINT4 (CS_INT)42 +#define CS_DATA_NOUINT8 (CS_INT)43 +#define CS_DATA_NOUINTN (CS_INT)44 +#define CS_NOWIDETABLES (CS_INT)45 +#define CS_DATA_NOUCHAR (CS_INT)46 +#define CS_IMAGE_NONCHAR (CS_INT)47 +#define CS_BLOB_NONCHAR_16 (CS_INT)48 +#define CS_BLOB_NONCHAR_8 (CS_INT)49 +#define CS_BLOB_NONCHAR_SCSU (CS_INT)50 +#define CS_DATA_NODATE (CS_INT)51 +#define CS_DATA_NOTIME (CS_INT)52 +#define CS_DATA_NOINTERVAL (CS_INT)53 +#define CS_DATA_NOUNITEXT (CS_INT)54 +#define CS_DATA_NOSINT1 (CS_INT)55 +#define CS_NO_LARGEIDENT (CS_INT)56 +#define CS_NO_BLOB_NCHAR_16 (CS_INT)57 +#define CS_NO_SRVPKTSIZE (CS_INT)58 +#define CS_DATA_NOXML (CS_INT)59 +#define CS_NONINT_RETURN_VALUE (CS_INT)60 +#define CS_RES_NOXNLMETADATA (CS_INT)61 +#define CS_RES_SUPPRESS_FMT (CS_INT)62 +#define CS_RES_SUPPRESS_DONEINPROC (CS_INT)63 +#define CS_UNUSED_RES (CS_INT)64 +#define CS_DATA_NOBIGDATETIME (CS_INT)65 +#define CS_DATA_NOBIGTIME (CS_INT)66 +#define CS_RES_NO_TDSCONTROL (CS_INT)67 +#define CS_RPCPARAM_NOLOB (CS_INT)68 +#define CS_DATA_NOLOBLOCATOR (CS_INT)69 +#define CS_RES_RESERVED_70 (CS_INT)70 +#define CS_RES_RESERVED_71 (CS_INT)71 +#define CS_RES_LIST_DR_MAP (CS_INT)72 +#define CS_RES_DR_NOKILL (CS_INT)73 + +/* +** Minimum and maximum response capability values. +*/ +#define CS_MIN_RES_CAP CS_RES_NOMSG +#define CS_MAX_RES_CAP CS_RES_DR_NOKILL + +/* +** Minimum and maximum of all capabilities defined above. +*/ +#define CS_MIN_CAPVALUE CS_REQ_LANG +#define CS_MAX_CAPVALUE CS_REQ_READONLY + +/* +** Size of area to store capabilities. The array len must be greater +** than CS_CAP_ARRAYLEN additional capabilities to be added. +*/ +#define CS_CAP_ARRAYLEN 16 + +/* +** Maximum OID length (bytes) +*/ +#define CS_MAX_OIDLEN 255 + +/* +** Index used by access macros so that the first byte in the array will +** contain the high order bit. +*/ +#define CS_CAP_IDX(B) ((CS_CAP_ARRAYLEN - (B)/ CS_BITS_PER_BYTE) - 1) + +/* +** Data structure defining storage for capabilities. +*/ +typedef struct _cs_cap_type +{ + CS_BYTE mask[CS_CAP_ARRAYLEN]; +} CS_CAP_TYPE; + +/* +** Access macros for CS_CAP_TYPE structure. +*/ +#define CS_SET_CAPMASK(M, B) ((M)->mask[CS_CAP_IDX(B)] |= \ + (1 << ((B) % CS_BITS_PER_BYTE))) +#define CS_CLR_CAPMASK(M, B) ((M)->mask[CS_CAP_IDX(B)] &= \ + ~(1 << ((B) % CS_BITS_PER_BYTE))) +#define CS_TST_CAPMASK(M, B) ((M)->mask[CS_CAP_IDX(B)] & \ + (1 << ((B) % CS_BITS_PER_BYTE))) + +/***************************************************************************** +** +** Defines used in Open Client/Server structures. +** +*****************************************************************************/ + +/* +** Define I/O types in the CS_IODESC structure. +*/ +#define CS_IODATA (CS_INT)1600 +#define CS_IOPARTIAL (CS_INT)1601 + +/* +** Define status values for the status field of the CS_SERVERMSG and +** CS_CLIENTMSG structures. +*/ +#define CS_HASEED (CS_INT)0x1 +#define CS_FIRST_CHUNK (CS_INT)0x2 +#define CS_LAST_CHUNK (CS_INT)0x4 +#define CS_EEDINFO (CS_INT)0x8 + +/***************************************************************************** +** +** Hidden information structures. +** +*****************************************************************************/ + +#ifndef CS__INTERNAL_STRUCTS + +/* +** If passing code through lint, define the hidden structures as void. +*/ +#ifdef lint + +#ifndef CS_LOGINFO +#define CS_LOGINFO CS_VOID +#endif /* CS_LOGINFO */ + +#ifndef CS_BLKDESC +#define CS_BLKDESC CS_VOID +#endif /* CS_BLKDESC */ + +#ifndef CS_BLK_ROW +#define CS_BLK_ROW CS_VOID +#endif /* CS_BLK_ROW */ + +#else /* lint */ + +/* +** Use anonymous structure tags to define the hidden structures. +*/ +typedef struct _csloginfo CS_LOGINFO; +typedef struct _cs_blkdesc CS_BLKDESC; +typedef struct _bulkrow CS_BLK_ROW; + +#endif /* lint */ + +#endif /* CS__INTERNAL_STRUCTS */ + +/***************************************************************************** +** +** User-accessible information structures. +** +*****************************************************************************/ + +/* +** Define the I/O descriptor structure used by Open Client/Server. +** +** iotype Indicates the type of I/O to perform. For text +** and image operations, iotype always has the +** value CS_IODATA. +** +** datatype The datatype of the data object. The only legal +** values for datatype are CS_TEXT_TYPE and +** CS_IMAGE_TYPE and CS_XML_TYPE. +** +** *locale A pointer to a CS_LOCALE structure containing +** localization information for the text or image +** value. Set locale to NULL if localization +** information is not required. +** +** usertype The SQL Server user-defined datatype of the data +** object, if any. +** +** total_txtlen The total length, in bytes, of the text or image +** value. +** +** offset Reserved for future use. +** +** log_on_update Whether the update for this text object should +** be logged or not. +** +** name The name of the text or image column. name is a +** string of the form table.column. +** +** namelen The actual length of name +** +** timestamp The text timestamp of the column. A text +** timestamp marks the time of a text or image +** column's last modification. +** +** timestamplen The length, in bytes, of timestamp. +** +** textptr The text pointer for the column. A text pointer +** is an internal server pointer that points to the +** data for a text or image column. textptr identifies +** the target column in a send-data operation. +** +** textptrlen The length, in bytes, of textptr. +*/ + +typedef struct _cs_iodesc +{ + CS_INT iotype; + CS_INT datatype; + CS_LOCALE *locale; + CS_INT usertype; + CS_INT total_txtlen; + CS_INT offset; + CS_BOOL log_on_update; + CS_CHAR name[CS_OBJ_NAME]; + CS_INT namelen; + CS_BYTE timestamp[CS_TS_SIZE]; + CS_INT timestamplen; + CS_BYTE textptr[CS_TP_SIZE]; + CS_INT textptrlen; + CS_INT delete_length; +} CS_IODESC; + +/* +** Define the browse descriptor structure used by Open Client/Server. +** +** status A bit mask of either CS_EXPRESSION and/or CS_RENAMED. +** +** isbrowse CS_TRUE the column can be browse-mode updated. +** +** origname The original name of the column in the database. +** +** orignlen Length of origname in bytes. +** +** tablenum The number of the table to which the column +** belongs. The first table in a select statement's +** from-list is table number 1, the second number 2, +** and so forth. +** +** tablename The name of the table to which the column belongs. +** +** tabnlen Length of tablename in bytes. +** +*/ +#if defined(CS_NO_LARGE_IDENTIFIERS) +/* +** In pre-15.0 versions the (old) value for CS_MAX_NAME was used for the +** origname array declaration. Starting from version 15.0, CS_MAX_CHAR +** is used to define this character array size. +*/ +typedef struct _cs_browsedesc +{ + CS_INT status; + CS_BOOL isbrowse; + CS_CHAR origname[CS_MAX_NAME]; + CS_INT orignlen; + CS_INT tablenum; + CS_CHAR tablename[CS_OBJ_NAME]; + CS_INT tabnlen; +} CS_BROWSEDESC; +#else +typedef struct _cs_browsedesc +{ + CS_INT status; + CS_BOOL isbrowse; + CS_CHAR origname[CS_MAX_CHAR]; + CS_INT orignlen; + CS_INT tablenum; + CS_CHAR tablename[CS_OBJ_NAME]; + CS_INT tabnlen; +} CS_BROWSEDESC; +#endif + +/* +** Define the server message structure used by Open Client/Server. +** +** msgnumber The server message number. +** +** state The server error state. +** +** severity The severity of the message. +** +** text The text of the error string. If an application +** is not sequencing messages, text is guaranteed +** to be null-terminated, even if it has been +** truncated. If an application is sequencing +** messages, text is null-terminated only if it is +** the last chunk of a sequenced message. +** +** textlen The length, in bytes, of text. +** +** svrname The name of the server that generated the message. +** +** svrnlen The length, in bytes, of svrname. +** +** proc The name of the stored procedure which caused +** the message, if any. +** +** proclen The length, in bytes, of proc. +** +** line The line number, if any, of the line that caused +** the message. line can be a line number in a +** stored procedure or a line number in a command +** batch. +** +** status A bitmask used to indicate various types of +** information, such as whether or not extended +** error data is included with the message. +** +** sqlstate SQL state information. +** +** sqlstatelen The length, in bytes, of sqlstate. +** +*/ +#if defined(CS_NO_LARGE_IDENTIFIERS) +/* +** In pre-15.0 versions the (old) value for CS_MAX_NAME was used for the +** name array declarations. Starting from version 15.0, CS_MAX_CHAR is +** used to define these character array sizes. +*/ +typedef struct _cs_servermsg +{ + CS_MSGNUM msgnumber; + CS_INT state; + CS_INT severity; + CS_CHAR text[CS_MAX_MSG]; + CS_INT textlen; + CS_CHAR svrname[CS_MAX_NAME]; + CS_INT svrnlen; + CS_CHAR proc[CS_MAX_NAME]; + CS_INT proclen; + CS_INT line; + CS_INT status; + CS_BYTE sqlstate[CS_SQLSTATE_SIZE]; + CS_INT sqlstatelen; +} CS_SERVERMSG; +#else +typedef struct _cs_servermsg +{ + CS_MSGNUM msgnumber; + CS_INT state; + CS_INT severity; + CS_CHAR text[CS_MAX_MSG]; + CS_INT textlen; + CS_CHAR svrname[CS_MAX_CHAR]; + CS_INT svrnlen; + CS_CHAR proc[CS_MAX_CHAR]; + CS_INT proclen; + CS_INT line; + CS_INT status; + CS_BYTE sqlstate[CS_SQLSTATE_SIZE]; + CS_INT sqlstatelen; +} CS_SERVERMSG; +#endif + +/* +** Define the client message structure used by Open Client/Server. +** +** severity A symbolic value representing the severity of +** the message. +** +** msgnumber The message number. For information on how to +** interpret this number in Client-Library +** applications, see the Client-Library Messages +** topics in the Open Client documentation. +** +** msgstring The message string. If an application is not +** sequencing messages, msgstring is guaranteed to +** be null-terminated, even if it has been truncated. +** If an application is sequencing messages, +** msgstring is null-terminated only if it is the +** last chunk of a sequenced message. +** +** msgstringlen The length, in bytes, of msgstring. +** +** osnumber An error may have involved interactions the +** operating system (OS). If so, the OS error +** number would be stored here. Otherwise, +** this will be zero. +** +** osstring The operating system error text (if any). +** +** osstringlen The length, in bytes, of osstring. +** +** status A bitmask used to indicate various types of +** information, such as whether or not this is the +** first, a middle, or the last chunk of an error +** message. +** +** sqlstate SQL state information. +** +** sqlstatelen The length, in bytes, of sqlstate. +** +*/ +typedef struct _cs_clientmsg +{ + CS_INT severity; + CS_MSGNUM msgnumber; + CS_CHAR msgstring[CS_MAX_MSG]; + CS_INT msgstringlen; + CS_INT osnumber; + CS_CHAR osstring[CS_MAX_MSG]; + CS_INT osstringlen; + CS_INT status; + CS_BYTE sqlstate[CS_SQLSTATE_SIZE]; + CS_INT sqlstatelen; +} CS_CLIENTMSG; + +/* +** Define the constants an application tests for in the DONEPROC callback +*/ +#define CS_TDS_DONEPROC_TYPE (CS_INT)1 +#define CS_TDS_DONEINPROC_TYPE (CS_INT)2 + +/* +** Define the parameter information structure used by contol message callbacks. +*/ +typedef enum _cs_ctlparams +{ + CS_CTL_UNKNOWN = 0, + CS_CTL_GROUPNAME = 1, + CS_CTL_GENERATION = 2, + CS_CTL_DSNAME = 3, + CS_CTL_ADDRSTR = 4, + CS_CTL_HANAME = 5, + CS_CTL_OPTION = 6 +} CS_CTLPARAMS_T; + +typedef struct _cs_ctlinfo +{ + CS_CTLPARAMS_T ctltype; + CS_DATAFMT ctlfmt; + CS_UBIGINT ctlintinfo; + CS_TRANADDR ctladdr; + CS_CHAR *ctlstring; +} CS_CTLINFO_T; + +/* +** The only defined option is to mark that a node can be connected +** to for readonly operations. +*/ +#define CS_CTLOPT_READONLY 0x01 + +/***************************************************************************** +** +** Define user-accessable functions for Client/Server Library here. +** +*****************************************************************************/ + +/* +** Declare all functions. +*/ +CS_START_EXTERN_C + +/* cscalc.c */ +extern CS_RETCODE CS_PUBLIC cs_calc( + CS_CONTEXT *context, + CS_INT op, + CS_INT datatype, + CS_VOID *var1, + CS_VOID *var2, + CS_VOID *dest + ); + +/* cscmp.c */ +extern CS_RETCODE CS_PUBLIC cs_cmp( + CS_CONTEXT *context, + CS_INT datatype, + CS_VOID *var1, + CS_VOID *var2, + CS_INT *result + ); + +/* cscnvrt.c */ +extern CS_RETCODE CS_PUBLIC cs_convert( + CS_CONTEXT *context, + CS_DATAFMT *srcfmt, + CS_VOID *srcdata, + CS_DATAFMT *destfmt, + CS_VOID *destdata, + CS_INT *outlen + ); +extern CS_RETCODE CS_PUBLIC cs_will_convert( + CS_CONTEXT *context, + CS_INT srctype, + CS_INT desttype, + CS_BOOL *result + ); +extern CS_RETCODE CS_PUBLIC cs_set_convert( + CS_CONTEXT *context, + CS_INT action, + CS_INT srctype, + CS_INT desttype, + CS_CONV_FUNC *buffer + ); +extern CS_RETCODE CS_PUBLIC cs_setnull( + CS_CONTEXT *context, + CS_DATAFMT *datafmt, + CS_VOID *buf, + CS_INT buflen + ); + +/* csconfig.c */ +extern CS_RETCODE CS_PUBLIC cs_config( + CS_CONTEXT *context, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); + +/* csctxall.c */ +extern CS_RETCODE CS_PUBLIC cs_ctx_alloc( + CS_INT version, + CS_CONTEXT **outptr + ); + +/* csctxdrp.c */ +extern CS_RETCODE CS_PUBLIC cs_ctx_drop( + CS_CONTEXT *context + ); + +/* csctxglb.c */ +extern CS_RETCODE CS_PUBLIC cs_ctx_global( + CS_INT version, + CS_CONTEXT **outptr + ); + +/* csobjs.c */ +extern CS_RETCODE CS_PUBLIC cs_objects( + CS_CONTEXT *context, + CS_INT action, + CS_OBJNAME *objname, + CS_OBJDATA *objdata + ); + +/* csdiag.c */ +extern CS_RETCODE CS_PUBLIC cs_diag( + CS_CONTEXT *context, + CS_INT operation, + CS_INT type, + CS_INT idx, + CS_VOID *buffer + ); + +/* csdtcrak.c */ +extern CS_RETCODE CS_PUBLIC cs_dt_crack( + CS_CONTEXT *context, + CS_INT datetype, + CS_VOID *dateval, + CS_DATEREC *daterec + ); + +/* csdtinfo.c */ +extern CS_RETCODE CS_PUBLIC cs_dt_info( + CS_CONTEXT *context, + CS_INT action, + CS_LOCALE *locale, + CS_INT type, + CS_INT item, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + ); + +/* csloc.c */ +extern CS_RETCODE CS_PUBLIC cs_locale( + CS_CONTEXT *context, + CS_INT action, + CS_LOCALE *locale, + CS_INT type, + CS_CHAR *buffer, + CS_INT buflen, + CS_INT *outlen + ); + +/* cslocall.c */ +extern CS_RETCODE CS_PUBLIC cs_loc_alloc( + CS_CONTEXT *context, + CS_LOCALE **loc_pointer + ); + +/* cslocator.c */ +extern CS_RETCODE CS_PUBLIC cs_locator( + CS_CONTEXT *context, + CS_INT action, + CS_LOCATOR *locator, + CS_INT type, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen); +extern CS_RETCODE CS_PUBLIC cs_locator_alloc( + CS_CONTEXT *context, + CS_LOCATOR **locator); +extern CS_RETCODE CS_PUBLIC cs_locator_drop( + CS_CONTEXT *context, + CS_LOCATOR *locator); + +/* cslocdrp.c */ +extern CS_RETCODE CS_PUBLIC cs_loc_drop( + CS_CONTEXT *context, + CS_LOCALE *locale + ); + +/* csstr.c */ +extern size_t CS_PUBLIC cs_strlcpy( + char *target_str, + const char *source_str, + size_t target_size + ); + +extern size_t CS_PUBLIC cs_strlcat( + char *target_str, + const char *source_str, + size_t target_size + ); + +extern void CS_PUBLIC cs_snprintf( + char *str, + size_t size, + const char *format, + ... + ); + +#ifdef CS__INTERNAL_STRUCTS +extern CS_RETCODE CS_VARARGS cs_strbuild( + CS_CONTEXT *context, + ... + ); +#else +extern CS_RETCODE CS_VARARGS cs_strbuild( + CS_CONTEXT *context, + CS_CHAR *buf, + CS_INT buflen, + CS_INT *outlen, + CS_CHAR *text, + CS_INT textlen, + ... + ); +#endif /* CS__INTERNAL_STRUCTS */ + +/* csstrcmp.c */ +extern CS_RETCODE CS_PUBLIC cs_strcmp( + CS_CONTEXT *context, + CS_LOCALE *locale, + CS_INT type, + CS_CHAR *str1, + CS_INT len1, + CS_CHAR *str2, + CS_INT len2, + CS_INT *result + ); + +/* cstime.c */ +extern CS_RETCODE CS_PUBLIC cs_time( + CS_CONTEXT *context, + CS_LOCALE *locale, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen, + CS_DATEREC *drec + ); + +/* csmancnt.c */ +extern CS_RETCODE CS_PUBLIC cs_manage_convert( + CS_CONTEXT *context, + CS_INT action, + CS_INT srctype, + CS_CHAR *srcname, + CS_INT srcnamelen, + CS_INT desttype, + CS_CHAR *destname, + CS_INT destnamelen, + CS_INT *maxmultiplier, + CS_CONV_FUNC *func + ); + +/* csmaxmul.c */ +extern CS_RETCODE CS_PUBLIC cs_conv_mult( + CS_CONTEXT *context, + CS_LOCALE *srcloc, + CS_LOCALE *destloc, + CS_INT *multiplier + ); + +CS_END_EXTERN_C + +#endif /* __CSPUBLIC_H__ */ diff --git a/libraries/SQLAPI/include/sybase/cstypes.h b/libraries/SQLAPI/include/sybase/cstypes.h new file mode 100644 index 000000000..114cbd0f6 --- /dev/null +++ b/libraries/SQLAPI/include/sybase/cstypes.h @@ -0,0 +1,1216 @@ +/* +** SAP Open Client/Server +** Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved. +*/ +#ifndef __CSTYPES_H__ +#define __CSTYPES_H__ + +/* +** This file defines basic error codes and data types used in all Open +** Client/Server Products. +*/ + +/* +** Include the configuration header file. This file contains the defines and +** type definitions that are platform/compiler specific. +*/ +#ifndef __NO_INCLUDE__ +#include +#endif /* __NO_INCLUDE__ */ + +/***************************************************************************** +** +** Return code defines used in client/server applications. +** +*****************************************************************************/ + +/* +** See the csconfig.h header file for the definition of CS_RETCODE. +*/ + +/* +** Define the core return codes. +*/ +#define CS_SUCCEED (CS_RETCODE)1 +#define CS_FAIL (CS_RETCODE)0 +#define CS_MEM_ERROR (CS_RETCODE)-1 +#define CS_PENDING (CS_RETCODE)-2 +#define CS_QUIET (CS_RETCODE)-3 +#define CS_BUSY (CS_RETCODE)-4 +#define CS_INTERRUPT (CS_RETCODE)-5 +#define CS_BLK_HAS_TEXT (CS_RETCODE)-6 +#define CS_CONTINUE (CS_RETCODE)-7 +#define CS_FATAL (CS_RETCODE)-8 +#define CS_RET_HAFAILOVER (CS_RETCODE)-9 +#define CS_UNSUPPORTED (CS_RETCODE)-10 + +/* +** Return codes for the srv_xferdata(). Indicates that a set of parameters has +** been copied during parameter batching. +** CS_PARAMS_MORE indicates that there are more parameters to be read. +** CS_PARAMS_END indicates that this set of parameters was the last. +*/ +#define CS_PARAMS_MORE (CS_RETCODE)-11 +#define CS_PARAMS_END (CS_RETCODE)-12 + +/* +** Define error offsets. All other CS_RETCODE error codes should be +** based off of these values to avoid define conflicts. +*/ +#define CS_CONV_ERR (CS_RETCODE)(-100) +#define CS_EXTERNAL_ERR (CS_RETCODE)(-200) +#define CS_INTERNAL_ERR (CS_RETCODE)(-300) + +/* common library errors */ +#define CS_COMN_ERR (CS_RETCODE)(-400) + +/* +** Return code for a routine which was cancelled via ct_cancel(). +*/ +#define CS_CANCELED (CS_RETCODE)(CS_EXTERNAL_ERR - 2) + +/* +** Special returns for ct_fetch(). +*/ +#define CS_ROW_FAIL (CS_RETCODE)(CS_EXTERNAL_ERR - 3) +#define CS_END_DATA (CS_RETCODE)(CS_EXTERNAL_ERR - 4) + +/* +** Special return for ct_results(). +*/ +#define CS_END_RESULTS (CS_RETCODE)(CS_EXTERNAL_ERR - 5) + +/* +** Special return for ct_get_data(). +*/ +#define CS_END_ITEM (CS_RETCODE)(CS_EXTERNAL_ERR - 6) + +/* +** Special return for ct_diag(). +*/ +#define CS_NOMSG (CS_RETCODE)(CS_EXTERNAL_ERR - 7) + +/* +** Special return for ct_poll(). +*/ +#define CS_TIMED_OUT (CS_RETCODE)(CS_EXTERNAL_ERR - 8) + +/* +** Special returns for passthru(). +*/ +#define CS_PASSTHRU_EOM (CS_RETCODE)(CS_EXTERNAL_ERR - 10) +#define CS_PASSTHRU_MORE (CS_RETCODE)(CS_EXTERNAL_ERR - 11) + +/* +** Special return for ct_cancel(). +*/ +#define CS_TRYING (CS_RETCODE)(CS_EXTERNAL_ERR - 13) + +/* +** Errors caused by external events (i.e. bad params supplied by user). +*/ +#define CS_EBADPARAM (CS_RETCODE)(CS_EXTERNAL_ERR - 14) +#define CS_EBADLEN (CS_RETCODE)(CS_EXTERNAL_ERR - 15) +#define CS_ENOCNVRT (CS_RETCODE)(CS_EXTERNAL_ERR - 16) + +/* +** Special returns for the new ct_scroll_fetch() API. For Scrollable +** Cursor only. +*/ +#define CS_SCROLL_CURSOR_ENDS (CS_RETCODE)(CS_EXTERNAL_ERR - 17) +#define CS_CURSOR_BEFORE_FIRST (CS_RETCODE)(CS_EXTERNAL_ERR - 18) +#define CS_CURSOR_AFTER_LAST (CS_RETCODE)(CS_EXTERNAL_ERR - 19) + +/* +** Special return for CS_BLOB_TYPE parameter data. +*/ +#define CS_BLOBDATA (CS_RETCODE)(CS_EXTERNAL_ERR - 20) + +/* +** Return codes for conversion errors. These should be used in any user- +** defined conversion routines that are install via cs_set_convert(). +*/ +#define CS_EOVERFLOW (CS_RETCODE)(CS_CONV_ERR - 1) +#define CS_EUNDERFLOW (CS_RETCODE)(CS_CONV_ERR - 2) +#define CS_EPRECISION (CS_RETCODE)(CS_CONV_ERR - 3) +#define CS_ESCALE (CS_RETCODE)(CS_CONV_ERR - 4) +#define CS_ESYNTAX (CS_RETCODE)(CS_CONV_ERR - 5) +#define CS_EFORMAT (CS_RETCODE)(CS_CONV_ERR - 6) +#define CS_EDOMAIN (CS_RETCODE)(CS_CONV_ERR - 7) +#define CS_EDIVZERO (CS_RETCODE)(CS_CONV_ERR - 8) +#define CS_ERESOURCE (CS_RETCODE)(CS_CONV_ERR - 9) +#define CS_ENULLNOIND (CS_RETCODE)(CS_CONV_ERR - 10) +#define CS_ETRUNCNOIND (CS_RETCODE)(CS_CONV_ERR - 11) +#define CS_ENOBIND (CS_RETCODE)(CS_CONV_ERR - 12) +#define CS_TRUNCATED (CS_RETCODE)(CS_CONV_ERR - 13) +#define CS_ESTYLE (CS_RETCODE)(CS_CONV_ERR - 14) +#define CS_EBADXLT (CS_RETCODE)(CS_CONV_ERR - 15) +#define CS_ENOXLT (CS_RETCODE)(CS_CONV_ERR - 16) +#define CS_USEREP (CS_RETCODE)(CS_CONV_ERR - 17) + +/* +** Error Severities. +*/ +#define CS_SV_INFORM (CS_INT)0 +#define CS_SV_API_FAIL (CS_INT)1 +#define CS_SV_RETRY_FAIL (CS_INT)2 +#define CS_SV_RESOURCE_FAIL (CS_INT)3 +#define CS_SV_CONFIG_FAIL (CS_INT)4 +#define CS_SV_COMM_FAIL (CS_INT)5 +#define CS_SV_INTERNAL_FAIL (CS_INT)6 +#define CS_SV_FATAL (CS_INT)7 + + +/***************************************************************************** +** +** Error numbers, and macros for extracting information from a +** Client-Library error number. +** +** Error numbers are broken down into four components: +** +** Layer - Represents which layer is reporting the error. +** Origin - Indicates where the error manifested itself. +** Severity - How bad is the error? +** Number - The actual layer specific error number being +** reported. +** +*****************************************************************************/ + +/* +** The error message number. +*/ +#if defined (SYB_LP64) || defined (SYB_LLP64) || defined (_AIX) +typedef unsigned int CS_MSGNUM; +#else +typedef long CS_MSGNUM; +#endif + +/* +** The following macros are used to extract the components from a composite +** error number. +*/ +#define CS_LAYER(L) (CS_MSGNUM) (((L) >> 24) & 0xff) +#define CS_ORIGIN(O) (CS_MSGNUM) (((O) >> 16) & 0xff) +#define CS_SEVERITY(S) (CS_MSGNUM) (((S) >> 8) & 0xff) +#define CS_NUMBER(N) (CS_MSGNUM) ((N) & 0xff) + +/* +** The following are the possible values for cs_status field of +** CHAR_ATTRIB structure defined in intl_nls.h +*/ + +# define CS_STAT_DEFAULT 0x0000 +# define CS_STAT_MULTIBYTE 0x0001 +# define CS_STAT_SPACELAST 0x0002 +# define CS_STAT_NONASCIISP 0x0004 + +/***************************************************************************** +** +** Defines used in client/server applications. +** +*****************************************************************************/ + +/* +** The maximum localization name allowed. A four byte value is added (instead +** of 1 byte) to provide space for null-termination and remain on a modulo 4 +** byte boundary. +*/ +#define CS_MAX_LOCALE (CS_INT)(64 + 4) + +/* +** The maximum column name length allowed. This maximum length does not +** include a null-terminator. For declarations of character arrays with +** the maximum possible size, including a null-terminator, CS_MAX_CHAR +** should be used. +** +** If the compile flag CS_NO_LARGE_IDENTIFIERS has been set, we need to +** use the old size for CS_MAX_NAME, defined as CS_MAX_NAME_NO_LRGID. +*/ +#define CS_MAX_NAME_NO_LRGID (CS_INT)(128 + 4) +#if defined(CS_NO_LARGE_IDENTIFIERS) +#define CS_MAX_NAME CS_MAX_NAME_NO_LRGID +#else +#define CS_MAX_NAME (CS_INT)(255) +#endif /* CS_NO_LARGE_IDENTIFIERS */ + +/* +** The maximum password length allowed. +*/ +#define CS_MAX_PASS (CS_INT)(30) + +/* +** The maximum number of characters in arrays, including a null-terminator. +** Please note that this define does not correspond to any server definition +** of lengths (particularly the length of the character data type, which +** is 255 bytes for the SAP server). +*/ +#define CS_MAX_CHAR (CS_INT)256 + +/* +** Maximum string in Directory Services +*/ +#define CS_MAX_DS_STRING (CS_INT)512 + +/* +** Maximum data length of numeric/decimal datatypes. +*/ +#define CS_MAX_NUMLEN (CS_INT)33 + +/* +** To be true or not true. +*/ +#define CS_TRUE (CS_BOOL)1 +#define CS_FALSE (CS_BOOL)0 + +/* +** Define basic default types. +*/ +#define CS_NULLTERM (CS_INT)(-9) +#define CS_WILDCARD (CS_INT)(-99) +#define CS_NO_LIMIT (CS_INT)(-9999) +#define CS_UNUSED (CS_INT)(-99999) + +/* +** timeout values +** +** CS_NO_LIMIT Resource will never expire. +** CS_UNEXPIRED Resource did not expire. +*/ +#define CS_UNEXPIRED (CS_INT)(-999999) + +/* +** Enumerate part of usertypes dataserver support. +*/ +#define USER_UNICHAR_TYPE (CS_INT)34 +#define USER_UNIVARCHAR_TYPE (CS_INT)35 + +/* +** Enumerate what datatypes we support. +*/ +#define CS_ILLEGAL_TYPE (CS_INT)(-1) +#define CS_CHAR_TYPE (CS_INT)0 +#define CS_BINARY_TYPE (CS_INT)1 +#define CS_LONGCHAR_TYPE (CS_INT)2 +#define CS_LONGBINARY_TYPE (CS_INT)3 +#define CS_TEXT_TYPE (CS_INT)4 +#define CS_IMAGE_TYPE (CS_INT)5 +#define CS_TINYINT_TYPE (CS_INT)6 +#define CS_SMALLINT_TYPE (CS_INT)7 +#define CS_INT_TYPE (CS_INT)8 +#define CS_REAL_TYPE (CS_INT)9 +#define CS_FLOAT_TYPE (CS_INT)10 +#define CS_BIT_TYPE (CS_INT)11 +#define CS_DATETIME_TYPE (CS_INT)12 +#define CS_DATETIME4_TYPE (CS_INT)13 +#define CS_MONEY_TYPE (CS_INT)14 +#define CS_MONEY4_TYPE (CS_INT)15 +#define CS_NUMERIC_TYPE (CS_INT)16 +#define CS_DECIMAL_TYPE (CS_INT)17 +#define CS_VARCHAR_TYPE (CS_INT)18 +#define CS_VARBINARY_TYPE (CS_INT)19 +#define CS_LONG_TYPE (CS_INT)20 +#define CS_SENSITIVITY_TYPE (CS_INT)21 +#define CS_BOUNDARY_TYPE (CS_INT)22 +#define CS_VOID_TYPE (CS_INT)23 +#define CS_USHORT_TYPE (CS_INT)24 +#define CS_UNICHAR_TYPE (CS_INT)25 +#define CS_BLOB_TYPE (CS_INT)26 +#define CS_DATE_TYPE (CS_INT)27 +#define CS_TIME_TYPE (CS_INT)28 +#define CS_UNITEXT_TYPE (CS_INT)29 +#define CS_BIGINT_TYPE (CS_INT)30 +#define CS_USMALLINT_TYPE (CS_INT)31 +#define CS_UINT_TYPE (CS_INT)32 +#define CS_UBIGINT_TYPE (CS_INT)33 +#define CS_XML_TYPE (CS_INT)34 +#define CS_BIGDATETIME_TYPE (CS_INT)35 +#define CS_BIGTIME_TYPE (CS_INT)36 +#define CS_TEXTLOCATOR_TYPE (CS_INT)37 +#define CS_IMAGELOCATOR_TYPE (CS_INT)38 +#define CS_UNITEXTLOCATOR_TYPE (CS_INT)39 + +/* +** Define the minimum and maximum datatype values. +*/ +#define CS_MIN_SYBTYPE CS_CHAR_TYPE +#define CS_MAX_SYBTYPE CS_UNITEXTLOCATOR_TYPE + +/* +** Define the number of datatypes that are supported by SAP. +*/ +#define CS_MAXSYB_TYPE (CS_MAX_SYBTYPE + 1) + +/* +** The minumum user-defined data type. +*/ +#define CS_USER_TYPE (CS_INT)100 + +/* +** Define the bit values used in the format element of the CS_DATAFMT +** structure. The CS_FMT_JUSTIFY_RT flag exists for future use only. +*/ +#define CS_FMT_UNUSED (CS_INT)0x0 +#define CS_FMT_NULLTERM (CS_INT)0x1 +#define CS_FMT_PADNULL (CS_INT)0x2 +#define CS_FMT_PADBLANK (CS_INT)0x4 +#define CS_FMT_JUSTIFY_RT (CS_INT)0x8 +#define CS_FMT_STRIPBLANKS (CS_INT)0x10 +#define CS_FMT_SAFESTR (CS_INT)0x20 +#define CS_FMT_SUBS_ILL_CHAR (CS_INT)0x40 + +/* +** The following are bit values for the status field in the CS_DATAFMT +** structure. +** +** CS_HIDDEN Set if this column would normally be hidden +** from the user. +** +** CS_KEY Set if the column is a key column. +** +** CS_VERSION_KEY Set if the column is part of the version key for +** the row. +** +** CS_NODATA Not currently used in Open Client/Server. +** +** CS_UPDATABLE Set if the column is an updatable cursor column. +** +** CS_CANBENULL Set if the column can contain NULL values. +** +** CS_DESCIN +** CS_DESCOUT Open Server-specific values for dynamic SQL. +** +** CS_INPUTVALUE Set if the parameter is an input parameter value +** for a Client-Library command. +** +** CS_UPDATECOL Set if the parameter is the name of a column in +** the update clause of a cursor declare command. +** +** CS_RETURN Set if the parameter is a return parameter to +** an RPC command. +** +** CS_TIMESTAMP Set if the column is a timestamp column. +** +** CS_NODEFAULT Open Server-specific status values for RPC parameters. +** +** CS_IDENTITY Set if the column is an identity column. +** +** CS_PADCHAR Do not truncate trailing zeroes on varbinary columns. +** +*/ +#define CS_HIDDEN (CS_INT)0x1 +#define CS_KEY (CS_INT)0x2 +#define CS_VERSION_KEY (CS_INT)0x4 +#define CS_NODATA (CS_INT)0x8 +#define CS_UPDATABLE (CS_INT)0x10 +#define CS_CANBENULL (CS_INT)0x20 +#define CS_DESCIN (CS_INT)0x40 +#define CS_DESCOUT (CS_INT)0x80 +#define CS_INPUTVALUE (CS_INT)0x100 +#define CS_UPDATECOL (CS_INT)0x200 +#define CS_RETURN (CS_INT)0x400 +#define CS_RETURN_CANBENULL (CS_INT) 0x420 +#define CS_TIMESTAMP (CS_INT)0x2000 +#define CS_NODEFAULT (CS_INT)0x4000 +#define CS_IDENTITY (CS_INT)0x8000 +#define CS_PADCHAR (CS_INT)0x10000 + +/* +** The following are bit values for the status field in the CS_BROWSEDESC +** structure. +** +** CS_EXPRESSION Set when the column is the result of an expression. +** +** CS_RENAMED Set when that the column's heading is not the +** original name of the column. +*/ +#define CS_EXPRESSION (CS_INT)0x800 +#define CS_RENAMED (CS_INT)0x1000 + +/* +** Define special precision/scale value for using the precision/scale of the +** source element when doing a conversion from a numeric/decimal datatype to a +** numeric/decimal datatype. +*/ +#define CS_SRC_VALUE (CS_INT)-2562 + +/* +** Minimum/maximum/default precision and scale values for numeric/decimal +** datatypes. +*/ +#define CS_MIN_PREC (CS_INT)1 +#define CS_MAX_PREC (CS_INT)77 +#define CS_DEF_PREC (CS_INT)18 + +#define CS_MIN_SCALE (CS_INT)0 +#define CS_MAX_SCALE (CS_INT)77 +#define CS_DEF_SCALE (CS_INT)0 + +/* +** The datetime format for converting datetime to char. +** +** Note: The style code of a 4-digit-year date is its 2-digit-year date +** counterpart plus 100. For example, CS_DATES_MDY1 is defined as 1, so +** CS_DATES_MDY1_YYYY is defined as 101. +*/ +#define CS_DATES_SHORT (CS_INT)0 /* default */ +#define CS_DATES_MDY1 (CS_INT)1 /* mm/dd/yy */ +#define CS_DATES_YMD1 (CS_INT)2 /* yy.mm.dd */ +#define CS_DATES_DMY1 (CS_INT)3 /* dd/mm/yy */ +#define CS_DATES_DMY2 (CS_INT)4 /* dd.mm.yy */ +#define CS_DATES_DMY3 (CS_INT)5 /* dd-mm-yy */ +#define CS_DATES_DMY4 (CS_INT)6 /* dd mon yy */ +#define CS_DATES_MDY2 (CS_INT)7 /* mon dd, yy */ +#define CS_DATES_HMS (CS_INT)8 /* hh:mm:ss */ +#define CS_DATES_LONG (CS_INT)9 /* default with micro secs */ +#define CS_DATES_MDY3 (CS_INT)10 /* mm-dd-yy */ +#define CS_DATES_YMD2 (CS_INT)11 /* yy/mm/dd */ +#define CS_DATES_YMD3 (CS_INT)12 /* yymmdd */ +#define CS_DATES_YDM1 (CS_INT)13 /* yy/dd/mm */ +#define CS_DATES_MYD1 (CS_INT)14 /* mm/yy/dd */ +#define CS_DATES_DYM1 (CS_INT)15 /* dd/yy/mm */ +#define CS_DATES_MDYHMS (CS_INT)16 /* mon dd yyyy hh:mm:ss */ +#define CS_DATES_HMA (CS_INT)17 /* hh:mmAM(PM) */ +#define CS_DATES_HM (CS_INT)18 /* hh:mm */ +#define CS_DATES_HMSZA (CS_INT)19 /* hh:mm:ss:zzzAM(PM) */ +#define CS_DATES_HMSZ (CS_INT)20 /* hh:mm:ss:zzz */ +#define CS_DATES_YMDHMS (CS_INT)21 /* yy/mm/dd hh:mm:ss */ +#define CS_DATES_YMDHMA (CS_INT)22 /* yy/mm/dd hh:mmAM */ +#define CS_DATES_YMDTHMS (CS_INT)23 /* yyyy-mm-ddThh:mm:ss */ +#define CS_DATES_HMSUSA (CS_INT)36 /* hh:mm:ss.zzzzzzAM(PM) */ +#define CS_DATES_HMSUS (CS_INT)37 /* hh:mm:ss.zzzzzz */ +#define CS_DATES_LONGUSA (CS_INT)38 /* mon dd yy hh:mm:ss.zzzzzzAM(PM) */ +#define CS_DATES_LONGUS (CS_INT)39 /* mon dd yy hh:mm:ss.zzzzzz */ +#define CS_DATES_YMDHMSUS (CS_INT)40 /* yy-mm-dd hh:mm:ss.zzzzzz */ +#define CS_DATES_SHORT_ALT (CS_INT)100 /* default */ +#define CS_DATES_MDY1_YYYY (CS_INT)101 /* mm/dd/yyyy */ +#define CS_DATES_YMD1_YYYY (CS_INT)102 /* yyyy.mm.dd */ +#define CS_DATES_DMY1_YYYY (CS_INT)103 /* dd/mm/yyyy */ +#define CS_DATES_DMY2_YYYY (CS_INT)104 /* dd.mm.yyyy */ +#define CS_DATES_DMY3_YYYY (CS_INT)105 /* dd-mm-yyyy */ +#define CS_DATES_DMY4_YYYY (CS_INT)106 /* dd mon yyyy */ +#define CS_DATES_MDY2_YYYY (CS_INT)107 /* mon dd, yyyy */ +#define CS_DATES_HMS_ALT (CS_INT)108 /* hh:mm:ss */ +#define CS_DATES_LONG_ALT (CS_INT)109 /* default with micro secs */ +#define CS_DATES_MDY3_YYYY (CS_INT)110 /* mm-dd-yyyy */ +#define CS_DATES_YMD2_YYYY (CS_INT)111 /* yyyy/mm/dd */ +#define CS_DATES_YMD3_YYYY (CS_INT)112 /* yyyymmdd */ +#define CS_DATES_YDM1_YYYY (CS_INT)113 /* yyyy/dd/mm */ +#define CS_DATES_MYD1_YYYY (CS_INT)114 /* mm/yyyy/dd */ +#define CS_DATES_DYM1_YYYY (CS_INT)115 /* dd/yyyy/mm */ +#define CS_DATES_MDYHMS_ALT (CS_INT)116 /* mon dd yyyy hh:mm:ss */ +#define CS_DATES_HMA_ALT (CS_INT)117 /* hh:mmAM(PM) */ +#define CS_DATES_HM_ALT (CS_INT)118 /* hh:mm */ +#define CS_DATES_YMDHMS_YYYY (CS_INT)121 /* yyyy/mm/dd hh:mm:ss */ +#define CS_DATES_YMDHMA_YYYY (CS_INT)122 /* yyyy/mm/dd hh:mmAM */ +#define CS_DATES_HMSUSA_YYYY (CS_INT)136 /* hh:mm:ss.zzzzzzAM(PM) */ +#define CS_DATES_HMSUS_YYYY (CS_INT)137 /* hh:mm:ss.zzzzzz */ +#define CS_DATES_LONGUSA_YYYY (CS_INT)138 /* mon dd yyyy hh:mm:ss.zzzzzzAM(PM) */ +#define CS_DATES_LONGUS_YYYY (CS_INT)139 /* mon dd yyyy hh:mm:ss.zzzzzz */ +#define CS_DATES_YMDHMSUS_YYYY (CS_INT)140 /* yyyy-mm-dd hh:mm:ss.zzzzzz */ + + +/* +** sizeof macro which forces a CS_INT cast for portability. +*/ +#define CS_SIZEOF (CS_INT)sizeof + +/* +** Locale type information. CS_LC_MONETARY and CS_LC_NUMERIC are defined +** for future use. +*/ +#define CS_LC_COLLATE (CS_INT)1 +#define CS_LC_CTYPE (CS_INT)2 +#define CS_LC_MESSAGE (CS_INT)3 +#define CS_LC_MONETARY (CS_INT)4 +#define CS_LC_NUMERIC (CS_INT)5 +#define CS_LC_TIME (CS_INT)6 +#define CS_LC_ALL (CS_INT)7 +#define CS_SYB_LANG (CS_INT)8 +#define CS_SYB_CHARSET (CS_INT)9 +#define CS_SYB_SORTORDER (CS_INT)10 +#define CS_SYB_COLLATE CS_SYB_SORTORDER +#define CS_SYB_LANG_CHARSET (CS_INT)11 +#define CS_SYB_TIME (CS_INT)12 +#define CS_SYB_MONETARY (CS_INT)13 +#define CS_SYB_NUMERIC (CS_INT)14 + +/* +** Object type information for the cs_objects() API. +*/ +#define CS_CONNECTNAME (CS_INT)1 +#define CS_CURSORNAME (CS_INT)2 +#define CS_STATEMENTNAME (CS_INT)3 +#define CS_CURRENT_CONNECTION (CS_INT)4 +#define CS_MIN_USERDATA (CS_INT)100 + +/* +** Info type information for the ct_ds_objinfo() API. +*/ +#define CS_DS_CLASSOID (CS_INT)1 +#define CS_DS_DIST_NAME (CS_INT)2 +#define CS_DS_NUMATTR (CS_INT)3 +#define CS_DS_ATTRIBUTE (CS_INT)4 +#define CS_DS_ATTRVALS (CS_INT)5 + +/* +** type information for cs_locator() API +*/ +#define CS_LCTR_LOBLEN (CS_INT)1 +#define CS_LCTR_PREFETCHLEN (CS_INT)2 +#define CS_LCTR_PREFETCHDATA (CS_INT)3 +#define CS_LCTR_LOCATOR (CS_INT)4 +#define CS_LCTR_DATATYPE (CS_INT)5 + +/***************************************************************************** +** +** Common datatype typedefs and structures used in client/server applications. +** +*****************************************************************************/ + +/* +** Define client/server datatypes. +** +** CS_INT is defined in csconfig.h +** CS_FLOAT is defined in csconfig.h +** CS_UINT is defined in csconfig.h +*/ +typedef unsigned char CS_TINYINT; /* 1 byte integer */ +typedef short CS_SMALLINT; /* 2 byte integer */ +typedef unsigned short CS_USMALLINT; /* 2 byte unsigned integer */ +typedef char CS_CHAR; /* char type */ +typedef unsigned char CS_BINARY; /* binary type */ +typedef unsigned char CS_BIT; /* bit type */ +typedef float CS_REAL; /* 4 byte float type */ +typedef unsigned char CS_BYTE; /* 1 byte byte */ +typedef unsigned char CS_TEXT; /* text data */ +typedef unsigned char CS_IMAGE; /* image data */ +typedef unsigned char CS_LONGCHAR; /* long char type */ +typedef unsigned char CS_LONGBINARY; /* long binary type */ +#if defined (SYB_LLP64) +typedef __int64 CS_LONG; /* long integer type */ +typedef unsigned __int64 CS_ULONG; /* unsigned long integer type */ +#else +typedef long CS_LONG; /* long integer type */ +#endif +typedef CS_INT CS_VOIDDATA; /* void data */ +typedef unsigned short CS_UNICHAR; /* 2-byte unichar type */ +typedef CS_INT CS_BLOB; /* blob data type */ +typedef CS_INT CS_DATE; /* 4-byte date type */ +typedef CS_INT CS_TIME; /* 4-byte time type */ +typedef unsigned short CS_UNITEXT; /* 2-byte unitext type */ + +#if defined(__alpha) || defined(SYB_LP64) +typedef long CS_BIGINT; /* 8-byte integer */ +typedef unsigned long CS_UBIGINT; /* 8-byte unsigned integer */ +#elif defined(_WIN32) || defined(SYB_LLP64) +typedef __int64 CS_BIGINT; /* 8-byte integer */ +typedef unsigned __int64 CS_UBIGINT; /* 8-byte unsigned integer */ +#else +typedef long long CS_BIGINT; /* 8-byte integer */ +typedef unsigned long long CS_UBIGINT; /* 8-byte unsigned integer */ +#endif + +#if defined(SYB_LLP64) +typedef unsigned __int64 CS_SOCKET; +#else +typedef int CS_SOCKET; +#endif + +typedef unsigned char CS_XML; /* xml data */ + +/* +** CS_BIGDATETIME is an 8-byte unsigned int containing the number +** of micro seconds (sec*10^-6) passed since midnight 1/1/0000 +*/ +typedef CS_UBIGINT CS_BIGDATETIME; + +/* +** CS_BIGTIME is an 8-byte unsigned int containing the number +** of micro seconds (sec*10^-6) passed since midnight +*/ +typedef CS_UBIGINT CS_BIGTIME; + +typedef struct cs_ctx_globs CS_CTX_GLOBS; +typedef struct cs_ctx_locglobs CS_CTX_LOCGLOBS; + +/* +** The following typedefs are platform specific. +** +** CS_VOID (compiler void differences) +** CS_THRDRES (compiler void differences) +** CS_INT (need to force it to 4 bytes) +** +** Please see the csconfig.h file for the actual definitions. +*/ + +/* +** Unsigned types (CS_UINT can be found in csconfig.h). +*/ +typedef unsigned short CS_USHORT; + +/* +** The datetime structures. +*/ +typedef struct _cs_datetime +{ + CS_INT dtdays; /* number of days since 1/1/1900 */ + CS_INT dttime; /* number 300th second since mid */ +} CS_DATETIME; + +typedef struct _cs_datetime4 +{ + CS_USHORT days; /* number of days since 1/1/1900 */ + CS_USHORT minutes; /* number of minutes since midnight */ +} CS_DATETIME4; + +/* +** The money structures. +*/ +typedef struct _cs_money +{ + CS_INT mnyhigh; + CS_UINT mnylow; +} CS_MONEY; + +typedef struct _cs_money4 +{ + CS_INT mny4; +} CS_MONEY4; + +/* +** The numeric structures. +*/ +typedef struct _cs_numeric +{ + CS_BYTE precision; + CS_BYTE scale; + CS_BYTE array[CS_MAX_NUMLEN]; +} CS_NUMERIC; + +typedef CS_NUMERIC CS_DECIMAL; + +/* +** The var (pascal like) structures. Please don't confuse these datatypes +** with the SAP server "varchar" column type. +*/ +typedef struct _cs_varychar +{ + CS_SMALLINT len; /* length of the string */ + CS_CHAR str[CS_MAX_CHAR]; /* string, no NULL terminator */ +} CS_VARCHAR; + +typedef struct _cs_varybin +{ + CS_SMALLINT len; /* length of the binary array */ + CS_BYTE array[CS_MAX_CHAR]; /* the array itself. */ +} CS_VARBINARY; + +/* +** Datetime value information. +*/ +typedef struct _cs_daterec +{ + CS_INT dateyear; /* 1900 to the future */ + CS_INT datemonth; /* 0 - 11 */ + CS_INT datedmonth; /* 1 - 31 */ + CS_INT datedyear; /* 1 - 366 */ + CS_INT datedweek; /* 0 - 6 (Mon. - Sun.) */ + CS_INT datehour; /* 0 - 23 */ + CS_INT dateminute; /* 0 - 59 */ + CS_INT datesecond; /* 0 - 59 */ + CS_INT datemsecond; /* 0 - 997 */ + CS_INT datetzone; /* 0 - 127 */ + CS_INT datesecfrac; /* 0 - 999999 */ + CS_INT datesecprec; /* For now 10^6 only */ +} CS_DATEREC; + +/***************************************************************************** +** +** Hidden information structures. +** +*****************************************************************************/ + +#ifndef CS__INTERNAL_STRUCTS + +/* +** If passing code through lint, define the hidden structures as void. +*/ +#ifdef lint + +#ifndef CS_CONTEXT +#define CS_CONTEXT CS_VOID +#endif /* CS_CONTEXT */ + +#ifndef CS_LOCALE +#define CS_LOCALE CS_VOID +#endif /* CS_LOCALE */ + +#ifndef CS_CONNECTION +#define CS_CONNECTION CS_VOID +#endif /* CS_CONNECTION */ + +#ifndef CS_COMMAND +#define CS_COMMAND CS_VOID +#endif /* CS_COMMAND */ + +#ifndef CS_DS_OBJECT +#define CS_DS_OBJECT CS_VOID +#endif /* CS_DS_OBJECT */ + +#ifndef CS_DS_RESULT +#define CS_DS_RESULT CS_VOID +#endif /* CS_DS_RESULT */ + +#ifndef CS_LOCATOR +#define CS_LOCATOR CS_VOID +#endif /* CS_LOCATOR */ + +#else /* lint */ + +/* +** Use anonymous structure tags to define the hidden structures. +*/ +typedef struct _cscontext CS_CONTEXT; +typedef struct _cslocale CS_LOCALE; +typedef struct _csconnection CS_CONNECTION; +typedef struct _cscommand CS_COMMAND; +typedef struct _csdsobject CS_DS_OBJECT; +typedef struct _csdsresult CS_DS_RESULT; +typedef struct _cslocator CS_LOCATOR; /* locator pointer type */ + +#endif /* lint */ + +#endif /* CS__INTERNAL_STRUCTS */ + +/***************************************************************************** +** +** User-accessible information structures. +** +*****************************************************************************/ + +/* +** The data format structure used by Open Client/Server. +** +** name[CS_MAX_CHAR] The name of the data. +** +** namelen The actual length of the name. +** +** datatype The datatype field indicates what SAP +** or user defined datatype is being represented. +** +** format The format field tells whether or not data +** should be padded to the full length of the +** variable. This will only be used if the type +** of the variable is character or binary. The +** format field also tells whether the data +** should be null-terminated (for char +** variables, only). This is a bit field in which +** the format values are or'd together. +** +** maxlength The max length the data might be. +** +** scale This is used if dataytype needs it (e.g. +** CS_NUMERIC) +** +** precision This is used if dataytype needs it. +** +** status Additional data status values. This is a bit +** field in which the status values are or'd +** together. +** +** count If binding data, the count field tells how +** many rows should be bound. +** +** usertype User-defined datatype code passed back from +** the Server. +** +** *locale Pointer to the locale for this data. +*/ +#if defined(CS_NO_LARGE_IDENTIFIERS) +/* +** In pre-15.0 versions the (old) value for CS_MAX_NAME was used for the +** name array declarations. Starting from version 15.0, CS_MAX_CHAR is +** used to define these character array sizes. +*/ +typedef struct _cs_datafmt +{ + CS_CHAR name[CS_MAX_NAME]; + CS_INT namelen; + CS_INT datatype; + CS_INT format; + CS_INT maxlength; + CS_INT scale; + CS_INT precision; + CS_INT status; + CS_INT count; + CS_INT usertype; + CS_LOCALE *locale; +} CS_DATAFMT; +#else +typedef struct _cs_datafmt +{ + CS_CHAR name[CS_MAX_CHAR]; + CS_INT namelen; + CS_INT datatype; + CS_INT format; + CS_INT maxlength; + CS_INT scale; + CS_INT precision; + CS_INT status; + CS_INT count; + CS_INT usertype; + CS_LOCALE *locale; +} CS_DATAFMT; +#endif + +/* +** The object name structure used by Client-Library cs_object() API. +** +** thinkexists indicates whether the application expects +** this object to exist. +** +** object_type The type of the object. This field is the +** first part of a 5-part key. +** +** last_name The `last name' associated with the object of +** interest, if any. This field is the second +** part of a 5-part key. +** +** lnlen The length, in bytes, of last_name. +** +** first_name The `first name' associated with the object of +** interest, if any. This field is the third part +** of a 5-part key. +** +** fnlen The length, in bytes, of first_name. +** +** scope Data that describes the scope of the object. +** This field is the fourth part of a 5-part key. +** +** scopelen The length, in bytes, of scope. +** +** thread Platform-specific data that is used to distinguish +** threads in a multi-threaded execution environment. +** This field is the fifth part of a 5-part key. +** +** threadlen The length, in bytes, of thread. +*/ +#if defined(CS_NO_LARGE_IDENTIFIERS) +/* +** In pre-15.0 versions the (old) value for CS_MAX_NAME was used for the +** name array declarations. Starting from version 15.0, CS_MAX_CHAR is +** used to define these character array sizes. +*/ +typedef struct _cs_objname +{ + CS_BOOL thinkexists; + CS_INT object_type; + CS_CHAR last_name[CS_MAX_NAME]; + CS_INT lnlen; + CS_CHAR first_name[CS_MAX_NAME]; + CS_INT fnlen; + CS_VOID *scope; + CS_INT scopelen; + CS_VOID *thread; + CS_INT threadlen; +} CS_OBJNAME; +#else +typedef struct _cs_objname +{ + CS_BOOL thinkexists; + CS_INT object_type; + CS_CHAR last_name[CS_MAX_CHAR]; + CS_INT lnlen; + CS_CHAR first_name[CS_MAX_CHAR]; + CS_INT fnlen; + CS_VOID *scope; + CS_INT scopelen; + CS_VOID *thread; + CS_INT threadlen; +} CS_OBJNAME; +#endif + +/* +** The object data structure used by Client-Library cs_object() API. +** +** actuallyexists Indicates whether this object actually exists. +** cs_objects sets actuallyexists to CS_TRUE +** if it finds a matching object. +** cs_objects sets actuallyexists to CS_FALSE +** if it does not find a matching object. +** +** connection A pointer to the CS_CONNECTION structure +** representing the connection in which the object exists. +** +** command A pointer to the CS_COMMAND structure representing the +** command space with which the object is associated, +** if any. +** +** buffer A pointer to data space. An application can +** use buffer to associate data with a saved object. +** +** buflen The length, in bytes, of *buffer. +** +*/ +typedef struct _cs_objdata +{ + CS_BOOL actuallyexists; + CS_CONNECTION *connection; + CS_COMMAND *command; + CS_VOID *buffer; + CS_INT buflen; +} CS_OBJDATA; + +/* +** Typedef to make using session ids more convenient. +*/ +typedef CS_BYTE CS_SESSIONID[6]; + +/* +** Definition of a pointer to a function for all conversion routines. +*/ + +CS_START_EXTERN_C + +typedef CS_RETCODE (CS_PUBLIC * CS_CONV_FUNC)PROTOTYPE(( + CS_CONTEXT *context, + CS_DATAFMT *srcfmt, + CS_VOID *src, + CS_DATAFMT *destfmt, + CS_VOID *dest, + CS_INT *destlen + )); +/* +** Pointers to the thread primitive functions used in Open Client. +*/ +typedef CS_RETCODE (CS_PUBLIC * CS_THRDM_FUNC)PROTOTYPE(( + CS_THRDRES *resource + )); +typedef CS_RETCODE (CS_PUBLIC * CS_THRDE_FUNC)PROTOTYPE(( + CS_THRDRES *resource + )); +typedef CS_RETCODE (CS_PUBLIC * CS_THRDC_FUNC)PROTOTYPE(( + CS_THRDRES **resource + )); +typedef CS_RETCODE (CS_PUBLIC * CS_THRDW_FUNC)PROTOTYPE(( + CS_THRDRES *resource, + CS_INT millisecs + )); +typedef CS_RETCODE (CS_PUBLIC * CS_THRDID_FUNC)PROTOTYPE(( + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + )); +CS_END_EXTERN_C + +/* +** Define the thread primitive structure. This structure is used by +** application programs to pass thread primitives into Client-Library. +** These primitives are used internally in Client-Library to run in a +** threaded environment. +** +** create_mutex_fn Create a recursive mutex. +** +** delete_mutex_fn Delete a mutex. +** +** take_mutex_fn Lock a mutex. +** +** release_mutex_fn Release a mutex. +** +** create_event_fn Create an event variable. +** +** delete_event_fn Delete an event variable. +** +** signal_event_fn Signal event variable. +** +** reset_event_fn Reset event variable. +** +** waitfor_event_fn Wait for event to be signaled. +** +** thread_id_fn Return id of currently executing thread. +*/ +typedef struct _cs_thread +{ + CS_THRDC_FUNC create_mutex_fn; + CS_THRDM_FUNC delete_mutex_fn; + CS_THRDM_FUNC take_mutex_fn; + CS_THRDM_FUNC release_mutex_fn; + CS_THRDC_FUNC create_event_fn; + CS_THRDE_FUNC delete_event_fn; + CS_THRDE_FUNC signal_event_fn; + CS_THRDE_FUNC reset_event_fn; + CS_THRDW_FUNC waitfor_event_fn; + CS_THRDID_FUNC thread_id_fn; +} CS_THREAD; + + +/* +** Directory Service definitions +*/ + +/* +** Token name for predefined OID strings. +*/ +#define CS_OID_SYBASE "1.3.6.1.4.1.897" +#define CS_OID_DIRECTORY "1.3.6.1.4.1.897.4" +#define CS_OID_OBJCLASS "1.3.6.1.4.1.897.4.1" +#define CS_OID_ATTRTYPE "1.3.6.1.4.1.897.4.2" +#define CS_OID_ATTRSYNTAX "1.3.6.1.4.1.897.4.3" +#define CS_OID_OBJSERVER "1.3.6.1.4.1.897.4.1.1" +#define CS_OID_ATTRVERSION "1.3.6.1.4.1.897.4.2.1" +#define CS_OID_ATTRSERVNAME "1.3.6.1.4.1.897.4.2.2" +#define CS_OID_ATTRSERVICE "1.3.6.1.4.1.897.4.2.3" +#define CS_OID_ATTRSTATUS "1.3.6.1.4.1.897.4.2.4" +#define CS_OID_ATTRADDRESS "1.3.6.1.4.1.897.4.2.5" +#define CS_OID_ATTRSECMECH "1.3.6.1.4.1.897.4.2.6" +#define CS_OID_ATTRRETRYCOUNT "1.3.6.1.4.1.897.4.2.7" +#define CS_OID_ATTRLOOPDELAY "1.3.6.1.4.1.897.4.2.8" + +#define CS_OID_ATTRJCPROTOCOL "1.3.6.1.4.1.897.4.2.9" +#define CS_OID_ATTRJCPROPERTY "1.3.6.1.4.1.897.4.2.10" +#define CS_OID_ATTRDATABASENAME "1.3.6.1.4.1.897.4.2.11" + +#define CS_OID_ATTRHAFAILOVER "1.3.6.1.4.1.897.4.2.15" +#define CS_OID_ATTRRMNAME "1.3.6.1.4.1.897.4.2.16" +#define CS_OID_ATTRRMTYPE "1.3.6.1.4.1.897.4.2.17" +#define CS_OID_ATTRJDBCDSI "1.3.6.1.4.1.897.4.2.18" +#define CS_OID_ATTRSERVERTYPE "1.3.6.1.4.1.897.4.2.19" + +/* +** Current status of server object. +*/ +#define CS_STATUS_ACTIVE (CS_INT)1 +#define CS_STATUS_STOPPED (CS_INT)2 +#define CS_STATUS_FAILED (CS_INT)3 +#define CS_STATUS_UNKNOWN (CS_INT)4 + + +/* +** Server object access type +*/ +#define CS_ACCESS_CLIENT (CS_INT)1 +#define CS_ACCESS_ADMIN (CS_INT)2 +#define CS_ACCESS_MGMTAGENT (CS_INT)3 +#define CS_ACCESS_CLIENT_QUERY (CS_INT)1 +#define CS_ACCESS_CLIENT_MASTER (CS_INT)2 +#define CS_ACCESS_ADMIN_QUERY (CS_INT)3 +#define CS_ACCESS_ADMIN_MASTER (CS_INT)4 +#define CS_ACCESS_MGMTAGENT_QUERY (CS_INT)5 +#define CS_ACCESS_MGMTAGENT_MASTER (CS_INT)6 + + +/* +** String Attribute Value +** +** This structure is used to describe a string attribute +** value. +** +** str_length Length of string. +** str_buffer String data. +*/ +typedef struct _cs_string +{ + CS_INT str_length; + CS_CHAR str_buffer[CS_MAX_DS_STRING]; +} CS_STRING; + +/* +** Transport Address attribute value +** +** This structure is used to describe a server address attribute +** value. +** +** addr_accesstype Access type provided on transport +** address. +** addr_trantype Transport address type +** addr_tranaddress The address string. +*/ +typedef struct _cs_tranaddr +{ + CS_INT addr_accesstype; + CS_STRING addr_trantype; + CS_STRING addr_tranaddress; +} CS_TRANADDR; + +/* +** Object Identifier +** +** This structure is used to represent an Object +** Identifier. +** +** oid_length Length of Object Identifier. +** oid_buffer Buffer containing object identifier. +*/ +typedef struct _cs_oid +{ + CS_INT oid_length; + CS_CHAR oid_buffer[CS_MAX_DS_STRING]; +} CS_OID; + +/* +** Attribute Value +** +** This union is used to represent an attribute value. +** +*/ +typedef union _cs_attrvalue +{ + CS_STRING value_string; + CS_BOOL value_boolean; + CS_INT value_enumeration; + CS_INT value_integer; + CS_OID value_oid; + CS_TRANADDR value_tranaddr; +} CS_ATTRVALUE; + + +/* +** Attribute +** +** This structure describes an attribute. +** +*/ +typedef struct _cs_attribute +{ + CS_OID attr_type; + CS_INT attr_syntax; + CS_INT attr_numvals; +} CS_ATTRIBUTE; + +/* +** Syntax identifier tokens for the CS_ATTRIBUTE union. +*/ +#define CS_ATTR_SYNTAX_NOOP (CS_INT) 0 +#define CS_ATTR_SYNTAX_STRING (CS_INT) 1 +#define CS_ATTR_SYNTAX_INTEGER (CS_INT) 2 +#define CS_ATTR_SYNTAX_BOOLEAN (CS_INT) 3 +#define CS_ATTR_SYNTAX_ENUMERATION (CS_INT) 4 +#define CS_ATTR_SYNTAX_TRANADDR (CS_INT) 5 +#define CS_ATTR_SYNTAX_OID (CS_INT) 6 + + +/* +** Structure for defining directory lookup criteria when using +** ct_ds_lookup api. +*/ +typedef struct _cs_ds_lookup_info +{ + CS_OID *objclass; + CS_CHAR *path; + CS_INT pathlen; + CS_DS_OBJECT *attrfilter; + CS_DS_OBJECT *attrselect; +} CS_DS_LOOKUP_INFO; + +/* +** Predefined signal handlers for client and server signal handler +** libraries. +*/ + +#define CS_SIGNAL_IGNORE -1 +#define CS_SIGNAL_DEFAULT -2 +#define CS_ASYNC_RESTORE -3 +#define CS_SIGNAL_BLOCK -4 +#define CS_SIGNAL_UNBLOCK -5 + +#endif /* __CSTYPES_H__ */ diff --git a/libraries/SQLAPI/include/sybase/ctpublic.h b/libraries/SQLAPI/include/sybase/ctpublic.h new file mode 100644 index 000000000..315e316ef --- /dev/null +++ b/libraries/SQLAPI/include/sybase/ctpublic.h @@ -0,0 +1,478 @@ +/* +** SAP CT-LIBRARY +** Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved. +*/ + +/* +** ctpublic.h - This is the public header file for CT-Lib. +*/ +#ifndef __CTPUBLIC_H__ +#define __CTPUBLIC_H__ + +/* +** include common defines and typedefs +*/ +#ifndef __NO_INCLUDE__ +#include +#include +#endif /* __NO_INCLUDE__ */ + +/***************************************************************************** +** +** defines used in CT-Lib applications +** +*****************************************************************************/ + +/* +** define for each CT-Lib API +*/ +#define CT_BIND (CS_INT) 0 +#define CT_BR_COLUMN (CS_INT) 1 +#define CT_BR_TABLE (CS_INT) 2 +#define CT_CALLBACK (CS_INT) 3 +#define CT_CANCEL (CS_INT) 4 +#define CT_CAPABILITY (CS_INT) 5 +#define CT_CLOSE (CS_INT) 6 +#define CT_CMD_ALLOC (CS_INT) 7 +#define CT_CMD_DROP (CS_INT) 8 +#define CT_CMD_PROPS (CS_INT) 9 +#define CT_COMMAND (CS_INT) 10 +#define CT_COMPUTE_INFO (CS_INT) 11 +#define CT_CON_ALLOC (CS_INT) 12 +#define CT_CON_DROP (CS_INT) 13 +#define CT_CON_PROPS (CS_INT) 14 +#define CT_CON_XFER (CS_INT) 15 +#define CT_CONFIG (CS_INT) 16 +#define CT_CONNECT (CS_INT) 17 +#define CT_CURSOR (CS_INT) 18 +#define CT_DATA_INFO (CS_INT) 19 +#define CT_DEBUG (CS_INT) 20 +#define CT_DESCRIBE (CS_INT) 21 +#define CT_DIAG (CS_INT) 22 +#define CT_DYNAMIC (CS_INT) 23 +#define CT_DYNDESC (CS_INT) 24 +#define CT_EXIT (CS_INT) 25 +#define CT_FETCH (CS_INT) 26 +#define CT_GET_DATA (CS_INT) 27 +#define CT_GETFORMAT (CS_INT) 28 +#define CT_GETLOGINFO (CS_INT) 29 +#define CT_INIT (CS_INT) 30 +#define CT_KEYDATA (CS_INT) 31 +#define CT_OPTIONS (CS_INT) 32 +#define CT_PARAM (CS_INT) 33 +#define CT_POLL (CS_INT) 34 +#define CT_RECVPASSTHRU (CS_INT) 35 +#define CT_REMOTE_PWD (CS_INT) 36 +#define CT_RES_INFO (CS_INT) 37 +#define CT_RESULTS (CS_INT) 38 +#define CT_SEND (CS_INT) 39 +#define CT_SEND_DATA (CS_INT) 40 +#define CT_SENDPASSTHRU (CS_INT) 41 +#define CT_SETLOGINFO (CS_INT) 42 +#define CT_WAKEUP (CS_INT) 43 +#define CT_LABELS (CS_INT) 44 +#define CT_DS_LOOKUP (CS_INT) 45 +#define CT_DS_DROP (CS_INT) 46 +#define CT_DS_OBJINFO (CS_INT) 47 +#define CT_SETPARAM (CS_INT) 48 +#define CT_DYNSQLDA (CS_INT) 49 +#define CT_SCROLL_FETCH (CS_INT) 50 +#define CT_SEND_PARAMS (CS_INT) 51 +#define CT_SEND_RAW (CS_INT) 52 + +#define CT_NOTIFICATION (CS_INT) 1000 /* id for event notfication + ** completion + */ +#define CT_USER_FUNC (CS_INT) 10000 /* minimum user-defined + ** function id + */ + + +/***************************************************************************** +** +** define all user accessable functions here +** +*****************************************************************************/ + +/* +** declare all functions +*/ +CS_START_EXTERN_C + +/* ctdebug.c */ +extern CS_RETCODE CS_PUBLIC ct_debug( + CS_CONTEXT *context, + CS_CONNECTION *connection, + CS_INT operation, + CS_INT flag, + CS_CHAR *filename, + CS_INT fnamelen + ); +/* ctbind.c */ +extern CS_RETCODE CS_PUBLIC ct_bind( + CS_COMMAND *cmd, + CS_INT item, + CS_DATAFMT *datafmt, + CS_VOID *buf, + CS_INT *outputlen, + CS_SMALLINT *indicator + ); +/* ctbr.c */ +extern CS_RETCODE CS_PUBLIC ct_br_column( + CS_COMMAND *cmd, + CS_INT colnum, + CS_BROWSEDESC *browsedesc + ); +extern CS_RETCODE CS_PUBLIC ct_br_table( + CS_COMMAND *cmd, + CS_INT tabnum, + CS_INT type, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +/* ctcallbk.c */ +extern CS_RETCODE CS_PUBLIC ct_callback( + CS_CONTEXT *context, + CS_CONNECTION *connection, + CS_INT action, + CS_INT type, + CS_VOID *func + ); +/* ctcancel.c */ +extern CS_RETCODE CS_PUBLIC ct_cancel( + CS_CONNECTION *connection, + CS_COMMAND *cmd, + CS_INT type + ); +/* ctcap.c */ +extern CS_RETCODE CS_PUBLIC ct_capability( + CS_CONNECTION *connection, + CS_INT action, + CS_INT type, + CS_INT capability, + CS_VOID *val + ); +/* ctcinfo.c */ +extern CS_RETCODE CS_PUBLIC ct_compute_info( + CS_COMMAND *cmd, + CS_INT type, + CS_INT colnum, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +/* ctclose.c */ +extern CS_RETCODE CS_PUBLIC ct_close( + CS_CONNECTION *connection, + CS_INT option + ); +/* ctcmd.c */ +extern CS_RETCODE CS_PUBLIC ct_cmd_alloc( + CS_CONNECTION *connection, + CS_COMMAND **cmdptr + ); +extern CS_RETCODE CS_PUBLIC ct_cmd_drop( + CS_COMMAND *cmd + ); +extern CS_RETCODE CS_PUBLIC ct_cmd_props( + CS_COMMAND *cmd, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +extern CS_RETCODE CS_PUBLIC ct_command( + CS_COMMAND *cmd, + CS_INT type, + CS_CHAR *buf, + CS_INT buflen, + CS_INT option + ); +/* ctcon.c */ +extern CS_RETCODE CS_PUBLIC ct_con_alloc( + CS_CONTEXT *context, + CS_CONNECTION **connection + ); +extern CS_RETCODE CS_PUBLIC ct_con_drop( + CS_CONNECTION *connection + ); +extern CS_RETCODE CS_PUBLIC ct_con_props( + CS_CONNECTION *connection, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +extern CS_RETCODE CS_PUBLIC ct_connect( + CS_CONNECTION *connection, + CS_CHAR *server_name, + CS_INT snamelen + ); +extern CS_RETCODE CS_PUBLIC ct_connect_string( + CS_CONNECTION *connection, + CS_CHAR *cnt_str, + CS_INT cnt_len + ); + +/* ctconfig.c */ +extern CS_RETCODE CS_PUBLIC ct_config( + CS_CONTEXT *context, + CS_INT action, + CS_INT property, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +/* ctcursor.c */ +extern CS_RETCODE CS_PUBLIC ct_cursor( + CS_COMMAND *cmd, + CS_INT type, + CS_CHAR *name, + CS_INT namelen, + CS_CHAR *text, + CS_INT tlen, + CS_INT option + ); +/* ctddesc.c */ +extern CS_RETCODE CS_PUBLIC ct_dyndesc( + CS_COMMAND *cmd, + CS_CHAR *descriptor, + CS_INT desclen, + CS_INT operation, + CS_INT idx, + CS_DATAFMT *datafmt, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *copied, + CS_SMALLINT *indicator + ); +/* ctdesc.c */ +extern CS_RETCODE CS_PUBLIC ct_describe( + CS_COMMAND *cmd, + CS_INT item, + CS_DATAFMT *datafmt + ); +/* ctdiag.c */ +extern CS_RETCODE CS_PUBLIC ct_diag( + CS_CONNECTION *connection, + CS_INT operation, + CS_INT type, + CS_INT idx, + CS_VOID *buffer + ); +/* ctdyn.c */ +extern CS_RETCODE CS_PUBLIC ct_dynamic( + CS_COMMAND *cmd, + CS_INT type, + CS_CHAR *id, + CS_INT idlen, + CS_CHAR *buf, + CS_INT buflen + ); +/* ctdynsqd.c */ +extern CS_RETCODE CS_PUBLIC ct_dynsqlda( + CS_COMMAND *cmd, + CS_INT type, + SQLDA *dap, + CS_INT operation + ); +/* ctexit.c */ +extern CS_RETCODE CS_PUBLIC ct_exit( + CS_CONTEXT *context, + CS_INT option + ); +/* ctfetch.c */ +extern CS_RETCODE CS_PUBLIC ct_fetch( + CS_COMMAND *cmd, + CS_INT type, + CS_INT offset, + CS_INT option, + CS_INT *count + ); +/* ctfetch.c */ +extern CS_RETCODE CS_PUBLIC ct_scroll_fetch( + CS_COMMAND *cmd, + CS_INT type, + CS_INT offset, + CS_INT option, + CS_INT *count + ); +/* ctgfmt.c */ +extern CS_RETCODE CS_PUBLIC ct_getformat( + CS_COMMAND *cmd, + CS_INT colnum, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +/* ctkeydat.c */ +extern CS_RETCODE CS_PUBLIC ct_keydata( + CS_COMMAND *cmd, + CS_INT action, + CS_INT colnum, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + ); +/* ctinit.c */ +extern CS_RETCODE CS_PUBLIC ct_init( + CS_CONTEXT *context, + CS_INT version + ); +/* ctopt.c */ +extern CS_RETCODE CS_PUBLIC ct_options( + CS_CONNECTION *connection, + CS_INT action, + CS_INT option, + CS_VOID *param, + CS_INT paramlen, + CS_INT *outlen + ); +/* ctparam.c */ +extern CS_RETCODE CS_PUBLIC ct_param( + CS_COMMAND *cmd, + CS_DATAFMT *datafmt, + CS_VOID *data, + CS_INT datalen, + CS_SMALLINT indicator + ); +/* ctpass.c */ +extern CS_RETCODE CS_PUBLIC ct_getloginfo( + CS_CONNECTION *connection, + CS_LOGINFO **logptr + ); +extern CS_RETCODE CS_PUBLIC ct_setloginfo( + CS_CONNECTION *connection, + CS_LOGINFO *loginfo + ); +extern CS_RETCODE CS_PUBLIC ct_recvpassthru( + CS_COMMAND *cmd, + CS_VOID **recvptr + ); +extern CS_RETCODE CS_PUBLIC ct_sendpassthru( + CS_COMMAND *cmd, + CS_VOID *send_bufp + ); +/* ctpoll.c */ +extern CS_RETCODE CS_PUBLIC ct_poll( + CS_CONTEXT *context, + CS_CONNECTION *connection, + CS_INT milliseconds, + CS_CONNECTION **compconn, + CS_COMMAND **compcmd, + CS_INT *compid, + CS_INT *compstatus + ); +/* ctrempwd.c */ +extern CS_RETCODE CS_PUBLIC ct_remote_pwd( + CS_CONNECTION *connection, + CS_INT action, + CS_CHAR *server_name, + CS_INT snamelen, + CS_CHAR *password, + CS_INT pwdlen + ); +/* ctresult.c */ +extern CS_RETCODE CS_PUBLIC ct_results( + CS_COMMAND *cmd, + CS_INT *result_type + ); +/* ctrinfo.c */ +extern CS_RETCODE CS_PUBLIC ct_res_info( + CS_COMMAND *cmd, + CS_INT operation, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +/* ctsend.c */ +extern CS_RETCODE CS_PUBLIC ct_send( + CS_COMMAND *cmd + ); +extern CS_RETCODE CS_PUBLIC ct_send_params( + CS_COMMAND *cmd, + CS_INT unused + ); + +/* ctgtdata.c */ +extern CS_RETCODE CS_PUBLIC ct_get_data( + CS_COMMAND *cmd, + CS_INT colnum, + CS_VOID *buf, + CS_INT buflen, + CS_INT *outlen + ); +/* ctsndata.c */ +extern CS_RETCODE CS_PUBLIC ct_send_data( + CS_COMMAND *cmd, + CS_VOID *buf, + CS_INT buflen + ); +/* ctdinfo.c */ +extern CS_RETCODE CS_PUBLIC ct_data_info( + CS_COMMAND *cmd, + CS_INT action, + CS_INT colnum, + CS_IODESC *iodesc + ); +/* ctwakeup.c */ +extern CS_RETCODE CS_PUBLIC ct_wakeup( + CS_CONNECTION *connection, + CS_COMMAND *cmd, + CS_INT func_id, + CS_RETCODE status + ); +/* ctsetlab.c */ +extern CS_RETCODE CS_PUBLIC ct_labels( + CS_CONNECTION *connection, + CS_INT action, + CS_CHAR *labelname, + CS_INT namelen, + CS_CHAR *labelvalue, + CS_INT valuelen, + CS_INT *outlen + ); +/* ctdsbrse.c */ +extern CS_RETCODE CS_PUBLIC ct_ds_lookup( + CS_CONNECTION *connection, + CS_INT action, + CS_INT *reqidp, + CS_DS_LOOKUP_INFO *lookupinfo, + CS_VOID *userdatap + ); +/* ctdsdrop.c */ +extern CS_RETCODE CS_PUBLIC ct_ds_dropobj( + CS_CONNECTION *connection, + CS_DS_OBJECT *object + ); +/* ctdsobji.c */ +extern CS_RETCODE CS_PUBLIC ct_ds_objinfo( + CS_DS_OBJECT *objclass, + CS_INT action, + CS_INT objinfo, + CS_INT number, + CS_VOID *buffer, + CS_INT buflen, + CS_INT *outlen + ); +/* ctsetpar.c */ +extern CS_RETCODE CS_PUBLIC ct_setparam( + CS_COMMAND *cmd, + CS_DATAFMT *datafmt, + CS_VOID *data, + CS_INT *datalenp, + CS_SMALLINT *indp + ); +/* ctsraw.c */ +extern CS_RETCODE CS_PUBLIC ct_send_raw( + CS_COMMAND *cmd, + CS_VOID *rawdata, + size_t rawsize, + CS_INT rawoption + ); +CS_END_EXTERN_C + +#endif /* __CTPUBLIC_H__ */ diff --git a/libraries/SQLAPI/include/sybase/sqlca.h b/libraries/SQLAPI/include/sybase/sqlca.h new file mode 100644 index 000000000..b00ff0911 --- /dev/null +++ b/libraries/SQLAPI/include/sybase/sqlca.h @@ -0,0 +1,38 @@ +/* +** SAP OC-LIBRARY +** Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved. +*/ + +/* +** sqlca.h - This is the header file for the sqlca structure for precompilers +*/ +#ifndef __SQLCA_H__ + +#define __SQLCA_H__ + +/***************************************************************************** +** +** sqlca structure used +** +*****************************************************************************/ + +typedef struct _sqlca +{ + char sqlcaid[8]; + long sqlcabc; + long sqlcode; + + struct + { + long sqlerrml; + char sqlerrmc[256]; + } sqlerrm; + + char sqlerrp[8]; + long sqlerrd[6]; + char sqlwarn[8]; + char sqlext[8]; + +} SQLCA; + +#endif /* __SQLCA_H__ */ diff --git a/libraries/SQLAPI/include/sybase/sqlda.h b/libraries/SQLAPI/include/sybase/sqlda.h new file mode 100644 index 000000000..f270e18c2 --- /dev/null +++ b/libraries/SQLAPI/include/sybase/sqlda.h @@ -0,0 +1,44 @@ +/* +** SAP CT-LIBRARY +** Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved. +*/ + +#ifndef __SQLDA_H__ +#define __SQLDA_H__ + +typedef struct _sqlda +{ + CS_SMALLINT sd_sqln; + CS_SMALLINT sd_sqld; + struct _sd_column + { + CS_DATAFMT sd_datafmt; + CS_VOID *sd_sqldata; + CS_SMALLINT sd_sqlind; + CS_INT sd_sqllen; + CS_VOID *sd_sqlmore; + } sd_column[1]; +} syb_sqlda; + +typedef syb_sqlda SQLDA; + +#define SYB_SQLDA_SIZE(n) (sizeof(SQLDA) \ + - sizeof(struct _sd_column) \ + + (n) * sizeof(struct _sd_column)) + +#ifndef SQLDA_DECL +#define SQLDA_DECL(name, size) \ +struct { \ + CS_SMALLINT sd_sqln; \ + CS_SMALLINT sd_sqld; \ + struct { \ + CS_DATAFMT sd_datafmt; \ + CS_VOID *sd_sqldata; \ + CS_SMALLINT sd_sqlind; \ + CS_INT sd_sqllen; \ + CS_VOID *sd_sqlmore; \ + } sd_column[(size)]; \ +} name +#endif /* SQLDA_DECL */ + +#endif /* __SQLDA_H__ */