00001 /* -*- c++ -*- 00002 * __BEGIN_COPYRIGHT 00003 * SimpleDB API 00004 * 00005 * Copyright (C) 2005 Eminence Technology Pty Ltd 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You can view the GNU Lesser General Public Licence at 00018 * http://www.gnu.org/licenses/lgpl.html or you can write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * Eminence Technology Pty Ltd can be contacted by writing to 00022 * Eminence Technology, PO Box 118, Moorooka QLD 4105, Australia. 00023 * Alternatively, you may email opensource [at] eminence [dot] com [dot] au 00024 * __END_COPYRIGHT 00025 */ 00026 00027 #ifndef __SIMPLEDB_QUERY_H_ 00028 #define __SIMPLEDB_QUERY_H_ 1 00029 00030 #include <sql.h> 00031 #include <sqltypes.h> 00032 #include <string> 00033 #include "Column.h" 00034 #include "Exception.h" 00035 00036 namespace SimpleDB { 00037 00042 class Query { 00043 00044 public: 00045 00049 class Exception : public SimpleDB::Exception { 00050 public: 00051 Exception(const std::string& message) : SimpleDB::Exception(message) {}; 00052 }; 00053 00058 Query(SQLHDBC connectionHandle); 00059 00062 ~Query(); 00063 00069 void bind(Column* columns[], int numberColumns); 00070 00071 00080 void execute(const std::string& sqlQuery); 00081 00086 bool fetchRow(); 00087 00088 protected: 00089 00092 SQLHSTMT statementHandle; 00093 00096 SQLHDBC connectionHandle; 00097 }; 00098 00099 } 00100 00101 #endif