Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

lookdbinterface.h

Go to the documentation of this file.
00001 /* liblookdb: lookdbinterface.h - Database interface layer (was lkxdbing.h) 
00002     Copyright (C) 1998-2001 LOOK Systems
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Lesser General Public
00006     License as published by the Free Software Foundation; either
00007     version 2.1 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Lesser General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public
00015     License along with this library; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 #ifndef LIBLOOKDB_LOOKDBINTERFACE_H
00019 #define LIBLOOKDB_LOOKDBINTERFACE_H
00020 
00021 /* $Id: lookdbinterface.h,v 1.23 2001/07/25 14:59:18 xian Exp $ */
00022 
00044 #ifndef DOXYGEN
00045 #ifdef WIN32
00046 #if defined(LOOKDBLIBRARY_BUILD) || defined(LOOKDBINTERFACE_BUILD)
00047 #define LOOKDBINTERFACE_DLL __declspec(dllexport)
00048 #else
00049 #define LOOKDBINTERFACE_DLL __declspec(dllimport)
00050 #endif
00051 #else
00052 #define LOOKDBINTERFACE_DLL
00053 #endif
00054 
00055 /* error returns */
00056 #define INVALID_PASSWORD_ERROR 1
00057 #endif
00058 
00059 /* supported databases */
00060 /* (for GetDatabaseType function */
00061 #define DB_TYPE_ERROR -1
00062 #define DB_UNKNOWN 0
00063 #define DB_INGRES 1
00064 #define DB_SQL_SERVER 2
00065 #define DB_ORACLE 3
00066 #define DB_POSTGRES 4
00067 
00087 #ifndef DOXYGEN
00088 /* standard interface, not documented */
00089 #define LOOK_DBC        long
00090 #define LOOK_STMT       long
00091 #define LOOK_SQLDA      long
00092 #define LOOK_SQLCOL     long
00093 #define LOOK_TYPE       int
00094 #endif
00095 
00096 /* standard SQL types */
00097 #define LOOK_CHAR       0
00098 #define LOOK_INTEGER    1
00099 #define LOOK_FLOAT      2
00100 #define LOOK_MONEY      3
00101 #define LOOK_VARCHAR    4
00102 #define LOOK_DATE       5
00103 #define LOOK_LONGVARCHAR        6
00104 #define LOOK_NUMERIC    7
00105 #define LOOK_RAWDATA    8
00106 #define LOOK_LONGRAWDATA        9
00107 
00139 #ifndef DOXYGEN
00140 /* may need to define BOOLEAN */
00141 /* we don't use bool here as it has to be c and c++ */
00142 #ifndef BOOLEAN
00143 #define BOOLEAN               short int
00144 #endif
00145 
00146 #ifdef TRUE
00147 #if (TRUE == 0)
00148 #undef TRUE
00149 #define TRUE                              1
00150 #endif
00151 #else
00152 #define TRUE                  1
00153 #endif
00154 
00155 #ifdef FALSE
00156 #if (FALSE != 0)
00157 #undef FALSE
00158 #define FALSE 0
00159 #endif
00160 #else
00161 #define FALSE                 0
00162 #endif
00163 #endif
00164 
00165 #include        <stddef.h>              /* size_t */
00166 
00167 #ifdef __cplusplus
00168 extern "C" {
00169 #endif
00170         LOOKDBINTERFACE_DLL int lookdbabf( );
00171         LOOKDBINTERFACE_DLL LOOK_DBC lookDbConnect (const char *theDatabaseName,
00172                                         const char *theUser, const char *thePassword,
00173                                         int isAutoCommit );
00174         LOOKDBINTERFACE_DLL void lookDbDisconnect (LOOK_DBC theSession);
00175         LOOKDBINTERFACE_DLL LOOK_STMT lookDbPrepare (LOOK_DBC theSession, const char *theStatement);
00176         LOOKDBINTERFACE_DLL BOOLEAN lookDbExecute (LOOK_STMT theStmt, int* theRowsAffected );
00177         LOOKDBINTERFACE_DLL BOOLEAN lookDbDescribe (LOOK_STMT theStmt);
00178         LOOKDBINTERFACE_DLL BOOLEAN lookDbOpenCursor (LOOK_STMT theStmt);
00179         LOOKDBINTERFACE_DLL BOOLEAN lookDbFetchCursor (LOOK_STMT theStmt);
00180         LOOKDBINTERFACE_DLL void lookDbCloseCursor (LOOK_STMT theStmt);
00181         LOOKDBINTERFACE_DLL void lookDbDestroyStatement( LOOK_STMT theStmt );
00182         LOOKDBINTERFACE_DLL BOOLEAN lookDbCommit (LOOK_DBC theSession);
00183         LOOKDBINTERFACE_DLL BOOLEAN lookDbRollback (LOOK_DBC theSession);
00184         LOOKDBINTERFACE_DLL BOOLEAN lookDbSetActiveSession (LOOK_DBC theSession);
00185 
00186         LOOKDBINTERFACE_DLL void lookDsPutInteger (LOOK_STMT theStmt, int theIndex, int theValue);
00187         LOOKDBINTERFACE_DLL void lookDsPutFloat (LOOK_STMT theStmt, int theIndex, double theValue);
00188         LOOKDBINTERFACE_DLL void lookDsPutString (LOOK_STMT theStmt, int theIndex,
00189                                         const char *theValue, size_t theLength);
00190         LOOKDBINTERFACE_DLL void lookDsPutLongString (LOOK_STMT theStmt, int theIndex,
00191                                         const char *theValue, size_t theLength);
00192         LOOKDBINTERFACE_DLL void lookDsPutLongRawData (LOOK_STMT theStmt, int theIndex,
00193                                         const char *theValue, size_t theLength);
00194         LOOKDBINTERFACE_DLL void lookDsPutRawData (LOOK_STMT theStmt, int theIndex,
00195                                         const char *theValue, size_t theLength);
00196         LOOKDBINTERFACE_DLL void lookDsPutNULLInteger (LOOK_STMT theStmt, int theIndex);
00197         LOOKDBINTERFACE_DLL void lookDsPutNULLFloat (LOOK_STMT theStmt, int theIndex);
00198         LOOKDBINTERFACE_DLL void lookDsPutNULLString (LOOK_STMT theStmt, int theIndex);
00199         LOOKDBINTERFACE_DLL void lookDsPutNULLLongString (LOOK_STMT theStmt, int theIndex);
00200         LOOKDBINTERFACE_DLL void lookDsPutNULLLongRawData (LOOK_STMT theStmt, int theIndex);
00201         LOOKDBINTERFACE_DLL void lookDsPutNULLRawData (LOOK_STMT theStmt, int theIndex);
00202         LOOKDBINTERFACE_DLL int lookDsColCount(LOOK_STMT theStmt);
00203         LOOKDBINTERFACE_DLL BOOLEAN lookDsHasResults(LOOK_STMT theStmt);
00204         LOOKDBINTERFACE_DLL int lookDsParameterCount(LOOK_STMT theStmt);
00205         LOOKDBINTERFACE_DLL void lookDsSetParameterCount(LOOK_STMT theStmt, int theCount);
00206 
00207         /* note this no longer returns a new pointer */
00208         LOOKDBINTERFACE_DLL char *lookDcFieldName(LOOK_STMT theStmt, int theIndex);
00209 
00210         LOOKDBINTERFACE_DLL BOOLEAN lookDcNullable(LOOK_STMT theStmt, int theIndex);
00211         LOOKDBINTERFACE_DLL BOOLEAN lookDcIsNull(LOOK_STMT theStmt, int theIndex);
00212         LOOKDBINTERFACE_DLL LOOK_TYPE lookDcType(LOOK_STMT theStmt, int theIndex);
00213         LOOKDBINTERFACE_DLL char *lookDcValue(LOOK_STMT theStmt, int theIndex);
00214         LOOKDBINTERFACE_DLL int lookDcPrecision(LOOK_STMT theStmt, int theIndex);
00215 
00216         LOOKDBINTERFACE_DLL const char* lookDbGetLastError( long* theErrorNumber );
00217 
00218         LOOKDBINTERFACE_DLL int lookDbGetDatabaseType( LOOK_DBC theSession );
00219 
00220         /* this is a function to identify the interface library we're going */
00221         /* to load */
00222         /* (the actual interfaces don't have it, but the dynamic loading */
00223         /* one does) */
00224         /* NULL means use default */
00225         /* If you don't call this to load the library, the default one gets */
00226         /* loaded (env LOOKDBINTERFACE or failing that odbc under win32, */
00227         /* ingres-oi under unix) */
00228 
00229         LOOKDBINTERFACE_DLL BOOLEAN lookDbSetInterfaceLibrary( const char* theLibraryName );
00230 
00231 #ifdef __cplusplus
00232 }
00233 #endif
00234 
00235 #define lookDcValueAs(T,DC,X)           *((T*)lookDcValue(DC,X))
00236         /* anyone who can tell me how to express this as an ANS-compliant C function wins a peanut */
00237 
00242 #endif

Generated at Thu Jan 17 12:53:06 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001