[go: up one dir, main page]

Menu

[r110]: / trunk / core / _ibs.cpp  Maximize  Restore  History

Download this file

109 lines (91 with data), 2.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
///////////////////////////////////////////////////////////////////////////////
//
// File : $Id$
// Subject : IBPP, internal Status class implementation
//
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2000-2007 T.I.P. Group S.A. and the IBPP Team (www.ibpp.org)
//
// The contents of this file are subject to the IBPP License (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at http://www.ibpp.org or in the 'license.txt'
// file which must have been distributed along with this file.
//
// This software, distributed under the License, is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
///////////////////////////////////////////////////////////////////////////////
//
// COMMENTS
// * Tabulations should be set every four characters when editing this file.
//
///////////////////////////////////////////////////////////////////////////////
#ifdef _MSC_VER
#pragma warning(disable: 4786 4996)
#ifndef _DEBUG
#pragma warning(disable: 4702)
#endif
#endif
#include "_ibpp.h"
#ifdef HAS_HDRSTOP
#pragma hdrstop
#endif
using namespace ibpp_internals;
int IBS::SqlCode() const
{
return (int)(mDriver->m_sqlcode)(&mVector[0]);
}
const char* IBS::ErrorMessage() const
{
char msg[1024];
ISC_LONG sqlcode;
if (! mMessage.empty()) return mMessage.c_str(); // If message compiled, returns it
// Compiles the message (SQL part)
std::ostringstream message;
sqlcode = (mDriver->m_sqlcode)(mVector);
if (sqlcode != -999)
{
(mDriver->m_sql_interprete)((short)sqlcode, msg, sizeof(msg));
message<< _("SQL Message : ")<< sqlcode<< "\n"<< msg<< "\n\n";
}
message<< _("Engine Code : ")<< EngineCode()<< "\n";
// Compiles the message (Engine part)
ISC_STATUS* error = &mVector[0];
try { (mDriver->m_interprete)(msg, &error); }
catch(...) { msg[0] = '\0'; }
message<< _("Engine Message :")<< "\n"<< msg;
try
{
while ((mDriver->m_interprete)(msg, &error))
message<< "\n"<< msg;
}
catch (...) { }
message<< "\n";
mMessage = message.str();
return mMessage.c_str();
}
void IBS::Reset()
{
for (int i = 0; i < 20; i++) mVector[i] = 0;
mMessage.erase();
}
IBS::IBS(DriverImpl* drv)
: mDriver(drv)
{
Reset();
}
IBS::~IBS()
{
}
/** Copy Constructor
*/
IBS::IBS(IBS& copied)
{
memcpy(mVector, copied.mVector, sizeof(mVector));
}
//
// EOF
//