- Main Page
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# oledb_sup.h

    00001 /******************************************************************************
    00002  * $Id: oledb_sup.h,v 1.12 2006/03/31 17:44:20 fwarmerdam Exp $
    00003  *
    00004  * Project:  OpenGIS Simple Features Reference Implementation
    00005  * Purpose:  OLE DB support functions.
    00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
    00007  *
    00008  ******************************************************************************
    00009  * Copyright (c) 1999, Frank Warmerdam
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a
    00012  * copy of this software and associated documentation files (the "Software"),
    00013  * to deal in the Software without restriction, including without limitation
    00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00015  * and/or sell copies of the Software, and to permit persons to whom the
    00016  * Software is furnished to do so, subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included
    00019  * in all copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00027  * DEALINGS IN THE SOFTWARE.
    00028  ******************************************************************************
    00029  *
    00030  * $Log: oledb_sup.h,v $
    00031  * Revision 1.12  2006/03/31 17:44:20  fwarmerdam
    00032  * header updates
    00033  *
    00034  * Revision 1.11  2001/11/09 19:09:03  warmerda
    00035  * added VARIANTToString... does not appear to work
    00036  *
    00037  * Revision 1.10  1999/11/18 19:02:20  warmerda
    00038  * expanded tabs
    00039  *
    00040  * Revision 1.9  1999/09/07 12:05:59  warmerda
    00041  * trimmed out some old oledbsup related stuff
    00042  *
    00043  * Revision 1.8  1999/06/09 21:03:58  warmerda
    00044  * Removed OledbSupRowset documentation ... this class will be decommisioned
    00045  * soon.
    00046  *
    00047  * Revision 1.7  1999/06/02 16:28:17  warmerda
    00048  * added docs
    00049  *
    00050  * Revision 1.6  1999/05/21 02:38:32  warmerda
    00051  * added AnsiToBSTR()
    00052  *
    00053  * Revision 1.5  1999/04/07 11:54:16  warmerda
    00054  * Added dumping stuff.
    00055  *
    00056  * Revision 1.4  1999/04/01 20:49:41  warmerda
    00057  * make class internals protected so OledbSFTable can have access
    00058  *
    00059  * Revision 1.3  1999/04/01 17:53:46  warmerda
    00060  * added getnumcolumns, and oledbsupWritecolumninfo
    00061  *
    00062  * Revision 1.2  1999/03/31 15:11:16  warmerda
    00063  * Use char * instead of LPWSTR, better multi-provider support
    00064  *
    00065  * Revision 1.1  1999/03/30 19:07:59  warmerda
    00066  * New
    00067  *
    00068  */
    00069
    00070 #ifndef OLEDB_SUP_H_INCLUDED
    00071 #define OLEDB_SUP_H_INCLUDED
    00072
    00073 #define WIN32_LEAN_AND_MEAN             // avoid the world
    00074 #define INC_OLE2                                // tell windows.h to always include ole2.h
    00075
    00076 #include <windows.h>                    //
    00077 #include <ole2ver.h>                    // OLE2.0 build version
    00078 #include <cguid.h>                              // GUID_NULL
    00079 #include <stdio.h>                              // vsnprintf, etc.
    00080 #include <stddef.h>                             // offsetof
    00081 #include <stdarg.h>                             // va_arg
    00082 #include <assert.h>                             // assert
    00083
    00084 //      OLE DB headers
    00085 #include <oledb.h>
    00086 #include <oledberr.h>
    00087
    00088 /* -------------------------------------------------------------------- */
    00089 /*      General error reporting.                                        */
    00090 /* -------------------------------------------------------------------- */
    00091 void DumpErrorMsg( const char * );
    00092 HRESULT DumpErrorHResult( HRESULT, const char *, ... );
    00093
    00094 HRESULT AnsiToUnicode(LPCSTR pszA, LPOLESTR* ppszW);
    00095 HRESULT UnicodeToAnsi(LPCOLESTR ppszW, LPSTR *pszA );
    00096 HRESULT AnsiToBSTR( const char *, BSTR * );
    00097
    00098 extern "C" {
    00099 const char *VARIANTToString( VARIANT * );
    00100 }
    00101
    00102 /* -------------------------------------------------------------------- */
    00103 /*      Ole helper functions.                                           */
    00104 /* -------------------------------------------------------------------- */
    00105 int OleSupInitialize();
    00106 int OleSupUninitialize();
    00107
    00108 void OledbSupWriteColumnInfo( FILE *, DBCOLUMNINFO * );
    00109 void OledbSupDumpRow( FILE *, DBCOLUMNINFO *, int, DBBINDING *,
    00110                       ULONG, ULONG, BYTE * );
    00111
    00112 /* -------------------------------------------------------------------- */
    00113 /*                       Constants from sampclnt.                       */
    00114 /* -------------------------------------------------------------------- */
    00115
    00116 // Alignment for placement of each column within memory.
    00117 // Rule of thumb is "natural" boundary, i.e. 4-byte member should be
    00118 // aligned on address that is multiple of 4.
    00119 // Worst case is double or __int64 (8 bytes).
    00120 #define COLUMN_ALIGNVAL 8
    00121
    00122 #define MAX_GUID_STRING     42  // size of a GUID, in characters
    00123 #define MAX_NAME_STRING     60  // size of DBCOLOD name or propid string
    00124 #define MAX_BINDINGS       100  // size of binding array
    00125 #define NUMROWS_CHUNK       20  // number of rows to grab at a time
    00126 #define DEFAULT_CBMAXLENGTH 40  // cbMaxLength for binding
    00127
    00128 //-----------------------------------
    00129 //      macros
    00130 //------------------------------------
    00131
    00132 // Rounding amount is always a power of two.
    00133 #define ROUND_UP(   Size, Amount ) (((DWORD)(Size) +  ((Amount) - 1)) & ~((Amount) - 1))
    00134
    00135 #ifndef  NUMELEM
    00136 # define NUMELEM(p) (sizeof(p)/sizeof(*p))
    00137 #endif
    00138
    00139 //-----------------------------------
    00140 //      type and structure definitions
    00141 //------------------------------------
    00142
    00143 // How to lay out each column in memory.
    00144 // Issue? we depend on the dwLength field being first in memory (see assert)
    00145 // is there another way to handle this?
    00146 struct COLUMNDATA
    00147         {
    00148         DWORD           dwLength;       // length of data (not space allocated)
    00149         DWORD           dwStatus;       // status of column
    00150         BYTE            bData[1];       // data here and beyond
    00151         };
    00152
    00153
    00154 // Lists of value/string pairs.
    00155 typedef struct {
    00156         DWORD dwFlag;
    00157         char *szText;
    00158 } Note;
    00159
    00160 char * GetNoteString( Note *, int, DWORD );
    00161
    00162 #define NOTE(s) { (DWORD) s, #s }
    00163
    00164 #endif /* ndef OLEDB_SUP_H_INCLUDED */

Generated for GDAL by 1.5.1.