2 /// DB2DriverCS - A DB2 driver for .Net
\r
3 /// Copyright 2003 By Christopher Bockner
\r
4 /// Released under the terms of the MIT/X11 Licence
\r
5 /// Please refer to the Licence.txt file that should be distributed with this package
\r
6 /// This software requires that DB2 client software be installed correctly on the machine
\r
7 /// (or instance) on which the driver is running.
\r
12 using System.Runtime.InteropServices;
\r
15 namespace DB2ClientCS
\r
18 /// DB2CLIPrototypes class is a wrapper for the db2cli.lib, IBM's Call Level Interface to DB2
\r
20 unsafe internal class DB2ClientPrototypes
\r
22 [DllImport("db2cli.dll", EntryPoint = "SQLAllocHandle")]
\r
23 unsafe public static extern short SQLAllocHandle(short handleType, IntPtr inputHandle, ref IntPtr outputHandle);
\r
24 [DllImport("db2cli.Dll", EntryPoint = "SQLConnect")]
\r
25 unsafe public static extern short SQLConnect(IntPtr sqlHdbc, string serverName, short serverNameLength, string userName, short userNameLength, string authentication, short authenticationLength);
\r
26 [DllImport("db2cli.Dll", CharSet = CharSet.Auto, EntryPoint = "SQLDisconnect")]
\r
27 unsafe public static extern short SQLDisconnect(long sqlHdbc);
\r
28 [DllImport("db2cli.dll", EntryPoint = "SQLGetDiagRec")]
\r
29 unsafe public static extern short SQLGetDiagRec( short handleType, IntPtr handle, short recNum, [Out] StringBuilder sqlState, ref IntPtr nativeErrorPtr, [Out] StringBuilder errorMessage, short bufferLength, ref IntPtr shortTextLengthPtr);
\r
30 [DllImport("db2cli.Dll", EntryPoint = "SQLSetConnectAttr")]
\r
31 unsafe public static extern short SQLSetConnectAttr(long sqlHdbc, long sqlAttr, IntPtr sqlValuePtr, long sqlStrLength);
\r
32 [DllImport("db2cli.Dll", EntryPoint = "SQLEndTran")]
\r
33 unsafe public static extern short SQLEndTran (short handleType, IntPtr handle, short fType);
\r
34 [DllImport("db2cli.Dll", EntryPoint = "SQLCancel")]
\r
35 unsafe public static extern short SQLCancel(IntPtr handle);
\r
36 [DllImport("db2cli.dll", EntryPoint = "SQLNumResultCols")]
\r
37 unsafe public static extern short SQLNumResultCols(IntPtr handle, ref int numCols);
\r
38 [DllImport("db2cli.Dll", EntryPoint = "SQLFetch")]
\r
39 unsafe public static extern short SQLFetch(IntPtr handle);
\r
40 [DllImport("db2cli.dll", EntryPoint = "SQLRowCount")]
\r
41 unsafe public static extern short SQLRowCount(IntPtr stmtHandle, ref int numRows);
\r
42 [DllImport("db2cli.dll", EntryPoint = "SQLExecute")]
\r
43 unsafe public static extern short SQLExecute(IntPtr handle);
\r
44 [DllImport ("db2cli.dll", EntryPoint = "SQLExecDirect")]
\r
45 unsafe public static extern short SQLExecDirect(IntPtr stmtHandle, string stmt, int length);
\r
46 [DllImport("db2cli.Dll", EntryPoint = "SQLDescribeCol")]
\r
47 unsafe public static extern short SQLDescribeCol(IntPtr stmtHandle, ushort colNum, [Out] StringBuilder colName, short colNameMaxLength, IntPtr colNameLength, ref IntPtr dataType, ref IntPtr colSizePtr, ref IntPtr scalePtr, ref IntPtr nullablePtr );
\r
48 [DllImport("db2cli.dll", EntryPoint = "SQLBindCol")]
\r
49 unsafe public static extern short SQLBindCol(IntPtr stmtHandle, ushort colNum, int dataType,[In][Out] IntPtr dataBufferPtr, int dataBufferLength, ref IntPtr StrLen_or_IndPtr);
\r