ocipl-commits Mailing List for OCIPL
Brought to you by:
martinfuchs
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
(10) |
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <mar...@us...> - 2008-05-30 09:24:18
|
Revision: 51
http://ocipl.svn.sourceforge.net/ocipl/?rev=51&view=rev
Author: martinfuchs
Date: 2008-05-30 02:24:19 -0700 (Fri, 30 May 2008)
Log Message:
-----------
- fix array float/double allocation in SqlVariantArray::assign()
- eliminate VS2005 warnings
Modified Paths:
--------------
trunk/ocipl/Makefile.VC6
trunk/ocipl/ocipl.cpp
Modified: trunk/ocipl/Makefile.VC6
===================================================================
--- trunk/ocipl/Makefile.VC6 2008-05-30 09:16:27 UTC (rev 50)
+++ trunk/ocipl/Makefile.VC6 2008-05-30 09:24:19 UTC (rev 51)
@@ -1,8 +1,8 @@
PROJ = ocipl
-INCL_PATH = E:\include
-LIB32 = E:\lib32
-HTML_DIR = E:\html\newhome
+INCL_PATH = W:\include
+LIB32 = W:\lib32
+HTML_DIR = W:\html\newhome
#ORACLE_HOME = D:\Oracle\Ora81
Modified: trunk/ocipl/ocipl.cpp
===================================================================
--- trunk/ocipl/ocipl.cpp 2008-05-30 09:16:27 UTC (rev 50)
+++ trunk/ocipl/ocipl.cpp 2008-05-30 09:24:19 UTC (rev 51)
@@ -856,7 +856,12 @@
if (tag.empty()) {
TCHAR buffer[16];
- _stprintf(buffer, _T("%x"), _stmt_cache.size());
+#ifdef __STDC_WANT_SECURE_LIB__
+ _stprintf_s(buffer, _countof(buffer),
+#else
+ _stprintf(buffer,
+#endif
+ _T("%x"), _stmt_cache.size());
tag = buffer;
}
@@ -1456,7 +1461,9 @@
tstring SqlVariant::str(OCIError* errh) const
{
+#ifdef SQLT_BFLOAT
TCHAR buffer[16];
+#endif
switch(_data_type) {
case 0:
@@ -1675,9 +1682,9 @@
SqlVariantArray::SqlVariantArray(ub2 data_type, int size, int blen)
+ : _size(size),
+ _data_type(data_type)
{
- _data_type = data_type;
-
switch(data_type) {
case OCI_TYPECODE_CHAR:
_data_type = OCI_TYPECODE_VARCHAR;
@@ -1729,9 +1736,9 @@
}
SqlVariantArray::SqlVariantArray(const SqlVariantArray& other)
+ : _size(0),
+ _data_type(0)
{
- _data_type = 0;
-
assign(other);
}
@@ -1739,6 +1746,7 @@
{
clear();
+ _size = other._size;
_data_type = other._data_type;
switch(other._data_type) {
@@ -1755,11 +1763,13 @@
#ifdef SQLT_BFLOAT
case OCI_TYPECODE_BFLOAT:
- _pfloat = new float[*other._pfloat];
+ _pfloat = new float[_size];
+ memcpy(_pfloat, other._pfloat, sizeof(float)*_size);
break;
case OCI_TYPECODE_BDOUBLE:
- _pdouble = new double[*other._pfloat];
+ _pdouble = new double[_size];
+ memcpy(_pfloat, other._pfloat, sizeof(double)*_size);
break;
#endif
@@ -1840,12 +1850,15 @@
assert(0);
}
+ _size = 0;
_data_type = 0;
}
tstring SqlVariantArray::str(int row, OCIError* errh) const
{
+#ifdef SQLT_BFLOAT
TCHAR buffer[16];
+#endif
switch(_data_type) {
case 0:
@@ -1860,11 +1873,21 @@
#ifdef SQLT_BFLOAT
case OCI_TYPECODE_BFLOAT:
- _stprintf(buffer, _T("%f"), _pfloat[row]);
+#ifdef __STDC_WANT_SECURE_LIB__
+ _stprintf_s(buffer, _countof(buffer),
+#else
+ _stprintf(buffer,
+#endif
+ _T("%f"), _pfloat[row]);
return buffer;
case OCI_TYPECODE_BDOUBLE:
- _stprintf(buffer, _T("%f"), _pdouble[row]);
+#ifdef __STDC_WANT_SECURE_LIB__
+ _stprintf_s(buffer, _countof(buffer),
+#else
+ _stprintf(buffer,
+#endif
+ _T("%f"), _pdouble[row]);
return buffer;
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-05-30 09:16:19
|
Revision: 50
http://ocipl.svn.sourceforge.net/ocipl/?rev=50&view=rev
Author: martinfuchs
Date: 2008-05-30 02:16:27 -0700 (Fri, 30 May 2008)
Log Message:
-----------
- new BindPar variants for char and float variables
- new function OciLogin::connected()
Modified Paths:
--------------
trunk/ocipl/ocipl.h
Modified: trunk/ocipl/ocipl.h
===================================================================
--- trunk/ocipl/ocipl.h 2008-05-30 08:25:42 UTC (rev 49)
+++ trunk/ocipl/ocipl.h 2008-05-30 09:16:27 UTC (rev 50)
@@ -773,6 +773,11 @@
}
}
+ bool connected() const
+ {
+ return _connected;
+ }
+
void commit(ub4 flags=OCI_DEFAULT)
{
sword res = OCITransCommit(_handle, _env._errh, flags);
@@ -1942,6 +1947,22 @@
indp = ind;
}
+ BindPar(const char& var, OCIInd* ind=NULL)
+ {
+ valuep = (void*)&var;
+ value_sz= sizeof(char);
+ dty = SQLT_CHR;
+ indp = ind;
+ }
+
+ BindPar(const float& var, OCIInd* ind=NULL)
+ {
+ valuep = (void*)&var;
+ value_sz= sizeof(float);
+ dty = SQLT_FLT;
+ indp = ind;
+ }
+
BindPar(const double& var, OCIInd* ind=NULL)
{
valuep = (void*)&var;
@@ -2788,6 +2809,7 @@
#endif
};
+ int _size;
ub2 _data_type;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-05-30 08:25:37
|
Revision: 49
http://ocipl.svn.sourceforge.net/ocipl/?rev=49&view=rev
Author: martinfuchs
Date: 2008-05-30 01:25:42 -0700 (Fri, 30 May 2008)
Log Message:
-----------
fix array allocation for float and double values
Modified Paths:
--------------
trunk/ocipl/ocipl.cpp
Modified: trunk/ocipl/ocipl.cpp
===================================================================
--- trunk/ocipl/ocipl.cpp 2008-05-30 08:24:46 UTC (rev 48)
+++ trunk/ocipl/ocipl.cpp 2008-05-30 08:25:42 UTC (rev 49)
@@ -1693,11 +1693,11 @@
#ifdef SQLT_BFLOAT
case OCI_TYPECODE_BFLOAT:
- _pfloat = new float(size);
+ _pfloat = new float[size];
break;
case OCI_TYPECODE_BDOUBLE:
- _pdouble = new double(size);
+ _pdouble = new double[size];
break;
#endif
@@ -1755,11 +1755,11 @@
#ifdef SQLT_BFLOAT
case OCI_TYPECODE_BFLOAT:
- _pfloat = new float(*other._pfloat);
+ _pfloat = new float[*other._pfloat];
break;
case OCI_TYPECODE_BDOUBLE:
- _pdouble = new double(*other._pfloat);
+ _pdouble = new double[*other._pfloat];
break;
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-05-30 08:24:38
|
Revision: 48
http://ocipl.svn.sourceforge.net/ocipl/?rev=48&view=rev
Author: martinfuchs
Date: 2008-05-30 01:24:46 -0700 (Fri, 30 May 2008)
Log Message:
-----------
zero-terminate SqlString buffer after resizing
Modified Paths:
--------------
trunk/ocipl/ocipl.h
Modified: trunk/ocipl/ocipl.h
===================================================================
--- trunk/ocipl/ocipl.h 2008-02-09 15:04:39 UTC (rev 47)
+++ trunk/ocipl/ocipl.h 2008-05-30 08:24:46 UTC (rev 48)
@@ -1091,7 +1091,7 @@
size_t blen() const {return _blen;}
size_t alen() const {return _blen + 1;}
- void resize(size_t l) {_blen = l; _str = (TCHAR*)realloc(_str, (l+1)*sizeof(TCHAR));}
+ void resize(size_t l) {_blen = l; _str = (TCHAR*)realloc(_str, (l+1)*sizeof(TCHAR)); _str[l] = '\0';}
void clear() {*_str = '\0'; _ind.clear();}
TCHAR* str() {return _str;} // Note: _ind is not checked by this function.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 15:04:35
|
Revision: 47
http://ocipl.svn.sourceforge.net/ocipl/?rev=47&view=rev
Author: martinfuchs
Date: 2008-02-09 07:04:39 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
use ResultIterator for fetch loops
Modified Paths:
--------------
trunk/ocipl/ocipl-xml.cpp
trunk/ocipl/ocipl.cpp
Modified: trunk/ocipl/ocipl-xml.cpp
===================================================================
--- trunk/ocipl/ocipl-xml.cpp 2008-02-09 15:04:03 UTC (rev 46)
+++ trunk/ocipl/ocipl-xml.cpp 2008-02-09 15:04:39 UTC (rev 47)
@@ -2,9 +2,9 @@
//
// ocipl-xml.cpp
//
- // Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
- // OCIPL Version 1.3
+ // OCIPL Version 1.4
//
/// \file ocipl-xml.cpp
@@ -71,14 +71,13 @@
if (!(_state & EXECUTED))
execute(); // instead of first_bulk()
- for(int fetched=fetched_rows(); fetched>0; fetched=next_bulk())
- for(int i=0; i<fetched; ++i) {
- pos.create(element_name);
+ for(ResultIterator it(*this); it.has_next(); ++it) {
+ pos.create(element_name);
- _res->dump_values(pos, i);
+ _res->dump_values(pos, it);
- pos.back();
- }
+ pos.back();
+ }
}
void SqlStatement::dump_results(XMLWriter& writer, const XS_String& element_name)
@@ -86,14 +85,13 @@
if (!(_state & EXECUTED))
execute();
- for(int fetched=fetched_rows(); fetched>0; fetched=next_bulk())
- for(int i=0; i<fetched; ++i) {
- writer.create(element_name);
+ for(ResultIterator it(*this); it.has_next(); ++it) {
+ writer.create(element_name);
- _res->dump_values(writer, i);
+ _res->dump_values(writer, it);
- writer.back();
- }
+ writer.back();
+ }
}
Modified: trunk/ocipl/ocipl.cpp
===================================================================
--- trunk/ocipl/ocipl.cpp 2008-02-09 15:04:03 UTC (rev 46)
+++ trunk/ocipl/ocipl.cpp 2008-02-09 15:04:39 UTC (rev 47)
@@ -1169,16 +1169,15 @@
int row_cnt = 0;
- for(int fetched=fetched_rows(); fetched>0; fetched=next_bulk())
- for(int i=0; i<fetched; ++i) {
- ++row_cnt;
+ for(ResultIterator it(*this); it.has_next(); ++it) {
+ ++row_cnt;
- out << _T("row ") << row_cnt << _T(":\n");
+ out << _T("row ") << row_cnt << _T(":\n");
- _res->print_values(out, i);
+ _res->print_values(out, it);
- out << _T("\n");
- }
+ out << _T("\n");
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 15:04:07
|
Revision: 46
http://ocipl.svn.sourceforge.net/ocipl/?rev=46&view=rev
Author: martinfuchs
Date: 2008-02-09 07:04:03 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
ignore batch files
Property Changed:
----------------
trunk/xmldump/
Property changes on: trunk/xmldump
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.ncb
*.opt
*.res
*.exe
+ Debug
Release
*.ncb
*.opt
*.res
*.exe
*.bat
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 15:03:01
|
Revision: 45
http://ocipl.svn.sourceforge.net/ocipl/?rev=45&view=rev
Author: martinfuchs
Date: 2008-02-09 07:03:00 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
replace usage of SQLT_CHR by SQLT_STR and SQLT_AFC to avoid trimming trailing white space
Modified Paths:
--------------
trunk/ocipl/ocipl.h
Modified: trunk/ocipl/ocipl.h
===================================================================
--- trunk/ocipl/ocipl.h 2008-02-09 15:00:55 UTC (rev 44)
+++ trunk/ocipl/ocipl.h 2008-02-09 15:03:00 UTC (rev 45)
@@ -1910,7 +1910,7 @@
indp = var.ind();
}
- BindPar(const int& var, OCIInd* ind=0)
+ BindPar(const int& var, OCIInd* ind=NULL)
{
valuep = (void*)&var;
value_sz= sizeof(int);
@@ -1918,7 +1918,7 @@
indp = ind;
}
- BindPar(const unsigned int& var, OCIInd* ind=0)
+ BindPar(const unsigned int& var, OCIInd* ind=NULL)
{
valuep = (void*)&var;
value_sz= sizeof(unsigned int);
@@ -1926,7 +1926,7 @@
indp = ind;
}
- BindPar(const long& var, OCIInd* ind=0)
+ BindPar(const long& var, OCIInd* ind=NULL)
{
valuep = (void*)&var;
value_sz= sizeof(long);
@@ -1934,7 +1934,7 @@
indp = ind;
}
- BindPar(const unsigned long& var, OCIInd* ind=0)
+ BindPar(const unsigned long& var, OCIInd* ind=NULL)
{
valuep = (void*)&var;
value_sz= sizeof(unsigned long);
@@ -1942,7 +1942,7 @@
indp = ind;
}
- BindPar(const double& var, OCIInd* ind=0)
+ BindPar(const double& var, OCIInd* ind=NULL)
{
valuep = (void*)&var;
value_sz= sizeof(double);
@@ -1950,32 +1950,35 @@
indp = ind;
}
- BindPar(const TCHAR* buffer, size_t len=-1, ub2 type=SQLT_CHR, OCIInd* ind=0)
+ BindPar(const TCHAR* buffer)
{
valuep = (dvoid*) buffer;
- if (len == -1) { // nicht sinnvoll f\xFCr OUT-Variablen
- value_sz = buffer? (sb4)_tcslen(buffer)*sizeof(TCHAR): 0;
- dty = SQLT_CHR;
- } else {
- value_sz = (sb4)len;
- dty = type;
- }
+ value_sz= buffer? (sb4)(_tcslen(buffer)+1)*sizeof(TCHAR): 0;
+ dty = SQLT_STR;
+ indp = NULL;
+ }
+
+ BindPar(const TCHAR* buffer, size_t len, ub2 type=SQLT_AFC, OCIInd* ind=NULL)
+ {
+ valuep = (dvoid*) buffer;
+ value_sz= (sb4)len;
+ dty = type;
indp = ind;
}
BindPar(const tstring& str)
{
valuep = (dvoid*) str.c_str();
- value_sz= (sb4)str.length()*sizeof(TCHAR);
- dty = SQLT_CHR;
+ value_sz= (sb4)(str.length()+1)*sizeof(TCHAR);
+ dty = SQLT_STR;
indp = NULL;
}
BindPar(const SqlString& str)
{
valuep = (dvoid*) str.c_str();
- value_sz= (sb4)str.len()*sizeof(TCHAR);
- dty = SQLT_CHR;
+ value_sz= (sb4)str.alen()*sizeof(TCHAR);
+ dty = SQLT_STR;
indp = NULL;
}
@@ -2045,7 +2048,7 @@
};
- /// Binding of input strings with trimming
+ /// Binding of input strings with trimming to the specified maximum length
struct TrimBindPar : BindPar
{
@@ -2055,7 +2058,7 @@
valuep = (dvoid*) buffer;
value_sz= (sb4)min(len, max_len)*sizeof(TCHAR);
- dty = SQLT_CHR;
+ dty = SQLT_AFC;
indp = NULL;
}
@@ -2065,7 +2068,7 @@
valuep = (dvoid*) str.c_str();
value_sz= (sb4)min(len, max_len)*sizeof(TCHAR);
- dty = SQLT_CHR;
+ dty = SQLT_AFC;
indp = NULL;
}
@@ -2075,7 +2078,7 @@
valuep = (dvoid*) str.c_str();
value_sz= (sb4)min(len, max_len)*sizeof(TCHAR);
- dty = SQLT_CHR;
+ dty = SQLT_AFC;
indp = NULL;
}
};
@@ -2108,7 +2111,7 @@
buffers = arr.get_buffer_count();
}
- DefinePar(int& var, OCIInd* ind=0)
+ DefinePar(int& var, OCIInd* ind=NULL)
{
valuep = &var;
value_sz= sizeof(int);
@@ -2116,7 +2119,7 @@
indp = ind;
buffers = 1;
}
- DefinePar(int* arr, int count, OCIInd* ind=0)
+ DefinePar(int* arr, int count, OCIInd* ind=NULL)
{
valuep = arr;
value_sz= sizeof(int);
@@ -2125,7 +2128,7 @@
buffers = count;
}
- DefinePar(unsigned int& var, OCIInd* ind=0)
+ DefinePar(unsigned int& var, OCIInd* ind=NULL)
{
valuep = &var;
value_sz= sizeof(unsigned int);
@@ -2133,7 +2136,7 @@
indp = ind;
buffers = 1;
}
- DefinePar(unsigned int* arr, int count, OCIInd* ind=0)
+ DefinePar(unsigned int* arr, int count, OCIInd* ind=NULL)
{
valuep = arr;
value_sz= sizeof(unsigned int);
@@ -2142,7 +2145,7 @@
buffers = count;
}
- DefinePar(long& var, OCIInd* ind=0)
+ DefinePar(long& var, OCIInd* ind=NULL)
{
valuep = &var;
value_sz= sizeof(long);
@@ -2150,7 +2153,7 @@
indp = ind;
buffers = 1;
}
- DefinePar(long* arr, int count, OCIInd* ind=0)
+ DefinePar(long* arr, int count, OCIInd* ind=NULL)
{
valuep = arr;
value_sz= sizeof(long);
@@ -2159,7 +2162,7 @@
buffers = count;
}
- DefinePar(unsigned long& var, OCIInd* ind=0)
+ DefinePar(unsigned long& var, OCIInd* ind=NULL)
{
valuep = &var;
value_sz= sizeof(unsigned long);
@@ -2167,7 +2170,7 @@
indp = ind;
buffers = 1;
}
- DefinePar(unsigned long* arr, int count, OCIInd* ind=0)
+ DefinePar(unsigned long* arr, int count, OCIInd* ind=NULL)
{
valuep = arr;
value_sz= sizeof(unsigned long);
@@ -2176,7 +2179,7 @@
buffers = count;
}
- DefinePar(double& var, OCIInd* ind=0)
+ DefinePar(double& var, OCIInd* ind=NULL)
{
valuep = &var;
value_sz= sizeof(double);
@@ -2184,7 +2187,7 @@
indp = ind;
buffers = 1;
}
- DefinePar(double* arr, int count, OCIInd* ind=0)
+ DefinePar(double* arr, int count, OCIInd* ind=NULL)
{
valuep = arr;
value_sz= sizeof(double);
@@ -2194,7 +2197,7 @@
}
#ifdef SQLT_BFLOAT
- DefinePar(float& var, OCIInd* ind=0)
+ DefinePar(float& var, OCIInd* ind=NULL)
{
valuep = &var;
value_sz= sizeof(float);
@@ -2202,7 +2205,7 @@
indp = ind;
buffers = 1;
}
- DefinePar(float* arr, int count, OCIInd* ind=0)
+ DefinePar(float* arr, int count, OCIInd* ind=NULL)
{
valuep = arr;
value_sz= sizeof(float);
@@ -2212,7 +2215,7 @@
}
#endif
- DefinePar(const TCHAR* buffer, size_t len, ub2 type=SQLT_STR, OCIInd* ind=0)
+ DefinePar(const TCHAR* buffer, size_t len, ub2 type=SQLT_STR, OCIInd* ind=NULL)
{
valuep = (dvoid*) buffer;
value_sz= (sb4)len*sizeof(TCHAR);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 15:01:07
|
Revision: 44
http://ocipl.svn.sourceforge.net/ocipl/?rev=44&view=rev
Author: martinfuchs
Date: 2008-02-09 07:00:55 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
xmldump-Projekt hinzugef?\195?\188gt
Added Paths:
-----------
trunk/xmldump/
trunk/xmldump/xmldump.cpp
trunk/xmldump/xmldump.dsp
trunk/xmldump/xmldump.dsw
trunk/xmldump/xmldump.h
Property changes on: trunk/xmldump
___________________________________________________________________
Name: svn:ignore
+ Debug
Release
*.ncb
*.opt
*.res
*.exe
Added: trunk/xmldump/xmldump.cpp
===================================================================
--- trunk/xmldump/xmldump.cpp (rev 0)
+++ trunk/xmldump/xmldump.cpp 2008-02-09 15:00:55 UTC (rev 44)
@@ -0,0 +1,647 @@
+
+ //
+ // xmldump.cpp
+ //
+ // Copyright (c) 2005, 2007 Martin Fuchs <mar...@gm...>
+ //
+
+/*
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <xmlstorage.h>
+using namespace XMLStorage;
+
+#include <iostream>
+using namespace std;
+
+#include <ocipl.h>
+using namespace OCIPL;
+
+#include <set>
+#include <iostream>
+using namespace std;
+
+#include <time.h>
+
+#include "xmldump.h"
+
+
+int main(int argc, char** argv)
+{
+ if (argc < 2) {
+ cerr << "xmldump <connect-string> [schema]\n";
+ return 1;
+ }
+
+ XMLDump dump;
+ LoginPara lp;
+
+ const char* conn_str = *++argv;
+ lp.parse(conn_str);
+
+ const char* schema = argc>=3? *++argv: lp._username.c_str();
+
+//TODO Kontrolle der Oracle-Version: >= 8.1.6
+
+ dump._data = false; //@@
+ dump._col_pos = false; //@@
+ dump._seq_val = false; //@@
+
+ //dump._filter.insert("EMP");
+ //dump._filter.insert("PLAN_TABLE");
+
+ try {
+
+ OciEnvAlloc env_alloc;
+ OciEnv env(env_alloc);
+
+ // dump database schema in XML format
+ XMLWriter writer(cout); //, PRETTY_LINEFEED);
+ dump.dump_schema(env, lp, schema, writer);
+
+ } catch(exception& e) {
+ cerr << "====\n"
+ "Exception: " << e.what() << "\n"
+ "====\n";
+ }
+
+ return 0;
+}
+
+
+static ColumnType* s_pcolTypes;
+
+static int cmp_col(const void* a, const void* b)
+{
+ int ia = *(int*)a;
+ int ib = *(int*)b;
+
+ return s_pcolTypes[ia]._name.compare(s_pcolTypes[ib]._name);
+}
+
+
+typedef pair<tstring, tstring> ObjIdent;
+
+ /// object info structure used in XMLDump::dump_schema()
+struct ObjInfo {
+ ub1 _type;
+
+ ObjInfo()
+ {
+ _type = -1;
+ }
+};
+
+typedef map<ObjIdent, ObjInfo> ObjNameMap;
+
+
+ // describe schema and write down the information immediatelly using XMLWriter
+void XMLDump::dump_schema(OciEnv& env, const LoginPara& lp, const TCHAR* schema, XMLWriter& writer)
+{
+ OciLogin login(env, lp);
+ OciConnection conn(env, login);
+
+ tstring owner = schema;
+ _tcsupr_s((TCHAR*)owner.data(), owner.length()+1);
+
+ SqlStatement stmt(conn);
+ TCHAR buffer[BUFFER_LEN];
+
+
+ writer.create("schema");
+ writer["name"] = schema;
+
+
+ // Erg\xE4nzung um Zusatzinformationen
+ if (_info) {
+ writer.create("info");
+
+ time_t now = time(NULL); // problems in the year 2038
+#ifdef __STDC_WANT_SECURE_LIB__
+ struct tm lct;
+ localtime_s(&lct, &now);
+ struct tm* plct = &lct;
+#else
+ struct tm* plct = localtime(&now);
+#endif
+ OciDate date(plct);
+ writer["date"] = date.str();
+ writer["dump"] = "xmldump 1.0";
+
+ writer.create("connect");
+ writer["username"] = lp._username;
+ writer["tnsname"] = lp._tnsname;
+ writer.back(); // </connect>
+
+ if (_db_version) {
+ writer.create("db-version");
+#if ORACLE_VERSION>=82
+ int oracle_ver = login._server._version;
+ TCHAR ver_str[32];
+ _stprintf(ver_str, _T("%d.%d.%d.%d.%d"),
+ oracle_ver>>24, (oracle_ver>>20)&0xF,
+ (oracle_ver>>16)&0xF, (oracle_ver>>8)&0xFF, oracle_ver&0xFF);
+ writer["number"] = ver_str;
+#endif
+ writer["string"] = login._server._version_string;
+
+ writer.set_content((LPCTSTR)login._server._version_string);
+ /*
+ SqlStatement stmt(conn, "select BANNER from V$VERSION");
+ //writer["main-string"] = stmt->get_string(0));
+ for(int fetched=stmt.first_bulk(); fetched>0; fetched=stmt.next_bulk())
+ for(int i=0; i<fetched; ++i) {
+ writer.create("line");
+ writer.set_content(stmt->get_string(0, i));
+ writer.back(); </line>
+ }
+ */
+ writer.back(); // </db-version>
+ }
+
+ if (_db_options) {
+ writer.create("db-options");
+ stmt.prepare(_T("select PARAMETER, VALUE from V$OPTION"));
+ stmt.dump_results(writer, "option");
+ writer.back(); // </db-options>
+ }
+
+ writer.back(); // </info>
+ }
+
+
+ typedef map<int, string> TablespaceMap;
+ TablespaceMap tablespaces;
+
+ try {
+ stmt.prepare(_T("select TS#, NAME from V$TABLESPACE"));
+
+ SqlIntArray ts_nr;
+ SqlStringArray ts_name;
+
+ stmt.bind_result(0, ts_nr);
+ stmt.bind_result(1, ts_name);
+
+ stmt.execute(); // throw exception immediatelly if we don't have access to the system view
+
+ writer.create("tablespaces");
+ for(int fetched=stmt.first_bulk(); fetched>0; fetched=stmt.next_bulk())
+ for(int i=0; i<fetched; ++i) {
+ int nr = ts_nr.get_int(i);
+ const char* name = ts_name.c_str(i);
+
+ writer.create("tablespace");
+ writer["nr"] = XMLInt(nr);
+ writer["name"] = name;
+ writer.back();
+
+ tablespaces[nr] = name;
+ }
+ writer.back(); // </tablespaces>
+ } catch(exception&) {
+ // ignore access right exceptions cerr << "Exception: " << e.what() << "\n";
+ }
+
+
+ // query public synonyms
+ if (_pub_syns) {
+ writer.create("public-synonyms");
+
+ SqlString synonym_name, object_name;
+
+ stmt.prepare(_T("select SYNONYM_NAME, TABLE_NAME\n")
+ _T("from ALL_SYNONYMS\n")
+ _T("where owner = 'PUBLIC'\n")
+ _T("and table_owner = :0\n")
+ _T("and db_link is null\n")
+ _T("order by SYNONYM_NAME"));
+
+ stmt.bind_param(0, owner);
+
+ stmt.bind_result(0, synonym_name);
+ stmt.bind_result(1, object_name);
+
+ for(int fetched=stmt.first_bulk(); fetched>0; fetched=stmt.next_bulk())
+ for(int i=0; i<fetched; ++i) {
+ writer.create("public synonym");
+
+ int l = _stprintf(buffer, _T("%s.%s"), owner.c_str(), object_name.c_str());
+
+ writer["name"] = synonym_name;
+ writer["target"] = buffer;
+
+ writer.back();
+ }
+
+ writer.back(); // </public-synonyms>
+ }
+
+
+ writer.create("objects");
+
+ OciDescribe descr(conn._env);
+ sword res = OCIDescribeAny(conn._svc_ctx, conn._env._errh,
+ (void*)schema, _tcslen(schema)*sizeof(TOraText), OCI_OTYPE_NAME,
+ OCI_DEFAULT, OCI_PTYPE_SCHEMA, descr);
+ oci_check_error(conn._env, res);
+
+ OciParam paramh(conn._env);
+ descr.get_attribute(¶mh, NULL, OCI_ATTR_PARAM, conn._env._errh);
+
+ OciParam objlisth(conn._env);
+ paramh.get_attribute(&objlisth, NULL, OCI_ATTR_LIST_OBJECTS);
+
+ ub2 num;
+ objlisth.get_attribute(&num, NULL, OCI_ATTR_NUM_PARAMS);
+
+ // automatische Sortierung der Objekte \xFCber ObjNameMap
+ ObjNameMap obj_names;
+
+ for(int i=0; i<num; ++i) {
+ ObjInfo info;
+ OciParam objh(conn._env);
+ res = OCIParamGet(objlisth, OciParam::get_type_id(), conn._env._errh, (void**)&objh, i);
+ oci_check_error(conn._env, res);
+
+ OraText* name; ub4 name_len;
+ objh.get_attribute(&name, &name_len, OCI_ATTR_OBJ_NAME);
+ tstring obj_name((const TCHAR*)name, name_len);
+
+ // filter by object name
+ if (!_filter.empty() && _filter.find(obj_name)==_filter.end())
+ continue;
+
+ objh.get_attribute(&info._type, NULL, OCI_ATTR_PTYPE);
+
+ if (info._type) { // no "unknown type" nodes
+ tstring type_str = get_oci_ptype_str(info._type);
+
+ // replace spaces by '-' for XML conformity
+ TCHAR* p = (TCHAR*)type_str.data();
+ for(; *p; ++p)
+ if (istspace(*p))
+ *p = '-';
+
+ obj_names[make_pair(type_str, obj_name)] = info;
+ }
+ }
+
+ for(ObjNameMap::const_iterator it=obj_names.begin(); it!=obj_names.end(); ++it) {
+ const ObjIdent& ident = it->first;
+ const tstring& type_str = ident.first;
+ const tstring& obj_name = ident.second;
+ const ObjInfo& info = it->second;
+
+ writer.create(type_str);
+ writer["name"] = obj_name;
+
+ int l = _stprintf(buffer, _T("%s.%s"), owner.c_str(), obj_name.c_str());
+
+ // Not avoidable to describe the object here again - now by name:
+ // Seems, the descriptor handles overflow at some point, so we get an error (msg_id=-1) after some loops.
+ OciDescribe obj_descr(conn._env);
+ res = OCIDescribeAny(conn._svc_ctx, conn._env._errh, (OraText*)buffer, l, OCI_OTYPE_NAME, OCI_DEFAULT, info._type, obj_descr);
+
+ if (res == OCI_SUCCESS) {
+ OciParam paramh(conn._env);
+ obj_descr.get_attribute(¶mh, NULL, OCI_ATTR_PARAM, conn._env._errh);
+
+ // tables (write table attributes before all subnodes)
+ if (info._type == OCI_PTYPE_TABLE) {
+ eword ts_nr;
+ paramh.get_attribute(&ts_nr, NULL, OCI_ATTR_TABLESPACE);
+
+ TablespaceMap::const_iterator found = tablespaces.find(ts_nr);
+
+ if (found != tablespaces.end())
+ writer["tablespace"] = found->second;
+ else
+ writer["tablespace-nr"] = XMLInt(ts_nr);
+
+ ub1 typed, clustered, partitioned, index_only, temporary;
+ paramh.get_attribute(&typed, NULL, OCI_ATTR_IS_TYPED);
+ paramh.get_attribute(&clustered, NULL, OCI_ATTR_CLUSTERED);
+ paramh.get_attribute(&partitioned, NULL, OCI_ATTR_PARTITIONED);
+ paramh.get_attribute(&index_only, NULL, OCI_ATTR_INDEX_ONLY);
+ paramh.get_attribute(&temporary, NULL, OCI_ATTR_IS_TEMPORARY);
+
+ if (typed || clustered || partitioned || index_only || temporary) {
+ writer["type"] = "extended";
+ writer["typed"] = XMLBool(typed? true: false);
+ writer["clustered"] = XMLBool(clustered? true: false);
+ writer["partitioned"] = XMLBool(partitioned? true: false);
+ writer["index_organized"] = XMLBool(index_only? true: false);
+
+ if (temporary) {
+ writer["temporary"] = XMLBool(temporary? true: false);
+
+ OCIDuration duration;
+ paramh.get_attribute(&duration, NULL, OCI_ATTR_DURATION);
+
+ writer["temporary_duration"] =
+ duration==OCI_DURATION_SESSION? "session":
+ duration==OCI_DURATION_TRANS? "transaction":
+ "NULL";
+ }
+ } else
+ writer["type"] = "normal";
+ }
+
+ // tables and views
+ if (info._type==OCI_PTYPE_TABLE || info._type==OCI_PTYPE_VIEW) {
+ // get table/view comments
+ if (_comments) {
+ SqlString comment;
+
+ stmt.prepare(_T("select COMMENTS from ALL_TAB_COMMENTS ")
+ _T("where OWNER=:0 and TABLE_NAME=:1"));
+ stmt.bind_param(0, owner);
+ stmt.bind_param(1, obj_name);
+
+ stmt.bind_result(0, comment);
+
+ stmt.execute_fetch();
+
+ if (stmt.fetched_rows()) {
+ writer.create("comment");
+ writer.set_content(comment.c_str());
+ writer.back();
+ }
+ }
+
+ ColumnType* pcolTypes = NULL;
+ int* pColIdxs = NULL;
+
+ try {
+ ub2 num_cols;
+ paramh.get_attribute(&num_cols, NULL, OCI_ATTR_NUM_COLS);
+
+ OciParam col_listh(conn._env);
+ paramh.get_attribute(&col_listh, NULL, OCI_ATTR_LIST_COLUMNS);
+
+ pcolTypes = new ColumnType[num_cols]; // Array der Spaltenbeschreibungen
+ ColumnType* pColType = pcolTypes;
+
+ pColIdxs = new int[num_cols]; // Array der Spalten-Indices
+ int* pColIdx = pColIdxs;
+
+ int j;
+ for(j=0; j<num_cols; ++j) {
+ OciParam colh(conn._env);
+ res = OCIParamGet(col_listh, OciParam::get_type_id(), conn._env._errh, (void**)&colh, j+1);
+ oci_check_error(conn._env, res);
+
+ pColType++->init(conn._env._errh, colh);
+ *pColIdx++ = j;
+ }
+
+ if (_sort_cols) {
+ s_pcolTypes = pcolTypes; //@@ nicht threadsicher
+ qsort(pColIdxs, num_cols, sizeof(int), cmp_col);
+ }
+
+ map<tstring, tstring> col_comments;
+ map<tstring, tstring> col_default;
+ SqlStringArray col_name, comment, data_default;
+
+ // Abfrage der Spaltenkommentare
+ if (_comments) {
+ stmt.prepare(_T("select COLUMN_NAME, COMMENTS ")
+ _T("from ALL_COL_COMMENTS ")
+ _T("where OWNER=:0 and TABLE_NAME=:1"));
+
+ stmt.bind_param(0, owner);
+ stmt.bind_param(1, obj_name);
+
+ stmt.bind_result(0, col_name);
+ stmt.bind_result(1, comment);
+
+ for(int fetched=stmt.first_bulk(); fetched>0; fetched=stmt.next_bulk())
+ for(int i=0; i<fetched; ++i)
+ if (comment.is_not_null(i))
+ col_comments[col_name.str(i)] = comment.str(i);
+ }
+
+ if (true) {
+ stmt.prepare(_T("select COLUMN_NAME, DATA_DEFAULT ")
+ _T("from ALL_TAB_COLUMNS ")
+ _T("where OWNER=:0 and TABLE_NAME=:1"));
+
+ stmt.bind_param(0, owner);
+ stmt.bind_param(1, obj_name);
+
+ stmt.bind_result(0, col_name);
+ stmt.bind_result(1, data_default);
+
+ for(int fetched=stmt.first_bulk(); fetched>0; fetched=stmt.next_bulk())
+ for(int i=0; i<fetched; ++i)
+ if (data_default.is_not_null(i))
+ col_default[col_name.str(i)] = data_default.str(i);
+ }
+
+ pColIdx = pColIdxs;
+ for(j=0; j<num_cols; ++j) {
+ int k = *pColIdx++;
+ pColType = pcolTypes + k;
+
+ writer.create("column");
+
+ writer["name"] = pColType->_name;
+ writer["type"] = pColType->get_type_str();
+
+ if (_col_pos)
+ writer["pos"] = XMLInt(k+1);
+
+ map<tstring, tstring>::const_iterator found = col_default.find(pColType->_name);
+
+ if (found != col_default.end())
+ writer["default"] = found->second.c_str();
+
+ // Ausgabe des Spaltenkommentars
+ if (_comments) {
+ found = col_comments.find(pColType->_name);
+
+ if (found != col_comments.end()) {
+ writer.create("comment");
+ writer.set_content(found->second.c_str());
+ writer.back();
+ }
+ }
+
+ writer.back(); // </column>
+ }
+
+ delete[] pColIdxs; pColIdxs = NULL;
+ delete[] pcolTypes; pcolTypes = NULL;
+
+
+ // Abfrage der Dateninhalte
+ if (_data) {
+ writer.create("data");
+
+ try {
+ _stprintf(buffer, _T("select * from %s.%s"), schema, obj_name.c_str());
+ stmt.execute(buffer);
+ stmt.dump_results(buffer, writer, "row");
+ } catch(exception& e) {
+ cerr << "====>\n"
+ "exception in dump of '" << ANSI_STRING(obj_name) << "' data: " << e.what() << endl <<
+ "<====\n";
+ }
+
+ writer.back(); // </data>
+ }
+ } catch(exception& e) {
+ cerr << "====>\n"
+ "exception in getting info about '" << ANSI_STRING(obj_name) << "': " << e.what() << endl <<
+ "<====\n";
+
+ delete[] pColIdxs;
+ delete[] pcolTypes;
+ }
+ }
+
+ // views
+ if (info._type == OCI_PTYPE_VIEW) {
+ stmt.prepare(_T("select TEXT from ALL_VIEWS where OWNER=:0 and VIEW_NAME=:1"));
+ stmt.bind_param(0, owner);
+ stmt.bind_param(1, obj_name);
+
+ SqlString view_txt(65536);
+ stmt.bind_result(0, view_txt);
+
+ stmt.execute_fetch();
+
+ if (stmt.fetched_rows() > 0) {
+ writer.create("sql_text");
+ writer.set_content(view_txt.c_str());
+ writer.back(); // </sql_text>
+ }
+
+ // synonyms
+ } else if (info._type == OCI_PTYPE_SYN) {
+ text *syn_schema, *syn_name, *syn_link;
+ ub4 syn_schema_len, syn_name_len, syn_link_len;
+
+ paramh.get_attribute(&syn_schema, &syn_schema_len, OCI_ATTR_SCHEMA_NAME);
+ paramh.get_attribute(&syn_name, &syn_name_len, OCI_ATTR_NAME);
+ paramh.get_attribute(&syn_link, &syn_link_len, OCI_ATTR_LINK);
+
+ int l = _stprintf(buffer, _T("%.*s.%.*s"), syn_schema_len, syn_schema, syn_name_len, syn_name);
+ TCHAR* p = buffer + l;
+
+ if (syn_link)
+#ifdef __STDC_WANT_SECURE_LIB__
+ _stprintf_s(p, COUNTOF(buffer)-l,
+#else
+ _stprintf(p,
+#endif
+ _T("@%.*s"), syn_link_len, syn_link);
+
+ writer["target"] = buffer;
+
+ // sequences
+ } else if (info._type == OCI_PTYPE_SEQ) {
+ ub1* num_ptr;
+
+ ub4 num_len = 0;
+ paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_MIN);
+ writer["min"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
+
+ num_len = 0;
+ paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_MAX);
+ writer["max"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
+
+ num_len = 0;
+ paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_INCR);
+ writer["increment"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
+
+ num_len = 0;
+ paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_CACHE);
+ writer["cache"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
+
+ if (_seq_val) {
+ num_len = 0;
+ paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_HW_MARK);
+ writer["high-water-mark"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
+ }
+
+ ub1 ordered;
+ paramh.get_attribute(&ordered, NULL, OCI_ATTR_ORDER);
+ writer["ordered"] = XMLBool(ordered? true: false);
+ }
+ } else {
+/* cerr << "====>\n"
+ "exception while describing '" << buffer << "': "
+ << OciException(conn._env._errh, __FILE__, __LINE__).what()
+ << "\n<====\n"; */
+ }
+
+ if (_grants) {
+ // query grants given to this object
+ if (lp._mode & OCI_SYSDBA)
+ stmt.prepare(
+ _T("select GRANTEE, PRIVILEGE ")
+ _T("from DBA_TAB_PRIVS ")
+ _T("where GRANTOR=:0 and TABLE_NAME=:1 ")
+ _T("order by GRANTEE, PRIVILEGE"));
+ else
+ stmt.prepare(
+ _T("select GRANTEE, PRIVILEGE ")
+ _T("from ALL_TAB_PRIVS ")
+ _T("where GRANTOR=:0 and TABLE_NAME=:1 ")
+ _T("order by GRANTEE, PRIVILEGE"));
+
+ writer.create("grants");
+ SqlStringArray grantee, privilege;
+
+ stmt.bind_param(0, owner);
+ stmt.bind_param(1, obj_name);
+
+ stmt.bind_result(0, grantee);
+ stmt.bind_result(1, privilege);
+
+ for(int fetched=stmt.first_bulk(); fetched>0; fetched=stmt.next_bulk())
+ for(int i=0; i<fetched; ++i) {
+ writer.create("grant");
+
+ writer["grantee"] = grantee.str(i);
+ writer["privilege"] = privilege.str(i);
+
+ writer.back(); // </grant>
+ }
+ writer.back(); // </grants>
+ }
+
+ writer.back(); // </...>
+ }
+
+ writer.back(); // </objects>
+
+ writer.back(); // </schema>
+}
Property changes on: trunk/xmldump/xmldump.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/xmldump/xmldump.dsp
===================================================================
--- trunk/xmldump/xmldump.dsp (rev 0)
+++ trunk/xmldump/xmldump.dsp 2008-02-09 15:00:55 UTC (rev 44)
@@ -0,0 +1,132 @@
+# Microsoft Developer Studio Project File - Name="xmldump" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xmldump - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmldump.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmldump.mak" CFG="xmldump - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmldump - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xmldump - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.cmd
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmldump - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../ocipl" /I "../xmlstorage" /D "NDEBUG" /D "_NO_ESQL" /D "OCIPL_NO_COMMENT" /D "XS_NO_COMMENT" /D ORACLE_VERSION=81 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.cmd
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib oci.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "xmldump - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../ocipl" /I "../xmlstorage" /D "_DEBUG" /D "_NO_ESQL" /D "OCIPL_NO_COMMENT" /D "XS_NO_COMMENT" /D ORACLE_VERSION=81 /FR /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.cmd
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 oci.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmldump - Win32 Release"
+# Name "xmldump - Win32 Debug"
+# Begin Group "ocipl"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE="..\ocipl\ocipl-xml.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ocipl\ocipl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\ocipl\ocipl.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ocipl\ocithrow.cpp
+# End Source File
+# End Group
+# Begin Group "xmlstorage"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\xmlstorage\xmlstorage.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\xmlstorage\xmlstorage.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\xmlstorage\xs-native.cpp"
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=".\xmldump.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ocipl\xmldump.h
+# End Source File
+# End Target
+# End Project
Property changes on: trunk/xmldump/xmldump.dsp
___________________________________________________________________
Name: svn:eol-style
+ CRLF
Added: trunk/xmldump/xmldump.dsw
===================================================================
--- trunk/xmldump/xmldump.dsw (rev 0)
+++ trunk/xmldump/xmldump.dsw 2008-02-09 15:00:55 UTC (rev 44)
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "xmldump"=.\xmldump.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
Property changes on: trunk/xmldump/xmldump.dsw
___________________________________________________________________
Name: svn:eol-style
+ CRLF
Added: trunk/xmldump/xmldump.h
===================================================================
--- trunk/xmldump/xmldump.h (rev 0)
+++ trunk/xmldump/xmldump.h 2008-02-09 15:00:55 UTC (rev 44)
@@ -0,0 +1,79 @@
+
+ //
+ // xmldump.h
+ //
+ // Copyright (c) 2007 Martin Fuchs <mar...@gm...>
+ //
+
+/*
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+
+#ifdef UNICODE
+#define ANSI_STRING(s) XS_String(s)
+#else
+#define ANSI_STRING(s) s
+#endif
+
+
+struct XMLDump {
+ bool _info : 1;
+ bool _db_version : 1;
+ bool _db_options : 1;
+
+ bool _tables : 1;
+ bool _views : 1;
+ bool _comments : 1;
+ bool _grants : 1;
+ bool _data : 1;
+ bool _col_pos : 1;
+ bool _seq_val : 1;
+ bool _pub_syns : 1;
+
+ bool _sort_cols : 1;
+
+ std::set<tstring> _filter;
+
+ XMLDump()
+ {
+ _info = true;
+ _db_version = true;
+ _db_options = false;
+ _tables = true;
+ _views = true;
+ _comments = true;
+ _grants = true;
+ _data = false;
+ _col_pos = true;
+ _seq_val = true;
+ _sort_cols = true;
+ _pub_syns = true;
+ }
+
+ void dump_schema(OciEnv& env, const LoginPara& lp, const TCHAR* schema, XMLStorage::XMLWriter& writer);
+};
Property changes on: trunk/xmldump/xmldump.h
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 14:00:32
|
Revision: 43
http://ocipl.svn.sourceforge.net/ocipl/?rev=43&view=rev
Author: martinfuchs
Date: 2008-02-09 06:00:37 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
handle the new Oracle 10g data types BINARY_FLOAT and BINARY_DOUBLE
Modified Paths:
--------------
trunk/ocipl/ocipl.cpp
trunk/ocipl/ocipl.h
Modified: trunk/ocipl/ocipl.cpp
===================================================================
--- trunk/ocipl/ocipl.cpp 2008-02-09 10:16:38 UTC (rev 42)
+++ trunk/ocipl/ocipl.cpp 2008-02-09 14:00:37 UTC (rev 43)
@@ -774,6 +774,16 @@
str << _T("NUMBER(") << (int)_precision << _T(")");
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ str << _T("BINARY_FLOAT");
+ break;
+
+ case OCI_TYPECODE_BDOUBLE:
+ str << _T("BINARY_DOUBLE");
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
str << _T("DATE");
break;
@@ -1099,13 +1109,11 @@
oci_check_error(errh, res);
#if ORACLE_VERSION>=90
- // Oracle 9 ->
// retrieve the length semantics for the column
size = sizeof(_char_semantics);
res = OCIAttrGet(handle, OCI_DTYPE_PARAM, &_char_semantics, &size, OCI_ATTR_CHAR_USED, errh);
if (res != OCI_SUCCESS)
_char_semantics = 0;
- // <- Oracle 9
size = sizeof(_width);
if (_char_semantics)
@@ -1124,7 +1132,11 @@
_scale = -127;
break;
- case OCI_TYPECODE_NUMBER: {
+ case OCI_TYPECODE_NUMBER:
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ case OCI_TYPECODE_BDOUBLE:
+#endif
size = sizeof(_precision);
res = OCIAttrGet(handle, OCI_DTYPE_PARAM, &_precision, &size, OCI_ATTR_PRECISION, errh);
oci_check_error(errh, res);
@@ -1132,7 +1144,7 @@
size = sizeof(_scale);
res = OCIAttrGet(handle, OCI_DTYPE_PARAM, &_scale, &size, OCI_ATTR_SCALE, errh);
oci_check_error(errh, res);
- break;}
+ break;
case OCI_TYPECODE_DATE:
#if ORACLE_VERSION>=81
@@ -1298,6 +1310,13 @@
_number = new SqlNumber;
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ case OCI_TYPECODE_BDOUBLE:
+ _double = other._double;
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
_oci_date = new OciDate;
break;
@@ -1350,6 +1369,16 @@
_number = new SqlNumber(*other._number);
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ _float = other._float;
+ break;
+
+ case OCI_TYPECODE_BDOUBLE:
+ _double = other._double;
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
_oci_date = new OciDate(*other._oci_date);
break;
@@ -1391,6 +1420,12 @@
delete _number;
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ case OCI_TYPECODE_BDOUBLE:
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
delete _oci_date;
break;
@@ -1422,6 +1457,8 @@
tstring SqlVariant::str(OCIError* errh) const
{
+ TCHAR buffer[16];
+
switch(_data_type) {
case 0:
return _T("");
@@ -1433,6 +1470,16 @@
case OCI_TYPECODE_NUMBER:
return _number->str(errh);
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ _stprintf(buffer, _T("%f"), _float);
+ return buffer;
+
+ case OCI_TYPECODE_BDOUBLE:
+ _stprintf(buffer, _T("%f"), _double);
+ return buffer;
+#endif
+
case OCI_TYPECODE_DATE:
return _oci_date->str();
@@ -1474,6 +1521,14 @@
case OCI_TYPECODE_NUMBER:
return *_number;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ return SqlNumber(_float);
+
+ case OCI_TYPECODE_BDOUBLE:
+ return SqlNumber(_double);
+#endif
+
//case OCI_TYPECODE_DATE:
// return ...
@@ -1534,6 +1589,10 @@
{
switch(_data_type) {
case 0:
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ case OCI_TYPECODE_BDOUBLE:
+#endif
return true;
case OCI_TYPECODE_VARCHAR:
@@ -1576,6 +1635,16 @@
stmt.bind_result(idx, *_number);
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ stmt.bind_result(idx, _float);
+ break;
+
+ case OCI_TYPECODE_BDOUBLE:
+ stmt.bind_result(idx, _double);
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
stmt.bind_result(idx, *_oci_date);
break;
@@ -1623,6 +1692,16 @@
_pnumber = new SqlNumberArray(size);
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ _pfloat = new float(size);
+ break;
+
+ case OCI_TYPECODE_BDOUBLE:
+ _pdouble = new double(size);
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
_poci_date = new OciDateArray(size);
break;
@@ -1675,6 +1754,16 @@
_pnumber = new SqlNumberArray(*other._pnumber);
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ _pfloat = new float(*other._pfloat);
+ break;
+
+ case OCI_TYPECODE_BDOUBLE:
+ _pdouble = new double(*other._pfloat);
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
_poci_date = new OciDateArray(*other._poci_date);
break;
@@ -1716,6 +1805,16 @@
delete _pnumber;
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ delete _pfloat;
+ break;
+
+ case OCI_TYPECODE_BDOUBLE:
+ delete _pfloat;
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
delete _poci_date;
break;
@@ -1747,6 +1846,8 @@
tstring SqlVariantArray::str(int row, OCIError* errh) const
{
+ TCHAR buffer[16];
+
switch(_data_type) {
case 0:
return _T("");
@@ -1758,6 +1859,16 @@
case OCI_TYPECODE_NUMBER:
return _pnumber->str(row, errh);
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ _stprintf(buffer, _T("%f"), _pfloat[row]);
+ return buffer;
+
+ case OCI_TYPECODE_BDOUBLE:
+ _stprintf(buffer, _T("%f"), _pdouble[row]);
+ return buffer;
+#endif
+
case OCI_TYPECODE_DATE:
return _poci_date->str(row);
@@ -1802,6 +1913,14 @@
else
return SqlNumber();
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ return SqlNumber(errh, _pfloat[row]);
+
+ case OCI_TYPECODE_BDOUBLE:
+ return SqlNumber(errh, _pdouble[row]);
+#endif
+
//case OCI_TYPECODE_DATE:
// return ...
@@ -1868,6 +1987,10 @@
{
switch(_data_type) {
case 0:
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ case OCI_TYPECODE_BDOUBLE:
+#endif
return true;
case OCI_TYPECODE_VARCHAR:
@@ -1910,6 +2033,16 @@
stmt.bind_result(idx, *_pnumber);
break;
+#ifdef SQLT_BFLOAT
+ case OCI_TYPECODE_BFLOAT:
+ stmt.bind_result(idx, *_pfloat);
+ break;
+
+ case OCI_TYPECODE_BDOUBLE:
+ stmt.bind_result(idx, *_pdouble);
+ break;
+#endif
+
case OCI_TYPECODE_DATE:
stmt.bind_result(idx, *_poci_date);
break;
Modified: trunk/ocipl/ocipl.h
===================================================================
--- trunk/ocipl/ocipl.h 2008-02-09 10:16:38 UTC (rev 42)
+++ trunk/ocipl/ocipl.h 2008-02-09 14:00:37 UTC (rev 43)
@@ -2193,6 +2193,25 @@
buffers = count;
}
+#ifdef SQLT_BFLOAT
+ DefinePar(float& var, OCIInd* ind=0)
+ {
+ valuep = &var;
+ value_sz= sizeof(float);
+ dty = SQLT_FLT;
+ indp = ind;
+ buffers = 1;
+ }
+ DefinePar(float* arr, int count, OCIInd* ind=0)
+ {
+ valuep = arr;
+ value_sz= sizeof(float);
+ dty = SQLT_FLT;
+ indp = ind;
+ buffers = count;
+ }
+#endif
+
DefinePar(const TCHAR* buffer, size_t len, ub2 type=SQLT_STR, OCIInd* ind=0)
{
valuep = (dvoid*) buffer;
@@ -2708,6 +2727,10 @@
SqlDateTime*_sql_date;
// OciBlob* _blob;
// OciClob* _clob;
+#ifdef SQLT_BFLOAT
+ float _float;
+ double _double;
+#endif
};
ub2 _data_type;
@@ -2755,7 +2778,11 @@
SqlDateTimeArray*_psql_date;
// OciBlobArray* _pblob;
// OciClobArray* _pclob;
- void* _punion_ptr;
+ void* _punion_ptr;
+#ifdef SQLT_BFLOAT
+ float* _pfloat;
+ double* _pdouble;
+#endif
};
ub2 _data_type;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 10:16:35
|
Revision: 42
http://ocipl.svn.sourceforge.net/ocipl/?rev=42&view=rev
Author: martinfuchs
Date: 2008-02-09 02:16:38 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
OCIPL Version 1.4:
- struct ResultIterator as loop iterator utilizing bulk mode fetching
- use INT_NULL as default for get_int() functions
- added break statements in throw_oci_exception()
Modified Paths:
--------------
trunk/ocipl/ocipl.cpp
trunk/ocipl/ocipl.h
Modified: trunk/ocipl/ocipl.cpp
===================================================================
--- trunk/ocipl/ocipl.cpp 2008-02-09 10:13:36 UTC (rev 41)
+++ trunk/ocipl/ocipl.cpp 2008-02-09 10:16:38 UTC (rev 42)
@@ -2,9 +2,9 @@
//
// ocipl.cpp
//
- // Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
- // OCIPL Version 1.3
+ // OCIPL Version 1.4
//
/// \file ocipl.cpp
@@ -65,9 +65,11 @@
switch(res) {
case OCI_ERROR:
THROW_OCI_EXCEPTION(errh);
+ break;
case OCI_INVALID_HANDLE:
THROW_OCI_EXCEPTION("invalid handle");
+ break;
//@todo handle other error states
Modified: trunk/ocipl/ocipl.h
===================================================================
--- trunk/ocipl/ocipl.h 2008-02-09 10:13:36 UTC (rev 41)
+++ trunk/ocipl/ocipl.h 2008-02-09 10:16:38 UTC (rev 42)
@@ -2,10 +2,10 @@
//
// ocipl.h
//
- // Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
- //
- // OCIPL Version 1.3
+ // Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
+ // OCIPL Version 1.4
+ //
/// \file ocipl.h
/// OCIPL header file
@@ -1383,7 +1383,7 @@
extern tstring number_to_str(const oraclenumber& val, OCIError* errh, const TCHAR* fmt, const TCHAR* nls_fmt);
#ifdef _MSC_VER
-extern __int64 number_to_int64(const oraclenumber& val, OCIError* errh, int null=0);
+extern __int64 number_to_int64(const oraclenumber& val, OCIError* errh, int null=INT_NULL);
#endif
@@ -1435,7 +1435,7 @@
operator OCINumber*() {return (OCINumber*)&_val;}
operator const OCINumber*() const {return (OCINumber*)&_val;}
- int get_int(OCIError* errh, int null=0) const
+ int get_int(OCIError* errh, int null=INT_NULL) const
{
if (is_null())
return null;
@@ -1444,7 +1444,7 @@
}
#ifdef _MSC_VER
- __int64 get_int64(OCIError* errh, int null=0) const
+ __int64 get_int64(OCIError* errh, int null=INT_NULL) const
{
if (is_null())
return null;
@@ -1493,7 +1493,7 @@
return tstring();
}
- int get_int(int row, OCIError* errh, int null=0) const
+ int get_int(int row, OCIError* errh, int null=INT_NULL) const
{
if (is_not_null(row))
return number_to_int(_pvalues[row], errh);
@@ -1502,7 +1502,7 @@
}
#ifdef _MSC_VER
- __int64 get_int64(int row, OCIError* errh, int null=0) const
+ __int64 get_int64(int row, OCIError* errh, int null=INT_NULL) const
{
if (is_not_null(row))
return number_to_int64(_pvalues[row], errh, null);
@@ -2874,6 +2874,15 @@
return get_column(col_name).number(row, _env._errh).get_double(_env._errh);
}
+ SqlNumber get_number(int idx, int row) const
+ {
+ return get_column(idx).number(row, _env._errh);
+ }
+ SqlNumber get_number(const tstring& col_name, int row) const
+ {
+ return get_column(col_name).number(row, _env._errh);
+ }
+
tstring get_string(int idx, int row) const
{
return get_column(idx).str(row, _env._errh);
@@ -2905,6 +2914,147 @@
};
+ /// iterator utilizing bulk mode fetching
+
+struct ResultIterator
+{
+ typedef ResultIterator myType;
+
+ ResultIterator(SqlStatement& stmt)
+ : _stmt(stmt),
+ _row_idx(0),
+ _row_nr(1)
+ {
+ _fetched = stmt.first_bulk();
+ }
+
+ int get_row_idx() const
+ {
+ return _row_idx;
+ }
+
+ operator int() const
+ {
+ return _row_idx;
+ }
+
+ int get_row_nr() const
+ {
+ return _row_nr;
+ }
+
+ bool has_next()
+ {
+ return _row_idx < _fetched;
+ }
+
+ myType& operator++()
+ {
+ if (++_row_idx >= _fetched) {
+ _fetched = _stmt.next_bulk();
+
+ if (_fetched) {
+ _row_idx = 0;
+ ++_row_nr;
+ }
+ } else
+ ++_row_nr;
+
+ return *this;
+ }
+
+ bool is_null(int idx) const
+ {
+ return _stmt->is_null(idx, _row_idx);
+ }
+ int is_null(const tstring& col_name) const
+ {
+ return _stmt->is_null(col_name, _row_idx);
+ }
+
+ bool is_not_null(int idx) const
+ {
+ return _stmt->is_not_null(idx, _row_idx);
+ }
+ int is_not_null(const tstring& col_name) const
+ {
+ return _stmt->is_not_null(col_name, _row_idx);
+ }
+
+ int get_int(int idx) const
+ {
+ return _stmt->get_int(idx, _row_idx);
+ }
+ int get_int(const tstring& col_name) const
+ {
+ return _stmt->get_int(col_name, _row_idx);
+ }
+
+#ifdef _MSC_VER
+ __int64 get_int64(int idx) const
+ {
+ return _stmt->get_int64(idx, _row_idx);
+ }
+ __int64 get_int64(const tstring& col_name) const
+ {
+ return _stmt->get_int64(col_name, _row_idx);
+ }
+#endif
+
+ double get_double(int idx) const
+ {
+ return _stmt->get_double(idx, _row_idx);
+ }
+ double get_double(const tstring& col_name) const
+ {
+ return _stmt->get_double(col_name, _row_idx);
+ }
+
+ SqlNumber get_number(int idx) const
+ {
+ return _stmt->get_number(idx, _row_idx);
+ }
+ SqlNumber get_number(const tstring& col_name) const
+ {
+ return _stmt->get_number(col_name, _row_idx);
+ }
+
+ tstring get_string(int idx) const
+ {
+ return _stmt->get_string(idx, _row_idx);
+ }
+ tstring get_string(const tstring& col_name) const
+ {
+ return _stmt->get_string(col_name, _row_idx);
+ }
+
+ OciDate get_oci_date(int idx) const
+ {
+ return _stmt->get_oci_date(idx, _row_idx);
+ }
+ OciDate get_oci_date(const tstring& col_name) const
+ {
+ return _stmt->get_oci_date(col_name, _row_idx);
+ }
+
+ SqlDateTime get_sql_date(int idx) const
+ {
+ return _stmt->get_sql_date(idx, _row_idx);
+ }
+ SqlDateTime get_sql_date(const tstring& col_name) const
+ {
+ return _stmt->get_sql_date(col_name, _row_idx);
+ }
+
+protected:
+ SqlStatement& _stmt;
+
+ int _fetched;
+ int _row_idx;
+ int _row_nr;
+};
+
+
inline void SqlStatement::bind_result(SqlRecord& rec)
{rec.bind_result(*this);}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 10:13:33
|
Revision: 41
http://ocipl.svn.sourceforge.net/ocipl/?rev=41&view=rev
Author: martinfuchs
Date: 2008-02-09 02:13:36 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
switch to Oracle 10 as default
Modified Paths:
--------------
trunk/ocipl/Makefile.VC6
Modified: trunk/ocipl/Makefile.VC6
===================================================================
--- trunk/ocipl/Makefile.VC6 2008-02-09 10:10:53 UTC (rev 40)
+++ trunk/ocipl/Makefile.VC6 2008-02-09 10:13:36 UTC (rev 41)
@@ -8,11 +8,11 @@
#ORACLE_HOME = D:\Oracle\Ora81
#ORACLE_VER = 81
-ORACLE_HOME = D:\Oracle\Ora9i2
-ORACLE_VER = 92
+#ORACLE_HOME = D:\Oracle\Ora9i2
+#ORACLE_VER = 92
-#ORACLE_HOME = D:\Oracle\O10g2
-#ORACLE_VER = 102
+ORACLE_HOME = D:\Oracle\product\10.2.0\client_1
+ORACLE_VER = 102
VC_VER = vc6
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-09 10:10:57
|
Revision: 40
http://ocipl.svn.sourceforge.net/ocipl/?rev=40&view=rev
Author: martinfuchs
Date: 2008-02-09 02:10:53 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
update to XMLStorage version 1.3
Modified Paths:
--------------
trunk/xmlstorage/xmlstorage-license.txt
trunk/xmlstorage/xmlstorage.cpp
trunk/xmlstorage/xmlstorage.h
trunk/xmlstorage/xs-native.cpp
Modified: trunk/xmlstorage/xmlstorage-license.txt
===================================================================
--- trunk/xmlstorage/xmlstorage-license.txt 2008-02-04 09:35:35 UTC (rev 39)
+++ trunk/xmlstorage/xmlstorage-license.txt 2008-02-09 10:10:53 UTC (rev 40)
@@ -2,7 +2,7 @@
//
// XML storage classes
//
- // Copyright (c) 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2004, 2005, 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
Modified: trunk/xmlstorage/xmlstorage.cpp
===================================================================
--- trunk/xmlstorage/xmlstorage.cpp 2008-02-04 09:35:35 UTC (rev 39)
+++ trunk/xmlstorage/xmlstorage.cpp 2008-02-09 10:10:53 UTC (rev 40)
@@ -56,7 +56,11 @@
const LPCXSSTR XS_FLOATFMT = XS_FLOATFMT_STR;
#endif
+const XS_String XS_KEY = XS_KEY_STR;
+const XS_String XS_VALUE = XS_VALUE_STR;
+const XS_String XS_PROPERTY = XS_PROPERTY_STR;
+
/// remove escape characters from zero terminated string
static std::string unescape(const char* s, char b, char e)
{
@@ -216,7 +220,7 @@
}
-XPath::XPath(const char* path)
+void XPath::init(const char* path)
{
// Is this an absolute path?
if (*path == '/') {
@@ -919,5 +923,91 @@
XS_String XMLWriter::s_empty_attr;
+void XMLWriter::create(const XS_String& name)
+{
+ if (!_stack.empty()) {
+ StackEntry& last = _stack.top();
+ if (last._state < PRE_CLOSED) {
+ write_attributes(last);
+ close_pre(last);
+ }
+
+ ++last._children;
+ }
+
+ StackEntry entry;
+ entry._node_name = name;
+ _stack.push(entry);
+
+ write_pre(entry);
+}
+
+bool XMLWriter::back()
+{
+ if (!_stack.empty()) {
+ write_post(_stack.top());
+
+ _stack.pop();
+ return true;
+ } else
+ return false;
+}
+
+void XMLWriter::close_pre(StackEntry& entry)
+{
+ _out << '>';
+
+ entry._state = PRE_CLOSED;
+}
+
+void XMLWriter::write_pre(StackEntry& entry)
+{
+ if (_format._pretty >= PRETTY_LINEFEED)
+ _out << _format._endl;
+
+ if (_format._pretty == PRETTY_INDENT)
+ for(size_t i=_stack.size(); --i>0; )
+ _out << XML_INDENT_SPACE;
+
+ _out << '<' << EncodeXMLString(entry._node_name);
+ //entry._state = PRE;
+}
+
+void XMLWriter::write_attributes(StackEntry& entry)
+{
+ for(AttrMap::const_iterator it=entry._attributes.begin(); it!=entry._attributes.end(); ++it)
+ _out << ' ' << EncodeXMLString(it->first) << "=\"" << EncodeXMLString(it->second) << "\"";
+
+ entry._state = ATTRIBUTES;
+}
+
+void XMLWriter::write_post(StackEntry& entry)
+{
+ if (entry._state < ATTRIBUTES)
+ write_attributes(entry);
+
+ if (entry._children || !entry._content.empty()) {
+ if (entry._state < PRE_CLOSED)
+ close_pre(entry);
+
+ _out << entry._content;
+ //entry._state = CONTENT;
+
+ if (_format._pretty>=PRETTY_LINEFEED && entry._content.empty())
+ _out << _format._endl;
+
+ if (_format._pretty==PRETTY_INDENT && entry._content.empty())
+ for(size_t i=_stack.size(); --i>0; )
+ _out << XML_INDENT_SPACE;
+
+ _out << "</" << EncodeXMLString(entry._node_name) << ">";
+ } else {
+ _out << "/>";
+ }
+
+ entry._state = POST;
+}
+
+
} // namespace XMLStorage
Modified: trunk/xmlstorage/xmlstorage.h
===================================================================
--- trunk/xmlstorage/xmlstorage.h 2008-02-04 09:35:35 UTC (rev 39)
+++ trunk/xmlstorage/xmlstorage.h 2008-02-09 10:10:53 UTC (rev 40)
@@ -202,7 +202,7 @@
#endif
#ifdef __BORLANDC__
-#define _strcmpi strcmpi
+#define _stricmp stricmp
#endif
@@ -395,6 +395,10 @@
#define XS_INTFMT_STR XS_TEXT("%d")
#define XS_FLOATFMT_STR XS_TEXT("%f")
+#define XS_KEY_STR XS_TEXT("key")
+#define XS_VALUE_STR XS_TEXT("value")
+#define XS_PROPERTY_STR XS_TEXT("property")
+
// work around GCC's wide string constant bug
#ifdef __GNUC__
extern const LPCXSSTR XS_EMPTY;
@@ -410,7 +414,11 @@
#define XS_FLOATFMT XS_FLOATFMT_STR
#endif
+extern const XS_String XS_KEY;
+extern const XS_String XS_VALUE;
+extern const XS_String XS_PROPERTY;
+
#ifndef XS_STRING_UTF8
// from UTF-8 to XS internal string encoding
@@ -812,8 +820,11 @@
struct XPath : std::list<XPathElement>
{
- XPath(const char* path);
+ XPath(const char* path) {init(path);}
+ XPath(const std::string path) {init(path.c_str());}
+ void init(const char* path);
+
bool _absolute;
};
@@ -1257,6 +1268,7 @@
struct iterator
{
typedef XMLNode::Children::iterator BaseIterator;
+ typedef iterator myType;
iterator(BaseIterator begin, BaseIterator end, const XS_String& filter_name)
: _cur(begin),
@@ -1281,7 +1293,7 @@
return *_cur;
}
- iterator& operator++()
+ myType& operator++()
{
++_cur;
search_next();
@@ -1289,9 +1301,9 @@
return *this;
}
- iterator operator++(int)
+ myType operator++(int)
{
- iterator ret = *this;
+ myType ret = *this;
++_cur;
search_next();
@@ -1299,14 +1311,14 @@
return ret;
}
- bool operator==(const BaseIterator& other) const
+ bool operator==(const myType& other) const
{
- return _cur == other;
+ return _cur == other._cur;
}
- bool operator!=(const BaseIterator& other) const
+ bool operator!=(const myType& other) const
{
- return _cur != other;
+ return _cur != other._cur;
}
protected:
@@ -1356,6 +1368,7 @@
struct const_iterator
{
typedef XMLNode::Children::const_iterator BaseIterator;
+ typedef const_iterator myType;
const_iterator(BaseIterator begin, BaseIterator end, const XS_String& filter_name)
: _cur(begin),
@@ -1375,7 +1388,7 @@
return *_cur;
}
- const_iterator& operator++()
+ myType& operator++()
{
++_cur;
search_next();
@@ -1383,9 +1396,9 @@
return *this;
}
- const_iterator operator++(int)
+ myType operator++(int)
{
- const_iterator ret = *this;
+ myType ret = *this;
++_cur;
search_next();
@@ -1393,14 +1406,14 @@
return ret;
}
- bool operator==(const BaseIterator& other) const
+ bool operator==(const myType& other) const
{
- return _cur == other;
+ return _cur == other._cur;
}
- bool operator!=(const BaseIterator& other) const
+ bool operator!=(const myType& other) const
{
- return _cur != other;
+ return _cur != other._cur;
}
protected:
@@ -1686,6 +1699,15 @@
XS_String& str() {return *_cur;}
const XS_String& str() const {return *_cur;}
+ // property (key/value pair) setter functions
+ void set_property(const XS_String& key, int value, const XS_String& name=XS_PROPERTY);
+ void set_property(const XS_String& key, double value, const XS_String& name=XS_PROPERTY);
+ void set_property(const XS_String& key, const XS_String& value, const XS_String& name=XS_PROPERTY);
+ void set_property(const XS_String& key, const struct XMLBool& value, const XS_String& name=XS_PROPERTY);
+
+ void set_property(const XS_String& key, const char* value, const XS_String& name=XS_PROPERTY)
+ {set_property(key, XS_String(value), name);}
+
protected:
XMLNode* _root;
XMLNode* _cur;
@@ -1815,7 +1837,7 @@
XMLBool(LPCXSSTR value, bool def=false)
{
- if (value && *value)
+ if (value && *value)//@@ also handle white space and return def instead of false
_value = !XS_icmp(value, XS_TRUE);
else
_value = def;
@@ -1905,7 +1927,7 @@
XMLInt(LPCXSSTR value, int def=0)
{
- if (value && *value)
+ if (value && *value)//@@ also handle white space and return def instead of 0
_value = XS_toi(value);
else
_value = def;
@@ -1930,7 +1952,7 @@
{
XS_CHAR buffer[32];
XS_snprintf(buffer, COUNTOF(buffer), XS_INTFMT, _value);
- return buffer;
+ return XS_String(buffer);
}
protected:
@@ -1986,7 +2008,7 @@
{
LPTSTR end;
- if (value && *value)
+ if (value && *value)//@@ also handle white space and return def instead of 0
_value = XS_tod(value, &end);
else
_value = def;
@@ -2012,7 +2034,7 @@
{
XS_CHAR buffer[32];
XS_snprintf(buffer, COUNTOF(buffer), XS_FLOATFMT, _value);
- return buffer;
+ return XS_String(buffer);
}
protected:
@@ -2160,6 +2182,141 @@
}
+inline void XMLPos::set_property(const XS_String& key, int value, const XS_String& name)
+{
+ smart_create(name, XS_KEY, key);
+ XMLIntRef(_cur, XS_VALUE) = value;
+ back();
+}
+
+inline void XMLPos::set_property(const XS_String& key, double value, const XS_String& name)
+{
+ smart_create(name, XS_KEY, key);
+ XMLDoubleRef(_cur, XS_VALUE) = value;
+ back();
+}
+
+inline void XMLPos::set_property(const XS_String& key, const XS_String& value, const XS_String& name)
+{
+ smart_create(name, XS_KEY, key);
+ put(XS_VALUE, value);
+ back();
+}
+
+inline void XMLPos::set_property(const XS_String& key, const XMLBool& value, const XS_String& name)
+{
+ smart_create(name, XS_KEY, key);
+ XMLBoolRef(_cur, XS_VALUE) = value;
+ back();
+}
+
+
+ /// a key/value pair for property data access
+struct XMLProperty {
+ XMLProperty(const XMLNode* node)
+ : _key(node->get(XS_KEY)),
+ _value(node->get(XS_VALUE))
+ {
+ }
+
+ XS_String _key;
+ XS_String _value;
+};
+
+
+ /// utility class to read property settings from a XML tree
+struct XMLPropertyReader
+{
+ XMLPropertyReader(const XMLNode::Children& children)
+ : _filter(children, XS_PROPERTY),
+ _begin(_filter.begin(), _filter.end()),
+ _end(_filter.end(), _filter.end())
+ {
+ }
+
+ XMLPropertyReader(const XMLNode* node)
+ : _filter(node, XS_PROPERTY),
+ _begin(_filter.begin(), _filter.end()),
+ _end(_filter.end(), _filter.end())
+ {
+ }
+
+ /// internal iterator class
+ struct const_iterator
+ {
+ typedef const_XMLChildrenFilter::const_iterator BaseIterator;
+ typedef const_iterator myType;
+
+ const_iterator(BaseIterator begin, BaseIterator end)
+ : _cur(begin),
+ _end(end)
+ {
+ }
+
+ operator BaseIterator()
+ {
+ return _cur;
+ }
+
+ XMLProperty operator*() const
+ {
+ return XMLProperty(*_cur);
+ }
+
+ const XMLNode* get_node() const
+ {
+ return *_cur;
+ }
+
+ myType& operator++()
+ {
+ ++_cur;
+
+ return *this;
+ }
+
+ myType operator++(int)
+ {
+ myType ret = *this;
+
+ ++_cur;
+
+ return ret;
+ }
+
+ bool operator==(const myType& other) const
+ {
+ return _cur == other._cur;
+ }
+
+ bool operator!=(const myType& other) const
+ {
+ return _cur != other._cur;
+ }
+
+ protected:
+ BaseIterator _cur;
+ BaseIterator _end;
+ };
+
+ const_iterator begin()
+ {
+ return _begin;
+ }
+
+ const_iterator end()
+ {
+ return _end;
+ }
+
+protected:
+ const_XMLChildrenFilter _filter;
+
+ const_iterator _begin;
+ const_iterator _end;
+};
+
+
#ifdef _MSC_VER
#pragma warning(disable: 4355)
#endif
@@ -2664,38 +2821,11 @@
}
/// create node and move to it
- void create(const XS_String& name)
- {
- if (!_stack.empty()) {
- StackEntry& last = _stack.top();
+ void create(const XS_String& name);
- if (last._state < PRE_CLOSED) {
- write_attributes(last);
- close_pre(last);
- }
-
- ++last._children;
- }
-
- StackEntry entry;
- entry._node_name = name;
- _stack.push(entry);
-
- write_pre(entry);
- }
-
/// go back to previous position
- bool back()
- {
- if (!_stack.empty()) {
- write_post(_stack.top());
+ bool back();
- _stack.pop();
- return true;
- } else
- return false;
- }
-
/// attribute setting
void put(const XS_String& attr_name, const XS_String& value)
{
@@ -2745,60 +2875,10 @@
static XS_String s_empty_attr;
- void close_pre(StackEntry& entry)
- {
- _out << '>';
-
- entry._state = PRE_CLOSED;
- }
-
- void write_pre(StackEntry& entry)
- {
- if (_format._pretty >= PRETTY_LINEFEED)
- _out << _format._endl;
-
- if (_format._pretty == PRETTY_INDENT)
- for(size_t i=_stack.size(); --i>0; )
- _out << XML_INDENT_SPACE;
-
- _out << '<' << EncodeXMLString(entry._node_name);
- //entry._state = PRE;
- }
-
- void write_attributes(StackEntry& entry)
- {
- for(AttrMap::const_iterator it=entry._attributes.begin(); it!=entry._attributes.end(); ++it)
- _out << ' ' << EncodeXMLString(it->first) << "=\"" << EncodeXMLString(it->second) << "\"";
-
- entry._state = ATTRIBUTES;
- }
-
- void write_post(StackEntry& entry)
- {
- if (entry._state < ATTRIBUTES)
- write_attributes(entry);
-
- if (entry._children || !entry._content.empty()) {
- if (entry._state < PRE_CLOSED)
- close_pre(entry);
-
- _out << entry._content;
- //entry._state = CONTENT;
-
- if (_format._pretty>=PRETTY_LINEFEED && entry._content.empty())
- _out << _format._endl;
-
- if (_format._pretty==PRETTY_INDENT && entry._content.empty())
- for(size_t i=_stack.size(); --i>0; )
- _out << XML_INDENT_SPACE;
-
- _out << "</" << EncodeXMLString(entry._node_name) << ">";
- } else {
- _out << "/>";
- }
-
- entry._state = POST;
- }
+ void close_pre(StackEntry& entry);
+ void write_pre(StackEntry& entry);
+ void write_attributes(StackEntry& entry);
+ void write_post(StackEntry& entry);
};
Modified: trunk/xmlstorage/xs-native.cpp
===================================================================
--- trunk/xmlstorage/xs-native.cpp 2008-02-04 09:35:35 UTC (rev 39)
+++ trunk/xmlstorage/xs-native.cpp 2008-02-09 10:10:53 UTC (rev 40)
@@ -1,8 +1,8 @@
//
- // XML storage C++ classes version 1.2
+ // XML storage C++ classes version 1.3
//
- // Copyright (c) 2006, 2007 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
/// \file xs-native.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-04 09:35:42
|
Revision: 39
http://ocipl.svn.sourceforge.net/ocipl/?rev=39&view=rev
Author: martinfuchs
Date: 2008-02-04 01:35:35 -0800 (Mon, 04 Feb 2008)
Log Message:
-----------
update to XMLStorage version 1.3
Modified Paths:
--------------
trunk/xmlstorage/xmlstorage.cpp
trunk/xmlstorage/xmlstorage.h
Modified: trunk/xmlstorage/xmlstorage.cpp
===================================================================
--- trunk/xmlstorage/xmlstorage.cpp 2008-02-04 09:25:15 UTC (rev 38)
+++ trunk/xmlstorage/xmlstorage.cpp 2008-02-04 09:35:35 UTC (rev 39)
@@ -1,8 +1,8 @@
//
- // XML storage C++ classes version 1.2
+ // XML storage C++ classes version 1.3
//
- // Copyright (c) 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2004, 2005, 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
/// \file xmlstorage.cpp
@@ -104,19 +104,13 @@
}
- /// move XPath like to position in XML tree
-bool XMLPos::go(const char* path)
+ /// move to the position defined by xpath in XML tree
+bool XMLPos::go(const XPath& xpath)
{
- XMLNode* node = _cur;
+ XMLNode* node = xpath._absolute? _root: _cur;
- // Is this an absolute path?
- if (*path == '/') {
- node = _root;
- ++path;
- }
+ node = node->find_relative(xpath);
- node = node->find_relative(path);
-
if (node) {
go_to(node);
return true;
@@ -124,19 +118,13 @@
return false;
}
- /// move XPath like to position in XML tree
-bool const_XMLPos::go(const char* path)
+ /// move to the position defined by xpath in XML tree
+bool const_XMLPos::go(const XPath& xpath)
{
- const XMLNode* node = _cur;
+ const XMLNode* node = xpath._absolute? _root: _cur;
- // Is this an absolute path?
- if (*path == '/') {
- node = _root;
- ++path;
- }
+ node = node->find_relative(xpath);
- node = node->find_relative(path);
-
if (node) {
go_to(node);
return true;
@@ -145,41 +133,8 @@
}
-const XMLNode* XMLNode::find_relative(const char* path) const
+const char* XPathElement::parse(const char* path)
{
- const XMLNode* node = this;
-
- // parse relative path
- while(*path) {
- node = const_cast<XMLNode*>(node)->get_child_relative(path, false); // get_child_relative() ist const for create==false
-
- if (!node)
- return NULL;
-
- if (*path == '/')
- ++path;
- }
-
- return node;
-}
-
-XMLNode* XMLNode::create_relative(const char* path)
-{
- XMLNode* node = this;
-
- // parse relative path
- while(*path) {
- node = node->get_child_relative(path, true);
-
- if (*path == '/')
- ++path;
- }
-
- return node;
-}
-
-XMLNode* XMLNode::get_child_relative(const char*& path, bool create)
-{
const char* slash = strchr(path, '/');
if (slash == path)
return NULL;
@@ -191,8 +146,7 @@
// look for [n] and [@attr_name="attr_value"] expressions in path components
const char* bracket = strchr(comp.c_str(), '[');
l = bracket? bracket-comp.c_str(): comp.length();
- std::string child_name(comp.c_str(), l);
- std::string attr_name, attr_value;
+ _child_name.assign(comp.c_str(), l);
int n = 0;
if (bracket) {
@@ -202,7 +156,7 @@
n = atoi(p); // read index number
if (n)
- n = n - 1; // convert into zero based index
+ _child_idx = n - 1; // convert into zero based index
const char* at = strchr(p, '@');
@@ -212,33 +166,201 @@
// read attribute name and value
if (equal) {
- attr_name = unescape(p, equal-p);
- attr_value = unescape(equal+1);
+ _attr_name = unescape(p, equal-p);
+ _attr_value = unescape(equal+1);
}
}
}
- XMLNode* child;
+ return path;
+}
- if (attr_name.empty())
- // search n.th child node with specified name
- child = find(child_name, n);
+XMLNode* XPathElement::find(XMLNode* node) const
+{
+ int n = 0;
+
+ for(XMLNode::Children::const_iterator it=node->_children.begin(); it!=node->_children.end(); ++it)
+ if (matches(**it, n))
+ return *it;
+
+ return NULL;
+}
+
+const XMLNode* XPathElement::const_find(const XMLNode* node) const
+{
+ int n = 0;
+
+ for(XMLNode::Children::const_iterator it=node->_children.begin(); it!=node->_children.end(); ++it)
+ if (matches(**it, n))
+ return *it;
+
+ return NULL;
+}
+
+bool XPathElement::matches(const XMLNode& node, int& n) const
+{
+ if (node != _child_name)
+ if (_child_name != "*") // use asterisk as wildcard
+ return false;
+
+ if (!_attr_name.empty())
+ if (node.get(_attr_name) != _attr_value)
+ return false;
+
+ if (_child_idx == -1)
+ return true;
+ else if (n++ == _child_idx)
+ return true;
else
- // search n.th child node with specified name and matching attribute value
- child = find(child_name, attr_name, attr_value, n);
+ return false;
+}
- if (!child && create) {
- child = new XMLNode(child_name);
- add_child(child);
- if (!attr_name.empty())
- (*this)[attr_name] = attr_value;
+XPath::XPath(const char* path)
+{
+ // Is this an absolute path?
+ if (*path == '/') {
+ _absolute = true;
+ ++path;
+ } else
+ _absolute = false;
+
+ // parse path
+ while(*path) {
+ XPathElement elem;
+
+ path = elem.parse(path);
+
+ if (!path)
+ break;
+
+ if (*path == '/')
+ ++path;
+
+ push_back(elem);
}
+}
- return child;
+
+const XMLNode* XMLNode::find_relative(const XPath& xpath) const
+{
+ const XMLNode* node = this;
+
+ for(XPath::const_iterator it=xpath.begin(); it!=xpath.end(); ++it) {
+ node = it->const_find(node);
+
+ if (!node)
+ return NULL;
+ }
+
+ return node;
}
+XMLNode* XMLNode::find_relative(const XPath& xpath)
+{
+ XMLNode* node = this;
+ for(XPath::const_iterator it=xpath.begin(); it!=xpath.end(); ++it) {
+ node = it->find(node);
+
+ if (!node)
+ return NULL;
+ }
+
+ return node;
+}
+
+XMLNode* XMLNode::create_relative(const XPath& xpath)
+{
+ XMLNode* node = this;
+
+ for(XPath::const_iterator it=xpath.begin(); it!=xpath.end(); ++it) {
+ XMLNode* child = it->find(this);
+
+ if (!child) {
+ child = new XMLNode(it->_child_name);
+ add_child(child);
+
+ if (!it->_attr_name.empty())
+ (*this)[it->_attr_name] = it->_attr_value;
+ }
+ }
+
+ return node;
+}
+
+ /// count the nodes matching the given relative XPath expression
+int XMLNode::count(XPath::const_iterator from, const XPath::const_iterator& to) const
+{
+ const XPathElement& elem = *from++;
+ int cnt = 0;
+ int n = 0;
+
+ for(XMLNode::Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
+ if (elem.matches(**it, n))
+ if (from != to)
+ // iterate deeper
+ cnt += (*it)->count(from, to);
+ else
+ // increment match counter
+ ++cnt;
+
+ return cnt;
+}
+
+ /// copy matching tree nodes using the given XPath filter expression
+bool XMLNode::filter(const XPath& xpath, XMLNode& target) const
+{
+ XMLNode* ret = filter(xpath.begin(), xpath.end());
+
+ if (ret) {
+ // move returned nodes to target node
+ target._children.move(ret->_children);
+ target._attributes = ret->_attributes;
+
+ delete ret;
+
+ return true;
+ } else
+ return false;
+}
+
+ /// create a new node tree using the given XPath filter expression
+XMLNode* XMLNode::filter(XPath::const_iterator from, const XPath::const_iterator& to) const
+{
+ XMLNode* copy = NULL;
+
+ const XPathElement& elem = *from++;
+ int cnt = 0;
+ int n = 0;
+
+ for(XMLNode::Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
+ if (elem.matches(**it, n)) {
+ if (!copy)
+ copy = new XMLNode(*this, XMLNode::COPY_NOCHILDREN);
+
+ if (from != to) {
+ XMLNode* ret = (*it)->filter(from, to);
+
+ if (ret) {
+ copy->add_child(ret);
+ ++cnt;
+ }
+ } else {
+ copy->add_child(new XMLNode(**it, XMLNode::COPY_NOCHILDREN));
+ ++cnt;
+ }
+ }
+
+ if (cnt > 0) {
+ return copy;
+ } else {
+ delete copy;
+ return NULL;
+ }
+}
+
+
/// encode XML string literals
std::string EncodeXMLString(const XS_String& str, bool cdata)
{
@@ -534,18 +656,33 @@
}
+const char* get_xmlsym_end_utf8(const char* p)
+{
+ for(; *p; ++p) {
+ char c = *p;
+
+ if (c == '\xC3') // UTF-8 escape character
+ ++p; //TODO only continue on umlaut characters
+ else if (!isalnum(c) && c!='_' && c!='-')
+ break;
+ }
+
+ return p;
+}
+
+
void DocType::parse(const char* p)
{
while(isspace((unsigned char)*p)) ++p;
const char* start = p;
- while(isxmlsym(*p)) ++p;
+ p = get_xmlsym_end_utf8(p);
_name.assign(start, p-start);
while(isspace((unsigned char)*p)) ++p;
start = p;
- while(isxmlsym(*p)) ++p;
+ p = get_xmlsym_end_utf8(p);
std::string keyword(p, p-start); // "PUBLIC" or "SYSTEM"
while(isspace((unsigned char)*p)) ++p;
Modified: trunk/xmlstorage/xmlstorage.h
===================================================================
--- trunk/xmlstorage/xmlstorage.h 2008-02-04 09:25:15 UTC (rev 38)
+++ trunk/xmlstorage/xmlstorage.h 2008-02-04 09:35:35 UTC (rev 39)
@@ -1,8 +1,8 @@
//
- // XML storage C++ classes version 1.2
+ // XML storage C++ classes version 1.3
//
- // Copyright (c) 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2004, 2005, 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
/// \file xmlstorage.h
@@ -265,10 +265,7 @@
#endif
-int inline isxmlsym(unsigned char c)
-{
- return isalnum(c) || c=='_' || c=='-';
-}
+extern const char* get_xmlsym_end_utf8(const char* p);
#if defined(_STRING_DEFINED) && !defined(XS_STRING_UTF8)
@@ -784,6 +781,43 @@
};
+struct XMLNode;
+
+struct XPathElement
+{
+ XPathElement() : _child_idx(-1) {}
+
+ XPathElement(const XS_String& child_name, int child_idx=-1)
+ : _child_name(child_name), _child_idx(child_idx) {}
+
+ XPathElement(const XS_String& child_name, int child_idx, const XS_String& attr_name, const XS_String& attr_value)
+ : _child_name(child_name), _child_idx(child_idx),
+ _attr_name(attr_name), _attr_value(attr_value)
+ {
+ }
+
+ XS_String _child_name;
+ int _child_idx;
+
+ XS_String _attr_name;
+ XS_String _attr_value;
+
+ const char* parse(const char* path);
+
+ XMLNode* find(XMLNode* node) const;
+ const XMLNode* const_find(const XMLNode* node) const;
+
+ bool matches(const XMLNode& node, int& n) const;
+};
+
+struct XPath : std::list<XPathElement>
+{
+ XPath(const char* path);
+
+ bool _absolute;
+};
+
+
/// in memory representation of an XML node
struct XMLNode : public XS_String
{
@@ -842,11 +876,41 @@
/// internal children node list
struct Children : public std::list<XMLNode*>
{
- void assign(const Children& other)
+ typedef std::list<XMLNode*> super;
+
+ Children()
{
+ }
+
+ Children(Children& other)
+ {
+ for(Children::const_iterator it=other.begin(); it!=other.end(); ++it)
+ push_back(*it);
+ }
+
+ void assign(Children& other)
+ {
clear();
+ move(other);
+ }
+ void move(Children& other)
+ {
for(Children::const_iterator it=other.begin(); it!=other.end(); ++it)
+ push_back(*it);
+
+ other.reset();
+ }
+
+ Children& operator=(Children& other)
+ {
+ assign(other);
+ return *this;
+ }
+
+ void copy(const Children& other)
+ {
+ for(Children::const_iterator it=other.begin(); it!=other.end(); ++it)
push_back(new XMLNode(**it));
}
@@ -860,12 +924,30 @@
delete node;
}
}
+
+ bool remove(XMLNode* node)
+ {
+ for(iterator it=begin(); it!=end(); ++it)
+ if (*it == node) {
+ erase(it);
+ return true;
+ }
+
+ return false;
+ }
+
+ private:
+ void reset()
+ {
+ super::clear();
+ }
};
// access to protected class members for XMLPos and XMLReader
friend struct XMLPos;
friend struct const_XMLPos;
friend struct XMLReaderBase;
+ friend struct XPathElement;
XMLNode(const XS_String& name)
: XS_String(name)
@@ -893,6 +975,22 @@
_children.push_back(new XMLNode(**it));
}
+ enum COPY_FLAGS {COPY_NOCHILDREN};
+
+ XMLNode(const XMLNode& other, COPY_FLAGS copy_no_children)
+ : XS_String(other),
+ _attributes(other._attributes),
+ _leading(other._leading),
+ _content(other._content),
+ _end_leading(other._end_leading),
+ _trailing(other._trailing)
+#ifdef XMLNODE_LOCATION
+ , _location(other._location)
+#endif
+ {
+// assert(copy_no_children==COPY_NOCHILDREN);
+ }
+
virtual ~XMLNode()
{
while(!_children.empty()) {
@@ -916,7 +1014,8 @@
XMLNode& operator=(const XMLNode& other)
{
- _children.assign(other._children);
+ _children.clear();
+ _children.copy(other._children);
_attributes = other._attributes;
@@ -934,6 +1033,16 @@
_children.push_back(child);
}
+ /// remove all children named 'name'
+ void remove_children(const XS_String& name)
+ {
+ Children::iterator it, next=_children.begin();
+
+ while((it=next++)!=_children.end())
+ if (**it == name)
+ _children.erase(it);
+ }
+
/// write access to an attribute
void put(const XS_String& attr_name, const XS_String& value)
{
@@ -957,10 +1066,16 @@
return def;
}
+ /// remove the attribute 'attr_name'
+ void erase(const XS_String& attr_name)
+ {
+ _attributes.erase(attr_name);
+ }
+
/// convenient value access in children node
- XS_String subvalue(const XS_String& name, const XS_String& attr_name, int n=0) const
+ XS_String subvalue(const XS_String& child_name, const XS_String& attr_name, int n=0) const
{
- const XMLNode* node = find(name, n);
+ const XMLNode* node = XPathElement(child_name, n).const_find(this);
if (node)
return node->get(attr_name);
@@ -969,12 +1084,12 @@
}
/// convenient storage of distinct values in children node
- XS_String& subvalue(const XS_String& name, const XS_String& attr_name, int n=0)
+ XS_String& subvalue(const XS_String& child_name, const XS_String& attr_name, int n=0)
{
- XMLNode* node = find(name, n);
+ XMLNode* node = XPathElement(child_name, n).find(this);
if (!node) {
- node = new XMLNode(name);
+ node = new XMLNode(child_name);
add_child(node);
}
@@ -983,9 +1098,9 @@
#if defined(UNICODE) && !defined(XS_STRING_UTF8)
/// convenient value access in children node
- XS_String subvalue(const char* name, const char* attr_name, int n=0) const
+ XS_String subvalue(const char* child_name, const char* attr_name, int n=0) const
{
- const XMLNode* node = find(name, n);
+ const XMLNode* node = XPathElement(child_name, n).find(this);
if (node)
return node->get(attr_name);
@@ -996,10 +1111,10 @@
/// convenient storage of distinct values in children node
XS_String& subvalue(const char* name, const XS_String& attr_name, int n=0)
{
- XMLNode* node = find(name, n);
+ XMLNode* node = XPathElement(child_name, n).find(this);
if (!node) {
- node = new XMLNode(name);
+ node = new XMLNode(child_name);
add_child(node);
}
@@ -1071,6 +1186,18 @@
return out.good();
}
+ /// count the nodes matching the given relative XPath expression
+ int count(const XPath& xpath) const
+ {
+ return count(xpath.begin(), xpath.end());
+ }
+
+ /// count the nodes matching the given relative XPath expression
+ int count(XPath::const_iterator from, const XPath::const_iterator& to) const;
+
+ /// copy matching tree nodes using the given XPath filter expression
+ bool filter(const XPath& xpath, XMLNode& target) const;
+
protected:
Children _children;
AttributeMap _attributes;
@@ -1092,72 +1219,22 @@
return NULL;
}
- XMLNode* find(const XS_String& name, int n=0) const
- {
- for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
- if (**it == name)
- if (!n--)
- return *it;
-
- return NULL;
- }
-
- XMLNode* find(const XS_String& name, const XS_String& attr_name, const XS_String& attr_value, int n=0) const
- {
- for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it) {
- const XMLNode& node = **it;
-
- if (node==name && node.get(attr_name)==attr_value)
- if (!n--)
- return *it;
- }
-
- return NULL;
- }
-
-#if defined(UNICODE) && !defined(XS_STRING_UTF8)
- XMLNode* find(const char* name, int n=0) const
- {
- for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
- if (**it == name)
- if (!n--)
- return *it;
-
- return NULL;
- }
-
- template<typename T, typename U>
- XMLNode* find(const char* name, const T& attr_name, const U& attr_value, int n=0) const
- {
- for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it) {
- const XMLNode& node = **it;
-
- if (node==name && node.get(attr_name)==attr_value)
- if (!n--)
- return *it;
- }
-
- return NULL;
- }
-#endif
-
/// XPath find function (const)
- const XMLNode* find_relative(const char* path) const;
+ const XMLNode* find_relative(const XPath& xpath) const;
/// XPath find function
- XMLNode* find_relative(const char* path)
- {return const_cast<XMLNode*>(const_cast<const XMLNode*>(this)->find_relative(path));}
+ XMLNode* find_relative(const XPath& xpath);
/// relative XPath create function
- XMLNode* create_relative(const char* path);
+ XMLNode* create_relative(const XPath& xpath);
+ /// create a new node tree using the given XPath filter expression
+ XMLNode* filter(XPath::const_iterator from, const XPath::const_iterator& to) const;
+
void write_worker(std::ostream& out) const;
void plain_write_worker(std::ostream& out) const;
void pretty_write_worker(std::ostream& out, const XMLFormat& format, int indent) const;
void smart_write_worker(std::ostream& out, const XMLFormat& format, int indent) const;
-
-protected:
- XMLNode* get_child_relative(const char*& path, bool create); // mutable for create==true
};
@@ -1465,9 +1542,9 @@
}
/// search for child and go down
- bool go_down(const XS_String& name, int n=0)
+ bool go_down(const XS_String& child_name, int n=0)
{
- XMLNode* node = _cur->find(name, n);
+ XMLNode* node = XPathElement(child_name, n).find(_cur);
if (node) {
go_to(node);
@@ -1476,13 +1553,13 @@
return false;
}
- /// move XPath like to position in XML tree
- bool go(const char* path);
+ /// move to the position defined by xpath in XML tree
+ bool go(const XPath& xpath);
/// create child nodes using XPath notation and move to the deepest child
- bool create_relative(const char* path)
+ bool create_relative(const XPath& xpath)
{
- XMLNode* node = _cur->create_relative(path);
+ XMLNode* node = _cur->create_relative(xpath);
if (!node)
return false; // invalid path specified
@@ -1497,35 +1574,47 @@
}
/// create node if not already existing and move to it
- void smart_create(const XS_String& name)
+ void smart_create(const XS_String& child_name)
{
- XMLNode* node = _cur->find(name);
+ XMLNode* node = XPathElement(child_name).find(_cur);
if (node)
go_to(node);
else
- add_down(new XMLNode(name));
+ add_down(new XMLNode(child_name));
}
/// search matching child node identified by key name and an attribute value
- void smart_create(const XS_String& name, const XS_String& attr_name, const XS_String& attr_value)
+ void smart_create(const XS_String& child_name, const XS_String& attr_name, const XS_String& attr_value)
{
- XMLNode* node = _cur->find(name, attr_name, attr_value);
+ XMLNode* node = XPathElement(child_name, 0, attr_name, attr_value).find(_cur);
if (node)
go_to(node);
else {
- node = new XMLNode(name);
+ node = new XMLNode(child_name);
add_down(node);
(*node)[attr_name] = attr_value;
}
}
+ /// count the nodes matching the given relative XPath expression
+ int count(const XPath& xpath) const
+ {
+ return _cur->count(xpath);
+ }
+
+ /// create a new node tree using the given XPath filter expression
+ int filter(const XPath& xpath, XMLNode& target) const
+ {
+ return _cur->filter(xpath, target);
+ }
+
#if defined(UNICODE) && !defined(XS_STRING_UTF8)
/// search for child and go down
- bool go_down(const char* name, int n=0)
+ bool go_down(const char* child_name, int n=0)
{
- XMLNode* node = _cur->find(name, n);
+ XMLNode* node = XPathElement(child_name, n).find(_cur);
if (node) {
go_to(node);
@@ -1535,38 +1624,65 @@
}
/// create node and move to it
- void create(const char* name)
+ void create(const char* child_name)
{
- add_down(new XMLNode(name));
+ add_down(new XMLNode(child_name));
}
/// create node if not already existing and move to it
- void smart_create(const char* name)
+ void smart_create(const char* child_name)
{
- XMLNode* node = _cur->find(name);
+ XMLNode* node = _cur->find(child_name);
if (node)
go_to(node);
else
- add_down(new XMLNode(name));
+ add_down(new XMLNode(child_name));
}
/// search matching child node identified by key name and an attribute value
template<typename T, typename U>
- void smart_create(const char* name, const T& attr_name, const U& attr_value)
+ void smart_create(const char* child_name, const T& attr_name, const U& attr_value)
{
- XMLNode* node = _cur->find(name, attr_name, attr_value);
+ XMLNode* node = _cur->find(child_name, attr_name, attr_value);
if (node)
go_to(node);
else {
- XMLNode* node = new XMLNode(name);
+ XMLNode* node = new XMLNode(child_name);
add_down(node);
(*node)[attr_name] = attr_value;
}
}
#endif
+ /// delete current node and go back to previous position
+ bool delete_this()
+ {
+ if (!_stack.empty()) {
+ XMLNode* pLast = _stack.top();
+
+ if (pLast->_children.remove(_cur)) {
+ _cur = _stack.top();
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /// remove all children named 'name'
+ void remove_children(const XS_String& name)
+ {
+ _cur->remove_children(name);
+ }
+
+ /// remove the attribute 'attr_name' from the current node
+ void erase(const XS_String& attr_name)
+ {
+ _cur->erase(attr_name);
+ }
+
XS_String& str() {return *_cur;}
const XS_String& str() const {return *_cur;}
@@ -1645,9 +1761,9 @@
}
/// search for child and go down
- bool go_down(const XS_String& name, int n=0)
+ bool go_down(const XS_String& child_name, int n=0)
{
- XMLNode* node = _cur->find(name, n);
+ const XMLNode* node = XPathElement(child_name, n).const_find(_cur);
if (node) {
go_to(node);
@@ -1656,14 +1772,14 @@
return false;
}
- /// move XPath like to position in XML tree
- bool go(const char* path);
+ /// move to the position defined by xpath in XML tree
+ bool go(const XPath& xpath);
#if defined(UNICODE) && !defined(XS_STRING_UTF8)
/// search for child and go down
- bool go_down(const char* name, int n=0)
+ bool go_down(const char* child_name, int n=0)
{
- XMLNode* node = _cur->find(name, n);
+ XMLNode* node = XPathElement(child_name, n).const_find(_cur);
if (node) {
go_to(node);
@@ -2023,6 +2139,7 @@
};
+ // read option (for example configuration) values from XML node attributes
template<typename T>
inline void read_option(T& var, const_XMLPos& cfg, LPCXSSTR key)
{
@@ -2032,6 +2149,7 @@
var = val;
}
+ // read integer option values from XML node attributes
template<>
inline void read_option(int& var, const_XMLPos& cfg, LPCXSSTR key)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2008-02-04 09:25:11
|
Revision: 38
http://ocipl.svn.sourceforge.net/ocipl/?rev=38&view=rev
Author: martinfuchs
Date: 2008-02-04 01:25:15 -0800 (Mon, 04 Feb 2008)
Log Message:
-----------
XMLStorage: allow UTF-8 encoded umlaut characters in tag names
Modified Paths:
--------------
trunk/xmlstorage/xs-native.cpp
Modified: trunk/xmlstorage/xs-native.cpp
===================================================================
--- trunk/xmlstorage/xs-native.cpp 2007-10-28 16:31:12 UTC (rev 37)
+++ trunk/xmlstorage/xs-native.cpp 2008-02-04 09:25:15 UTC (rev 38)
@@ -93,7 +93,7 @@
_buffer_str.erase();
}
- void append(char c)
+ void append(int c)
{
size_t wpos = _wptr-_buffer;
@@ -103,7 +103,7 @@
_wptr = _buffer + wpos;
}
- *_wptr++ = c;
+ *_wptr++ = static_cast<char>(c);
}
const std::string& str(bool utf8) // returns UTF-8 encoded buffer content
@@ -148,8 +148,7 @@
if (*q == '?')
++q;
- while(isxmlsym(*q))
- ++q;
+ q = get_xmlsym_end_utf8(q);
#ifdef XS_STRING_UTF8
return XS_String(p, q-p);
@@ -174,8 +173,7 @@
else if (*p == '?')
++p;
- while(isxmlsym(*p))
- ++p;
+ p = get_xmlsym_end_utf8(p);
// read attributes from buffer
while(*p && *p!='>' && *p!='/') {
@@ -184,8 +182,7 @@
const char* attr_name = p;
- while(isxmlsym(*p))
- ++p;
+ p = get_xmlsym_end_utf8(p);
if (*p != '=')
break; //@TODO error handling
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2007-10-28 16:31:09
|
Revision: 37
http://ocipl.svn.sourceforge.net/ocipl/?rev=37&view=rev
Author: martinfuchs
Date: 2007-10-28 09:31:12 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Update Doxyfile, enable caller graphs
Modified Paths:
--------------
trunk/ocipl/Doxyfile
Modified: trunk/ocipl/Doxyfile
===================================================================
--- trunk/ocipl/Doxyfile 2007-10-28 15:08:59 UTC (rev 36)
+++ trunk/ocipl/Doxyfile 2007-10-28 16:31:12 UTC (rev 37)
@@ -1,4 +1,4 @@
-# Doxyfile 1.5.3
+# Doxyfile 1.5.4
#---------------------------------------------------------------------------
# Project related configuration options
@@ -11,17 +11,7 @@
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF = "The $name class " \
- "The $name widget " \
- "The $name file " \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
+ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
@@ -40,8 +30,10 @@
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
+TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@@ -80,7 +72,7 @@
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text "
+WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
@@ -223,7 +215,7 @@
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
-CALLER_GRAPH = NO
+CALLER_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2007-10-28 15:44:31
|
Revision: 36
http://ocipl.svn.sourceforge.net/ocipl/?rev=36&view=rev
Author: martinfuchs
Date: 2007-10-28 08:08:59 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
18.01.2007:
- _NO_COMMENT -> OCIPL_NO_COMMENT (ocipl.h, ocipl.cpp, ocithrow.cpp)
11.02.2007:
- ocidate_to_short_string(), als R?\195?\188ckgabetyp f?\195?\188r execute...() und fetch() (ocipl.h, ocipl.cpp)
- UNICODE adjustments (ocipl.h)
- reset FETCH state when executing a recycled SqlStatement object to fix SqlStatement::next() (ocipl.h, ocipl.cpp)
01.05.2007:
- move dump_schema() into xmldump module
- definition of default buffer size for strings using OCIPL_DEFAULT_STRING_BUFFER
- NULL parameter for SqlIntArray::get_int()
- OciDateArray::get_date() (ocipl.h, ocipl.cpp)
19.08.2007:
- Parsing of date strings with format specifier
- Rounding of floating point numbers to integer values with Oracle 8.0 (ocipl.h, ocipl.cpp)
14.10.2007:
- use OCI_IND_NULL constant
- SqlValue construktor with indicator (ocipl.h)
- Doxyfile Update (Doxyfile)
28.10.2007:
- destruktor ~SqlIndArray() to fix memory leaks (ocipl.h)
Modified Paths:
--------------
trunk/ocipl/ocipl-license.txt
trunk/ocipl/ocipl-xml.cpp
trunk/ocipl/ocipl.cpp
trunk/ocipl/ocipl.h
trunk/ocipl/ocithrow.cpp
Modified: trunk/ocipl/ocipl-license.txt
===================================================================
--- trunk/ocipl/ocipl-license.txt 2007-10-28 14:50:00 UTC (rev 35)
+++ trunk/ocipl/ocipl-license.txt 2007-10-28 15:08:59 UTC (rev 36)
@@ -2,7 +2,7 @@
//
// OCIPL
//
- // Copyright (c) 2003, 2004, 2005, 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
//
/*
Modified: trunk/ocipl/ocipl-xml.cpp
===================================================================
--- trunk/ocipl/ocipl-xml.cpp 2007-10-28 14:50:00 UTC (rev 35)
+++ trunk/ocipl/ocipl-xml.cpp 2007-10-28 15:08:59 UTC (rev 36)
@@ -2,7 +2,7 @@
//
// ocipl-xml.cpp
//
- // Copyright (c) 2003, 2004, 2005, 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
//
// OCIPL Version 1.3
//
@@ -39,8 +39,8 @@
*/
-#ifndef _NO_COMMENT
-#define _NO_COMMENT // no #pragma comment(lib, ...) statements in .lib files
+#ifndef OCIPL_NO_COMMENT
+#define OCIPL_NO_COMMENT // no #pragma comment(lib, ...) statements in .lib files
#endif
#ifndef XS_NO_COMMENT
#define XS_NO_COMMENT // no pragma(lib) in xmlstorage.h
@@ -69,7 +69,7 @@
void SqlStatement::dump_results(XMLPos& pos, const XS_String& element_name)
{
if (!(_state & EXECUTED))
- execute();
+ execute(); // instead of first_bulk()
for(int fetched=fetched_rows(); fetched>0; fetched=next_bulk())
for(int i=0; i<fetched; ++i) {
@@ -114,782 +114,4 @@
}
-static ColumnType* s_pcolTypes;
-
-static int cmp_col(const void* a, const void* b)
-{
- int ia = *(int*)a;
- int ib = *(int*)b;
-
- return s_pcolTypes[ia]._name.compare(s_pcolTypes[ib]._name);
-}
-
-
-typedef pair<tstring, tstring> ObjIdent;
-
- /// object info structure used in OCIPL::Dump::dump_schema()
-struct ObjInfo {
- ub1 _type;
-
- ObjInfo()
- {
- _type = -1;
- }
-};
-
-typedef map<ObjIdent, ObjInfo> ObjNameMap;
-
-
-/*
- // describe schema and dump the information into an XML tree
-void Dump::dump_schema(OciConnection& conn, const TCHAR* schema, XMLPos& pos)
-{
- tstring owner = schema;
-
- _tcsupr((TCHAR*)owner.data());
-
- pos.create("schema");
- pos["name"] = schema;
-
- pos.create("info");
- time_t now = time(NULL); // problems in the year 2038
-#ifdef __STDC_WANT_SECURE_LIB__
- struct tm lct;
- localtime_s(&lct, &now);
- struct tm* plct = &lct;
-#else
- struct tm* plct = localtime(&now);
-#endif
- OciDate date(plct);
- pos["date"] = date.str();
- pos["dump"] = "xmldump 1.0";
- pos.back(); // </info>
-
- OciDescribe descr(conn._env);
- sword res = OCIDescribeAny(conn._svc_ctx, conn._env._errh,
- (void*)schema, strlen(schema), OCI_OTYPE_NAME,
- OCI_DEFAULT, OCI_PTYPE_SCHEMA, descr);
- oci_check_error(conn._env, res);
-
- OciParam paramh(conn._env);
- descr.get_attribute(¶mh, NULL, OCI_ATTR_PARAM, conn._env._errh);
-
- OciParam objlisth(conn._env);
- paramh.get_attribute(&objlisth, NULL, OCI_ATTR_LIST_OBJECTS);
-
- ub2 num;
- objlisth.get_attribute(&num, NULL, OCI_ATTR_NUM_PARAMS);
-
- // automatische Sortierung der Objekte \xFCber ObjNameMap
- ObjNameMap obj_names;
-
- for(int i=0; i<num; ++i) {
- ObjInfo info;
- OciParam objh(conn._env);
- res = OCIParamGet(objlisth, OciParam::get_type_id(), conn._env._errh, (void**)&objh, i);
- oci_check_error(conn._env, res);
-
- OraText* name; ub4 name_len;
- objh.get_attribute(&name, &name_len, OCI_ATTR_OBJ_NAME);
- tstring obj_name((const TCHAR*)name, name_len);
-
- // filter by object name
- if (!_filter.empty() && _filter.find(obj_name)==_filter.end())
- continue;
-
- objh.get_attribute(&info._type, NULL, OCI_ATTR_PTYPE);
-
- if (info._type) { // no "unknown type" nodes
- tstring type_str = get_oci_ptype_str(info._type);
-
- // replace spaces by '-' for XML conformity
- TCHAR* p = (TCHAR*)type_str.data();
- for(; *p; ++p)
- if (istspace(*p))
- *p = '-';
-
- obj_names[make_pair(type_str, obj_name)] = info;
- }
- }
-
- SqlStatement stmt(conn);
- TCHAR buffer[BUFFER_LEN];
-
- for(ObjNameMap::const_iterator it=obj_names.begin(); it!=obj_names.end(); ++it) {
- const ObjIdent& ident = it->first;
- const string& type_str = ident.first;
- const string& obj_name = ident.second;
- const ObjInfo& info = it->second;
-
- pos.create(type_str);
- pos["name"] = obj_name;
-
- // Not avoidable to describe the object here again - now by name:
- // Seems, the descriptor handles overflow at some point, so we get an error (msg_id=-1) after some loops.
- OciDescribe obj_descr(conn._env);
- res = OCIDescribeAny(conn._svc_ctx, conn._env._errh, (OraText*)obj_name.c_str(), obj_name.length(), OCI_OTYPE_NAME, OCI_DEFAULT, info._type, obj_descr);
-
- if (res == OCI_SUCCESS) {
- OciParam paramh(conn._env);
- obj_descr.get_attribute(¶mh, NULL, OCI_ATTR_PARAM, conn._env._errh);
-
- // tables and views
- if (info._type==OCI_PTYPE_TABLE || info._type==OCI_PTYPE_VIEW) {
- // Abfrage des Tabellen-/View-Kommentars
- if (_comments) {
- SqlString comment;
-
- stmt.prepare("select COMMENTS from ALL_TAB_COMMENTS "
- "where OWNER=:0 and TABLE_NAME=:1");
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
- stmt.bind_result(0, comment);
-
- if (stmt.fetch()) {
- pos.create("comment");
- pos->set_content(comment.c_str());
- pos.back();
- }
- }
-
- ColumnType* pcolTypes = NULL;
- int* pColIdxs = NULL;
-
- try {
- ub2 num_cols;
- paramh.get_attribute(&num_cols, NULL, OCI_ATTR_NUM_COLS);
-
- OciParam col_listh(conn._env);
- paramh.get_attribute(&col_listh, NULL, OCI_ATTR_LIST_COLUMNS);
-
- pcolTypes = new ColumnType[num_cols]; // Array der Spaltenbeschreibungen
- ColumnType* pColType = pcolTypes;
-
- pColIdxs = new int[num_cols]; // Array der Spalten-Indices
- int* pColIdx = pColIdxs;
-
- int j;
- for(j=0; j<num_cols; ++j) {
- OciParam colh(conn._env);
- res = OCIParamGet(col_listh, OciParam::get_type_id(), conn._env._errh, (void**)&colh, j+1);
- oci_check_error(conn._env, res);
-
- pColType++->init(conn._env._errh, colh);
- *pColIdx++ = j;
- }
-
- if (_sort_cols) {
- s_pcolTypes = pcolTypes; //@@ nicht threadsicher
- qsort(pColIdxs, num_cols, sizeof(int), cmp_col);
- }
-
- pColIdx = pColIdxs;
- for(j=0; j<num_cols; ++j) {
- int k = *pColIdx++;
- pColType = pcolTypes + k;
-
- pos.create("column");
-
- pos["name"] = pColType->_name;
- pos["type"] = pColType->get_type_str();
- XMLIntRef(pos, "pos") = k+1;
-
- pos.back(); // </column>
- }
-
- delete[] pColIdxs; pColIdxs = NULL;
- delete[] pcolTypes; pcolTypes = NULL;
-
-
- // Abfrage der Spaltenkommentare
- if (_comments) {
- SqlString comment, col_name;
-
- stmt.prepare("select COLUMN_NAME, COMMENTS from ALL_COL_COMMENTS "
- "where OWNER=:0 and TABLE_NAME=:1");
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
- stmt.bind_result(0, col_name);
- stmt.bind_result(1, comment);
-
- while(stmt.fetch()) {
- pos.smart_create("column", "name", col_name.c_str());
- pos.create("comment");
- pos->set_content(comment.c_str());
- pos.back();
- pos.back();
- }
- }
-
-
- // Abfrage der Dateninhalte
- if (_data) {
- pos.create("data");
-
- try {
- sprintf(buffer, "select * from %s.%s", schema, obj_name.c_str());
- stmt.execute(buffer);
- stmt.dump_results(buffer, pos, "row");
- } catch(exception& e) {
- cerr << "====>\n"
- "exception in dump of '" << obj_name << "' data: " << e.what() << endl <<
- "<====\n";
- }
-
- pos.back(); // </data>
- }
- } catch(exception& e) {
- cerr << "====>\n"
- "exception in getting info about '" << obj_name << "': " << e.what() << endl <<
- "<====\n";
-
- delete[] pColIdxs;
- delete[] pcolTypes;
- }
- }
-
- // tables
- if (info._type == OCI_PTYPE_TABLE) {
- eword tablespace;
- paramh.get_attribute(&tablespace, NULL, OCI_ATTR_TABLESPACE);
- pos["tablespace-nr"] = XMLInt(tablespace);
-
- ub1 typed, clustered, partitioned, index_only, temporary;
- paramh.get_attribute(&typed, NULL, OCI_ATTR_IS_TYPED);
- paramh.get_attribute(&clustered, NULL, OCI_ATTR_CLUSTERED);
- paramh.get_attribute(&partitioned, NULL, OCI_ATTR_PARTITIONED);
- paramh.get_attribute(&index_only, NULL, OCI_ATTR_INDEX_ONLY);
- paramh.get_attribute(&temporary, NULL, OCI_ATTR_IS_TEMPORARY);
-
- if (typed || clustered || partitioned || index_only || temporary) {
- pos["type"] = "extended";
- pos["typed"] = XMLBool(typed? true: false);
- pos["clustered"] = XMLBool(clustered? true: false);
- pos["partitioned"] = XMLBool(partitioned? true: false);
- pos["index_organized"] = XMLBool(index_only? true: false);
-
- if (temporary) {
- pos["temporary"] = XMLBool(temporary? true: false);
-
- OCIDuration duration;
- paramh.get_attribute(&duration, NULL, OCI_ATTR_DURATION);
-
- pos["temporary_duration"] =
- duration==OCI_DURATION_SESSION? "session":
- duration==OCI_DURATION_TRANS? "transaction":
- "NULL";
- }
- } else
- pos["type"] = "normal";
-
- // views
- } else if (info._type == OCI_PTYPE_VIEW) {
- stmt.prepare("select TEXT from ALL_VIEWS where OWNER=:0 and VIEW_NAME=:1");
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
- stmt.execute_fetch();
- string view_txt = stmt->get_string(0);
-
- pos.create("sql_text");
- pos->set_content(view_txt);
- pos.back(); // </sql_text>
-
- // synonyms
- } else if (info._type == OCI_PTYPE_SYN) {
- text *syn_schema, *syn_name, *syn_link;
- ub4 syn_schema_len, syn_name_len, syn_link_len;
-
- paramh.get_attribute(&syn_schema, &syn_schema_len, OCI_ATTR_SCHEMA_NAME);
- paramh.get_attribute(&syn_name, &syn_name_len, OCI_ATTR_NAME);
- paramh.get_attribute(&syn_link, &syn_link_len, OCI_ATTR_LINK);
-
- TCHAR* p = buffer + _stprintf(buffer, "%.*s.%.*s", syn_schema_len, syn_schema, syn_name_len, syn_name);
-
- if (syn_link)
- sprintf(p, "@%.*s", syn_link_len, syn_link);
-
- pos["target"] = buffer;
-
- // sequences
- } else if (info._type == OCI_PTYPE_SEQ) {
- ub1* num_ptr;
-
- ub4 num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_MIN);
- pos["min"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_MAX);
- pos["max"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_INCR);
- pos["increment"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_CACHE);
- pos["cache"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_HW_MARK);
- pos["high-water-mark"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- ub1 ordered;
- paramh.get_attribute(&ordered, NULL, OCI_ATTR_ORDER);
- pos["ordered"] = XMLBool(ordered? true: false);
- }
- } else {
- //cerr << OciException(conn._env._errh, __FILE__, __LINE__).what() << endl;
- }
-
- pos.back(); // </...>
- }
-
- pos.back(); // </objects>
-}
-*/
-
-
- // describe schema and write down the information immediatelly using XMLWriter
-void Dump::dump_schema(OciEnv& env, const LoginPara& lp, const TCHAR* schema, XMLWriter& writer)
-{
- OciLogin login(env, lp._username, lp._password, lp._tnsname);
- OciConnection conn(env, login);
-
- tstring owner = schema;
- _tcsupr_s((TCHAR*)owner.data(), owner.length()+1);
-
- writer.create("schema");
- writer["name"] = schema;
-
- writer.create("objects");
-
- // Erg\xE4nzung um Zusatzinformationen
- if (_info) {
- writer.create("info");
-
- time_t now = time(NULL); // problems in the year 2038
-#ifdef __STDC_WANT_SECURE_LIB__
- struct tm lct;
- localtime_s(&lct, &now);
- struct tm* plct = &lct;
-#else
- struct tm* plct = localtime(&now);
-#endif
- OciDate date(plct);
- writer["date"] = date.str();
- writer["dump"] = "xmldump 1.0";
-
- writer.create("connect");
- writer["username"] = lp._username;
- writer["tnsname"] = lp._tnsname;
- writer.back(); // </connect>
-
- if (_db_version) {
- writer.create("db-version");
- int oracle_ver = login._server._version;
- TCHAR ver_str[32];
- _stprintf(ver_str, _T("%d.%d.%d.%d.%d"),
- oracle_ver>>24, (oracle_ver>>20)&0xF,
- (oracle_ver>>16)&0xF, (oracle_ver>>8)&0xFF, oracle_ver&0xFF);
- writer["number"] = ver_str;
-
- writer.set_content((LPCTSTR)login._server._version_string);
- /*
- SqlStatement stmt(conn, "select BANNER from V$VERSION");
- //writer["main-string"] = stmt->get_string(0));
- while(stmt.fetch()) {
- writer.create("line");
- writer.set_content(stmt->get_string(0));
- writer.back(); </line>
- } */
- writer.back(); // </db-version>
- }
-
- if (_db_options) {
- writer.create("db-options");
- SqlStatement stmt(conn, _T("select PARAMETER, VALUE from V$OPTION"));
- stmt.dump_results(writer, "option");
- writer.back(); // </db-options>
- }
-
- writer.back(); // </info>
- }
-
- OciDescribe descr(conn._env);
- sword res = OCIDescribeAny(conn._svc_ctx, conn._env._errh,
- (void*)schema, _tcslen(schema)*sizeof(TOraText), OCI_OTYPE_NAME,
- OCI_DEFAULT, OCI_PTYPE_SCHEMA, descr);
- oci_check_error(conn._env, res);
-
- OciParam paramh(conn._env);
- descr.get_attribute(¶mh, NULL, OCI_ATTR_PARAM, conn._env._errh);
-
- OciParam objlisth(conn._env);
- paramh.get_attribute(&objlisth, NULL, OCI_ATTR_LIST_OBJECTS);
-
- ub2 num;
- objlisth.get_attribute(&num, NULL, OCI_ATTR_NUM_PARAMS);
-
- // automatische Sortierung der Objekte \xFCber ObjNameMap
- ObjNameMap obj_names;
-
- for(int i=0; i<num; ++i) {
- ObjInfo info;
- OciParam objh(conn._env);
- res = OCIParamGet(objlisth, OciParam::get_type_id(), conn._env._errh, (void**)&objh, i);
- oci_check_error(conn._env, res);
-
- OraText* name; ub4 name_len;
- objh.get_attribute(&name, &name_len, OCI_ATTR_OBJ_NAME);
- tstring obj_name((const TCHAR*)name, name_len);
-
- // filter by object name
- if (!_filter.empty() && _filter.find(obj_name)==_filter.end())
- continue;
-
- objh.get_attribute(&info._type, NULL, OCI_ATTR_PTYPE);
-
- if (info._type) { // no "unknown type" nodes
- tstring type_str = get_oci_ptype_str(info._type);
-
- // replace spaces by '-' for XML conformity
- TCHAR* p = (TCHAR*)type_str.data();
- for(; *p; ++p)
- if (istspace(*p))
- *p = '-';
-
- obj_names[make_pair(type_str, obj_name)] = info;
- }
- }
-
- SqlStatement stmt(conn);
- TCHAR buffer[BUFFER_LEN];
-
- for(ObjNameMap::const_iterator it=obj_names.begin(); it!=obj_names.end(); ++it) {
- const ObjIdent& ident = it->first;
- const tstring& type_str = ident.first;
- const tstring& obj_name = ident.second;
- const ObjInfo& info = it->second;
-
- writer.create(type_str);
- writer["name"] = obj_name;
-
- // Not avoidable to describe the object here again - now by name:
- // Seems, the descriptor handles overflow at some point, so we get an error (msg_id=-1) after some loops.
- OciDescribe obj_descr(conn._env);
- res = OCIDescribeAny(conn._svc_ctx, conn._env._errh, (OraText*)obj_name.c_str(), obj_name.length(), OCI_OTYPE_NAME, OCI_DEFAULT, info._type, obj_descr);
-
- if (res == OCI_SUCCESS) {
- OciParam paramh(conn._env);
- obj_descr.get_attribute(¶mh, NULL, OCI_ATTR_PARAM, conn._env._errh);
-
- // tables (write table attributes before of all subnodes)
- if (info._type == OCI_PTYPE_TABLE) {
- eword tablespace;
- paramh.get_attribute(&tablespace, NULL, OCI_ATTR_TABLESPACE);
- writer["tablespace-nr"] = XMLInt(tablespace);
-
- ub1 typed, clustered, partitioned, index_only, temporary;
- paramh.get_attribute(&typed, NULL, OCI_ATTR_IS_TYPED);
- paramh.get_attribute(&clustered, NULL, OCI_ATTR_CLUSTERED);
- paramh.get_attribute(&partitioned, NULL, OCI_ATTR_PARTITIONED);
- paramh.get_attribute(&index_only, NULL, OCI_ATTR_INDEX_ONLY);
- paramh.get_attribute(&temporary, NULL, OCI_ATTR_IS_TEMPORARY);
-
- if (typed || clustered || partitioned || index_only || temporary) {
- writer["type"] = "extended";
- writer["typed"] = XMLBool(typed? true: false);
- writer["clustered"] = XMLBool(clustered? true: false);
- writer["partitioned"] = XMLBool(partitioned? true: false);
- writer["index_organized"] = XMLBool(index_only? true: false);
-
- if (temporary) {
- writer["temporary"] = XMLBool(temporary? true: false);
-
- OCIDuration duration;
- paramh.get_attribute(&duration, NULL, OCI_ATTR_DURATION);
-
- writer["temporary_duration"] =
- duration==OCI_DURATION_SESSION? "session":
- duration==OCI_DURATION_TRANS? "transaction":
- "NULL";
- }
- } else
- writer["type"] = "normal";
- }
-
- // tables and views
- if (info._type==OCI_PTYPE_TABLE || info._type==OCI_PTYPE_VIEW) {
- // get table/view comments
- if (_comments) {
- SqlString comment;
-
- stmt.prepare(_T("select COMMENTS from ALL_TAB_COMMENTS ")
- _T("where OWNER=:0 and TABLE_NAME=:1"));
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
- stmt.bind_result(0, comment);
-
- if (stmt.fetch()) {
- writer.create("comment");
- writer.set_content(comment.c_str());
- writer.back();
- }
- }
-
- ColumnType* pcolTypes = NULL;
- int* pColIdxs = NULL;
-
- try {
- ub2 num_cols;
- paramh.get_attribute(&num_cols, NULL, OCI_ATTR_NUM_COLS);
-
- OciParam col_listh(conn._env);
- paramh.get_attribute(&col_listh, NULL, OCI_ATTR_LIST_COLUMNS);
-
- pcolTypes = new ColumnType[num_cols]; // Array der Spaltenbeschreibungen
- ColumnType* pColType = pcolTypes;
-
- pColIdxs = new int[num_cols]; // Array der Spalten-Indices
- int* pColIdx = pColIdxs;
-
- int j;
- for(j=0; j<num_cols; ++j) {
- OciParam colh(conn._env);
- res = OCIParamGet(col_listh, OciParam::get_type_id(), conn._env._errh, (void**)&colh, j+1);
- oci_check_error(conn._env, res);
-
- pColType++->init(conn._env._errh, colh);
- *pColIdx++ = j;
- }
-
- if (_sort_cols) {
- s_pcolTypes = pcolTypes; //@@ nicht threadsicher
- qsort(pColIdxs, num_cols, sizeof(int), cmp_col);
- }
-
- map<tstring, tstring> col_comments;
- map<tstring, tstring> col_default;
- SqlString col_name, comment, data_default;
-
- // Abfrage der Spaltenkommentare
- if (_comments) {
- stmt.prepare(_T("select COLUMN_NAME, COMMENTS ")
- _T("from ALL_COL_COMMENTS ")
- _T("where OWNER=:0 and TABLE_NAME=:1"));
-
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
-
- stmt.bind_result(0, col_name);
- stmt.bind_result(1, comment);
-
- while(stmt.fetch())
- if (comment.is_not_null())
- col_comments[col_name.c_str()] = comment;
- }
-
- if (true) {
- stmt.prepare(_T("select COLUMN_NAME, DATA_DEFAULT ")
- _T("from ALL_TAB_COLUMNS ")
- _T("where OWNER=:0 and TABLE_NAME=:1"));
-
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
-
- stmt.bind_result(0, col_name);
- stmt.bind_result(1, data_default);
-
- while(stmt.fetch())
- if (data_default.is_not_null())
- col_default[col_name.c_str()] = data_default;
- }
-
- pColIdx = pColIdxs;
- for(j=0; j<num_cols; ++j) {
- int k = *pColIdx++;
- pColType = pcolTypes + k;
-
- writer.create("column");
-
- writer["name"] = pColType->_name;
- writer["type"] = pColType->get_type_str();
-
- if (_col_pos)
- writer["pos"] = XMLInt(k+1);
-
- map<tstring, tstring>::const_iterator found = col_default.find(pColType->_name);
-
- if (found != col_default.end())
- writer["default"] = found->second.c_str();
-
- // Ausgabe des Spaltenkommentars
- if (_comments) {
- found = col_comments.find(pColType->_name);
-
- if (found != col_comments.end()) {
- writer.create("comment");
- writer.set_content(found->second.c_str());
- writer.back();
- }
- }
-
- writer.back(); // </column>
- }
-
- delete[] pColIdxs; pColIdxs = NULL;
- delete[] pcolTypes; pcolTypes = NULL;
-
-
- // Abfrage der Dateninhalte
- if (_data) {
- writer.create("data");
-
- try {
- _stprintf(buffer, _T("select * from %s.%s"), schema, obj_name.c_str());
- stmt.execute(buffer);
- stmt.dump_results(buffer, writer, "row");
- } catch(exception& e) {
- cerr << "====>\n"
- "exception in dump of '" << ANSI_STRING(obj_name) << "' data: " << e.what() << endl <<
- "<====\n";
- }
-
- writer.back(); // </data>
- }
- } catch(exception& e) {
- cerr << "====>\n"
- "exception in getting info about '" << ANSI_STRING(obj_name) << "': " << e.what() << endl <<
- "<====\n";
-
- delete[] pColIdxs;
- delete[] pcolTypes;
- }
- }
-
- // views
- if (info._type == OCI_PTYPE_VIEW) {
- stmt.prepare(_T("select TEXT from ALL_VIEWS where OWNER=:0 and VIEW_NAME=:1"));
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
- stmt.execute_fetch();
- tstring view_txt = stmt->get_string(0, 0);
-
- writer.create("sql_text");
- writer.set_content(view_txt);
- writer.back(); // </sql_text>
-
- // synonyms
- } else if (info._type == OCI_PTYPE_SYN) {
- text *syn_schema, *syn_name, *syn_link;
- ub4 syn_schema_len, syn_name_len, syn_link_len;
-
- paramh.get_attribute(&syn_schema, &syn_schema_len, OCI_ATTR_SCHEMA_NAME);
- paramh.get_attribute(&syn_name, &syn_name_len, OCI_ATTR_NAME);
- paramh.get_attribute(&syn_link, &syn_link_len, OCI_ATTR_LINK);
-
- int l = _stprintf(buffer, _T("%.*s.%.*s"), syn_schema_len, syn_schema, syn_name_len, syn_name);
- TCHAR* p = buffer + l;
-
- if (syn_link)
-#ifdef __STDC_WANT_SECURE_LIB__
- _stprintf_s(p, COUNTOF(buffer)-l,
-#else
- _stprintf(p,
-#endif
- _T("@%.*s"), syn_link_len, syn_link);
-
- writer["target"] = buffer;
-
- // sequences
- } else if (info._type == OCI_PTYPE_SEQ) {
- ub1* num_ptr;
-
- ub4 num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_MIN);
- writer["min"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_MAX);
- writer["max"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_INCR);
- writer["increment"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_CACHE);
- writer["cache"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
-
- if (_seq_val) {
- num_len = 0;
- paramh.get_attribute(&num_ptr, &num_len, OCI_ATTR_HW_MARK);
- writer["high-water-mark"] = SqlNumber(num_ptr, num_len).str(conn._env._errh);
- }
-
- ub1 ordered;
- paramh.get_attribute(&ordered, NULL, OCI_ATTR_ORDER);
- writer["ordered"] = XMLBool(ordered? true: false);
- }
- } else {
- //cerr << OciException(conn._env._errh, __FILE__, __LINE__).what() << endl;
- }
-
- if (_grants) {
- // query grants given to this object
- stmt.prepare(_T("select GRANTEE, PRIVILEGE ")
- _T("from ALL_TAB_PRIVS ")
- _T("where GRANTOR=:0 and TABLE_NAME=:1 ")
- _T("order by GRANTEE, PRIVILEGE"));
-
- writer.create("grants");
- SqlString grantee, privilege;
-
- stmt.bind_param(0, owner);
- stmt.bind_param(1, obj_name);
-
- stmt.bind_result(0, grantee);
- stmt.bind_result(1, privilege);
-
- while(stmt.fetch()) {
- writer.create("grant");
- writer["grantee"] = grantee;
- writer["privilege"] = privilege;
- writer.back(); // </grant>
- }
- writer.back(); // </grants>
- }
-
- writer.back(); // </...>
- }
-
- writer.back(); // </objects>
-
- try {
- stmt.prepare(_T("select TS#, NAME from V$TABLESPACE"));
- stmt.execute(); // throw exception immediatelly if we don't have access to the system view
-
- writer.create("tablespaces");
- SqlInt ts_nr;
- SqlString ts_name;
-
- stmt.bind_result(0, ts_nr);
- stmt.bind_result(1, ts_name);
-
- while(stmt.fetch()) {
- writer.create("tablespace");
- writer["nr"] = XMLInt(ts_nr);
- writer["name"] = ts_name;
- writer.back();
- }
- writer.back(); // </tablespaces>
- } catch(exception&) {
- // ignore access right exceptions cerr << "Exception: " << e.what() << "\n";
- }
-
- writer.back(); // </schema>
-}
-
-
} // namespace OCIPL
Modified: trunk/ocipl/ocipl.cpp
===================================================================
--- trunk/ocipl/ocipl.cpp 2007-10-28 14:50:00 UTC (rev 35)
+++ trunk/ocipl/ocipl.cpp 2007-10-28 15:08:59 UTC (rev 36)
@@ -2,7 +2,7 @@
//
// ocipl.cpp
//
- // Copyright (c) 2003, 2004, 2005, 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
//
// OCIPL Version 1.3
//
@@ -39,8 +39,8 @@
*/
-#ifndef _NO_COMMENT
-#define _NO_COMMENT // no #pragma comment(lib, ...) statements in .lib files -> free selection of orasql library
+#ifndef OCIPL_NO_COMMENT
+#define OCIPL_NO_COMMENT // no #pragma comment(lib, ...) statements in .lib files -> free selection of orasql library
#endif
#define _olint // for #define CONST const
@@ -350,20 +350,24 @@
boolean isInt;
sword res = OCINumberIsInt(errh, (OCINumber*)&val, &isInt);
- if (res==OCI_SUCCESS && isInt) {
+ if (res==OCI_SUCCESS && isInt)
+ {
res = OCINumberToInt(errh, (OCINumber*)&val, sizeof(x), OCI_NUMBER_SIGNED, &x);
oci_check_error(errh, res);
- } else {
- double d = number_to_double(val, errh);
-
- x = int(d + .5);
}
+ else
#else
// OCI.DLL of Oracle Version 8.0
sword res = OCINumberToInt(errh, (OCINumber*)&val, sizeof(x), OCI_NUMBER_SIGNED, &x);
- oci_check_error(errh, res);
+
+ if (res != OCI_SUCCESS)
#endif
+ {
+ double d = number_to_double(val, errh);
+ x = int(d + .5);
+ }
+
//x = atoi(str(true).c_str());
return x;
@@ -421,19 +425,22 @@
SqlNumber::SqlNumber(OCIError* errh, const TCHAR* str, const TCHAR* fmt, const TCHAR* nls_fmt)
{
- while(str && istspace(*str))
- ++str;
+ if (str) {
+ while(istspace(*str))
+ ++str;
- if (str && *str) {
- sword res = OCINumberFromText(errh,
- (const OraText*)str, (ub4)_tcslen(str)*sizeof(TOraText),
- (const OraText*)fmt, (ub4)_tcslen(fmt)*sizeof(TOraText),
- (const OraText*)nls_fmt, (ub4)_tcslen(nls_fmt)*sizeof(TOraText),
- (OCINumber*)&_val);
+ if (*str) {
+ sword res = OCINumberFromText(errh,
+ (const OraText*)str, (ub4)_tcslen(str)*sizeof(TOraText),
+ (const OraText*)fmt, (ub4)_tcslen(fmt)*sizeof(TOraText),
+ (const OraText*)nls_fmt, (ub4)_tcslen(nls_fmt)*sizeof(TOraText),
+ (OCINumber*)&_val);
- oci_check_error(errh, res);
+ oci_check_error(errh, res);
- _ind.set();
+ _ind.set();
+ } else
+ _ind.clear();
} else
_ind.clear();
}
@@ -566,6 +573,21 @@
return buffer;
}
+tstring ocidate_to_short_string(const OCIDate& date)
+{
+ TCHAR buffer[40];
+
+#ifdef __STDC_WANT_SECURE_LIB__
+ _stprintf_s(buffer, _countof(buffer),
+#else
+ _stprintf(buffer,
+#endif
+ _T("%02d.%02d.%04d"),
+ date.OCIDateDD, date.OCIDateMM, date.OCIDateYYYY);
+
+ return buffer;
+}
+
struct tm* ocidate_to_gmt(const OCIDate& date)
{
struct tm ltime = {
@@ -652,17 +674,21 @@
ind().set();
}
-OciDate::OciDate(OCIError* errh, const TCHAR* str)
+OciDate::OciDate(OCIError* errh, const TCHAR* str, const TCHAR* fmt)
{
- while(str && istspace(*str))
- ++str;
+ if (str) {
+ while(istspace(*str))
+ ++str;
- if (str && *str) {
- sword res = OCIDateFromText(errh, (const OraText*)str, (ub4)_tcslen(str)*sizeof(TOraText), NULL/*fmt*/, 0, NULL/*lang*/, 0, this);
+ if (*str) {
+ sword res = OCIDateFromText(errh, (const OraText*)str, (ub4)_tcslen(str)*sizeof(TOraText),
+ (const OraText*)fmt, (ub4)_tcslen(fmt)*sizeof(TOraText), NULL/*lang*/, 0, this);
- oci_check_error(errh, res);
+ oci_check_error(errh, res);
- _ind.set();
+ _ind.set();
+ } else
+ _ind.clear();
} else
_ind.clear();
}
@@ -913,7 +939,7 @@
delete _res;
_res = NULL;
- _state = (_state|DEFINED) & ~FETCHED;
+ _state = (_state|DEFINED) & ~(FETCHED|EOF_DATA);
} else
_state |= DEFINED;
@@ -923,54 +949,43 @@
}
-bool SqlStatement::execute(ub4 rows, ub4 mode)
+void SqlStatement::execute(ub4 rows, ub4 mode)
{
- if (!(_state & DEFINED)) {
- ub2 stmt_type = get_stmt_type();
+ // a SELECT statement without ready defined variables?
+ if (!(_state&DEFINED) && get_stmt_type()==OCI_STMT_SELECT) {
+ execute_internal(0, mode);
- // a SELECT statement without ready define variables?
- if (stmt_type == OCI_STMT_SELECT) {
- bool ret = execute_internal(0, mode);
+ // define resultset variables
+ assert(!_res);
- // define resultset variables
- assert(!_res);
-
- if (rows > 0) {
- _res = new SqlResult(*this, rows);
- return fetch(rows);
- } else {
- _res = new SqlResult(*this, _bulk_rows);
- return ret;
- }
+ if (rows > 0) {
+ _res = new SqlResult(*this, rows);
+ fetch(rows);
+ } else {
+ _res = new SqlResult(*this, _bulk_rows);
}
- }
-
- return execute_internal(rows, mode);
+ } else
+ execute_internal(rows, mode);
}
-bool SqlStatement::execute_fetch(ub4 mode)
+void SqlStatement::execute_fetch(ub4 mode)
{
- if (!(_state & DEFINED)) {
- ub2 stmt_type = get_stmt_type();
+ // A SELECT statement without ready defined variables?
+ if (!(_state&DEFINED) && get_stmt_type()==OCI_STMT_SELECT) {
+ execute_internal(0, mode);
- // A SELECT statement without ready define variables?
- if (stmt_type == OCI_STMT_SELECT) {
- bool ret = execute_internal(0, mode);
+ // define resultset variables
+ assert(!_res);
+ _res = new SqlResult(*this, _bulk_rows);
- // define resultset variables
- assert(!_res);
- _res = new SqlResult(*this, _bulk_rows);
-
- return fetch(_result_buffers);
- }
- }
-
- return execute_internal(_result_buffers, mode);
+ fetch(_result_buffers);
+ } else
+ execute_internal(_result_buffers, mode);
}
-bool SqlStatement::execute_internal(ub4 rows, ub4 mode)
+void SqlStatement::execute_internal(ub4 rows, ub4 mode)
{
if (rows==0 && get_stmt_type()==OCI_STMT_SELECT) {
// Optimizing of TCP packets by transfering multiple datasets in one packet
@@ -991,26 +1006,26 @@
if (res == OCI_NO_DATA) {
_state |= EOF_DATA;
- return false; // There are no additional rows pending to be fetched.
+
+ // There are no additional rows pending to be fetched.
} else if (res == OCI_ERROR) {
_state = STMT_ERROR;
//throw OCI_EXCEPTION(_env._errh, *this, __FILE__, __LINE__);
throw_ocipl_exception(OciException(_env._errh, *this, __FILE__, __LINE__));
- //return false; // not reached
} else {
if (rows > 0)
_state |= EXECUTED|FETCHED;
else
- _state = (_state|EXECUTED) & ~FETCHED;
+ _state = (_state|EXECUTED) & ~(FETCHED|EOF_DATA);
oci_check_error(_env, res);
- return true; // There may be more rows available to be fetched (for queries) or the DML statement succeeded.
+ // There may be more rows available to be fetched (for queries) or the DML statement succeeded.
}
}
-bool SqlStatement::fetch(ub4 rows/*=-1*/)
+void SqlStatement::fetch(ub4 rows/*=-1*/)
{
if (!(_state & EXECUTED)) {
if (rows == -1)
@@ -1019,28 +1034,30 @@
else
rows = _result_buffers;
- return execute(rows);
- }
+ execute(rows);
+ } else {
+ if (rows == -1)
+ rows = _result_buffers;
- if (rows == -1)
- rows = _result_buffers;
-
#if ORACLE_VERSION>=90
- sword res = OCIStmtFetch2(_handle, _env._errh, rows, OCI_FETCH_NEXT, 0, OCI_DEFAULT);
+ sword res = OCIStmtFetch2(_handle, _env._errh, rows, OCI_FETCH_NEXT, 0, OCI_DEFAULT);
#else
- sword res = OCIStmtFetch(_handle, _env._errh, rows, OCI_FETCH_NEXT, OCI_DEFAULT);
+ sword res = OCIStmtFetch(_handle, _env._errh, rows, OCI_FETCH_NEXT, OCI_DEFAULT);
#endif
- _last_row = _last_fetched_row;
- _last_fetched_row = row_count();
+ _last_row = _last_fetched_row;
+ _last_fetched_row = row_count();
- if (res != OCI_NO_DATA) { // more data available or did there occur an error?
- _state |= FETCHED;
- oci_check_error(_env, res);
- return true; // There may be more rows available to be fetched.
- } else {
- _state |= EOF_DATA;
- return false; // There are no additional rows pending to be fetched.
+ if (res != OCI_NO_DATA) { // more data available or did there occur an error?
+ _state |= FETCHED;
+ oci_check_error(_env, res);
+
+ // There may be more rows available to be fetched.
+ } else {
+ _state |= EOF_DATA;
+
+ // There are no additional rows pending to be fetched.
+ }
}
}
@@ -1324,7 +1341,7 @@
break;
case OCI_TYPECODE_VARCHAR:
- _string = new SqlString(*other._string, 2000/*blen*/);
+ _string = new SqlString(*other._string, OCIPL_DEFAULT_STRING_BUFFER/*blen*/);
break;
case OCI_TYPECODE_NUMBER:
@@ -1350,7 +1367,7 @@
break;
*/
case SQLT_LNG:
- _string = new SqlString(*other._string, 2000/*blen*/); //@@
+ _string = new SqlString(*other._string, OCIPL_DEFAULT_STRING_BUFFER/*blen*/); //@@
break;
default:
@@ -1587,7 +1604,7 @@
#endif // SqlVariant
-SqlVariantArray::SqlVariantArray(ub2 data_type, int size)
+SqlVariantArray::SqlVariantArray(ub2 data_type, int size, int blen)
{
_data_type = data_type;
@@ -1597,7 +1614,7 @@
// fall through
case OCI_TYPECODE_VARCHAR:
- _pstring = new SqlStringArray(size);
+ _pstring = new SqlStringArray(size, blen);
break;
case OCI_TYPECODE_NUMBER:
@@ -1623,7 +1640,7 @@
*/
#endif
case SQLT_LNG:
- _pstring = new SqlStringArray(size); //@@
+ _pstring = new SqlStringArray(size, blen); //@@
break;
default:
Modified: trunk/ocipl/ocipl.h
===================================================================
--- trunk/ocipl/ocipl.h 2007-10-28 14:50:00 UTC (rev 35)
+++ trunk/ocipl/ocipl.h 2007-10-28 15:08:59 UTC (rev 36)
@@ -2,7 +2,7 @@
//
// ocipl.h
//
- // Copyright (c) 2003, 2004, 2005, 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2003, 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
//
// OCIPL Version 1.3
//
@@ -42,7 +42,17 @@
#ifndef _OCIPL_H
-#ifdef WIN32
+#ifdef UNICODE
+#ifndef _UNICODE
+#define _UNICODE
+#endif
+#else
+#ifdef _UNICODE
+#define UNICODE
+#endif
+#endif
+
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
@@ -73,8 +83,8 @@
#define _strupr_s(b, s) strupr(b)
#endif
-#ifndef _itoa_s
-#define _itoa_s(x, b, l, r) (_itoa(x, b, r)? 0: EINVAL)
+#ifndef _itot_s
+#define _itot_s(x, b, l, r) (_itot(x, b, r)? 0: EINVAL)
#endif
#endif
@@ -141,7 +151,7 @@
#ifdef _MSC_VER
#include <minmax.h>
-#ifndef _NO_COMMENT
+#ifndef OCIPL_NO_COMMENT
#pragma comment(lib, "oci")
#if defined(_DEBUG) && defined(_DLL) // DEBUG version only supported with MSVCRTD
@@ -169,7 +179,7 @@
#endif
#endif
-#endif // _NO_COMMENT
+#endif // OCIPL_NO_COMMENT
#endif // _MSC_VER
@@ -179,7 +189,11 @@
// default bulk fetch size
extern int g_OCIPL_BULK_ROWS;
+ // default string buffer size
+#define OCIPL_DEFAULT_STRING_BUFFER 2000
+
+#ifndef istspace
inline int istspace(TCHAR c)
{
#ifdef _UNICODE
@@ -188,6 +202,7 @@
return isspace((unsigned char)c);
#endif
}
+#endif
struct SqlStatement;
@@ -555,13 +570,6 @@
__declspec(noreturn) void throw_ocipl_exception(OciException& e);
-/*
-#ifndef OCI_EXCEPTION
-#define OCI_EXCEPTION OCIPL::OciException
-#endif
-
-#define THROW_OCI_EXCEPTION(par) throw OCI_EXCEPTION(par, __FILE__, __LINE__)
-*/
#define THROW_OCI_EXCEPTION(par) throw_ocipl_exception(OCIPL::OciException(par, __FILE__, __LINE__))
@@ -616,8 +624,10 @@
OracleServer(OciEnv& env)
: super(env)
{
+#if ORACLE_VERSION>=82
+ _version = 0;
+#endif
_version_string[0] = '\0';
- _version = 0;
}
~OracleServer()
@@ -645,7 +655,9 @@
oci_check_error(_env, res);
}
+#if ORACLE_VERSION>=82
ub4 _version; // e.g. 0x9200500
+#endif
TCHAR _version_string[2000];
};
@@ -682,13 +694,13 @@
{
typedef OciHandle<OCISvcCtx> super;
- OciLogin(OciEnv& env, const LoginPara& login_para, ub4 mode=OCI_DEFAULT)
+ OciLogin(OciEnv& env, const LoginPara& login_para)
: super(env),
_server(env),
_session(env),
_connected(false)
{
- connect(login_para._username, login_para._password, login_para._tnsname, mode);
+ connect(login_para._username, login_para._password, login_para._tnsname, login_para._mode);
}
OciLogin(OciEnv& env, const tstring& username, const tstring& password, const tstring& tnsname, ub4 mode=OCI_DEFAULT)
@@ -872,7 +884,7 @@
struct SqlInd
{
- SqlInd(OCIInd ind=-1)
+ SqlInd(OCIInd ind=OCI_IND_NULL)
: _ind(ind)
{
}
@@ -880,11 +892,11 @@
operator OCIInd() const {return _ind;}
operator OCIInd*() {return &_ind;}
- bool is_null() const {return _ind==-1;}
- bool is_not_null() const {return _ind!=-1;}
+ bool is_null() const {return _ind==OCI_IND_NULL;}
+ bool is_not_null() const {return _ind!=OCI_IND_NULL;}
- void clear() {_ind = -1;}
- void set() {_ind = 0;}
+ void clear() {_ind = OCI_IND_NULL;}
+ void set() {_ind = OCI_IND_NOTNULL;}
protected:
OCIInd _ind; // short
@@ -896,6 +908,7 @@
struct SqlValue
{
SqlValue() {}
+ SqlValue(OCIInd ind) : _ind(ind) {}
SqlValue(const SqlValue& other) : _ind(other._ind) {}
bool is_null() const {return _ind.is_null();}
@@ -928,6 +941,11 @@
memcpy(_pind, other._pind, other._count*sizeof(SqlInd));
}
+ ~SqlIndArray()
+ {
+ delete [] _pind;
+ }
+
bool is_null(int idx) const {return _pind[idx].is_null();}
bool is_not_null(int idx) const {return _pind[idx].is_not_null();}
@@ -956,6 +974,12 @@
_ind.set();
}
+ SqlInt(int value, OCIInd ind)
+ : SqlValue(ind),
+ _value(value)
+ {
+ }
+
SqlInt(const SqlInt& other)
: SqlValue(other),
_value(other._value)
@@ -970,7 +994,7 @@
TCHAR buffer[16];
if (_ind.is_not_null()) {
- _itoa_s(_value, buffer, sizeof(buffer)/sizeof(TCHAR), 10);
+ _itot_s(_value, buffer, sizeof(buffer)/sizeof(TCHAR), 10);
return buffer;
} else
return tstring();
@@ -1003,7 +1027,7 @@
free(_pvalues);
}
- int get_int(int row) const {return _pind[row].is_not_null()? _pvalues[row]: INT_NULL;}
+ int get_int(int row, int null=INT_NULL) const {return _pind[row].is_not_null()? _pvalues[row]: null;}
int* get_ref(int row) {return &_pvalues[row];}
tstring str(int row) const
@@ -1011,7 +1035,7 @@
TCHAR buffer[16];
if (_pind[row].is_not_null()) {
- _itoa_s(_pvalues[row], buffer, sizeof(buffer)/sizeof(TCHAR), 10);
+ _itot_s(_pvalues[row], buffer, sizeof(buffer)/sizeof(TCHAR), 10);
return buffer;
} else
return tstring();
@@ -1026,7 +1050,7 @@
struct SqlString : public SqlValue
{
- SqlString(int blen=2000)
+ SqlString(int blen=OCIPL_DEFAULT_STRING_BUFFER)
: _blen(blen),
_str((TCHAR*)malloc((blen+1)*sizeof(TCHAR)))
{
@@ -1045,7 +1069,7 @@
: _blen(blen),
_str((TCHAR*)malloc((blen+1)*sizeof(TCHAR)))
{
- tcscpyn(_str, s, blen+1);
+ ocipl_tcscpyn(_str, s, blen+1);
if (*s)
_ind.set();
@@ -1082,18 +1106,8 @@
friend tostream& operator<<(tostream& os, const SqlString& str)
{if (str.is_not_null()) os << str._str; return os;}
- static inline TCHAR* strcpyn(TCHAR* dest, const TCHAR* source, size_t count)
+ static inline TCHAR* ocipl_tcscpyn(TCHAR* dest, const TCHAR* source, size_t count)
{
- char* d = dest;
-
- for(const char* s=source; count&&(*d++=*s++); )
- count--;
-
- return dest;
- }
-
- static inline TCHAR* tcscpyn(TCHAR* dest, const TCHAR* source, size_t count)
- {
TCHAR* d = dest;
for(const TCHAR* s=source; count&&(*d++=*s++); )
@@ -1112,7 +1126,7 @@
struct SqlStringArray : public SqlIndArray
{
- SqlStringArray(int size=g_OCIPL_BULK_ROWS, int blen=2000)
+ SqlStringArray(int size=g_OCIPL_BULK_ROWS, int blen=OCIPL_DEFAULT_STRING_BUFFER)
: SqlIndArray(size),
_blen(blen),
_buffer((TCHAR*)malloc(size*(blen+1)*sizeof(TCHAR)))
@@ -1149,6 +1163,7 @@
extern tstring ocidate_to_string(const OCIDate& date);
+extern tstring ocidate_to_short_string(const OCIDate& date);
extern struct tm* ocidate_to_gmt(const OCIDate& date);
extern struct tm* ocidate_to_lctime(const OCIDate& date);
extern time_t ocidate_to_time_t(const OCIDate& date);
@@ -1160,7 +1175,7 @@
{
OciDate() {}
OciDate(const OCIDate& date);
- OciDate(OCIError* errh, const TCHAR* str);
+ OciDate(OCIError* errh, const TCHAR* str, const TCHAR* fmt=_T("dd.mm.yyyy"));
OciDate(struct tm* t);
tstring str() const
@@ -1171,6 +1186,14 @@
return tstring();
}
+ tstring short_str() const
+ {
+ if (_ind.is_not_null())
+ return ocidate_to_short_string(*this);
+ else
+ return tstring();
+ }
+
int get_int_date() const
{
if (_ind.is_not_null())
@@ -1222,6 +1245,7 @@
free(_buffers);
}
+ const OCIDate& get_date(int row) const {return _buffers[row];}
OCIDate* get_ref(int row) {return &_buffers[row];}
tstring str(int row) const
@@ -1232,6 +1256,14 @@
return tstring();
}
+ tstring short_str(int row) const
+ {
+ if (_pind[row].is_not_null())
+ return ocidate_to_short_string(_buffers[row]);
+ else
+ return tstring();
+ }
+
int get_int_date(int row) const
{
if (_pind[row].is_not_null()) {
@@ -2416,51 +2448,69 @@
void bind_result(struct SqlRecord& rec);
- bool ensure_execute()
- {
- if (!(_state & EXECUTED))
- return execute();
+ // execute a prepared SQL statement
- return !eof();
- }
-
- bool execute()
+ void execute()
{
int rows = get_stmt_type()==OCI_STMT_SELECT? 0: 1;
- return execute(rows);
+ execute(rows);
}
- bool execute(ub4 rows, ub4 mode=OCI_DEFAULT);
+ void execute(ub4 rows, ub4 mode=OCI_DEFAULT);
- bool execute(const tstring& sql)
+ void execute(const tstring& sql)
{
prepare(sql);
int rows = get_stmt_type()==OCI_STMT_SELECT? 0: 1;
- return execute(rows);
+ execute(rows);
}
- bool execute(const tstring& sql, ub4 rows)
+ void execute(const tstring& sql, ub4 rows)
{
prepare(sql);
- return execute(rows);
+ execute(rows);
}
- bool execute_fetch(ub4 mode=OCI_DEFAULT);
+ void ensure_execute()
+ {
+ if (!(_state & EXECUTED))
+ execute();
+ }
- bool execute_fetch(const tstring& sql, ub4 lang=OCI_NTV_SYNTAX, ub4 mode=OCI_DEFAULT)
+
+ // execute a SQL statement and fetch rows of the result set (default number of rows: _bulk_rows)
+
+ void execute_fetch(ub4 mode=OCI_DEFAULT);
+
+ void execute_fetch(const tstring& sql, ub4 lang=OCI_NTV_SYNTAX, ub4 mode=OCI_DEFAULT)
{
prepare(sql, lang);
- return execute_fetch(mode);
+ execute_fetch(mode);
}
- bool fetch(ub4 rows=-1);
+ // fetch the next rows of a result set (default number of rows: _bulk_rows)
+ void fetch(ub4 rows=-1);
+
+ // next() is used to iterate through result sets without using bulk mode fetching.
+
+ bool next()
+ {
+ if (!eof()) {
+ fetch(1);
+
+ return fetched_rows() > 0;
+ } else
+ return false;
+ }
+
+
// utility functions for bulk mode fetching
int first_bulk()
@@ -2499,7 +2549,9 @@
void print_results(const tstring& sql, tostream& out, bool header=true)
{
- if (execute(sql))
+ execute(sql);
+
+ if (!eof())
print_results(out, header);
}
@@ -2519,13 +2571,17 @@
void dump_results(const tstring& sql, XMLStorage::XMLPos& pos, const XMLStorage::XS_String& element_name)
{
- if (execute(sql))
+ execute(sql);
+
+ if (!eof())
dump_results(pos, element_name);
}
void dump_results(const tstring& sql, XMLStorage::XMLWriter& writer, const XMLStorage::XS_String& element_name)
{
- if (execute(sql))
+ execute(sql);
+
+ if (!eof())
dump_results(writer, element_name);
}
#endif
@@ -2540,7 +2596,7 @@
}
protected:
- bool execute_internal(ub4 rows, ub4 mode);
+ void execute_internal(ub4 rows, ub4 mode);
ub4 _last_row;
ub4 _last_fetched_row;
@@ -2669,7 +2725,7 @@
_punion_ptr = NULL;
}
- SqlVariantArray(ub2 data_type, int size);
+ SqlVariantArray(ub2 data_type, int size, int blen=OCIPL_DEFAULT_STRING_BUFFER);
SqlVariantArray(const SqlVariantArray& other);
~SqlVariantArray() {clear();}
@@ -3070,46 +3126,6 @@
extern const TCHAR* get_oci_ptype_str(ub1 type);
-#ifdef _XMLSTORAGE_H
-
-struct Dump {
- bool _info : 1;
- bool _db_version : 1;
- bool _db_options : 1;
-
- bool _tables : 1;
- bool _views : 1;
- bool _comments : 1;
- bool _grants : 1;
- bool _data : 1;
- bool _col_pos : 1;
- bool _seq_val : 1;
-
- bool _sort_cols : 1;
-
- std::set<tstring> _filter;
-
- Dump()
- {
- _info = true;
- _db_version = true;
- _db_options = false;
- _tables = true;
- _views = true;
- _comments = true;
- _grants = true;
- _data = false;
- _col_pos = true;
- _seq_val = true;
- _sort_cols = true;
- }
-
- //void dump_schema(OciConnection& conn, const TCHAR* schema, XMLStorage::XMLPos& pos);
- void dump_schema(OciEnv& env, const LoginPara& lp, const TCHAR* schema, XMLStorage::XMLWriter& writer);
-};
-
-#endif
-
} // namespace OCIPL
#define _OCIPL_H
Modified: trunk/ocipl/ocithrow.cpp
===================================================================
--- trunk/ocipl/ocithrow.cpp 2007-10-28 14:50:00 UTC (rev 35)
+++ trunk/ocipl/ocithrow.cpp 2007-10-28 15:08:59 UTC (rev 36)
@@ -37,8 +37,8 @@
*/
-#ifndef _NO_COMMENT
-#define _NO_COMMENT // no #pragma comment(lib, ...) statements in .lib files -> free selection of orasql library
+#ifndef OCIPL_NO_COMMENT
+#define OCIPL_NO_COMMENT // no #pragma comment(lib, ...) statements in .lib files -> free selection of orasql library
#endif
#define _olint // for #define CONST const
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2007-10-28 14:49:59
|
Revision: 35
http://ocipl.svn.sourceforge.net/ocipl/?rev=35&view=rev
Author: martinfuchs
Date: 2007-10-28 07:50:00 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Update XMLStorage to version 1.2
Modified Paths:
--------------
trunk/xmlstorage/xmlstorage-license.txt
trunk/xmlstorage/xmlstorage.cpp
trunk/xmlstorage/xmlstorage.h
trunk/xmlstorage/xs-expat.cpp
trunk/xmlstorage/xs-native.cpp
trunk/xmlstorage/xs-xerces.cpp
Modified: trunk/xmlstorage/xmlstorage-license.txt
===================================================================
--- trunk/xmlstorage/xmlstorage-license.txt 2007-10-28 10:28:31 UTC (rev 34)
+++ trunk/xmlstorage/xmlstorage-license.txt 2007-10-28 14:50:00 UTC (rev 35)
@@ -2,7 +2,7 @@
//
// XML storage classes
//
- // Copyright (c) 2004, 2005, 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
//
Modified: trunk/xmlstorage/xmlstorage.cpp
===================================================================
--- trunk/xmlstorage/xmlstorage.cpp 2007-10-28 10:28:31 UTC (rev 34)
+++ trunk/xmlstorage/xmlstorage.cpp 2007-10-28 14:50:00 UTC (rev 35)
@@ -1,8 +1,8 @@
//
- // XML storage classes Version 1.1
+ // XML storage C++ classes version 1.2
//
- // Copyright (c) 2004, 2005, 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
//
/// \file xmlstorage.cpp
@@ -151,51 +151,8 @@
// parse relative path
while(*path) {
- const char* slash = strchr(path, '/');
- if (slash == path)
- return NULL;
+ node = const_cast<XMLNode*>(node)->get_child_relative(path, false); // get_child_relative() ist const for create==false
- size_t l = slash? slash-path: strlen(path);
- std::string comp(path, l);
- path += l;
-
- // look for [n] and [@attr_name="attr_value"] expressions in path components
- const char* bracket = strchr(comp.c_str(), '[');
- l = bracket? bracket-comp.c_str(): comp.length();
- std::string child_name(comp.c_str(), l);
- std::string attr_name, attr_value;
-
- int n = 0;
- if (bracket) {
- std::string expr = unescape(bracket, '[', ']');
- const char* p = expr.c_str();
-
- n = atoi(p); // read index number
-
- if (n)
- n = n - 1; // convert into zero based index
-
- const char* at = strchr(p, '@');
-
- if (at) {
- p = at + 1;
- const char* equal = strchr(p, '=');
-
- // read attribute name and value
- if (equal) {
- attr_name = unescape(p, equal-p);
- attr_value = unescape(equal+1);
- }
- }
- }
-
- if (attr_name.empty())
- // search n.th child node with specified name
- node = node->find(child_name, n);
- else
- // search n.th child node with specified name and matching attribute value
- node = node->find(child_name, attr_name, attr_value, n);
-
if (!node)
return NULL;
@@ -212,68 +169,73 @@
// parse relative path
while(*path) {
- const char* slash = strchr(path, '/');
- if (slash == path)
- return NULL;
+ node = node->get_child_relative(path, true);
- size_t l = slash? slash-path: strlen(path);
- std::string comp(path, l);
- path += l;
+ if (*path == '/')
+ ++path;
+ }
- // look for [n] and [@attr_name="attr_value"] expressions in path components
- const char* bracket = strchr(comp.c_str(), '[');
- l = bracket? bracket-comp.c_str(): comp.length();
- std::string child_name(comp.c_str(), l);
- std::string attr_name, attr_value;
+ return node;
+}
- int n = 0;
- if (bracket) {
- std::string expr = unescape(bracket, '[', ']');
- const char* p = expr.c_str();
+XMLNode* XMLNode::get_child_relative(const char*& path, bool create)
+{
+ const char* slash = strchr(path, '/');
+ if (slash == path)
+ return NULL;
- n = atoi(p); // read index number
+ size_t l = slash? slash-path: strlen(path);
+ std::string comp(path, l);
+ path += l;
- if (n)
- n = n - 1; // convert into zero based index
+ // look for [n] and [@attr_name="attr_value"] expressions in path components
+ const char* bracket = strchr(comp.c_str(), '[');
+ l = bracket? bracket-comp.c_str(): comp.length();
+ std::string child_name(comp.c_str(), l);
+ std::string attr_name, attr_value;
- const char* at = strchr(p, '@');
+ int n = 0;
+ if (bracket) {
+ std::string expr = unescape(bracket, '[', ']');
+ const char* p = expr.c_str();
- if (at) {
- p = at + 1;
- const char* equal = strchr(p, '=');
+ n = atoi(p); // read index number
- // read attribute name and value
- if (equal) {
- attr_name = unescape(p, equal-p);
- attr_value = unescape(equal+1);
- }
- }
- }
+ if (n)
+ n = n - 1; // convert into zero based index
- XMLNode* child;
+ const char* at = strchr(p, '@');
- if (attr_name.empty())
- // search n.th child node with specified name
- child = node->find(child_name, n);
- else
- // search n.th child node with specified name and matching attribute value
- child = node->find(child_name, attr_name, attr_value, n);
+ if (at) {
+ p = at + 1;
+ const char* equal = strchr(p, '=');
- if (!child) {
- child = new XMLNode(child_name);
- node->add_child(child);
-
- if (!attr_name.empty())
- (*node)[attr_name] = attr_value;
+ // read attribute name and value
+ if (equal) {
+ attr_name = unescape(p, equal-p);
+ attr_value = unescape(equal+1);
+ }
}
+ }
- node = child;
+ XMLNode* child;
- if (*path == '/')
- ++path;
+ if (attr_name.empty())
+ // search n.th child node with specified name
+ child = find(child_name, n);
+ else
+ // search n.th child node with specified name and matching attribute value
+ child = find(child_name, attr_name, attr_value, n);
+
+ if (!child && create) {
+ child = new XMLNode(child_name);
+ add_child(child);
+
+ if (!attr_name.empty())
+ (*this)[attr_name] = attr_value;
}
- return node;
+ return child;
}
@@ -283,36 +245,49 @@
LPCXSSTR s = str.c_str();
size_t l = XS_len(s);
- if (!cdata && l<=BUFFER_LEN) {
+ if (cdata) {
+ // encode the whole string in a CDATA section
+ std::string ret = "<![CDATA[";
+
+#ifdef XS_STRING_UTF8
+ ret += str;
+#else
+ ret += get_utf8(str);
+#endif
+
+ ret += "]]>";
+
+ return ret;
+ } else if (l <= BUFFER_LEN) {
LPXSSTR buffer = (LPXSSTR)alloca(6*sizeof(XS_CHAR)*XS_len(s)); // worst case """ / "'"
LPXSSTR o = buffer;
for(LPCXSSTR p=s; *p; ++p)
switch(*p) {
case '&':
- *o++ = '&'; *o++ = 'a'; *o++ = 'm'; *o++ = 'p'; *o++ = ';';
+ *o++ = '&'; *o++ = 'a'; *o++ = 'm'; *o++ = 'p'; *o++ = ';'; // "&"
break;
case '<':
- *o++ = '&'; *o++ = 'l'; *o++ = 't'; *o++ = ';';
+ *o++ = '&'; *o++ = 'l'; *o++ = 't'; *o++ = ';'; // "<"
break;
case '>':
- *o++ = '&'; *o++ = 'g'; *o++ = 't'; *o++ = ';';
+ *o++ = '&'; *o++ = 'g'; *o++ = 't'; *o++ = ';'; // ">"
break;
case '"':
- *o++ = '&'; *o++ = 'q'; *o++ = 'u'; *o++ = 'o'; *o++ = 't'; *o++ = ';';
+ *o++ = '&'; *o++ = 'q'; *o++ = 'u'; *o++ = 'o'; *o++ = 't'; *o++ = ';'; // """
break;
case '\'':
- *o++ = '&'; *o++ = 'a'; *o++ = 'p'; *o++ = 'o'; *o++ = 's'; *o++ = ';';
+ *o++ = '&'; *o++ = 'a'; *o++ = 'p'; *o++ = 'o'; *o++ = 's'; *o++ = ';'; // "'"
break;
default:
- if ((unsigned)*p<20 && *p!='\t' && *p!='\r' && *p!='\n') {
+ if ((unsigned)*p<0x20 && *p!='\t' && *p!='\r' && *p!='\n') {
char b[16];
- sprintf(b, "&%d;", (unsigned)*p);
+ sprintf(b, "&#%d;", (unsigned)*p);
for(const char*q=b; *q; )
*o++ = *q++;
} else
@@ -325,24 +300,10 @@
return get_utf8(buffer, o-buffer);
#endif
} else { // l > BUFFER_LEN
- // encode the whole string in a CDATA section
- std::string ret = "<![CDATA[";
+ // alternative code for larger strings using ostringstream
+ // and avoiding to use alloca() for preallocated memory
+ fast_ostringstream out;
-#ifdef XS_STRING_UTF8
- ret += str;
-#else
- ret += get_utf8(str);
-#endif
-
- ret += "]]>";
-
- return ret;
-
-/* alternative code using ostringstream (beware: quite slow)
-#include <sstream>
-
- std::ostringstream out;
-
LPCXSSTR s = str.c_str();
for(LPCXSSTR p=s; *p; ++p)
@@ -368,8 +329,8 @@
break;
default:
- if ((unsigned)*p<20 && *p!='\t' *p!='\r' && *p!='\n')
- out << "&" << (unsigned)*p << ";";
+ if ((unsigned)*p<0x20 && *p!='\t' && *p!='\r' && *p!='\n')
+ out << "&#" << (unsigned)*p << ";";
else
out << *p;
}
@@ -379,7 +340,6 @@
#else
return get_utf8(out.str());
#endif
- */
}
}
@@ -407,7 +367,7 @@
} else if (!XS_nicmp(p+1, XS_TEXT("apos;"), 5)) {
*o++ = '\'';
p += 5;
- } else
+ } else //@@ maybe decode "&#xx;" special characters
*o++ = *p;
} else if (*p=='<' && !XS_nicmp(p+1,XS_TEXT("![CDATA["),8)) {
LPCXSSTR e = XS_strstr(p+9, XS_TEXT("]]>"));
@@ -416,7 +376,7 @@
size_t l = e - p;
memcpy(o, p, l);
o += l;
- p += 3;
+ p = e + 2;
} else
*o++ = *p;
} else
@@ -427,7 +387,7 @@
/// write node with children tree to output stream using original white space
-void XMLNode::write_worker(std::ostream& out, int indent) const
+void XMLNode::write_worker(std::ostream& out) const
{
out << _leading << '<' << EncodeXMLString(*this);
@@ -438,7 +398,7 @@
out << '>' << _content;
for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
- (*it)->write_worker(out, indent+1);
+ (*it)->write_worker(out);
out << _end_leading << "</" << EncodeXMLString(*this) << '>';
} else
@@ -456,9 +416,13 @@
for(AttributeMap::const_iterator it=_attributes.begin(); it!=_attributes.end(); ++it)
out << ' ' << EncodeXMLString(it->first) << "=\"" << EncodeXMLString(it->second) << "\"";
- if (!_children.empty()/*@@ || !_content.empty()*/) {
- out << ">";
+ // strip leading white space from content
+ const char* content = _content.c_str();
+ while(isspace((unsigned char)*content)) ++content;
+ if (!_children.empty() || *content) {
+ out << ">" << content;
+
for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
(*it)->plain_write_worker(out);
@@ -479,9 +443,16 @@
for(AttributeMap::const_iterator it=_attributes.begin(); it!=_attributes.end(); ++it)
out << ' ' << EncodeXMLString(it->first) << "=\"" << EncodeXMLString(it->second) << "\"";
- if (!_children.empty()/*@@ || !_content.empty()*/) {
- out << '>' << format._endl;
+ // strip leading white space from content
+ const char* content = _content.c_str();
+ while(isspace((unsigned char)*content)) ++content;
+ if (!_children.empty() || *content) {
+ out << '>' << content;
+
+ if (!_children.empty())
+ out << format._endl;
+
for(Children::const_iterator it=_children.begin(); it!=_children.end(); ++it)
(*it)->pretty_write_worker(out, format, indent+1);
@@ -497,26 +468,34 @@
/// write node with children tree to output stream using smart formating
void XMLNode::smart_write_worker(std::ostream& out, const XMLFormat& format, int indent) const
{
- if (_leading.empty())
+ // strip the first line feed from _leading
+ const char* leading = _leading.c_str();
+ if (*leading == '\n') ++leading;
+
+ if (!*leading)
for(int i=indent; i--; )
out << XML_INDENT_SPACE;
else
- out << _leading;
+ out << leading;
out << '<' << EncodeXMLString(*this);
for(AttributeMap::const_iterator it=_attributes.begin(); it!=_attributes.end(); ++it)
out << ' ' << EncodeXMLString(it->first) << "=\"" << EncodeXMLString(it->second) << "\"";
- if (_children.empty() && _content.empty())
+ // strip leading white space from content
+ const char* content = _content.c_str();
+ while(isspace((unsigned char)*content)) ++content;
+
+ if (_children.empty() && !*content)
out << "/>";
else {
out << '>';
- if (_content.empty())
+ if (!*content)
out << format._endl;
else
- out << _content;
+ out << content;
Children::const_iterator it = _children.begin();
@@ -524,11 +503,15 @@
for(; it!=_children.end(); ++it)
(*it)->smart_write_worker(out, format, indent+1);
- if (_end_leading.empty())
+ // strip the first line feed from _end_leading
+ const char* end_leading = _end_leading.c_str();
+ if (*end_leading == '\n') ++end_leading;
+
+ if (!*end_leading)
for(int i=indent; i--; )
out << XML_INDENT_SPACE;
else
- out << _end_leading;
+ out << end_leading;
} else
out << _end_leading;
@@ -711,16 +694,14 @@
/// notifications about XML start tag
void XMLReaderBase::StartElementHandler(const XS_String& name, const XMLNode::AttributeMap& attributes)
{
- // search for end of first line
const char* s = _content.c_str();
+ const char* e = s + _content.length();
const char* p = s;
- const char* e = p + _content.length();
- for(; p<e; ++p)
- if (*p == '\n') {
- ++p;
+ // search for content end leaving only white space for leading
+ for(p=e; p>s; --p)
+ if (!isspace((unsigned char)p[-1]))
break;
- }
if (p != s)
if (_pos->_children.empty()) { // no children in last node?
@@ -755,25 +736,27 @@
/// notifications about XML end tag
void XMLReaderBase::EndElementHandler()
{
- // search for end of first line
const char* s = _content.c_str();
- const char* p = s;
- const char* e = p + _content.length();
+ const char* e = s + _content.length();
+ const char* p;
- for(; p<e; ++p)
- if (*p == '\n') {
- ++p;
- break;
- }
+ if (!strncmp(s,"<![CDATA[",9) && !strncmp(e-3,"]]>",3)) {
+ s += 9;
+ p = (e-=3);
+ } else {
+ // search for content end leaving only white space for _end_leading
+ for(p=e; p>s; --p)
+ if (!isspace((unsigned char)p[-1]))
+ break;
+ }
if (p != s)
if (_pos->_children.empty()) // no children in current node?
_pos->_content.append(s, p-s);
+ else if (_last_tag == TAG_START)
+ _pos->_content.append(s, p-s);
else
- if (_last_tag == TAG_START)
- _pos->_content.append(s, p-s);
- else
- _pos->_children.back()->_trailing.append(s, p-s);
+ _pos->_children.back()->_trailing.append(s, p-s);
if (p != e)
_pos->_end_leading.assign(p, e-p);
Modified: trunk/xmlstorage/xmlstorage.h
===================================================================
--- trunk/xmlstorage/xmlstorage.h 2007-10-28 10:28:31 UTC (rev 34)
+++ trunk/xmlstorage/xmlstorage.h 2007-10-28 14:50:00 UTC (rev 35)
@@ -1,8 +1,8 @@
//
- // XML storage classes Version 1.1
+ // XML storage C++ classes version 1.2
//
- // Copyright (c) 2004, 2005, 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
//
/// \file xmlstorage.h
@@ -40,6 +40,26 @@
#ifndef _XMLSTORAGE_H
+#ifdef UNICODE
+#ifndef _UNICODE
+#define _UNICODE
+#endif
+#else
+#ifdef _UNICODE
+#define UNICODE
+#endif
+#endif
+
+#ifndef _WIN32
+#ifdef UNICODE
+#error no UNICODE build in Unix version available
+#endif
+#ifndef XS_STRING_UTF8
+#define XS_STRING_UTF8
+#endif
+#endif
+
+
#if _MSC_VER>=1400
#ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
@@ -129,21 +149,63 @@
#endif // _MSC_VER
-#ifdef UNICODE
-#ifndef _UNICODE
-#define _UNICODE
+#ifdef _WIN32
+
+#include <windows.h> // for LPCTSTR
+#include <tchar.h>
+#include <malloc.h>
+
+#ifndef _MSC_VER
+#include <stdio.h> // vsnprintf(), snprintf()
#endif
+
#else
-#ifdef _UNICODE
-#define UNICODE
+
+#include <wchar.h>
+#include <stdarg.h>
+
+typedef char CHAR;
+#ifdef _WCHAR_T_DEFINED
+#define __wchar_t wchar_t
#endif
+
+typedef __wchar_t WCHAR;
+typedef unsigned char UCHAR;
+typedef char* LPSTR;
+typedef const char* LPCSTR;
+typedef WCHAR* LPWSTR;
+typedef const WCHAR* LPCWSTR;
+
+#ifndef UNICODE
+#define TEXT(x) x
+typedef char TCHAR;
+typedef unsigned char _TUCHAR;
+typedef CHAR* PTSTR;
+typedef CHAR* LPTSTR;
+typedef const CHAR* LPCTSTR;
+
+#define _ttoi atoi
+#define _tfopen fopen
+#define _tcstod strtod
+#define _tcslen strlen
+#define _tcsstr strstr
+#define _snprintf snprintf
+#define _sntprintf snprintf
+#define _vsnprintf vsnprintf
+#define _vsntprintf vsnprintf
+#define _stricmp strcasecmp
+#define _tcsicmp strcasecmp
+#define strnicmp strncasecmp
+#define _tcsnicmp strncasecmp
#endif
-#include <windows.h> // for LPCTSTR
+#endif
-#include <tchar.h>
-#include <malloc.h>
+#ifdef __BORLANDC__
+#define _strcmpi strcmpi
+#endif
+
#include <fstream>
#include <sstream>
#include <string>
@@ -168,7 +230,7 @@
#define LPXSSTR LPSTR
#define LPCXSSTR LPCSTR
#define XS_cmp strcmp
-#define XS_icmp stricmp
+#define XS_icmp _stricmp
#define XS_ncmp strncmp
#define XS_nicmp strnicmp
#define XS_toi atoi
@@ -238,6 +300,7 @@
XS_String(const super& other) : super(other) {}
XS_String(const XS_String& other) : super(other) {}
+#ifdef _WIN32
#if defined(UNICODE) && !defined(XS_STRING_UTF8)
XS_String(LPCSTR s) {assign(s);}
XS_String(LPCSTR s, size_t l) {assign(s, l);}
@@ -251,7 +314,6 @@
XS_String(const std::wstring& other) {assign(other.c_str());}
XS_String& operator=(LPCWSTR s) {assign(s); return *this;}
#ifdef XS_STRING_UTF8
- void assign(const XS_String& s) {assign(s.c_str());}
void assign(LPCWSTR s) {if (s) {size_t bl=wcslen(s); LPSTR b=(LPSTR)alloca(bl); super::assign(b, WideCharToMultiByte(CP_UTF8, 0, s, (int)bl, b, (int)bl, 0, 0));} else erase();}
void assign(LPCWSTR s, size_t l) {size_t bl=l; if (s) {LPSTR b=(LPSTR)alloca(bl); super::assign(b, WideCharToMultiByte(CP_UTF8, 0, s, (int)l, b, (int)bl, 0, 0));} else erase();}
#else // if !UNICODE && !XS_STRING_UTF8
@@ -259,7 +321,12 @@
void assign(LPCWSTR s, size_t l) {size_t bl=l; if (s) {LPSTR b=(LPSTR)alloca(bl); super::assign(b, WideCharToMultiByte(CP_ACP, 0, s, (int)l, b, (int)bl, 0, 0));} else erase();}
#endif
#endif
+#endif // _WIN32
+#ifdef XS_STRING_UTF8
+ void assign(const XS_String& s) {assign(s.c_str());}
+#endif
+
XS_String& operator=(LPCXSSTR s) {if (s) super::assign(s); else erase(); return *this;}
XS_String& operator=(const super& s) {super::assign(s); return *this;}
void assign(LPCXSSTR s) {super::assign(s);}
@@ -267,6 +334,7 @@
operator LPCXSSTR() const {return c_str();}
+#ifdef _WIN32
#ifdef XS_STRING_UTF8
operator std::wstring() const {size_t bl=length(); LPWSTR b=(LPWSTR)alloca(sizeof(WCHAR)*bl); return std::wstring(b, MultiByteToWideChar(CP_UTF8, 0, c_str(), bl, b, bl));}
#elif defined(UNICODE)
@@ -274,6 +342,7 @@
#else
operator std::wstring() const {size_t bl=length(); LPWSTR b=(LPWSTR)alloca(sizeof(WCHAR)*bl); return std::wstring(b, MultiByteToWideChar(CP_ACP, 0, c_str(), (int)bl, b, (int)bl));}
#endif
+#endif
XS_String& printf(LPCXSSTR fmt, ...)
{
@@ -415,11 +484,13 @@
#ifdef __GNUC__
#include <ext/stdio_filebuf.h>
-typedef __gnu_cxx::stdio_filebuf<char> STDIO_FILEBUF;
-#else
-typedef std::filebuf STDIO_FILEBUF;
+#define FILE_FILEBUF __gnu_cxx::stdio_filebuf<char>
+#elif defined(_MSC_VER)
+#define FILE_FILEBUF std::filebuf
#endif
+#ifdef FILE_FILEBUF
+
/// base class for XMLStorage::tifstream and XMLStorage::tofstream
struct FileHolder
{
@@ -460,7 +531,7 @@
}
protected:
- STDIO_FILEBUF _buf;
+ FILE_FILEBUF _buf;
};
/// output file stream with ANSI/UNICODE file names
@@ -485,10 +556,38 @@
}
protected:
- STDIO_FILEBUF _buf;
+ FILE_FILEBUF _buf;
};
+#else // FILE_FILEBUF
+#ifdef UNICODE
+#error UNICODE not supported for this platform
+#endif
+
+struct tifstream : public std::ifstream
+{
+ typedef std::ifstream super;
+
+ tifstream(const char* path)
+ : super(path, std::ios::in|std::ios::binary)
+ {
+ }
+};
+
+struct tofstream : public std::ofstream
+{
+ typedef std::ofstream super;
+
+ tofstream(const char* path)
+ : super(path, std::ios::out|std::ios::binary)
+ {
+ }
+};
+
+#endif
+
+
// write XML files with 2 spaces indenting
#define XML_INDENT_SPACE " "
@@ -714,7 +813,7 @@
return super::find(x);
}
- XS_String get(const char* x, LPXSSTR def=XS_EMPTY_STR) const
+ XS_String get(const char* x, LPCXSSTR def=XS_EMPTY_STR) const
{
const_iterator found = find(x);
@@ -728,7 +827,7 @@
/// map of XML node attributes
struct AttributeMap : public std::map<XS_String, XS_String>
{
- XS_String get(const char* x, LPXSSTR def=XS_EMPTY_STR) const
+ XS_String get(const char* x, LPCXSSTR def=XS_EMPTY_STR) const
{
const_iterator found = find(x);
@@ -841,14 +940,14 @@
_attributes[attr_name] = value;
}
- /// C++ write access to an attribute
+ /// index operator write access to an attribute
XS_String& operator[](const XS_String& attr_name)
{
return _attributes[attr_name];
}
/// read only access to an attribute
- template<typename T> XS_String get(const T& attr_name, LPXSSTR def=XS_EMPTY_STR) const
+ template<typename T> XS_String get(const T& attr_name, LPCXSSTR def=XS_EMPTY_STR) const
{
AttributeMap::const_iterator found = _attributes.find(attr_name);
@@ -950,7 +1049,7 @@
#endif
/// write node with children tree to output stream
- std::ostream& write(std::ostream& out, const XMLFormat& format, WRITE_MODE mode=FORMAT_SMART, int indent=0) const
+ bool write(std::ostream& out, const XMLFormat& format, WRITE_MODE mode=FORMAT_SMART, int indent=0) const
{
switch(mode) {
case FORMAT_PLAIN:
@@ -962,14 +1061,14 @@
break;
case FORMAT_ORIGINAL:
- write_worker(out, indent);
+ write_worker(out);
break;
default: // FORMAT_SMART
smart_write_worker(out, format, indent);
}
- return out;
+ return out.good();
}
protected:
@@ -1052,10 +1151,13 @@
/// relative XPath create function
XMLNode* create_relative(const char* path);
- void write_worker(std::ostream& out, int indent) const;
+ void write_worker(std::ostream& out) const;
void plain_write_worker(std::ostream& out) const;
void pretty_write_worker(std::ostream& out, const XMLFormat& format, int indent) const;
void smart_write_worker(std::ostream& out, const XMLFormat& format, int indent) const;
+
+protected:
+ XMLNode* get_child_relative(const char*& path, bool create); // mutable for create==true
};
@@ -1306,7 +1408,7 @@
return *_cur;
}
- /// C++ access to current node
+ /// automatic access to current node
operator const XMLNode*() const {return _cur;}
operator XMLNode*() {return _cur;}
@@ -1317,9 +1419,9 @@
XMLNode& operator*() {return *_cur;}
/// attribute access
- XS_String get(const XS_String& attr_name) const
+ XS_String get(const XS_String& attr_name, LPCXSSTR def=XS_EMPTY_STR) const
{
- return _cur->get(attr_name);
+ return _cur->get(attr_name, def);
}
/// attribute setting
@@ -1328,7 +1430,7 @@
_cur->put(attr_name, value);
}
- /// C++ attribute access
+ /// index operator attribute access
template<typename T> XS_String get(const T& attr_name) const {return (*_cur)[attr_name];}
XS_String& operator[](const XS_String& attr_name) {return (*_cur)[attr_name];}
@@ -1503,7 +1605,7 @@
return *_cur;
}
- /// C++ access to current node
+ /// automatic access to current node
operator const XMLNode*() const {return _cur;}
const XMLNode* operator->() const {return _cur;}
@@ -1516,7 +1618,7 @@
return _cur->get(attr_name);
}
- /// C++ attribute access
+ /// index operator attribute access
template<typename T> XS_String get(const T& attr_name) const {return _cur->get(attr_name);}
/// go back to previous position
@@ -1883,23 +1985,23 @@
};
/// type converter for string data with write access
-struct XMStringRef
+struct XMLStringRef
{
- XMStringRef(XMLNode* node, const XS_String& attr_name, LPCXSSTR def=XS_EMPTY)
+ XMLStringRef(XMLNode* node, const XS_String& attr_name, LPCXSSTR def=XS_EMPTY)
: _ref((*node)[attr_name])
{
if (_ref.empty())
assign(def);
}
- XMStringRef(XMLNode* node, const XS_String& node_name, const XS_String& attr_name, LPCXSSTR def=XS_EMPTY)
+ XMLStringRef(const XS_String& node_name, XMLNode* node, const XS_String& attr_name, LPCXSSTR def=XS_EMPTY)
: _ref(node->subvalue(node_name, attr_name))
{
if (_ref.empty())
assign(def);
}
- XMStringRef& operator=(const XS_String& value)
+ XMLStringRef& operator=(const XS_String& value)
{
assign(value);
@@ -2136,6 +2238,102 @@
#endif // XS_USE_XERCES
+#if defined(_MSC_VER) && _MSC_VER<1400
+
+struct fast_ostringbuffer : public std::streambuf
+{
+ typedef char _E;
+ typedef std::char_traits<_E> _Tr;
+
+ explicit fast_ostringbuffer()
+ {_Init(0, 0, std::_Noread);} // optimized for ios::out mode
+
+ virtual ~fast_ostringbuffer()
+ {_Tidy();}
+
+ std::string str() const
+ {if (pptr() != 0)
+ {std::string _Str(pbase(),
+ (_Seekhigh<pptr()? pptr(): _Seekhigh) - pbase());
+ return _Str;}
+ else
+ return std::string();}
+
+protected:
+ virtual int_type overflow(int_type _C = _Tr::eof())
+ {if (_Tr::eq_int_type(_Tr::eof(), _C))
+ return _Tr::not_eof(_C);
+ else if (pptr() != 0 && pptr() < epptr())
+ {*_Pninc() = _Tr::to_char_type(_C);
+ return _C;}
+ else
+ {size_t _Os = gptr() == 0 ? 0 : epptr() - eback();
+ size_t _Ns = _Os + _Alsize;
+ _E *_P = _Al.allocate(_Ns, (void *)0);
+ if (0 < _Os)
+ _Tr::copy(_P, eback(), _Os);
+ else if (_ALSIZE < _Alsize)
+ _Alsize = _ALSIZE;
+
+ if (_Strmode & std::_Allocated)
+ _Al.deallocate(eback(), _Os);
+
+ _Strmode |= std::_Allocated;
+
+ if (_Os == 0)
+ {_Seekhigh = _P;
+ setp(_P, _P + _Ns);
+ setg(_P, _P, _P); }
+ else
+ {_Seekhigh = _Seekhigh - eback() + _P;
+ setp(pbase() - eback() + _P, pptr() - eback() + _P, _P + _Ns);
+ setg(_P, _P, _P);}
+ *_Pninc() = _Tr::to_char_type(_C);
+
+ return _C;}}
+
+ void _Init(const _E *_S, size_t _N, std::_Strstate _M)
+ {_Pendsave = 0, _Seekhigh = 0;
+ _Alsize = _MINSIZE, _Strmode = _M;
+ setg(0, 0, 0);
+ setp(0, 0);}
+
+ void _Tidy()
+ {if (_Strmode & std::_Allocated)
+ _Al.deallocate(eback(), (pptr() != 0 ? epptr() : egptr()) - eback());
+ _Seekhigh = 0;
+ _Strmode &= ~std::_Allocated;}
+
+private:
+ enum {_ALSIZE = 65536/*512*/, _MINSIZE = 32768/*32*/}; // bigger buffer sizes
+
+ _E *_Pendsave, *_Seekhigh;
+ int _Alsize;
+ std::_Strstate _Strmode;
+ std::allocator<_E> _Al;
+};
+
+struct fast_ostringstream : public std::iostream
+{
+ typedef std::iostream super;
+
+ explicit fast_ostringstream()
+ : super(&_Sb) {}
+
+ std::string str() const
+ {return _Sb.str();}
+
+private:
+ fast_ostringbuffer _Sb;
+};
+
+#else
+
+typedef std::ostringstream fast_ostringstream;
+
+#endif
+
+
/// XML document holder
struct XMLDoc : public XMLNode
{
@@ -2147,11 +2345,11 @@
XMLDoc(LPCTSTR path)
: XMLNode("")
{
- read(path);
+ read_file(path);
}
#ifdef XS_USE_XERCES
- bool read(LPCTSTR path)
+ bool read_file(LPCTSTR path)
{
XMLReader reader(this, path);
@@ -2162,7 +2360,7 @@
#endif
}
- bool read(const char* buffer, size_t len, const std::string& system_id=std::string())
+ bool read_buffer(const char* buffer, size_t len, const std::string& system_id=std::string())
{
XMLReader reader(this, (const XMLByte*)buffer, len, system_id);
@@ -2171,7 +2369,7 @@
#else // XS_USE_XERCES
- bool read(LPCTSTR path)
+ bool read_file(LPCTSTR path)
{
tifstream in(path);
XMLReader reader(this, in);
@@ -2183,7 +2381,7 @@
#endif
}
- bool read(const char* buffer, size_t len, const std::string& system_id=std::string())
+ bool read_buffer(const char* buffer, size_t len, const std::string& system_id=std::string())
{
std::istringstream in(std::string(buffer, len));
@@ -2220,35 +2418,40 @@
return true;
}
- /// write XML stream preserving previous white space and comments
- std::ostream& write(std::ostream& out, WRITE_MODE mode=FORMAT_SMART) const
+ /// write XML stream
+ // FORMAT_SMART: preserving previous white space and comments
+ bool write(std::ostream& out, WRITE_MODE mode=FORMAT_SMART) const
{
_format.print_header(out, mode!=FORMAT_PLAIN);
- if (!_children.empty())
+ if (_children.size() == 1)
_children.front()->write(out, _format, mode);
+ else if (!_children.empty()) {
+ //throw Exception("more than one XML root!");
+ return false;
+ }
- return out;
+ return out.good();
}
/// write XML stream with formating
- std::ostream& write_formating(std::ostream& out) const
+ bool write_formating(std::ostream& out) const
{
return write(out, FORMAT_PRETTY);
}
- bool write(LPCTSTR path, WRITE_MODE mode=FORMAT_SMART) const
+ bool write_file(LPCTSTR path, WRITE_MODE mode=FORMAT_SMART) const
{
tofstream out(path);
- return write(out, mode).good();
+ return write(out, mode);
}
bool write_formating(LPCTSTR path) const
{
tofstream out(path);
- return write_formating(out).good();
+ return write_formating(out);
}
XMLFormat _format;
@@ -2293,7 +2496,7 @@
{
XMLMessageFromString(const std::string& xml_str, const std::string& system_id=std::string())
{
- read(xml_str.c_str(), xml_str.length(), system_id);
+ read_buffer(xml_str.c_str(), xml_str.length(), system_id);
}
};
@@ -2304,7 +2507,7 @@
XMLMessageReader(const std::string& xml_str, const std::string& system_id=std::string())
: XMLPos(&_msg)
{
- _msg.read(xml_str.c_str(), xml_str.length(), system_id);
+ _msg.read_buffer(xml_str.c_str(), xml_str.length(), system_id);
}
const XMLDoc& get_document()
@@ -2382,7 +2585,7 @@
_stack.top()._attributes[attr_name] = value;
}
- /// C++ write access to an attribute
+ /// index operator write access to an attribute
XS_String& operator[](const XS_String& attr_name)
{
if (_stack.empty())
Modified: trunk/xmlstorage/xs-expat.cpp
===================================================================
--- trunk/xmlstorage/xs-expat.cpp 2007-10-28 10:28:31 UTC (rev 34)
+++ trunk/xmlstorage/xs-expat.cpp 2007-10-28 14:50:00 UTC (rev 35)
@@ -1,6 +1,6 @@
//
- // XML storage classes Version 1.1
+ // XML storage C++ classes version 1.2
//
// Copyright (c) 2006 Martin Fuchs <mar...@gm...>
//
Modified: trunk/xmlstorage/xs-native.cpp
===================================================================
--- trunk/xmlstorage/xs-native.cpp 2007-10-28 10:28:31 UTC (rev 34)
+++ trunk/xmlstorage/xs-native.cpp 2007-10-28 14:50:00 UTC (rev 35)
@@ -1,8 +1,8 @@
//
- // XML storage classes Version 1.1
+ // XML storage C++ classes version 1.2
//
- // Copyright (c) 2006 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2006, 2007 Martin Fuchs <mar...@gm...>
//
/// \file xs-native.cpp
@@ -108,10 +108,14 @@
const std::string& str(bool utf8) // returns UTF-8 encoded buffer content
{
+#if defined(_WIN32) && !defined(XS_STRING_UTF8)
if (utf8)
+#endif
_buffer_str.assign(_buffer, _wptr-_buffer);
+#if defined(_WIN32) && !defined(XS_STRING_UTF8)
else
_buffer_str = get_utf8(_buffer, _wptr-_buffer);
+#endif
return _buffer_str;
}
@@ -219,7 +223,7 @@
char* _buffer;
char* _wptr;
size_t _len;
- std::string _buffer_str; // UF-8 encoded
+ std::string _buffer_str; // UTF-8 encoded
};
bool XMLReaderBase::parse()
@@ -381,7 +385,7 @@
buffer.reset();
}
- return true;
+ return true; //TODO return false on invalid XML
}
int XMLReaderBase::eat_endl()
Modified: trunk/xmlstorage/xs-xerces.cpp
===================================================================
--- trunk/xmlstorage/xs-xerces.cpp 2007-10-28 10:28:31 UTC (rev 34)
+++ trunk/xmlstorage/xs-xerces.cpp 2007-10-28 14:50:00 UTC (rev 35)
@@ -1,6 +1,6 @@
//
- // XML storage classes Version 1.1
+ // XML storage C++ classes version 1.2
//
// Copyright (c) 2006 Martin Fuchs <mar...@gm...>
//
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2007-10-28 10:28:29
|
Revision: 34
http://ocipl.svn.sourceforge.net/ocipl/?rev=34&view=rev
Author: martinfuchs
Date: 2007-10-28 03:28:31 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
add Doxyfile for OCIPL
Added Paths:
-----------
trunk/ocipl/Doxyfile
Added: trunk/ocipl/Doxyfile
===================================================================
--- trunk/ocipl/Doxyfile (rev 0)
+++ trunk/ocipl/Doxyfile 2007-10-28 10:28:31 UTC (rev 34)
@@ -0,0 +1,241 @@
+# Doxyfile 1.5.3
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = OCIPL/C++
+PROJECT_NUMBER =
+OUTPUT_DIRECTORY = doxy
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class " \
+ "The $name widget " \
+ "The $name file " \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = YES
+CPP_CLI_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = YES
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = NO
+GENERATE_TESTLIST = NO
+GENERATE_BUGLIST = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = YES
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text "
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = .
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS =
+RECURSIVE = NO
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = YES
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+HTML_DYNAMIC_SECTIONS = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = YES
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|