freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Problem connecting to SQL server on linux
- From: Jeff Dahl <jddahl AT micron.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Problem connecting to SQL server on linux
- Date: Mon, 25 Sep 2006 13:46:12 -0600
Frederik Teerlinck wrote:
Isn't there a way to get more information back then just 'SQL_ERROR'?Here's my SQLException class:
#ifndef SQLEXCEPTION_H
#define SQLEXCEPTION_H
#include <string>
#include <stdexcept>
#include "sql.h"
#define MAX_MESSAGE_LEN 512
class SQLException : public exception
{
public:
SQLException( std::string = "" );
SQLException( SQLSMALLINT, SQLHANDLE );
~SQLException( ) throw( );
const char *what( ) const throw( );
protected:
std::string message;
};
#endif
// sqlexception.cpp
#include "sqlexception.h"
SQLException::SQLException( std::string m )
{
message = ( "SQLException: " + m );
}
SQLException::SQLException( SQLSMALLINT handleType, SQLHANDLE handle )
{
int i = 1;
short int msgLen;
unsigned char msg[MAX_MESSAGE_LEN];
SQLRETURN ret;
while(( ret = SQLGetDiagField( handleType, handle, i,
SQL_DIAG_MESSAGE_TEXT, msg, MAX_MESSAGE_LEN, &msgLen )) != SQL_NO_DATA )
{
if( i > 1 )
{
message += "\n\t";
}
message += (std::string)"SQLException: " + (char *)msg;
i++;
}
}
SQLException::~SQLException( ) throw( )
{
}
const char *SQLException::what( ) const throw( )
{
return message.c_str( );
}
HTH
-
[freetds] Problem connecting to SQL server on linux,
Frederik Teerlinck, 09/25/2006
-
Re: [freetds] Problem connecting to SQL server on linux,
Jeff Dahl, 09/25/2006
-
Re: [freetds] Problem connecting to SQL server on linux,
Frederik Teerlinck, 09/25/2006
- Re: [freetds] Problem connecting to SQL server on linux, Jeff Dahl, 09/25/2006
-
Re: [freetds] Problem connecting to SQL server on linux,
Frederik Teerlinck, 09/25/2006
- Re: [freetds] Problem connecting to SQL server on linux, IJ/ETH, 09/26/2006
- <Possible follow-up(s)>
-
Re: [freetds] Problem connecting to SQL server on linux,
Lowden, James K, 09/25/2006
-
Re: [freetds] Problem connecting to SQL server on linux,
Frederik Teerlinck, 09/26/2006
- Re: [freetds] Problem connecting to SQL server on linux, Frederik Teerlinck, 09/26/2006
-
Re: [freetds] Problem connecting to SQL server on linux,
Frederik Teerlinck, 09/26/2006
-
Re: [freetds] Problem connecting to SQL server on linux,
Lowden, James K, 09/26/2006
- Re: [freetds] Problem connecting to SQL server on linux, Frederik Teerlinck, 09/26/2006
-
Re: [freetds] Problem connecting to SQL server on linux,
Jeff Dahl, 09/25/2006
Archive powered by MHonArc 2.6.24.