openbsd-ports/devel/mysql++/patches/patch-sqlplusint_connection_cc
wilfried bf0e4b3714 a few gcc3 patches
also move the header files to ${LOCALBASE}/include/mysql++
2004-01-06 11:16:53 +00:00

171 lines
5.3 KiB
Plaintext

$OpenBSD: patch-sqlplusint_connection_cc,v 1.5 2004/01/06 11:16:53 wilfried Exp $
--- sqlplusint/connection.cc.orig 2001-05-19 18:44:48.000000000 +0200
+++ sqlplusint/connection.cc 2004-01-05 00:03:21.000000000 +0100
@@ -2,6 +2,8 @@
#include "connection3.hh"
#include "result3.hh"
+using namespace std;
+
Connection::Connection (const char *db, const char *host, const char *user,
const char *passwd, bool te)
: throw_exceptions(te), locked(false)
@@ -10,38 +12,38 @@ Connection::Connection (const char *db,
if (real_connect (db, host, user, passwd,3306,0,60,NULL,0))
{
locked = false;
- Success = is_connected = true;
+ Success_ = is_connected = true;
}
else
{
- locked = false; Success = is_connected = false;
+ locked = false; Success_ = is_connected = false;
if (throw_exceptions) throw BadQuery(error());
}
}
Connection::Connection (const char *db, const char *host, const char *user,
- const char *passwd, uint port, my_bool compress = 0,
- unsigned int connect_timeout = 60, bool te = true,
- const char *socket_name = "", unsigned client_flag = 0)
+ const char *passwd, uint port, my_bool compress,
+ unsigned int connect_timeout, bool te,
+ const char *socket_name, unsigned client_flag)
: throw_exceptions(te), locked(false)
{
mysql_init(&mysql);
if (real_connect (db, host, user, passwd, port, compress, connect_timeout,socket_name, client_flag))
{
locked = false;
- Success = is_connected = true;
+ Success_ = is_connected = true;
}
else
{
- locked = false; Success = is_connected = false;
+ locked = false; Success_ = is_connected = false;
if (throw_exceptions) throw BadQuery(error());
}
}
bool Connection::real_connect (cchar *db, cchar *host, cchar *user,
- cchar *passwd, uint port, my_bool compress = 0,
- unsigned int connect_timeout = 60,
- const char *socket_name = "", unsigned int client_flag = 0)
+ cchar *passwd, uint port, my_bool compress,
+ unsigned int connect_timeout,
+ const char *socket_name, unsigned int client_flag)
{
mysql.options.compress = compress;
mysql.options.connect_timeout=connect_timeout;
@@ -52,18 +54,18 @@ bool Connection::real_connect (cchar *db
if (mysql_real_connect(&mysql,host,user,passwd,db, port,socket_name,client_flag))
{
locked = false;
- Success = is_connected = true;
+ Success_ = is_connected = true;
}
else
{
- locked = false; Success = is_connected = false;
+ locked = false; Success_ = is_connected = false;
if (throw_exceptions) throw BadQuery(error());
}
// mysql.options.my_cnf_file=0;
- if (!Success) return Success;
+ if (!Success_) return Success_;
if (db && db[0]) // if db is not empty
- Success = select_db(db);
- return Success;
+ Success_ = select_db(db);
+ return Success_;
}
Connection::~Connection () {
@@ -95,21 +97,21 @@ bool Connection::connect (cchar *db, cch
if (mysql_real_connect(&mysql,host,user,passwd,db, 3306,NULL,0)) {
locked = false;
- Success = is_connected = true;
+ Success_ = is_connected = true;
} else {
locked = false;
if (throw_exceptions) throw BadQuery(error());
- Success = is_connected = false;
+ Success_ = is_connected = false;
}
// mysql.options.my_cnf_file=0;
- if (!Success) return Success;
+ if (!Success_) return Success_;
if (db && db[0]) // if db is not empty
- Success = select_db(db);
- return Success;
+ Success_ = select_db(db);
+ return Success_;
}
string Connection::info () {
- char *i = mysql_info(&mysql);
+ const char *i = mysql_info(&mysql);
if (!i)
return string();
else
@@ -117,44 +119,44 @@ string Connection::info () {
}
ResNSel Connection::execute(const string &str, bool throw_excptns) {
- Success = false;
+ Success_ = false;
if (lock())
if (throw_excptns) throw BadQuery(error());
else return ResNSel();
- Success = !mysql_query(&mysql, str.c_str());
+ Success_ = !mysql_query(&mysql, str.c_str());
unlock();
- if (!Success)
+ if (!Success_)
if (throw_excptns) throw BadQuery(error());
else return ResNSel();
return ResNSel(this);
}
bool Connection::exec(const string &str) {
- Success = !mysql_query(&mysql,str.c_str());
- if (!Success && throw_exceptions) throw BadQuery(error());
- return Success;
+ Success_ = !mysql_query(&mysql,str.c_str());
+ if (!Success_ && throw_exceptions) throw BadQuery(error());
+ return Success_;
}
Result Connection::store(const string &str, bool throw_excptns) {
- Success = false;
+ Success_ = false;
if (lock())
if (throw_excptns) throw BadQuery(error());
else return Result();
- Success = !mysql_query(&mysql, str.c_str());
+ Success_ = !mysql_query(&mysql, str.c_str());
unlock();
- if (!Success)
+ if (!Success_)
if (throw_excptns) throw BadQuery(error());
else return Result();
return Result(mysql_store_result(&mysql));
}
ResUse Connection::use(const string &str, bool throw_excptns) {
- Success = false;
+ Success_ = false;
if (lock())
if (throw_excptns) throw BadQuery(error());
else return ResUse();
- Success = !mysql_query(&mysql, str.c_str());
- if (!Success)
+ Success_ = !mysql_query(&mysql, str.c_str());
+ if (!Success_)
if (throw_excptns) throw BadQuery(error());
else return ResUse();
return ResUse(mysql_use_result(&mysql), this);