• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ocipl-xml.cpp

Go to the documentation of this file.
00001 
00002  //
00003  // ocipl-xml.cpp
00004  //
00005  // Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Martin Fuchs <martin-fuchs@gmx.net>
00006  // 
00007  // OCIPL Version 1.5
00008  //
00009 
00010  /// \file ocipl-xml.cpp
00011  /// implementation file of OCIPL's XML functions
00012 
00013 
00014 /*
00015 
00016   All rights reserved.
00017 
00018   Redistribution and use in source and binary forms, with or without
00019   modification, are permitted provided that the following conditions are met:
00020 
00021   * Redistributions of source code must retain the above copyright
00022     notice, this list of conditions and the following disclaimer.
00023   * Redistributions in binary form must reproduce the above copyright
00024     notice, this list of conditions and the following disclaimer in
00025     the documentation and/or other materials provided with the
00026     distribution.
00027 
00028   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00029   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00032   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00033   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00034   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00035   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00036   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00037   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00038   POSSIBILITY OF SUCH DAMAGE.
00039 
00040 */
00041 
00042 #ifndef OCIPL_NO_COMMENT
00043 #define OCIPL_NO_COMMENT    // no #pragma comment(lib, ...) statements in .lib files
00044 #endif
00045 #ifndef XS_NO_COMMENT
00046 #define XS_NO_COMMENT   // no pragma(lib) in xmlstorage.h
00047 #endif
00048 
00049 #include <xmlstorage.h>
00050 using namespace XMLStorage;
00051 
00052 #ifdef UNICODE
00053 #define ANSI_STRING(s) XS_String(s)
00054 #else
00055 #define ANSI_STRING(s) s
00056 #endif
00057 
00058 #include <iostream>
00059 using namespace std;
00060 
00061 #include <time.h>
00062 
00063 #include "ocipl.h"
00064 
00065 
00066 namespace OCIPL {
00067 
00068 
00069 void SqlStatement::dump_results(XMLPos& pos, const XS_String& element_name)
00070 {
00071     if (!(_state & EXECUTED))
00072         execute();  // instead of first_bulk()
00073 
00074     for(ResultIterator it(*this); it.has_next(); ++it) {
00075         pos.create(element_name);
00076 
00077         _res->dump_values(pos, it);
00078 
00079         pos.back();
00080     }
00081 }
00082 
00083 void SqlStatement::dump_results(XMLWriter& writer, const XS_String& element_name)
00084 {
00085     if (!(_state & EXECUTED))
00086         execute();
00087 
00088     for(ResultIterator it(*this); it.has_next(); ++it) {
00089         writer.create(element_name);
00090 
00091         _res->dump_values(writer, it);
00092 
00093         writer.back();
00094     }
00095 }
00096 
00097 
00098 void SqlRecord::dump_values(XMLPos& pos, int row)
00099 {
00100     ColumnVector::const_iterator it_type = _values.begin();
00101 
00102     for(ColumnVector::const_iterator it=_values.begin(); it!=_values.end(); ++it,++it_type)
00103         pos[it->_type._name] = it->_pvar->str(row, _env._errh);
00104 }
00105 
00106 void SqlRecord::dump_values(XMLWriter& writer, int row)
00107 {
00108     ColumnVector::const_iterator it_type = _values.begin();
00109 
00110     for(ColumnVector::const_iterator it=_values.begin(); it!=_values.end(); ++it,++it_type)
00111         writer[it->_type._name] = it->_pvar->str(row, _env._errh);
00112 }
00113 
00114 
00115 } // namespace OCIPL

Generated on Fri Sep 22 2017 00:05:09 for OCIPL/C++ by  doxygen 1.7.2