00001 /* File: odbc_driver.h 00002 ** Author: Saikat Mukherjee 00003 ** Contact: xsb-contact@cs.sunysb.edu 00004 ** 00005 ** Copyright (C) The Research Foundation of SUNY, 2002-2006 00006 ** 00007 ** XSB is free software; you can redistribute it and/or modify it under the 00008 ** terms of the GNU Library General Public License as published by the Free 00009 ** Software Foundation; either version 2 of the License, or (at your option) 00010 ** any later version. 00011 ** 00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY 00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00014 ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for 00015 ** more details. 00016 ** 00017 ** You should have received a copy of the GNU Library General Public License 00018 ** along with XSB; if not, write to the Free Software Foundation, 00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 ** 00021 */ 00022 00023 /* 00024 ** This is the header file for the ODBC driver. 00025 */ 00026 00027 #include <stdio.h> 00028 #include <stdlib.h> 00029 #include <string.h> 00030 #include <sql.h> 00031 #include <sqlext.h> 00032 00033 #include "cinterf.h" 00034 #include "driver_manager_defs.h" 00035 00036 00037 /****** data structures for metadata *****/ 00038 00039 struct driverODBC_columnmeta 00040 { 00041 SQLSMALLINT type; 00042 SQLUINTEGER length; 00043 }; 00044 00045 struct driverODBC_meta 00046 { 00047 SQLSMALLINT numCols; 00048 struct driverODBC_columnmeta** types; 00049 }; 00050 00051 /******* data structures for handles ******/ 00052 00053 struct driverODBC_queryInfo 00054 { 00055 char* query; 00056 char* handle; 00057 SQLHSTMT hstmt; 00058 struct driverODBC_meta* resultmeta; 00059 struct driverODBC_meta* parammeta; 00060 }; 00061 00062 struct driverODBC_connectionInfo 00063 { 00064 SQLHDBC hdbc; 00065 char* handle; 00066 }; 00067 00068 /********* function declarations *********/ 00069 00070 DllExport int call_conv driverODBC_initialise(); 00071 int driverODBC_connect(struct xsb_connectionHandle* handle); 00072 int driverODBC_disconnect(struct xsb_connectionHandle* handle); 00073 struct xsb_data** driverODBC_query(struct xsb_queryHandle* handle); 00074 int driverODBC_prepareStatement(struct xsb_queryHandle* qHandle); 00075 struct xsb_data** driverODBC_execPrepareStatement(struct xsb_data** param, struct xsb_queryHandle* handle); 00076 int driverODBC_closeStatement(struct xsb_queryHandle* handle); 00077 char* driverODBC_errorMesg(); 00078 DllExport int call_conv driverODBC_register(); 00079 00080 00081 DllExport extern int call_conv registerXSBDriver(char* dr, int num); 00082 DllExport extern int call_conv registerXSBFunction(char* dr, int type, union functionPtrs* func); 00083 00084