#At bzr+ssh://ahristov@stripped/bzrroot/public/connector-cpp-bzr/trunk/
191 andrey.hristov@stripped 2008-10-21
Add Alfredo's Fedora Core 9 patch
Fix Exceptions' constructors, no more BC with __FUNCTION__ and __LINE__
modified:
cppconn/exception.h
driver/mysql_connection.cpp
driver/mysql_constructed_resultset.cpp
driver/mysql_cset_metadata.cpp
driver/mysql_metadata.cpp
driver/mysql_metadata.h
driver/mysql_prepared_statement.cpp
driver/mysql_prepared_statement.h
driver/mysql_ps_resultset.cpp
driver/mysql_ps_resultset_metadata.cpp
driver/mysql_res_wrapper.cpp
driver/mysql_resultset.cpp
driver/mysql_resultset_metadata.cpp
driver/mysql_statement.cpp
test/test_common.cpp
=== modified file 'cppconn/exception.h'
--- a/cppconn/exception.h 2008-10-20 21:03:54 +0000
+++ b/cppconn/exception.h 2008-10-21 09:17:11 +0000
@@ -63,12 +63,9 @@ public:
SQLException(const std::string& reason, const std::string& SQLState) : std::runtime_error(reason), sql_state(SQLState), errNo(0) {}
- SQLException(const std::string& reason) : std::runtime_error(reason), sql_state(""), errNo(0) {}
+ SQLException(const std::string& reason) : std::runtime_error(reason), sql_state("HY000"), errNo(0) {}
- SQLException() : std::runtime_error(""), sql_state(""), errNo(0) {}
-
- /* BC - FIXME */
- SQLException(const char *, int, const char *) : std::runtime_error("BC - FIXME"), sql_state(""), errNo(0) {}
+ SQLException() : std::runtime_error(""), sql_state("HY000"), errNo(0) {}
const std::string& getSQLState() const
{
@@ -101,9 +98,6 @@ struct MethodNotImplementedException : p
MethodNotImplementedException(const MethodNotImplementedException& e) : SQLException(e.what(), e.sql_state, e.errNo) { next= e.next; }
MethodNotImplementedException(const std::string& reason) : SQLException(reason, "", 0) {}
- /* BC - FIXME */
- MethodNotImplementedException(const char * reason) : SQLException(std::string(reason), "", 0) {}
-
private:
MEMORY_ALLOC_OPERATORS(MethodNotImplementedException)
};
@@ -113,9 +107,6 @@ struct InvalidArgumentException : public
InvalidArgumentException(const InvalidArgumentException& e) : SQLException(e.what(), e.sql_state, e.errNo) { next= e.next; }
InvalidArgumentException(const std::string& reason) : SQLException(reason, "", 0) {}
- /* BC - FIXME */
- InvalidArgumentException(const char * /*func*/, int /*line*/, const char *t) : SQLException(std::string(t), "", 0) {}
-
private:
MEMORY_ALLOC_OPERATORS(InvalidArgumentException)
};
=== modified file 'driver/mysql_connection.cpp'
--- a/driver/mysql_connection.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_connection.cpp 2008-10-21 09:17:11 +0000
@@ -24,6 +24,10 @@
#include <stdio.h>
#include "mysql_private_iface.h"
+#ifndef _WIN32
+#include <string.h>
+#endif
+
#include "mysql_connection.h"
#include "mysql_prepared_statement.h"
#include "mysql_statement.h"
@@ -33,15 +37,6 @@
#include "common/ccppTypes.h"
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
-
#include "mysql_debug.h"
namespace sql
@@ -61,7 +56,7 @@ MySQL_Savepoint::MySQL_Savepoint(const s
int
MySQL_Savepoint::getSavepointId()
{
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__ , "Only named savepoints are supported.");
+ throw sql::InvalidArgumentException("Only named savepoints are supported.");
}
/* }}} */
@@ -428,7 +423,7 @@ MySQL_Connection::releaseSavepoint(Savep
CPP_ENTER("MySQL_Connection::releaseSavepoint");
checkClosed();
if (getAutoCommit()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__ , "The connection is in autoCommit mode");
+ throw sql::InvalidArgumentException("The connection is in autoCommit mode");
}
std::string sql("RELEASE SAVEPOINT ");
sql.append(savepoint->getSavepointName());
@@ -457,7 +452,7 @@ MySQL_Connection::rollback(Savepoint * s
CPP_ENTER("MySQL_Connection::rollback");
checkClosed();
if (getAutoCommit()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__ , "The connection is in autoCommit mode");
+ throw sql::InvalidArgumentException("The connection is in autoCommit mode");
}
std::string sql("ROLLBACK TO SAVEPOINT ");
sql.append(savepoint->getSavepointName());
@@ -541,10 +536,10 @@ MySQL_Connection::setSavepoint(const std
CPP_ENTER("MySQL_Connection::setSavepoint");
checkClosed();
if (getAutoCommit()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__ , "The connection is in autoCommit mode");
+ throw sql::InvalidArgumentException("The connection is in autoCommit mode");
}
if (!name.length()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__ , "Savepoint name cannot be empty string");
+ throw sql::InvalidArgumentException("Savepoint name cannot be empty string");
}
std::string sql("SAVEPOINT ");
sql.append(name);
@@ -590,7 +585,7 @@ MySQL_Connection::setTransactionIsolatio
q = "SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED";
break;
default:
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__ , "MySQL_Connection::setTransactionIsolation()");
+ throw sql::InvalidArgumentException("MySQL_Connection::setTransactionIsolation()");
}
txIsolationLevel = level;
mysql_query(mysql, q);
=== modified file 'driver/mysql_constructed_resultset.cpp'
--- a/driver/mysql_constructed_resultset.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_constructed_resultset.cpp 2008-10-21 09:17:11 +0000
@@ -255,7 +255,7 @@ MySQL_ConstructedResultSet::getBoolean(u
CPP_INFO_FMT("this=%p", this);
checkValid();
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getString: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getString: can't fetch because not on result set");
}
return getInt(columnIndex) != 0;
}
@@ -308,10 +308,10 @@ MySQL_ConstructedResultSet::getDouble(un
checkValid();
/* Don't columnIndex--, as we use it in the while loop later */
if (columnIndex > num_fields || columnIndex == 0) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getDouble: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getDouble: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getDouble: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getDouble: can't fetch because not on result set");
}
StringList::iterator f = current_record;
@@ -383,10 +383,10 @@ MySQL_ConstructedResultSet::getInt(unsig
checkValid();
/* Don't columnIndex--, as we use it in the while loop later */
if (columnIndex > num_fields || columnIndex == 0) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getInt: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getInt: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getInt: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getInt: can't fetch because not on result set");
}
StringList::iterator f = current_record;
@@ -420,10 +420,10 @@ MySQL_ConstructedResultSet::getLong(unsi
checkValid();
/* Don't columnIndex--, as we use it in the while loop later */
if (columnIndex > num_fields || columnIndex == 0) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getLong: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getLong: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getLong: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getLong: can't fetch because not on result set");
}
StringList::iterator f = current_record;
@@ -514,10 +514,10 @@ MySQL_ConstructedResultSet::getString(un
checkValid();
/* Don't columnIndex--, as we use it in the while loop later */
if (columnIndex > num_fields || columnIndex == 0) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getString: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getString: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::getString: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::getString: can't fetch because not on result set");
}
StringList::iterator f = current_record;
@@ -636,7 +636,7 @@ MySQL_ConstructedResultSet::isNull(unsig
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ConstructedResultSet::isNull: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ConstructedResultSet::isNull: invalid value of 'columnIndex'");
}
return false;
}
@@ -739,7 +739,7 @@ MySQL_ConstructedResultSet::previous()
}
return true;
}
- throw sql::SQLException(CPPCONN_FUNC, __LINE__, "Impossible");
+ throw sql::SQLException("Impossible");
}
/* }}} */
=== modified file 'driver/mysql_cset_metadata.cpp'
--- a/driver/mysql_cset_metadata.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_cset_metadata.cpp 2008-10-21 09:17:11 +0000
@@ -26,14 +26,6 @@
#include "mysql_constructed_resultset.h"
#include "mysql_cset_metadata.h"
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
namespace sql
@@ -48,7 +40,7 @@ MySQL_ConstructedResultSetMetaData::getC
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getCatalogName");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "";
}
@@ -74,7 +66,7 @@ MySQL_ConstructedResultSetMetaData::getC
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getColumnDisplaySize");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
throw sql::MethodNotImplementedException("MySQL_ConstructedResultSetMetaData::getColumnDisplaySize()");
}
@@ -88,7 +80,7 @@ MySQL_ConstructedResultSetMetaData::getC
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getColumnLabel");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return parent->field_index_to_name_map[columnIndex - 1];
}
@@ -102,7 +94,7 @@ MySQL_ConstructedResultSetMetaData::getC
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getColumnName");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return parent->field_index_to_name_map[columnIndex - 1];
}
@@ -116,7 +108,7 @@ MySQL_ConstructedResultSetMetaData::getC
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getColumnType");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return MYSQL_TYPE_VARCHAR;
// return mysql_fetch_field_direct(result->get(), columnIndex - 1)->type;
@@ -131,7 +123,7 @@ MySQL_ConstructedResultSetMetaData::getC
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getColumnTypeName");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "VARCHAR";
}
@@ -145,7 +137,7 @@ MySQL_ConstructedResultSetMetaData::getP
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getPrecision");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
throw sql::MethodNotImplementedException("MySQL_ConstructedResultSetMetaData::getPrecision()");
}
@@ -159,7 +151,7 @@ MySQL_ConstructedResultSetMetaData::getS
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getScale");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
throw sql::MethodNotImplementedException("MySQL_ConstructedResultSetMetaData::getScale()");
}
@@ -173,7 +165,7 @@ MySQL_ConstructedResultSetMetaData::getS
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getSchemaName");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "";
}
@@ -187,7 +179,7 @@ MySQL_ConstructedResultSetMetaData::getT
CPP_ENTER("MySQL_ConstructedResultSetMetaData::getTableName");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "";
}
@@ -201,7 +193,7 @@ MySQL_ConstructedResultSetMetaData::isAu
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isAutoIncrement");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return false;
}
@@ -215,7 +207,7 @@ MySQL_ConstructedResultSetMetaData::isCa
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isCaseSensitive");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "true";
}
@@ -229,7 +221,7 @@ MySQL_ConstructedResultSetMetaData::isCu
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isCurrency");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return false;
}
@@ -243,7 +235,7 @@ MySQL_ConstructedResultSetMetaData::isDe
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isDefinitelyWritable");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return isWritable(columnIndex);
}
@@ -257,7 +249,7 @@ MySQL_ConstructedResultSetMetaData::isNu
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isNullable");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return false;
}
@@ -271,7 +263,7 @@ MySQL_ConstructedResultSetMetaData::isRe
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isReadOnly");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
/* We consider we connect to >= 40100 - else, we can't say */
return true;
@@ -286,7 +278,7 @@ MySQL_ConstructedResultSetMetaData::isSe
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isSearchable");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return true;
}
@@ -300,7 +292,7 @@ MySQL_ConstructedResultSetMetaData::isSi
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isSigned");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return false;
}
@@ -314,7 +306,7 @@ MySQL_ConstructedResultSetMetaData::isWr
CPP_ENTER("MySQL_ConstructedResultSetMetaData::isWritable");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > parent->num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return !isReadOnly(columnIndex);
}
=== modified file 'driver/mysql_metadata.cpp'
--- a/driver/mysql_metadata.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_metadata.cpp 2008-10-21 09:17:11 +0000
@@ -34,14 +34,6 @@
#define snprintf _snprintf
#endif // _WIN32
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
namespace sql
@@ -953,7 +945,7 @@ MySQL_ConnectionMetaData::getSchemaObjec
.append(" FROM information_schema.triggers")
.append(triggers_where_clause);
} else {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQLMetadata::getSchemaObjects: invalid 'objectType'");
+ throw sql::InvalidArgumentException("MySQLMetadata::getSchemaObjects: invalid 'objectType'");
}
}
// XXX:
@@ -1046,7 +1038,7 @@ MySQL_ConnectionMetaData::getSchemaObjec
ddl_query.append("SHOW CREATE TRIGGER `").append(schema).append("`.`").append(name).append("`");
*/
} else {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQLMetadata::getSchemaObjects: invalid OBJECT_TYPE returned from query");
+ throw sql::InvalidArgumentException("MySQLMetadata::getSchemaObjects: invalid OBJECT_TYPE returned from query");
}
// due to bugs in server code some queries can fail.
=== modified file 'driver/mysql_metadata.h'
--- a/driver/mysql_metadata.h 2008-10-15 17:05:45 +0000
+++ b/driver/mysql_metadata.h 2008-10-21 09:17:11 +0000
@@ -26,11 +26,12 @@
namespace sql
{
+class ResultSet;
+
namespace mysql
{
class MySQL_Connection;
-class sql::ResultSet;
class MySQL_DebugLogger;
class MySQL_ConnectionMetaData : public sql::DatabaseMetaData
=== modified file 'driver/mysql_prepared_statement.cpp'
--- a/driver/mysql_prepared_statement.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_prepared_statement.cpp 2008-10-21 09:17:11 +0000
@@ -27,18 +27,12 @@
#include "mysql_ps_resultset.h"
#include "mysql_parameter_metadata.h"
+#ifndef _WIN32
+#include <string.h>
+#endif
#define mysql_stmt_conn(s) (s)->mysql
-
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
@@ -215,7 +209,7 @@ allocate_buffer_for_type(MYSQL_FIELD *fi
return BufferSizePair(new char[1], 1);
return BufferSizePair(new char[field->max_length], field->max_length);
default:
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "allocate_buffer_for_type: invalid result_bind data type");
+ throw sql::InvalidArgumentException("allocate_buffer_for_type: invalid result_bind data type");
}
}
@@ -225,7 +219,7 @@ void
MySQL_Prepared_Statement::bindResult()
{
CPP_ENTER("MySQL_Prepared_Statement::bindResult");
- for (int i = 0; i < num_fields; i++) {
+ for (unsigned int i = 0; i < num_fields; i++) {
delete[] (char *) result_bind[i].buffer;
}
delete[] result_bind;
@@ -256,7 +250,7 @@ MySQL_Prepared_Statement::bindResult()
mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &tmp);
mysql_stmt_store_result(stmt);
- for (int i = 0; i < num_fields; i++) {
+ for (unsigned int i = 0; i < num_fields; i++) {
MYSQL_FIELD *field = mysql_fetch_field(result_meta);
BufferSizePair p = allocate_buffer_for_type(field);
@@ -277,7 +271,7 @@ MySQL_Prepared_Statement::bindResult()
mysql_free_result(result_meta);
result_meta = NULL;
if (mysql_stmt_bind_result(stmt, result_bind)) {
- throw sql::SQLException(CPPCONN_FUNC, __LINE__, "Can't bind");
+ throw sql::SQLException("Can't bind");
}
}
@@ -340,7 +334,7 @@ MySQL_Prepared_Statement::setBlob(unsign
checkClosed();
parameterIndex--; /* DBC counts from 1 */
if (parameterIndex >= param_count) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setBlob: invalid 'parameterIndex'");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setBlob: invalid 'parameterIndex'");
}
do {
std::string chunk = blob.readChunk(1024);
@@ -352,7 +346,7 @@ MySQL_Prepared_Statement::setBlob(unsign
case CR_OUT_OF_MEMORY:
throw std::bad_alloc();
case CR_INVALID_BUFFER_USE:
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setBlob: can't set blob value on that column");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setBlob: can't set blob value on that column");
case CR_SERVER_GONE_ERROR:
case CR_COMMANDS_OUT_OF_SYNC:
default:
@@ -382,7 +376,7 @@ MySQL_Prepared_Statement::setDateTime(un
checkClosed();
parameterIndex--; /* DBC counts from 1 */
if (parameterIndex >= param_count) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setDateTime: invalid 'parameterIndex'");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setDateTime: invalid 'parameterIndex'");
}
setString(parameterIndex, value);
}
@@ -427,7 +421,7 @@ allocate_buffer_for_type(enum_field_type
case MYSQL_TYPE_NULL:
return BufferSizePair(NULL, 0);
default:
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "allocate_buffer_for_type: invalid result_bind data type");
+ throw sql::InvalidArgumentException("allocate_buffer_for_type: invalid result_bind data type");
}
}
@@ -442,7 +436,7 @@ MySQL_Prepared_Statement::setDouble(unsi
parameterIndex--; /* DBC counts from 1 */
if (parameterIndex >= param_count) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setDouble: invalid 'parameterIndex'");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setDouble: invalid 'parameterIndex'");
}
enum_field_types t = MYSQL_TYPE_DOUBLE;
@@ -474,7 +468,7 @@ MySQL_Prepared_Statement::setInt(unsigne
parameterIndex--; /* DBC counts from 1 */
if (parameterIndex >= param_count) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setInt: invalid 'parameterIndex'");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setInt: invalid 'parameterIndex'");
}
enum_field_types t = MYSQL_TYPE_LONG;
@@ -504,7 +498,7 @@ MySQL_Prepared_Statement::setLong(unsign
parameterIndex--; /* DBC counts from 1 */
if (parameterIndex >= param_count) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setLong: invalid 'parameterIndex'");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setLong: invalid 'parameterIndex'");
}
enum_field_types t = MYSQL_TYPE_LONGLONG;
@@ -533,7 +527,7 @@ MySQL_Prepared_Statement::setBigInt(unsi
checkClosed();
parameterIndex--; /* DBC counts from 1 */
if (parameterIndex >= param_count) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setBigInt: invalid 'parameterIndex'");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setBigInt: invalid 'parameterIndex'");
}
setString(parameterIndex, value);
}
@@ -774,7 +768,7 @@ MySQL_Prepared_Statement::setString(unsi
parameterIndex--; /* DBC counts from 1 */
if (parameterIndex >= param_count) {
CPP_ERR("Invalid parameterIndex");
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_Statement::setString: invalid 'parameterIndex'");
+ throw InvalidArgumentException("MySQL_Prepared_Statement::setString: invalid 'parameterIndex'");
}
enum_field_types t = MYSQL_TYPE_STRING;
@@ -816,7 +810,7 @@ MySQL_Prepared_Statement::closeIntern()
/* allocated with calloc */
free(param_bind);
- for (int i = 0; i < num_fields; i++) {
+ for (unsigned int i = 0; i < num_fields; i++) {
delete[] (char *) result_bind[i].buffer;
}
delete[] result_bind;
=== modified file 'driver/mysql_prepared_statement.h'
--- a/driver/mysql_prepared_statement.h 2008-10-17 16:54:41 +0000
+++ b/driver/mysql_prepared_statement.h 2008-10-21 09:17:11 +0000
@@ -54,7 +54,7 @@ protected:
virtual void bindResult();
- int num_fields;
+ unsigned int num_fields;
my_bool *is_null;
my_bool *err;
unsigned long *len;
=== modified file 'driver/mysql_ps_resultset.cpp'
--- a/driver/mysql_ps_resultset.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_ps_resultset.cpp 2008-10-21 09:17:11 +0000
@@ -29,14 +29,6 @@
#include <stdlib.h>
#endif // _WIN32
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
namespace sql
@@ -243,7 +235,7 @@ MySQL_Prepared_ResultSet::getBoolean(uns
CPP_INFO_FMT("this=%p", this);
checkValid();
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getBoolean: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getBoolean: can't fetch because not on result set");
}
return getInt(columnIndex)? true:false;
}
@@ -258,7 +250,7 @@ MySQL_Prepared_ResultSet::getBoolean(con
CPP_INFO_FMT("this=%p", this);
checkValid();
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getBoolean: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getBoolean: can't fetch because not on result set");
}
return getInt(columnLabel)? true:false;
}
@@ -299,10 +291,10 @@ MySQL_Prepared_ResultSet::getDouble(unsi
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQLPreparedResultSet::getDouble: invalid 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQLPreparedResultSet::getDouble: invalid 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getDouble: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getDouble: can't fetch because not on result set");
}
last_queried_column = columnIndex;
@@ -368,10 +360,10 @@ MySQL_Prepared_ResultSet::getInt(unsigne
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getInt: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getInt: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getInt: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getInt: can't fetch because not on result set");
}
last_queried_column = columnIndex;
@@ -381,7 +373,7 @@ MySQL_Prepared_ResultSet::getInt(unsigne
case 8:
return static_cast<int>( !*stmt->bind[columnIndex].is_null? *reinterpret_cast<long long *>(stmt->bind[columnIndex].buffer):0 );
default:
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getInt: invalid type");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getInt: invalid type");
}
}
/* }}} */
@@ -409,10 +401,10 @@ MySQL_Prepared_ResultSet::getLong(unsign
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getLong: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getLong: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getLong: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getLong: can't fetch because not on result set");
}
last_queried_column = columnIndex;
@@ -422,7 +414,7 @@ MySQL_Prepared_ResultSet::getLong(unsign
case 8:
return !*stmt->bind[columnIndex].is_null? *reinterpret_cast<long long *>(stmt->bind[columnIndex].buffer):0;
default:
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getLong: invalid type");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getLong: invalid type");
}
}
/* }}} */
@@ -505,10 +497,10 @@ MySQL_Prepared_ResultSet::getString(unsi
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQLPreparedResultSet::getString: invalid 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQLPreparedResultSet::getString: invalid 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::getLong: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::getLong: can't fetch because not on result set");
}
last_queried_column = columnIndex;
@@ -625,7 +617,7 @@ MySQL_Prepared_ResultSet::isNull(unsigne
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::isNull: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::isNull: invalid value of 'columnIndex'");
}
return *stmt->bind[columnIndex].is_null != 0;
}
@@ -641,7 +633,7 @@ MySQL_Prepared_ResultSet::isNull(const s
checkValid();
int col_idx = findColumn(columnLabel);
if (col_idx == -1) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_Prepared_ResultSet::isNull: invalid value of 'columnLabel'");
+ throw sql::InvalidArgumentException("MySQL_Prepared_ResultSet::isNull: invalid value of 'columnLabel'");
}
return isNull(col_idx);
}
@@ -740,9 +732,9 @@ MySQL_Prepared_ResultSet::previous()
if (result == MYSQL_NO_DATA) {
return false;
}
- throw sql::SQLException(CPPCONN_FUNC, __LINE__, "Error during mysql_stmt_fetch");
+ throw sql::SQLException("Error during mysql_stmt_fetch");
}
- throw sql::SQLException(CPPCONN_FUNC, __LINE__, "Impossible");
+ throw sql::SQLException("Impossible");
}
/* }}} */
=== modified file 'driver/mysql_ps_resultset_metadata.cpp'
--- a/driver/mysql_ps_resultset_metadata.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_ps_resultset_metadata.cpp 2008-10-21 09:17:11 +0000
@@ -26,14 +26,6 @@
#include "mysql_ps_resultset.h"
#include "mysql_ps_resultset_metadata.h"
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
namespace sql
@@ -62,7 +54,7 @@ MySQL_Prepared_ResultSetMetaData::getCat
CPP_ENTER("MySQL_Prepared_ResultSetMetaData::getCatalogName");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "";
}
@@ -87,7 +79,7 @@ MySQL_Prepared_ResultSetMetaData::getCol
CPP_ENTER("MySQL_Prepared_ResultSetMetaData::getColumnDisplaySize");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
throw sql::MethodNotImplementedException("MySQL_Prepared_ResultSetMetaData::getColumnDisplaySize()");
}
@@ -102,7 +94,7 @@ MySQL_Prepared_ResultSetMetaData::getCol
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result_meta, columnIndex)->name;
}
@@ -117,7 +109,7 @@ MySQL_Prepared_ResultSetMetaData::getCol
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result_meta, columnIndex)->name;
}
@@ -132,7 +124,7 @@ MySQL_Prepared_ResultSetMetaData::getCol
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result_meta, columnIndex)->type;
}
@@ -147,7 +139,7 @@ MySQL_Prepared_ResultSetMetaData::getCol
CPP_INFO_FMT("this=%p", this);
columnIndex--; /* Indexed from 1 */
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
bool isUnsigned = (mysql_fetch_field_direct(result_meta, columnIndex)->flags & UNSIGNED_FLAG) != 0;
switch (mysql_fetch_field_direct(result_meta, columnIndex)->type) {
@@ -226,7 +218,7 @@ MySQL_Prepared_ResultSetMetaData::getPre
CPP_ENTER("MySQL_Prepared_ResultSetMetaData::getPrecision");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
throw sql::MethodNotImplementedException("MySQL_Prepared_ResultSetMetaData::getPrecision()");
}
@@ -240,7 +232,7 @@ MySQL_Prepared_ResultSetMetaData::getSca
CPP_ENTER("MySQL_Prepared_ResultSetMetaData::getScale");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
throw sql::MethodNotImplementedException("MySQL_Prepared_ResultSetMetaData::getScale()");
}
@@ -254,7 +246,7 @@ MySQL_Prepared_ResultSetMetaData::getSch
CPP_ENTER("MySQL_Prepared_ResultSetMetaData::getSchemaName");
CPP_INFO_FMT("this=%p", this);
if (columnIndex == 0 || columnIndex > num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "";
}
@@ -269,7 +261,7 @@ MySQL_Prepared_ResultSetMetaData::getTab
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result_meta, columnIndex)->org_table;
}
@@ -284,7 +276,7 @@ MySQL_Prepared_ResultSetMetaData::isAuto
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return (mysql_fetch_field_direct(result_meta, columnIndex)->flags & AUTO_INCREMENT_FLAG ) != 0;
}
@@ -299,7 +291,7 @@ MySQL_Prepared_ResultSetMetaData::isCase
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result_meta, columnIndex)->flags & BINARY_FLAG;
}
@@ -314,7 +306,7 @@ MySQL_Prepared_ResultSetMetaData::isCurr
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return false;
}
@@ -329,7 +321,7 @@ MySQL_Prepared_ResultSetMetaData::isDefi
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return isWritable(columnIndex + 1);
}
@@ -344,7 +336,7 @@ MySQL_Prepared_ResultSetMetaData::isNull
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result_meta, columnIndex)->flags & NOT_NULL_FLAG? columnNoNulls:columnNullable;
}
@@ -359,7 +351,7 @@ MySQL_Prepared_ResultSetMetaData::isRead
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
/* We consider we connect to >= 40100 - else, we can't say */
@@ -380,7 +372,7 @@ MySQL_Prepared_ResultSetMetaData::isSear
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return true;
}
@@ -395,7 +387,7 @@ MySQL_Prepared_ResultSetMetaData::isSign
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return !(mysql_fetch_field_direct(result_meta, columnIndex)->flags & UNSIGNED_FLAG);
}
@@ -410,7 +402,7 @@ MySQL_Prepared_ResultSetMetaData::isWrit
CPP_INFO_FMT("this=%p", this);
columnIndex--;
if (columnIndex >= num_fields) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return !isReadOnly(columnIndex + 1);
}
=== modified file 'driver/mysql_res_wrapper.cpp'
--- a/driver/mysql_res_wrapper.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_res_wrapper.cpp 2008-10-21 09:17:11 +0000
@@ -21,16 +21,10 @@
#include "mysql_res_wrapper.h"
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
namespace sql
{
+
namespace mysql
{
@@ -50,7 +44,7 @@ MYSQL_RES_Wrapper * MYSQL_RES_Wrapper::g
refcount++;
return this;
} else {
- throw SQLException(CPPCONN_FUNC, __LINE__, "Object is invalid");
+ throw sql::SQLException("Object is invalid");
}
}
@@ -78,7 +72,7 @@ void MYSQL_RES_Wrapper::dispose() throw
MYSQL_RES * MYSQL_RES_Wrapper::get() const
{
if (!is_valid) {
- throw SQLException(CPPCONN_FUNC, __LINE__, "Object is invalid");
+ throw sql::SQLException("Object is invalid");
}
return result;
}
=== modified file 'driver/mysql_resultset.cpp'
--- a/driver/mysql_resultset.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_resultset.cpp 2008-10-21 09:17:11 +0000
@@ -25,19 +25,15 @@
#include "mysql_res_wrapper.h"
#ifndef _WIN32
+#include <string.h>
+#endif
+
+#ifndef _WIN32
#include <stdlib.h>
#else
#define atoll(x) _atoi64((x))
#endif // _WIN32
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
namespace sql
@@ -228,7 +224,7 @@ MySQL_ResultSet::getBoolean(unsigned int
CPP_INFO_FMT("this=%p", this);
checkValid();
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getBoolean: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getBoolean: can't fetch because not on result set");
}
return getInt(columnIndex)? true:false;
}
@@ -243,7 +239,7 @@ MySQL_ResultSet::getBoolean(const std::s
CPP_INFO_FMT("this=%p", this);
checkValid();
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getBoolean: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getBoolean: can't fetch because not on result set");
}
return getInt(columnLabel)? true:false;
}
@@ -284,10 +280,10 @@ MySQL_ResultSet::getDouble(unsigned int
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getDouble: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getDouble: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getDouble: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getDouble: can't fetch because not on result set");
}
if (row[columnIndex] == NULL) {
@@ -358,10 +354,10 @@ MySQL_ResultSet::getInt(unsigned int col
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getInt: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getInt: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getInt: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getInt: can't fetch because not on result set");
}
if (row[columnIndex] == NULL) {
@@ -396,10 +392,10 @@ MySQL_ResultSet::getLong(unsigned int co
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getLong: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getLong: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getInt: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getInt: can't fetch because not on result set");
}
if (row[columnIndex] == NULL) {
@@ -491,10 +487,10 @@ MySQL_ResultSet::getString(unsigned int
/* internally zero based */
columnIndex--;
if (columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getString: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getString: invalid value of 'columnIndex'");
}
if (isBeforeFirst() || isAfterLast()) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::getString: can't fetch because not on result set");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::getString: can't fetch because not on result set");
}
if(row[columnIndex] == NULL) {
@@ -612,7 +608,7 @@ MySQL_ResultSet::isNull(unsigned int col
/* internally zero based */
columnIndex--;
if(columnIndex >= num_fields) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::isNull: invalid value of 'columnIndex'");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::isNull: invalid value of 'columnIndex'");
}
return (row[columnIndex] == NULL);
}
@@ -628,7 +624,7 @@ MySQL_ResultSet::isNull(const std::strin
checkValid();
int col_idx = findColumn(columnLabel);
if (col_idx == -1) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "MySQL_ResultSet::isNull: invalid value of 'columnLabel'");
+ throw sql::InvalidArgumentException("MySQL_ResultSet::isNull: invalid value of 'columnLabel'");
}
return isNull(col_idx);
}
@@ -713,7 +709,7 @@ MySQL_ResultSet::previous()
seek();
return true;
}
- throw sql::SQLException(CPPCONN_FUNC, __LINE__, "Impossible");
+ throw sql::SQLException("Impossible");
}
/* }}} */
=== modified file 'driver/mysql_resultset_metadata.cpp'
--- a/driver/mysql_resultset_metadata.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_resultset_metadata.cpp 2008-10-21 09:17:11 +0000
@@ -26,14 +26,6 @@
#include "mysql_resultset.h"
#include "mysql_resultset_metadata.h"
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
namespace sql
@@ -49,12 +41,12 @@ MySQL_ResultSetMetaData::getCatalogName(
CPP_ENTER("MySQL_ResultSetMetaData::getCatalogName");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
char *db = mysql_fetch_field_direct(result->get(), columnIndex - 1)->db;
return db ? db : "";
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -67,7 +59,7 @@ MySQL_ResultSetMetaData::getColumnCount(
if (result->isValid()) {
return mysql_num_fields(result->get());
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -79,12 +71,12 @@ MySQL_ResultSetMetaData::getColumnDispla
CPP_ENTER("MySQL_ResultSetMetaData::getColumnDisplaySize");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return 20; /* TODO : temporary value */
throw sql::MethodNotImplementedException("MySQL_ResultSetMetaData::getColumnDisplaySize()");
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -96,11 +88,11 @@ MySQL_ResultSetMetaData::getColumnLabel(
CPP_ENTER("MySQL_ResultSetMetaData::getColumnLabel");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result->get(), columnIndex - 1)->name;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -112,11 +104,11 @@ MySQL_ResultSetMetaData::getColumnName(u
CPP_ENTER("MySQL_ResultSetMetaData::getColumnName");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result->get(), columnIndex - 1)->name;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -128,11 +120,11 @@ MySQL_ResultSetMetaData::getColumnType(u
CPP_ENTER("MySQL_ResultSetMetaData::getColumnType");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result->get(), columnIndex - 1)->type;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -144,7 +136,7 @@ MySQL_ResultSetMetaData::getColumnTypeNa
CPP_ENTER("MySQL_ResultSetMetaData::getColumnTypeName");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
bool isUnsigned = ( mysql_fetch_field_direct(result->get(), columnIndex - 1)->flags & UNSIGNED_FLAG ) != 0;
switch (mysql_fetch_field_direct(result->get(), columnIndex - 1)->type) {
@@ -214,7 +206,7 @@ MySQL_ResultSetMetaData::getColumnTypeNa
return mysql_fetch_field_direct(result->get(), columnIndex - 1)->name;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -226,11 +218,11 @@ MySQL_ResultSetMetaData::getPrecision(un
CPP_ENTER("MySQL_ResultSetMetaData::getPrecision");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
throw sql::MethodNotImplementedException("MySQL_ResultSetMetaData::getPrecision()");
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -242,12 +234,12 @@ MySQL_ResultSetMetaData::getScale(unsign
CPP_ENTER("MySQL_ResultSetMetaData::getScale");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return 10; // TODO : Temporary value
throw sql::MethodNotImplementedException("MySQL_ResultSetMetaData::getScale()");
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -259,11 +251,11 @@ MySQL_ResultSetMetaData::getSchemaName(u
CPP_ENTER("MySQL_ResultSetMetaData::getSchemaName");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return "";
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -275,11 +267,11 @@ MySQL_ResultSetMetaData::getTableName(un
CPP_ENTER("MySQL_ResultSetMetaData::getTableName");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result->get(), columnIndex - 1)->org_table;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -291,13 +283,13 @@ MySQL_ResultSetMetaData::isAutoIncrement
CPP_ENTER("MySQL_ResultSetMetaData::isAutoIncrement");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return ( mysql_fetch_field_direct(result->get(), columnIndex - 1)->flags
& AUTO_INCREMENT_FLAG ) != 0;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -309,11 +301,11 @@ MySQL_ResultSetMetaData::isCaseSensitive
CPP_ENTER("MySQL_ResultSetMetaData::isCaseSensitive");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result->get(), columnIndex - 1)->flags & BINARY_FLAG;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -325,11 +317,11 @@ MySQL_ResultSetMetaData::isCurrency(unsi
CPP_ENTER("MySQL_ResultSetMetaData::isCurrency");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return false;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -341,11 +333,11 @@ MySQL_ResultSetMetaData::isDefinitelyWri
CPP_ENTER("MySQL_ResultSetMetaData::isDefinitelyWritable");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return isWritable(columnIndex);
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -357,11 +349,11 @@ MySQL_ResultSetMetaData::isNullable(unsi
CPP_ENTER("MySQL_ResultSetMetaData::isNullable");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return mysql_fetch_field_direct(result->get(), columnIndex - 1)->flags & NOT_NULL_FLAG? columnNoNulls:columnNullable;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -373,7 +365,7 @@ MySQL_ResultSetMetaData::isReadOnly(unsi
CPP_ENTER("MySQL_ResultSetMetaData::isReadOnly");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
/* We consider we connect to >= 40100 - else, we can't say */
char * orgColumnName = mysql_fetch_field_direct(result->get(), columnIndex - 1)->org_name;
@@ -383,7 +375,7 @@ MySQL_ResultSetMetaData::isReadOnly(unsi
return !(orgColumnName != NULL && orgColumnNameLen > 0 && orgTableName != NULL && orgTableNameLen > 0);
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -395,11 +387,11 @@ MySQL_ResultSetMetaData::isSearchable(un
CPP_ENTER("MySQL_ResultSetMetaData::isSearchable");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return true;
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -411,11 +403,11 @@ MySQL_ResultSetMetaData::isSigned(unsign
CPP_ENTER("MySQL_ResultSetMetaData::isSigned");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return !(mysql_fetch_field_direct(result->get(), columnIndex - 1)->flags & UNSIGNED_FLAG);
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
@@ -427,11 +419,11 @@ MySQL_ResultSetMetaData::isWritable(unsi
CPP_ENTER("MySQL_ResultSetMetaData::isWritable");
if (result->isValid()) {
if (columnIndex == 0 || columnIndex > mysql_num_fields(result->get())) {
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Invalid value for columnIndex");
+ throw sql::InvalidArgumentException("Invalid value for columnIndex");
}
return !isReadOnly(columnIndex);
}
- throw sql::InvalidArgumentException(CPPCONN_FUNC, __LINE__, "ResultSet is not valid anymore");
+ throw sql::InvalidArgumentException("ResultSet is not valid anymore");
}
/* }}} */
=== modified file 'driver/mysql_statement.cpp'
--- a/driver/mysql_statement.cpp 2008-10-20 11:49:28 +0000
+++ b/driver/mysql_statement.cpp 2008-10-21 09:17:11 +0000
@@ -26,14 +26,6 @@
#include "mysql_statement.h"
#include "mysql_resultset.h"
-#ifdef __GNUC__
-#if __GNUC__ >= 2
-#define CPPCONN_FUNC __FUNCTION__
-#endif
-#else
-#define CPPCONN_FUNC "<unknown>"
-#endif
-
#include "mysql_debug.h"
namespace sql
@@ -151,7 +143,7 @@ MySQL_Statement::executeUpdate(const std
checkClosed();
do_query(sql.c_str(), static_cast<int>(sql.length()));
if (mysql_field_count(connection->getMySQLHandle())) {
- throw InvalidArgumentException(CPPCONN_FUNC, __LINE__, "Statement returning result set");
+ throw sql::InvalidArgumentException("Statement returning result set");
}
return static_cast<int>(last_update_count = mysql_affected_rows(connection->getMySQLHandle()));
}
=== modified file 'test/test_common.cpp'
--- a/test/test_common.cpp 2008-10-20 11:49:28 +0000
+++ b/test/test_common.cpp 2008-10-21 09:17:11 +0000
@@ -36,9 +36,9 @@
#define __LINE__ "(line number n/a)"
#endif
-#define ensure(msg, stmt) do {total_tests++;if(!(stmt)){printf("\nError! line=%d: %s\n",__LINE__,msg);total_errors++;throw sql::SQLException(CPPCONN_FUNC, __LINE__,"error");} else { printf(".");}} while (0)
-#define ensure_equal(msg, op1, op2) do {total_tests++;if((op1)!=(op2)){printf("\nError! line=%d: %s\n",__LINE__,msg);total_errors++;throw sql::SQLException(CPPCONN_FUNC, __LINE__, "error");} else { printf(".");}}while(0)
-#define ensure_equal_int(msg, op1, op2) do {total_tests++;if((op1)!=(op2)){printf("\nError! line=%d: %s Op1=%d Op2=%d\n",__LINE__,msg,op1,op2);total_errors++;throw sql::SQLException(CPPCONN_FUNC, __LINE__, "error");} else { printf(".");}}while(0)
+#define ensure(msg, stmt) do {total_tests++;if(!(stmt)){printf("\nError! line=%d: %s\n",__LINE__,msg);total_errors++;throw sql::SQLException("error");} else { printf(".");}} while (0)
+#define ensure_equal(msg, op1, op2) do {total_tests++;if((op1)!=(op2)){printf("\nError! line=%d: %s\n",__LINE__,msg);total_errors++;throw sql::SQLException("error");} else { printf(".");}}while(0)
+#define ensure_equal_int(msg, op1, op2) do {total_tests++;if((op1)!=(op2)){printf("\nError! line=%d: %s Op1=%d Op2=%d\n",__LINE__,msg,op1,op2);total_errors++;throw sql::SQLException("error");} else { printf(".");}}while(0)
static int total_errors = 0;
static int total_tests = 0;
| Thread |
|---|
| • bzr commit into connector-cpp-bzr branch (andrey.hristov:191) | andrey.hristov | 21 Oct |