00001 // database row template class -*- C++ -*- 00002 // $Id: row.h,v 1.7 2004/01/28 21:21:08 roger Exp $ 00003 // 00004 // Copyright (C) 2003 Roger Leigh <rleigh@debian.org> 00005 // 00006 // 00007 // All rights reserved. 00008 // 00009 // Redistribution and use in source and binary forms, with or without 00010 // modification, are permitted provided that the following conditions 00011 // are met: 00012 // 00013 // * Redistributions of source code must retain the above copyright 00014 // notice, this list of conditions and the following disclaimer. 00015 // * Redistributions in binary form must reproduce the above 00016 // copyright notice, this list of conditions and the following 00017 // disclaimer in the documentation and/or other materials provided 00018 // with the distribution. 00019 // * Neither the name of the author, nor the names of other 00020 // contributors may be used to endorse or promote products derived 00021 // from this software without specific prior written permission. 00022 // 00023 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00024 // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00025 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00026 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 00028 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00030 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00031 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00032 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 00033 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00034 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00035 // SUCH DAMAGE. 00036 // 00038 00039 #ifndef PQXX_OBJECT_ROW_H 00040 #define PQXX_OBJECT_ROW_H 00041 00042 #include <memory> 00043 00044 #include <pqxx-object/row_base.h> 00045 00046 namespace pqxxobject 00047 { 00079 template<typename Row> 00080 class row : public row_base 00081 { 00082 public: 00084 typedef std::auto_ptr<Row> row_ptr; 00085 00087 row(): 00088 row_base() 00089 {} 00090 00096 row(row_state status, 00097 bool modified=false): 00098 row_base(status, modified) 00099 {} 00100 00102 virtual ~row() 00103 {} 00104 00111 static row_ptr create(pqxx::result::const_iterator row, 00112 pqxxobject::transaction& tran) 00113 { 00114 row_ptr p(new Row); 00115 p->convert_impl(row, tran); 00116 p->row_base::m_state = STATE_INITIALISED; 00117 return p; 00118 } 00119 00120 protected: 00121 00122 }; // class row 00123 00124 }; // namespace pqxxobject 00125 00126 #endif // PQXX_OBJECT_ROW_H