00001 00002 // 00003 // mysqlpl-xml.cpp 00004 // 00005 // Copyright (c) 2004, 2006, 2007 Martin Fuchs <martin-fuchs@gmx.net> 00006 // 00007 00008 /* 00009 00010 All rights reserved. 00011 00012 Redistribution and use in source and binary forms, with or without 00013 modification, are permitted provided that the following conditions are met: 00014 00015 * Redistributions of source code must retain the above copyright 00016 notice, this list of conditions and the following disclaimer. 00017 * Redistributions in binary form must reproduce the above copyright 00018 notice, this list of conditions and the following disclaimer in 00019 the documentation and/or other materials provided with the 00020 distribution. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00026 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00027 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00028 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00031 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 POSSIBILITY OF SUCH DAMAGE. 00033 00034 */ 00035 00036 #define _NO_COMMENT // no #pragma comment(lib, ...) statements in .lib files 00037 00038 #include <xmlstorage.h> 00039 00040 #include "mysqlpl.h" 00041 00042 00043 namespace MySqlPL { 00044 00045 00046 void SqlStatement::dump_results(XMLStorage::XMLPos& idx, const XMLStorage::XS_String& element_name) 00047 { 00048 if (!(_state & EXECUTED)) 00049 execute(); 00050 00051 while(fetch()) { 00052 idx.create(element_name); 00053 00054 _res->dump_values(idx); 00055 00056 idx.back(); 00057 } 00058 } 00059 00060 void SqlRecord::dump_values(XMLStorage::XMLPos& idx) 00061 { 00062 #if MYSQLPL_PREP_STMT 00063 for(ColumnVector::const_iterator it=_columns.begin(); it!=_columns.end(); ++it) 00064 idx[it->_type._name] = it->_column.str(); 00065 #else 00066 for(size_t i=0; i<_columns.size(); ++i,++i) 00067 idx[_columns[i]._type._name] = _stmt->get_string(i); 00068 #endif 00069 } 00070 00071 00072 } // namespace MySqlPL