]> git.stg.codes - stg.git/blobdiff - stglibs/ibpp.lib/statement.cpp
Port to CMake, get rid of os_int.h.
[stg.git] / stglibs / ibpp.lib / statement.cpp
diff --git a/stglibs/ibpp.lib/statement.cpp b/stglibs/ibpp.lib/statement.cpp
deleted file mode 100644 (file)
index e2271cf..0000000
+++ /dev/null
@@ -1,1307 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     File    : $Id: statement.cpp,v 1.2 2009/03/19 20:00:28 faust Exp $\r
-//     Subject : IBPP, Service class implementation\r
-//\r
-///////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     (C) Copyright 2000-2006 T.I.P. Group S.A. and the IBPP Team (www.ibpp.org)\r
-//\r
-//     The contents of this file are subject to the IBPP License (the "License");\r
-//     you may not use this file except in compliance with the License.  You may\r
-//     obtain a copy of the License at http://www.ibpp.org or in the 'license.txt'\r
-//     file which must have been distributed along with this file.\r
-//\r
-//     This software, distributed under the License, is distributed on an "AS IS"\r
-//     basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the\r
-//     License for the specific language governing rights and limitations\r
-//     under the License.\r
-//\r
-///////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     COMMENTS\r
-//     * Tabulations should be set every four characters when editing this file.\r
-//\r
-///////////////////////////////////////////////////////////////////////////////\r
-\r
-#ifdef _MSC_VER\r
-#pragma warning(disable: 4786 4996)\r
-#ifndef _DEBUG\r
-#pragma warning(disable: 4702)\r
-#endif\r
-#endif\r
-\r
-#include "_ibpp.h"\r
-\r
-#ifdef HAS_HDRSTOP\r
-#pragma hdrstop\r
-#endif\r
-\r
-#include <cstring>\r
-\r
-using namespace ibpp_internals;\r
-\r
-//     (((((((( OBJECT INTERFACE IMPLEMENTATION ))))))))\r
-\r
-void StatementImpl::Prepare(const std::string& sql)\r
-{\r
-       if (mDatabase == 0)\r
-               throw LogicExceptionImpl("Statement::Prepare", _("An IDatabase must be attached."));\r
-       if (mDatabase->GetHandle() == 0)\r
-               throw LogicExceptionImpl("Statement::Prepare", _("IDatabase must be connected."));\r
-       if (mTransaction == 0)\r
-               throw LogicExceptionImpl("Statement::Prepare", _("An ITransaction must be attached."));\r
-       if (mTransaction->GetHandle() == 0)\r
-               throw LogicExceptionImpl("Statement::Prepare", _("ITransaction must be started."));\r
-       if (sql.empty())\r
-               throw LogicExceptionImpl("Statement::Prepare", _("SQL statement can't be 0."));\r
-\r
-       // Saves the SQL sentence, only for reporting reasons in case of errors\r
-       mSql = sql;\r
-\r
-       IBS status;\r
-\r
-       // Free all resources currently attached to this Statement, then allocate\r
-       // a new statement descriptor.\r
-       Close();\r
-       (*gds.Call()->m_dsql_allocate_statement)(status.Self(), mDatabase->GetHandlePtr(), &mHandle);\r
-       if (status.Errors())\r
-               throw SQLExceptionImpl(status, "Statement::Prepare",\r
-                       _("isc_dsql_allocate_statement failed"));\r
-\r
-       // Empirical estimate of parameters count and output columns count.\r
-       // This is by far not an exact estimation, which would require parsing the\r
-       // SQL statement. If the SQL statement contains '?' and ',' in string\r
-       // constants, this count will obviously be wrong, but it will be exagerated.\r
-       // It won't hurt. We just try to not have to re-allocate those descriptors later.\r
-       // So we prefer to get them a little bit larger than needed than the other way.\r
-       int16_t inEstimate = 0;\r
-       int16_t outEstimate = 1;\r
-       for (size_t i = 0; i < strlen(sql.c_str()); i++)\r
-       {\r
-               if (sql[i] == '?') ++inEstimate;\r
-               if (sql[i] == ',') ++outEstimate;\r
-       }\r
-\r
-       /*\r
-       DebugStream()<< "Prepare(\""<< sql<< "\")"<< fds;\r
-       DebugStream()<< _("Estimation: ")<< inEstimate<< _(" IN parameters and ")\r
-                       << outEstimate<< _(" OUT columns")<< fds;\r
-       */\r
-\r
-       // Allocates output descriptor and prepares the statement\r
-       mOutRow = new RowImpl(mDatabase->Dialect(), outEstimate, mDatabase, mTransaction);\r
-       mOutRow->AddRef();\r
-\r
-       status.Reset();\r
-       (*gds.Call()->m_dsql_prepare)(status.Self(), mTransaction->GetHandlePtr(),\r
-               &mHandle, (short)sql.length(), const_cast<char*>(sql.c_str()),\r
-                       short(mDatabase->Dialect()), mOutRow->Self());\r
-       if (status.Errors())\r
-       {\r
-               Close();\r
-               std::string context = "Statement::Prepare( ";\r
-               context.append(mSql).append(" )");\r
-               throw SQLExceptionImpl(status, context.c_str(),\r
-                       _("isc_dsql_prepare failed"));\r
-       }\r
-\r
-       // Read what kind of statement was prepared\r
-       status.Reset();\r
-       char itemsReq[] = {isc_info_sql_stmt_type};\r
-       char itemsRes[8];\r
-       (*gds.Call()->m_dsql_sql_info)(status.Self(), &mHandle, 1, itemsReq,\r
-               sizeof(itemsRes), itemsRes);\r
-       if (status.Errors())\r
-       {\r
-               Close();\r
-               throw SQLExceptionImpl(status, "Statement::Prepare",\r
-                       _("isc_dsql_sql_info failed"));\r
-       }\r
-       if (itemsRes[0] == isc_info_sql_stmt_type)\r
-       {\r
-               switch (itemsRes[3])\r
-               {\r
-                       case isc_info_sql_stmt_select :         mType = IBPP::stSelect; break;\r
-                       case isc_info_sql_stmt_insert :         mType = IBPP::stInsert; break;\r
-                       case isc_info_sql_stmt_update :         mType = IBPP::stUpdate; break;\r
-                       case isc_info_sql_stmt_delete :         mType = IBPP::stDelete; break;\r
-                       case isc_info_sql_stmt_ddl :            mType = IBPP::stDDL; break;\r
-                       case isc_info_sql_stmt_exec_procedure : mType = IBPP::stExecProcedure; break;\r
-                       case isc_info_sql_stmt_select_for_upd : mType = IBPP::stSelectUpdate; break;\r
-                       case isc_info_sql_stmt_set_generator :  mType = IBPP::stSetGenerator; break;\r
-                       case isc_info_sql_stmt_savepoint :      mType = IBPP::stSavePoint; break;\r
-                       default : mType = IBPP::stUnsupported;\r
-               }\r
-       }\r
-       if (mType == IBPP::stUnknown || mType == IBPP::stUnsupported)\r
-       {\r
-               Close();\r
-               throw LogicExceptionImpl("Statement::Prepare",\r
-                       _("Unknown or unsupported statement type"));\r
-       }\r
-\r
-       if (mOutRow->Columns() == 0)\r
-       {\r
-               // Get rid of the output descriptor, if it wasn't required (no output)\r
-               mOutRow->Release();\r
-               mOutRow = 0;\r
-               /*\r
-               DebugStream()<< _("Dropped output descriptor which was not required")<< fds;\r
-               */\r
-       }\r
-       else if (mOutRow->Columns() > mOutRow->AllocatedSize())\r
-       {\r
-               // Resize the output descriptor (which is too small).\r
-               // The statement does not need to be prepared again, though the\r
-               // output columns must be described again.\r
-\r
-               /*\r
-               DebugStream()<< _("Resize output descriptor from ")\r
-                       << mOutRow->AllocatedSize()<< _(" to ")<< mOutRow->Columns()<< fds;\r
-               */\r
-\r
-               mOutRow->Resize(mOutRow->Columns());\r
-               status.Reset();\r
-               (*gds.Call()->m_dsql_describe)(status.Self(), &mHandle, 1, mOutRow->Self());\r
-               if (status.Errors())\r
-               {\r
-                       Close();\r
-                       throw SQLExceptionImpl(status, "Statement::Prepare",\r
-                               _("isc_dsql_describe failed"));\r
-               }\r
-       }\r
-\r
-       if (inEstimate > 0)\r
-       {\r
-               // Ready an input descriptor\r
-               mInRow = new RowImpl(mDatabase->Dialect(), inEstimate, mDatabase, mTransaction);\r
-               mInRow->AddRef();\r
-\r
-               status.Reset();\r
-               (*gds.Call()->m_dsql_describe_bind)(status.Self(), &mHandle, 1, mInRow->Self());\r
-               if (status.Errors())\r
-               {\r
-                       Close();\r
-                       throw SQLExceptionImpl(status, "Statement::Prepare",\r
-                               _("isc_dsql_describe_bind failed"));\r
-               }\r
-\r
-               if (mInRow->Columns() == 0)\r
-               {\r
-                       // Get rid of the input descriptor, if it wasn't required (no parameters)\r
-                       mInRow->Release();\r
-                       mInRow = 0;\r
-                       /*\r
-                       DebugStream()<< _("Dropped input descriptor which was not required")<< fds;\r
-                       */\r
-               }\r
-               else if (mInRow->Columns() > mInRow->AllocatedSize())\r
-               {\r
-                       // Resize the input descriptor (which is too small).\r
-                       // The statement does not need to be prepared again, though the\r
-                       // parameters must be described again.\r
-\r
-                       /*\r
-                       DebugStream()<< _("Resize input descriptor from ")\r
-                                       << mInRow->AllocatedSize()<< _(" to ")\r
-                                       << mInRow->Columns()<< fds;\r
-                       */\r
-\r
-                       mInRow->Resize(mInRow->Columns());\r
-                       status.Reset();\r
-                       (*gds.Call()->m_dsql_describe_bind)(status.Self(), &mHandle, 1, mInRow->Self());\r
-                       if (status.Errors())\r
-                       {\r
-                               Close();\r
-                               throw SQLExceptionImpl(status, "Statement::Prepare",\r
-                                       _("isc_dsql_describe_bind failed"));\r
-                       }\r
-               }\r
-       }\r
-\r
-       // Allocates variables of the input descriptor\r
-       if (mInRow != 0)\r
-       {\r
-               // Turn on 'can be NULL' on each input parameter\r
-               for (int i = 0; i < mInRow->Columns(); i++)\r
-               {\r
-                       XSQLVAR* var = &(mInRow->Self()->sqlvar[i]);\r
-                       if (! (var->sqltype & 1)) var->sqltype += short(1);\r
-               }\r
-               mInRow->AllocVariables();\r
-       }\r
-\r
-       // Allocates variables of the output descriptor\r
-       if (mOutRow != 0) mOutRow->AllocVariables();\r
-}\r
-\r
-void StatementImpl::Plan(std::string& plan)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Plan", _("No statement has been prepared."));\r
-       if (mDatabase == 0)\r
-               throw LogicExceptionImpl("Statement::Plan", _("A Database must be attached."));\r
-       if (mDatabase->GetHandle() == 0)\r
-               throw LogicExceptionImpl("Statement::Plan", _("Database must be connected."));\r
-\r
-       IBS status;\r
-       RB result(4096);\r
-       char itemsReq[] = {isc_info_sql_get_plan};\r
-\r
-       (*gds.Call()->m_dsql_sql_info)(status.Self(), &mHandle, 1, itemsReq,\r
-                                                                  result.Size(), result.Self());\r
-       if (status.Errors()) throw SQLExceptionImpl(status,\r
-                                                               "Statement::Plan", _("isc_dsql_sql_info failed."));\r
-\r
-       result.GetString(isc_info_sql_get_plan, plan);\r
-       if (plan[0] == '\n') plan.erase(0, 1);\r
-}\r
-\r
-void StatementImpl::Execute(const std::string& sql)\r
-{\r
-       if (! sql.empty()) Prepare(sql);\r
-\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Execute",\r
-                       _("No statement has been prepared."));\r
-\r
-       // Check that a value has been set for each input parameter\r
-       if (mInRow != 0 && mInRow->MissingValues())\r
-               throw LogicExceptionImpl("Statement::Execute",\r
-                       _("All parameters must be specified."));\r
-\r
-       CursorFree();   // Free a previous 'cursor' if any\r
-\r
-       IBS status;\r
-       if (mType == IBPP::stSelect)\r
-       {\r
-               // Could return a result set (none, single or multi rows)\r
-               (*gds.Call()->m_dsql_execute)(status.Self(), mTransaction->GetHandlePtr(),\r
-                       &mHandle, 1, mInRow == 0 ? 0 : mInRow->Self());\r
-               if (status.Errors())\r
-               {\r
-                       //Close();      Commented because Execute error should not free the statement\r
-                       std::string context = "Statement::Execute( ";\r
-                       context.append(mSql).append(" )");\r
-                       throw SQLExceptionImpl(status, context.c_str(),\r
-                               _("isc_dsql_execute failed"));\r
-               }\r
-               if (mOutRow != 0)\r
-               {\r
-                       mResultSetAvailable = true;\r
-                       mCursorOpened = true;\r
-               }\r
-       }\r
-       else\r
-       {\r
-               // Should return at most a single row\r
-               (*gds.Call()->m_dsql_execute2)(status.Self(), mTransaction->GetHandlePtr(),\r
-                       &mHandle, 1, mInRow == 0 ? 0 : mInRow->Self(),\r
-                       mOutRow == 0 ? 0 : mOutRow->Self());\r
-               if (status.Errors())\r
-               {\r
-                       //Close();      Commented because Execute error should not free the statement\r
-                       std::string context = "Statement::Execute( ";\r
-                       context.append(mSql).append(" )");\r
-                       throw SQLExceptionImpl(status, context.c_str(),\r
-                               _("isc_dsql_execute2 failed"));\r
-               }\r
-       }\r
-}\r
-\r
-void StatementImpl::CursorExecute(const std::string& cursor, const std::string& sql)\r
-{\r
-       if (cursor.empty())\r
-               throw LogicExceptionImpl("Statement::CursorExecute", _("Cursor name can't be 0."));\r
-\r
-       if (! sql.empty()) Prepare(sql);\r
-\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::CursorExecute", _("No statement has been prepared."));\r
-       if (mType != IBPP::stSelectUpdate)\r
-               throw LogicExceptionImpl("Statement::CursorExecute", _("Statement must be a SELECT FOR UPDATE."));\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::CursorExecute", _("Statement would return no rows."));\r
-\r
-       // Check that a value has been set for each input parameter\r
-       if (mInRow != 0 && mInRow->MissingValues())\r
-               throw LogicExceptionImpl("Statement::CursorExecute",\r
-                       _("All parameters must be specified."));\r
-\r
-       CursorFree();   // Free a previous 'cursor' if any\r
-\r
-       IBS status;\r
-       (*gds.Call()->m_dsql_execute)(status.Self(), mTransaction->GetHandlePtr(),\r
-               &mHandle, 1, mInRow == 0 ? 0 : mInRow->Self());\r
-       if (status.Errors())\r
-       {\r
-               //Close();      Commented because Execute error should not free the statement\r
-               std::string context = "Statement::CursorExecute( ";\r
-               context.append(mSql).append(" )");\r
-               throw SQLExceptionImpl(status, context.c_str(),\r
-                       _("isc_dsql_execute failed"));\r
-       }\r
-\r
-       status.Reset();\r
-       (*gds.Call()->m_dsql_set_cursor_name)(status.Self(), &mHandle, const_cast<char*>(cursor.c_str()), 0);\r
-       if (status.Errors())\r
-       {\r
-               //Close();      Commented because Execute error should not free the statement\r
-               throw SQLExceptionImpl(status, "Statement::CursorExecute",\r
-                       _("isc_dsql_set_cursor_name failed"));\r
-       }\r
-\r
-       mResultSetAvailable = true;\r
-       mCursorOpened = true;\r
-}\r
-\r
-void StatementImpl::ExecuteImmediate(const std::string& sql)\r
-{\r
-       if (mDatabase == 0)\r
-               throw LogicExceptionImpl("Statement::ExecuteImmediate", _("An IDatabase must be attached."));\r
-       if (mDatabase->GetHandle() == 0)\r
-               throw LogicExceptionImpl("Statement::ExecuteImmediate", _("IDatabase must be connected."));\r
-       if (mTransaction == 0)\r
-               throw LogicExceptionImpl("Statement::ExecuteImmediate", _("An ITransaction must be attached."));\r
-       if (mTransaction->GetHandle() == 0)\r
-               throw LogicExceptionImpl("Statement::ExecuteImmediate", _("ITransaction must be started."));\r
-       if (sql.empty())\r
-               throw LogicExceptionImpl("Statement::ExecuteImmediate", _("SQL statement can't be 0."));\r
-\r
-       IBS status;\r
-       Close();\r
-    (*gds.Call()->m_dsql_execute_immediate)(status.Self(), mDatabase->GetHandlePtr(),\r
-       mTransaction->GetHandlePtr(), 0, const_cast<char*>(sql.c_str()),\r
-               short(mDatabase->Dialect()), 0);\r
-    if (status.Errors())\r
-       {\r
-               std::string context = "Statement::ExecuteImmediate( ";\r
-               context.append(sql).append(" )");\r
-               throw SQLExceptionImpl(status, context.c_str(),\r
-                       _("isc_dsql_execute_immediate failed"));\r
-       }\r
-}\r
-\r
-int StatementImpl::AffectedRows()\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::AffectedRows", _("No statement has been prepared."));\r
-       if (mDatabase == 0)\r
-               throw LogicExceptionImpl("Statement::AffectedRows", _("A Database must be attached."));\r
-       if (mDatabase->GetHandle() == 0)\r
-               throw LogicExceptionImpl("Statement::AffectedRows", _("Database must be connected."));\r
-\r
-       int count;\r
-       IBS status;\r
-       RB result;\r
-       char itemsReq[] = {isc_info_sql_records};\r
-\r
-       (*gds.Call()->m_dsql_sql_info)(status.Self(), &mHandle, 1, itemsReq,\r
-               result.Size(), result.Self());\r
-       if (status.Errors()) throw SQLExceptionImpl(status,\r
-                       "Statement::AffectedRows", _("isc_dsql_sql_info failed."));\r
-\r
-       if (mType == IBPP::stInsert)\r
-                       count = result.GetValue(isc_info_sql_records, isc_info_req_insert_count);\r
-       else if (mType == IBPP::stUpdate)\r
-                       count = result.GetValue(isc_info_sql_records, isc_info_req_update_count);\r
-       else if (mType == IBPP::stDelete)\r
-                       count = result.GetValue(isc_info_sql_records, isc_info_req_delete_count);\r
-       else if (mType == IBPP::stSelect)\r
-                       count = result.GetValue(isc_info_sql_records, isc_info_req_select_count);\r
-       else    count = 0;      // Returns zero count for unknown cases\r
-\r
-       return count;\r
-}\r
-\r
-bool StatementImpl::Fetch()\r
-{\r
-       if (! mResultSetAvailable)\r
-               throw LogicExceptionImpl("Statement::Fetch",\r
-                       _("No statement has been executed or no result set available."));\r
-\r
-       IBS status;\r
-       ISC_STATUS code = (*gds.Call()->m_dsql_fetch)(status.Self(), &mHandle, 1, mOutRow->Self());\r
-       if (code == 100)        // This special code means "no more rows"\r
-       {\r
-               mResultSetAvailable = false;\r
-               // Oddly enough, fetching rows up to the last one seems to open\r
-               // an 'implicit' cursor that needs to be closed.\r
-               mCursorOpened = true;\r
-               CursorFree();   // Free the explicit or implicit cursor/result-set\r
-               return false;\r
-       }\r
-       if (status.Errors())\r
-       {\r
-               Close();\r
-               throw SQLExceptionImpl(status, "Statement::Fetch",\r
-                       _("isc_dsql_fetch failed."));\r
-       }\r
-\r
-       return true;\r
-}\r
-\r
-bool StatementImpl::Fetch(IBPP::Row& row)\r
-{\r
-       if (! mResultSetAvailable)\r
-               throw LogicExceptionImpl("Statement::Fetch(row)",\r
-                       _("No statement has been executed or no result set available."));\r
-\r
-       RowImpl* rowimpl = new RowImpl(*mOutRow);\r
-       row = rowimpl;\r
-\r
-       IBS status;\r
-       ISC_STATUS code = (*gds.Call()->m_dsql_fetch)(status.Self(), &mHandle, 1,\r
-                                       rowimpl->Self());\r
-       if (code == 100)        // This special code means "no more rows"\r
-       {\r
-               mResultSetAvailable = false;\r
-               // Oddly enough, fetching rows up to the last one seems to open\r
-               // an 'implicit' cursor that needs to be closed.\r
-               mCursorOpened = true;\r
-               CursorFree();   // Free the explicit or implicit cursor/result-set\r
-               row.clear();\r
-               return false;\r
-       }\r
-       if (status.Errors())\r
-       {\r
-               Close();\r
-               row.clear();\r
-               throw SQLExceptionImpl(status, "Statement::Fetch(row)",\r
-                       _("isc_dsql_fetch failed."));\r
-       }\r
-\r
-       return true;\r
-}\r
-\r
-void StatementImpl::Close()\r
-{\r
-       // Free all statement resources.\r
-       // Used before preparing a new statement or from destructor.\r
-\r
-       if (mInRow != 0) { mInRow->Release(); mInRow = 0; }\r
-       if (mOutRow != 0) { mOutRow->Release(); mOutRow = 0; }\r
-\r
-       mResultSetAvailable = false;\r
-       mCursorOpened = false;\r
-       mType = IBPP::stUnknown;\r
-\r
-       if (mHandle != 0)\r
-       {\r
-               IBS status;\r
-               (*gds.Call()->m_dsql_free_statement)(status.Self(), &mHandle, DSQL_drop);\r
-               mHandle = 0;\r
-               if (status.Errors())\r
-                       throw SQLExceptionImpl(status, "Statement::Close(DSQL_drop)",\r
-                               _("isc_dsql_free_statement failed."));\r
-       }\r
-}\r
-\r
-void StatementImpl::SetNull(int param)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::SetNull", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::SetNull", _("The statement does not take parameters."));\r
-\r
-       mInRow->SetNull(param);\r
-}\r
-\r
-void StatementImpl::Set(int param, bool value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[bool]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[bool]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, const char* cstring)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[char*]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[char*]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, cstring);\r
-}\r
-\r
-void StatementImpl::Set(int param, const void* bindata, int len)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[void*]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[void*]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, bindata, len);\r
-}\r
-\r
-void StatementImpl::Set(int param, const std::string& s)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[string]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[string]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, s);\r
-}\r
-\r
-void StatementImpl::Set(int param, int16_t value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[int16_t]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[int16_t]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, int32_t value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[int32_t]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[int32_t]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, int64_t value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[int64_t]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[int64_t]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, float value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[float]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[float]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, double value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[double]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[double]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, const IBPP::Timestamp& value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Timestamp]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Timestamp]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, const IBPP::Date& value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Date]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Date]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, const IBPP::Time& value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Time]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Time]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-\r
-void StatementImpl::Set(int param, const IBPP::Blob& blob)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Blob]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Blob]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, blob);\r
-}\r
-\r
-void StatementImpl::Set(int param, const IBPP::Array& array)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Array]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Array]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, array);\r
-}\r
-\r
-void StatementImpl::Set(int param, const IBPP::DBKey& key)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[DBKey]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[DBKey]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, key);\r
-}\r
-\r
-/*\r
-void StatementImpl::Set(int param, const IBPP::Value& value)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Value]", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Set[Value]", _("The statement does not take parameters."));\r
-\r
-       mInRow->Set(param, value);\r
-}\r
-*/\r
-\r
-bool StatementImpl::IsNull(int column)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::IsNull", _("The row is not initialized."));\r
-\r
-       return mOutRow->IsNull(column);\r
-}\r
-\r
-bool StatementImpl::Get(int column, bool* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(column, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, bool& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, char* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, void* bindata, int& userlen)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, bindata, userlen);\r
-}\r
-\r
-bool StatementImpl::Get(int column, std::string& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, int16_t* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(column, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, int16_t& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, int32_t* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(column, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, int32_t& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, int64_t* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(column, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, int64_t& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, float* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(column, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, float& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, double* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(column, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, double& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(int column, IBPP::Timestamp& timestamp)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, timestamp);\r
-}\r
-\r
-bool StatementImpl::Get(int column, IBPP::Date& date)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, date);\r
-}\r
-\r
-bool StatementImpl::Get(int column, IBPP::Time& time)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, time);\r
-}\r
-\r
-bool StatementImpl::Get(int column, IBPP::Blob& blob)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, blob);\r
-}\r
-\r
-bool StatementImpl::Get(int column, IBPP::DBKey& key)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, key);\r
-}\r
-\r
-bool StatementImpl::Get(int column, IBPP::Array& array)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column, array);\r
-}\r
-\r
-/*\r
-const IBPP::Value StatementImpl::Get(int column)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(column);\r
-}\r
-*/\r
-\r
-bool StatementImpl::IsNull(const std::string& name)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::IsNull", _("The row is not initialized."));\r
-\r
-       return mOutRow->IsNull(name);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, bool* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(name, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, bool& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, char* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get[char*]", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, void* retvalue, int& count)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get[void*,int]", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue, count);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, std::string& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::GetString", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, int16_t* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(name, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, int16_t& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, int32_t* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(name, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, int32_t& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, int64_t* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(name, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, int64_t& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, float* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(name, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, float& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, double* retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-       if (retvalue == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("Null pointer detected"));\r
-\r
-       return mOutRow->Get(name, *retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, double& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, IBPP::Timestamp& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, IBPP::Date& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, IBPP::Time& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string&name, IBPP::Blob& retblob)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retblob);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, IBPP::DBKey& retvalue)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retvalue);\r
-}\r
-\r
-bool StatementImpl::Get(const std::string& name, IBPP::Array& retarray)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name, retarray);\r
-}\r
-\r
-/*\r
-const IBPP::Value StatementImpl::Get(const std::string& name)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Get", _("The row is not initialized."));\r
-\r
-       return mOutRow->Get(name);\r
-}\r
-*/\r
-\r
-int StatementImpl::Columns()\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Columns", _("The row is not initialized."));\r
-\r
-       return mOutRow->Columns();\r
-}\r
-\r
-int StatementImpl::ColumnNum(const std::string& name)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnNum", _("The row is not initialized."));\r
-\r
-       return mOutRow->ColumnNum(name);\r
-}\r
-\r
-const char* StatementImpl::ColumnName(int varnum)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Columns", _("The row is not initialized."));\r
-\r
-       return mOutRow->ColumnName(varnum);\r
-}\r
-\r
-const char* StatementImpl::ColumnAlias(int varnum)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Columns", _("The row is not initialized."));\r
-\r
-       return mOutRow->ColumnAlias(varnum);\r
-}\r
-\r
-const char* StatementImpl::ColumnTable(int varnum)\r
-{\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::Columns", _("The row is not initialized."));\r
-\r
-       return mOutRow->ColumnTable(varnum);\r
-}\r
-\r
-IBPP::SDT StatementImpl::ColumnType(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnType", _("No statement has been prepared."));\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnType", _("The statement does not return results."));\r
-\r
-    return mOutRow->ColumnType(varnum);\r
-}\r
-\r
-int StatementImpl::ColumnSubtype(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnSubtype", _("No statement has been prepared."));\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnSubtype", _("The statement does not return results."));\r
-\r
-    return mOutRow->ColumnSubtype(varnum);\r
-}\r
-\r
-int StatementImpl::ColumnSize(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnSize", _("No statement has been prepared."));\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnSize", _("The row is not initialized."));\r
-\r
-       return mOutRow->ColumnSize(varnum);\r
-}\r
-\r
-int StatementImpl::ColumnScale(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnScale", _("No statement has been prepared."));\r
-       if (mOutRow == 0)\r
-               throw LogicExceptionImpl("Statement::ColumnScale", _("The row is not initialized."));\r
-\r
-       return mOutRow->ColumnScale(varnum);\r
-}\r
-\r
-int StatementImpl::Parameters()\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::Parameters", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::Parameters", _("The statement uses no parameters."));\r
-\r
-       return mInRow->Columns();\r
-}\r
-\r
-IBPP::SDT StatementImpl::ParameterType(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterType", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterType", _("The statement uses no parameters."));\r
-\r
-    return mInRow->ColumnType(varnum);\r
-}\r
-\r
-int StatementImpl::ParameterSubtype(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterSubtype", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterSubtype", _("The statement uses no parameters."));\r
-\r
-    return mInRow->ColumnSubtype(varnum);\r
-}\r
-\r
-int StatementImpl::ParameterSize(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterSize", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterSize", _("The statement uses no parameters."));\r
-\r
-       return mInRow->ColumnSize(varnum);\r
-}\r
-\r
-int StatementImpl::ParameterScale(int varnum)\r
-{\r
-       if (mHandle == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterScale", _("No statement has been prepared."));\r
-       if (mInRow == 0)\r
-               throw LogicExceptionImpl("Statement::ParameterScale", _("The statement uses no parameters."));\r
-\r
-       return mInRow->ColumnScale(varnum);\r
-}\r
-\r
-IBPP::Database StatementImpl::DatabasePtr() const\r
-{\r
-       return mDatabase;\r
-}\r
-\r
-IBPP::Transaction StatementImpl::TransactionPtr() const\r
-{\r
-       return mTransaction;\r
-}\r
-\r
-IBPP::IStatement* StatementImpl::AddRef()\r
-{\r
-       ASSERTION(mRefCount >= 0);\r
-       ++mRefCount;\r
-\r
-       return this;\r
-}\r
-\r
-void StatementImpl::Release()\r
-{\r
-       // Release cannot throw, except in DEBUG builds on assertion\r
-       ASSERTION(mRefCount >= 0);\r
-       --mRefCount;\r
-       try { if (mRefCount <= 0) delete this; }\r
-               catch (...) { }\r
-}\r
-\r
-//     (((((((( OBJECT INTERNAL METHODS ))))))))\r
-\r
-void StatementImpl::AttachDatabaseImpl(DatabaseImpl* database)\r
-{\r
-       if (database == 0)\r
-               throw LogicExceptionImpl("Statement::AttachDatabase",\r
-                       _("Can't attach a 0 IDatabase object."));\r
-\r
-       if (mDatabase != 0) mDatabase->DetachStatementImpl(this);\r
-       mDatabase = database;\r
-       mDatabase->AttachStatementImpl(this);\r
-}\r
-\r
-void StatementImpl::DetachDatabaseImpl()\r
-{\r
-       if (mDatabase == 0) return;\r
-\r
-       Close();\r
-       mDatabase->DetachStatementImpl(this);\r
-       mDatabase = 0;\r
-}\r
-\r
-void StatementImpl::AttachTransactionImpl(TransactionImpl* transaction)\r
-{\r
-       if (transaction == 0)\r
-               throw LogicExceptionImpl("Statement::AttachTransaction",\r
-                       _("Can't attach a 0 ITransaction object."));\r
-\r
-       if (mTransaction != 0) mTransaction->DetachStatementImpl(this);\r
-       mTransaction = transaction;\r
-       mTransaction->AttachStatementImpl(this);\r
-}\r
-\r
-void StatementImpl::DetachTransactionImpl()\r
-{\r
-       if (mTransaction == 0) return;\r
-\r
-       Close();\r
-       mTransaction->DetachStatementImpl(this);\r
-       mTransaction = 0;\r
-}\r
-\r
-void StatementImpl::CursorFree()\r
-{\r
-       if (mCursorOpened)\r
-       {\r
-               mCursorOpened = false;\r
-               if (mHandle != 0)\r
-               {\r
-                       IBS status;\r
-                       (*gds.Call()->m_dsql_free_statement)(status.Self(), &mHandle, DSQL_close);\r
-                       if (status.Errors())\r
-                               throw SQLExceptionImpl(status, "StatementImpl::CursorFree(DSQL_close)",\r
-                                       _("isc_dsql_free_statement failed."));\r
-               }\r
-       }\r
-}\r
-\r
-StatementImpl::StatementImpl(DatabaseImpl* database, TransactionImpl* transaction,\r
-       const std::string& sql)\r
-       : mRefCount(0), mHandle(0), mDatabase(0), mTransaction(0),\r
-       mInRow(0), mOutRow(0),\r
-       mResultSetAvailable(false), mCursorOpened(false), mType(IBPP::stUnknown)\r
-{\r
-       AttachDatabaseImpl(database);\r
-       if (transaction != 0) AttachTransactionImpl(transaction);\r
-       if (! sql.empty()) Prepare(sql);\r
-}\r
-\r
-StatementImpl::~StatementImpl()\r
-{\r
-       try { Close(); }\r
-               catch (...) { }\r
-       try { if (mTransaction != 0) mTransaction->DetachStatementImpl(this); }\r
-               catch (...) { }\r
-       try { if (mDatabase != 0) mDatabase->DetachStatementImpl(this); }\r
-               catch (...) { }\r
-}\r
-\r
-//\r
-//     EOF\r
-//\r