SQLQuery.h++

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002    commonc++ - A C++ Common Class Library
00003    Copyright (C) 2005-2012  Mark A Lindner
00004 
00005    This file is part of commonc++.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 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    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public
00018    License along with this library; if not, write to the Free
00019    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020    ---------------------------------------------------------------------------
00021 */
00022 
00023 #ifndef __ccxx_SQLQuery_hxx
00024 #define __ccxx_SQLQuery_hxx
00025 
00026 #include <commonc++/Common.h++>
00027 #include <commonc++/Blob.h++>
00028 #include <commonc++/InterruptedException.h++>
00029 #include <commonc++/SQLException.h++>
00030 #include <commonc++/String.h++>
00031 #include <commonc++/Variant.h++>
00032 
00033 namespace ccxx {
00034 
00035 class SQLDatabase; // fwd decl
00036 class SQLPrivate; // fwd decl
00037 
00057 class COMMONCPPDB_API SQLQuery
00058 {
00059   friend class SQLDatabase;
00060 
00061   public:
00062 
00064   ~SQLQuery() throw();
00065 
00070   void reset() throw(SQLException);
00071 
00077   String toSQL() throw(SQLException);
00078 
00085   void bind(uint_t index) throw(SQLException);
00086 
00092   void bind(const String &name) throw(SQLException);
00093 
00101   void bind(uint_t index, int value) throw(SQLException);
00102 
00109   void bind(const String &name, int value) throw(SQLException);
00110 
00119   void bind(uint_t index, const int64_t &value) throw(SQLException);
00120 
00128   void bind(const String &name, const int64_t &value) throw(SQLException);
00129 
00138   void bind(uint_t index, const double &value) throw(SQLException);
00139 
00147   void bind(const String &name, const double &value) throw(SQLException);
00148 
00156   void bind(uint_t index, const String &value) throw(SQLException);
00157 
00164   void bind(const String &name, const String &value) throw(SQLException);
00165 
00173   void bind(uint_t index, const char *value) throw(SQLException);
00174 
00181   void bind(const String &name, const char *value) throw(SQLException);
00182 
00191   void bind(uint_t index, const Blob &value) throw(SQLException);
00192 
00199   void bind(const String &name, const Blob &value) throw(SQLException);
00200 
00205   void clear() throw(SQLException);
00206 
00211   uint_t getParameterCount() throw(SQLException);
00212 
00219   void execute() throw(SQLException, InterruptedException);
00220 
00231   bool next() throw(SQLException, InterruptedException, TimeoutException);
00232 
00238   uint_t getColumnCount() throw(SQLException);
00239 
00247   Variant getColumnValue(uint_t column) throw(SQLException);
00248 
00255   String getColumnName(uint_t column) throw(SQLException);
00256 
00263   String getAliasedColumnName(uint_t column) throw(SQLException);
00264 
00271   String getTableName(uint_t column) throw(SQLException);
00272 
00280   int getInt(uint_t column) throw(SQLException);
00281 
00289   int64_t getInt64(uint_t column) throw(SQLException);
00290 
00298   double getDouble(uint_t column) throw(SQLException);
00299 
00307   String getString(uint_t column) throw(SQLException);
00308 
00316   Blob getBlob(uint_t column) throw(SQLException);
00317 
00318   private:
00319 
00320   SQLQuery(const SQLPrivate &private_);
00321 
00322   void prime() throw(SQLException, InterruptedException);
00323   void _next() throw();
00324 
00325   String _getString(uint_t column) throw();
00326   Blob _getBlob(uint_t column) throw();
00327 
00328   SQLPrivate *_private;
00329   int _result;
00330   bool _primed;
00331   bool _hasData;
00332 
00333   CCXX_COPY_DECLS(SQLQuery);
00334 };
00335 
00336 } // namespace ccxx
00337 
00338 #endif // __ccxx_SQLQuery_hxx
Generated on Sat Nov 26 16:49:07 2011 for libcommonc++ by  doxygen 1.6.3