00001 //******************************************************************** 00002 //*** ResourcePool/mysql/mysql_bind.hh 00003 //*** Copyright (c) 2003-2009 by Markus Winand <mws@fatalmind.com> 00004 //*** $Id: mysql_bind.hh,v 1.1 2009-03-17 19:13:54 mws Exp $ 00005 //******************************************************************** 00006 /* 00007 This file is part of ResourcePool. 00008 00009 ResourcePool is free software; you can redistribute it 00010 and/or modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 of 00012 the License, or (at your option) any later version. 00013 00014 ResourcePool is distributed in the hope that it will be 00015 useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00016 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with ResourcePool; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00022 02111-1307 USA */ 00023 00024 00025 #ifndef RESOURCEPOOL_MYSQL_MYSQLBIND_HH 00026 #define RESOURCEPOOL_MYSQL_MYSQLBIND_HH 00027 00028 #ifndef RESOURCEPOOL_MYSQL_SQLTYPE_HH 00029 #include "SQLType.hh" 00030 #endif 00031 00032 #ifndef INCLUDED_GC_PTR_HH 00033 #include "mm/gc_ptr.hh" 00034 #endif 00035 00036 #include "ResourcePool/SQL/SQLStatement.hh" 00037 00038 #include <vector> 00039 #include <string> 00040 #include <sstream> 00041 00042 namespace fatalmind { 00043 namespace mysql { 00044 00045 class mysql_bind { 00046 public: 00047 mysql_bind(MYSQL& dbh, const SQL::SQLStatement& _sql, const std::vector<gc_ptr<SQLType> >& args); 00048 00049 const std::string getSQL() { 00050 return _os.str(); 00051 } 00052 00053 private: 00054 00055 void appendValue(int i, const gc_ptr<SQLType>& v, const SQL::SQLStatement& _sql); 00056 std::ostringstream _os; 00057 MYSQL& _dbh; 00058 }; 00059 } // namespace mysql 00060 } // namespace fatalmind 00061 00062 #endif