Apache Portable Runtime Utility Library
|
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more 00002 * contributor license agreements. See the NOTICE file distributed with 00003 * this work for additional information regarding copyright ownership. 00004 * The ASF licenses this file to You under the Apache License, Version 2.0 00005 * (the "License"); you may not use this file except in compliance with 00006 * the License. You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 00018 /* ONLY USED FOR ODBC Version 2 -DODBCV2 00019 * 00020 * Re-define everything to work (more-or-less) in an ODBC V2 environment 00021 * Random access to retrieved rows is not supported - i.e. calls to apr_dbd_select() cannot 00022 * have a 'random' argument of 1. apr_dbd_get_row() must always pass rownum as 0 (get next row) 00023 * 00024 */ 00025 00026 #define SQLHANDLE SQLHENV /* Presumes that ENV, DBC, and STMT handles are all the same datatype */ 00027 #define SQL_NULL_HANDLE 0 00028 #define SQL_HANDLE_STMT 1 00029 #define SQL_HANDLE_DBC 2 00030 #define SQL_HANDLE_ENV 3 00031 #define SQL_NO_DATA SQL_NO_DATA_FOUND 00032 00033 #ifndef SQL_SUCCEEDED 00034 #define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) 00035 #endif 00036 00037 #undef SQLSetEnvAttr 00038 #define SQLSetEnvAttr(henv, Attribute, Value, StringLength) (0) 00039 00040 #undef SQLAllocHandle 00041 #define SQLAllocHandle(type, parent, hndl) \ 00042 ( (type == SQL_HANDLE_STMT) ? SQLAllocStmt(parent, hndl) \ 00043 : (type == SQL_HANDLE_ENV) ? SQLAllocEnv(hndl) \ 00044 : SQLAllocConnect(parent, hndl) \ 00045 ) 00046 00047 #undef SQLFreeHandle 00048 #define SQLFreeHandle(type, hndl) \ 00049 ( (type == SQL_HANDLE_STMT) ? SQLFreeStmt(hndl, SQL_DROP) \ 00050 : (type == SQL_HANDLE_ENV) ? SQLFreeEnv(hndl) \ 00051 : SQLFreeConnect(hndl) \ 00052 ) 00053 00054 #undef SQLGetDiagRec 00055 #define SQLGetDiagRec(type, h, i, state, native, buffer, bufsize, reslen) \ 00056 SQLError( (type == SQL_HANDLE_ENV) ? h : NULL, \ 00057 (type == SQL_HANDLE_DBC) ? h : NULL, \ 00058 (type == SQL_HANDLE_STMT) ? h : NULL, \ 00059 state, native, buffer, bufsize, reslen) 00060 00061 #undef SQLCloseCursor 00062 #define SQLCloseCursor(stmt) SQLFreeStmt(stmt, SQL_CLOSE) 00063 00064 #undef SQLGetConnectAttr 00065 #define SQLGetConnectAttr(hdbc, fOption, ValuePtr, BufferLength, NULL) \ 00066 SQLGetConnectOption(hdbc, fOption, ValuePtr) 00067 00068 #undef SQLSetConnectAttr 00069 #define SQLSetConnectAttr(hdbc, fOption, ValuePtr, BufferLength) \ 00070 SQLSetConnectOption(hdbc, fOption, (SQLUINTEGER) ValuePtr) 00071 00072 #undef SQLSetStmtAttr 00073 #define SQLSetStmtAttr(hstmt, fOption, ValuePtr, BufferLength) (0); return APR_ENOTIMPL; 00074 00075 #undef SQLEndTran 00076 #define SQLEndTran(hType, hdbc,type) SQLTransact(henv, hdbc, type) 00077 00078 #undef SQLFetchScroll 00079 #define SQLFetchScroll(stmt, orient, rownum) (0); return APR_ENOTIMPL; 00080 00081 #define SQL_DESC_TYPE SQL_COLUMN_TYPE 00082 #define SQL_DESC_CONCISE_TYPE SQL_COLUMN_TYPE 00083 #define SQL_DESC_DISPLAY_SIZE SQL_COLUMN_DISPLAY_SIZE 00084 #define SQL_DESC_OCTET_LENGTH SQL_COLUMN_LENGTH 00085 #define SQL_DESC_UNSIGNED SQL_COLUMN_UNSIGNED 00086 00087 #undef SQLColAttribute 00088 #define SQLColAttribute(s, c, f, a, l, m, n) SQLColAttributes(s, c, f, a, l, m, n) 00089 00090 #define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE 00091 #define SQL_ATTR_AUTOCOMMIT SQL_AUTOCOMMIT 00092 #define SQL_ATTR_CONNECTION_TIMEOUT 113 00093 #define SQL_ATTR_CURRENT_CATALOG SQL_CURRENT_QUALIFIER 00094 #define SQL_ATTR_DISCONNECT_BEHAVIOR 114 00095 #define SQL_ATTR_ENLIST_IN_DTC 1207 00096 #define SQL_ATTR_ENLIST_IN_XA 1208 00097 00098 #define SQL_ATTR_CONNECTION_DEAD 1209 00099 #define SQL_CD_TRUE 1L /* Connection is closed/dead */ 00100 #define SQL_CD_FALSE 0L /* Connection is open/available */ 00101 00102 #define SQL_ATTR_LOGIN_TIMEOUT SQL_LOGIN_TIMEOUT 00103 #define SQL_ATTR_ODBC_CURSORS SQL_ODBC_CURSORS 00104 #define SQL_ATTR_PACKET_SIZE SQL_PACKET_SIZE 00105 #define SQL_ATTR_QUIET_MODE SQL_QUIET_MODE 00106 #define SQL_ATTR_TRACE SQL_OPT_TRACE 00107 #define SQL_ATTR_TRACEFILE SQL_OPT_TRACEFILE 00108 #define SQL_ATTR_TRANSLATE_LIB SQL_TRANSLATE_DLL 00109 #define SQL_ATTR_TRANSLATE_OPTION SQL_TRANSLATE_OPTION 00110 #define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION 00111 00112 #define SQL_ATTR_CURSOR_SCROLLABLE -1 00113 00114 #define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) /* SIGNED BIGINT */ 00115 #define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED BIGINT */ 00116 00117 #define SQL_FALSE 0 00118 #define SQL_TRUE 1 00119