]> git.stg.codes - stg.git/blobdiff - libs/ibpp/_ibs.cpp
Port to CMake, get rid of os_int.h.
[stg.git] / libs / ibpp / _ibs.cpp
diff --git a/libs/ibpp/_ibs.cpp b/libs/ibpp/_ibs.cpp
new file mode 100644 (file)
index 0000000..25e66bc
--- /dev/null
@@ -0,0 +1,109 @@
+///////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     File    : $Id: _ibs.cpp,v 1.2 2009/03/19 20:00:27 faust Exp $\r
+//     Subject : IBPP, internal Status 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
+int IBS::SqlCode() const\r
+{\r
+       return (int)(*gds.Call()->m_sqlcode)(&mVector[0]);\r
+}\r
+\r
+const char* IBS::ErrorMessage() const\r
+{\r
+       char msg[1024];\r
+       ISC_LONG sqlcode;\r
+\r
+       if (! mMessage.empty()) return mMessage.c_str();        // If message compiled, returns it\r
+\r
+       // Compiles the message (SQL part)\r
+       std::ostringstream message;\r
+       sqlcode = (*gds.Call()->m_sqlcode)(mVector);\r
+       if (sqlcode != -999)\r
+       {\r
+               (*gds.Call()->m_sql_interprete)((short)sqlcode, msg, sizeof(msg));\r
+               message<< _("SQL Message : ")<< sqlcode<< "\n"<< msg<< "\n\n";\r
+       }\r
+\r
+       message<< _("Engine Code    : ")<< EngineCode()<< "\n";\r
+\r
+       // Compiles the message (Engine part)\r
+       ISC_STATUS* error = &mVector[0];\r
+       try { (*gds.Call()->m_interprete)(msg, &error); }\r
+       catch(...) { msg[0] = '\0'; }\r
+       message<< _("Engine Message :")<< "\n"<< msg;\r
+       try\r
+       {\r
+               while ((*gds.Call()->m_interprete)(msg, &error))\r
+                       message<< "\n"<< msg;\r
+       }\r
+       catch (...) { }\r
+\r
+       message<< "\n";\r
+       mMessage = message.str();\r
+       return mMessage.c_str();\r
+}\r
+\r
+void IBS::Reset()\r
+{\r
+       for (int i = 0; i < 20; i++) mVector[i] = 0;\r
+       mMessage.erase();\r
+}\r
+\r
+IBS::IBS()\r
+{\r
+       Reset();\r
+}\r
+\r
+IBS::~IBS()\r
+{\r
+}\r
+\r
+/** Copy Constructor\r
+*/\r
+\r
+IBS::IBS(IBS& copied)\r
+{\r
+       memcpy(mVector, copied.mVector, sizeof(mVector));\r
+}\r
+\r
+//\r
+//     EOF\r
+//\r