Skip to content

Commit a2ff7fe

Browse files
author
Ali Lloyd
committed
[[ Bug 11149 ]] Make sure most recent error string is available to revDatabaseConnectResult
1 parent 2b269a9 commit a2ff7fe

13 files changed

Lines changed: 45 additions & 28 deletions

docs/notes/bugfix-11149.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# revDatabaseConnectResult always returns empty

revdb/src/dbdriver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class DBConnection: public DBObject
170170
virtual void transBegin() = 0;
171171
virtual void transCommit() = 0;
172172
virtual void transRollback() = 0;
173-
virtual char *getErrorMessage() = 0;
173+
virtual char *getErrorMessage(Bool last = False) = 0;
174174

175175
virtual DBList *getCursorList() = 0;
176176
virtual void deleteCursor(int fid) = 0;

revdb/src/dbmysql.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class DBConnection_MYSQL: public CDBConnection
6161
void transBegin();
6262
void transCommit();
6363
void transRollback();
64-
char *getErrorMessage();
64+
char *getErrorMessage(Bool p_last);
6565
Bool IsError();
6666
void getTables(char *buffer, int *bufsize);
6767
int getConnectionType(void) { return -1; }

revdb/src/dbodbc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class DBConnection_ODBC: public CDBConnection
9191
void transCommit();
9292
const char *getconnectionstring();
9393
void transRollback();
94-
char *getErrorMessage();
94+
char *getErrorMessage(Bool p_last);
9595
Bool IsError();
9696
cursor_type_t getCursorType(void) { return m_cursor_type; }
9797
int getVersion(void) { return 2; }

revdb/src/dboracle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class DBConnection_ORACLE: public CDBConnection
134134
void transBegin();
135135
void transCommit();
136136
void transRollback();
137-
char *getErrorMessage();
137+
char *getErrorMessage(Bool p_last);
138138
Bool IsError();
139139
void getTables(char *buffer, int *bufsize);
140140
int getVersion(void) { return 2; }

revdb/src/dbpostgresql.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class DBConnection_POSTGRESQL: public CDBConnection
132132
void transBegin();
133133
void transCommit();
134134
void transRollback();
135-
char *getErrorMessage();
135+
char *getErrorMessage(Bool p_last);
136136
Bool IsError();
137137
int getConnectionType(void) { return -1; }
138138
int getVersion(void) { return 2; }

revdb/src/dbsqlite.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class DBConnection_SQLITE : public CDBConnection
8585
void transBegin();
8686
void transCommit();
8787
void transRollback();
88-
char *getErrorMessage();
88+
char *getErrorMessage(Bool p_last);
8989

9090
int basicExec(const char *q, unsigned int *rows = 0);
9191

revdb/src/mysql_connection.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,10 @@ Bool DBConnection_MYSQL::IsError()
351351
}
352352

353353
/*getErrorMessage- return error string*/
354-
char *DBConnection_MYSQL::getErrorMessage()
354+
char *DBConnection_MYSQL::getErrorMessage(Bool p_last)
355355
{
356-
if (IsError() == True)
356+
// AL-2013-11-08 [[ Bug 11149 ]] Make sure most recent error string is available to revDatabaseConnectResult
357+
if (p_last || IsError() == True)
357358
{
358359
if (m_error != NULL)
359360
return m_error;

revdb/src/odbc_connection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ void DBConnection_ODBC::SetError(SQLHSTMT p_statement)
510510
}
511511

512512
/*getErrorMessage- return error string*/
513-
char *DBConnection_ODBC::getErrorMessage()
513+
char *DBConnection_ODBC::getErrorMessage(Bool p_last)
514514
{
515515
if (IsError() == True) return errmsg;
516516
else return (char *)DBNullValue;

revdb/src/oracle_connection.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,17 @@ Bool DBConnection_ORACLE::IsError()
250250
}
251251

252252
/*getErrorMessage- return error string*/
253-
char *DBConnection_ORACLE::getErrorMessage()
253+
char *DBConnection_ORACLE::getErrorMessage(Bool p_last)
254254
{
255-
// OK-2007-09-10 : Bug 5360
256-
if (m_error != NULL)
257-
return m_error;
258-
else
259-
return (char *)DBNullValue;
255+
// AL-2013-11-08 [[ Bug 11149 ]] Make sure most recent error string is available to revDatabaseConnectResult
256+
if (p_last || IsError())
257+
{
258+
// OK-2007-09-10 : Bug 5360
259+
if (m_error != NULL)
260+
return m_error;
261+
}
262+
263+
return (char *)DBNullValue;
260264
}
261265

262266
/*BindVariables-parses querystring and binds variables*/

0 commit comments

Comments
 (0)