From cab6bfacc5e2085601496d4e39b022b9afb13a9f Mon Sep 17 00:00:00 2001 From: prabatuty Date: Sun, 11 Oct 2009 06:40:06 +0000 Subject: [PATCH] adding more debug messages to odbc checking for permission when checking dead process during cleanup --- scripts/startup.sh | 4 +++- src/odbc/odbcDbc.cxx | 16 +++++++++++++++- src/odbc/odbcStmt.cxx | 4 ++-- src/tools/csqlserver.cxx | 8 +++++++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/scripts/startup.sh b/scripts/startup.sh index 01243227..01af4bc4 100755 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -1,7 +1,9 @@ #!/bin/sh # Start CSQL Server VERBOSE=$1 -LOGDIR=/tmp +LOGFILE=`grep LOG_FILE $CSQL_CONFIG_FILE| tail -1 | awk -F"=" '{ print $2 }'` +LOGDIR=`dirname $LOGFILE` + echo "CSQL Server Start: " + `date` >>$LOGDIR/csqlserver.log if [ -z "$VERBOSE" ] then diff --git a/src/odbc/odbcDbc.cxx b/src/odbc/odbcDbc.cxx index 87b97837..ac946720 100644 --- a/src/odbc/odbcDbc.cxx +++ b/src/odbc/odbcDbc.cxx @@ -63,7 +63,6 @@ SQLRETURN CSqlOdbcDbc::SQLAllocHandle( inputEnv->state_ = E2; ((CSqlOdbcDbc*) *outputHandle)->parentEnv_ = inputEnv; ((CSqlOdbcDbc*) *outputHandle)->state_ = C2; - return( SQL_SUCCESS ); } @@ -117,6 +116,10 @@ SQLRETURN SQLDriverConnect( SQLSMALLINT * StringLength2Ptr, SQLUSMALLINT DriverCompletion) { +#ifdef DEBUG + printError(ErrWarning, "SQLDriverConnect"); +#endif + // Validate handle if( isValidHandle( ConnectionHandle, SQL_HANDLE_DBC ) != SQL_SUCCESS ) return( SQL_INVALID_HANDLE ); @@ -158,6 +161,10 @@ SQLRETURN SQLConnect( // All param's are IN SQLCHAR *Authentication, SQLSMALLINT NameLength3) { +#ifdef DEBUG + printError(ErrWarning, "SQLConnect"); +#endif + // Validate handle if( isValidHandle( ConnectionHandle, SQL_HANDLE_DBC ) != SQL_SUCCESS ) return( SQL_INVALID_HANDLE ); @@ -274,6 +281,9 @@ SQLRETURN CSqlOdbcDbc::SQLConnect( // All param's are IN SQLRETURN SQLDisconnect( SQLHDBC ConnectionHandle) // IN { +#ifdef DEBUG + printError(ErrWarning, "SQLDisConnect"); +#endif // Validate Handle if( isValidHandle( ConnectionHandle, SQL_HANDLE_DBC ) != SQL_SUCCESS ) return( SQL_INVALID_HANDLE ); @@ -318,6 +328,10 @@ SQLRETURN CSqlOdbcDbc::SQLDisconnect( void ) SQLRETURN CSqlOdbcDbc::SQLEndTran( SQLSMALLINT completionType) // IN { +#ifdef DEBUG + printError(ErrWarning, "SQLEndTran: %hd", completionType); +#endif + SQLRETURN rc; // Start with NO_ERR diff --git a/src/odbc/odbcStmt.cxx b/src/odbc/odbcStmt.cxx index 9801ddbe..970835b6 100644 --- a/src/odbc/odbcStmt.cxx +++ b/src/odbc/odbcStmt.cxx @@ -495,7 +495,7 @@ SQLRETURN SQLExecDirect( SQLINTEGER TextLength) // IN { #ifdef DEBUG - printError(ErrWarning, "SQLExecDirect"); + printError(ErrWarning, "SQLExecDirect: %s", StatementText); #endif // Is Stmt valid ? @@ -585,7 +585,7 @@ SQLRETURN SQLPrepare( SQLINTEGER TextLength) // IN { #ifdef DEBUG - printError(ErrWarning, "SQLPrepare"); + printError(ErrWarning, "SQLPrepare: %s", StatementText); #endif // Is Stmt valid ? diff --git a/src/tools/csqlserver.cxx b/src/tools/csqlserver.cxx index b6aec3a2..0e7cb4a1 100644 --- a/src/tools/csqlserver.cxx +++ b/src/tools/csqlserver.cxx @@ -47,7 +47,13 @@ static void sigChildHandler(int sig) bool checkDead(pid_t pid) { int ret = os::kill(pid, 0); - if (ret == -1) return true; else return false; + if (ret == -1) { + if (errno == EPERM) + printError(ErrWarning, "No permission to check process %d is alive."); + else + return true; + } + return false; } DbRetVal releaseAllResources(Database *sysdb, ThreadInfo *info ) -- 2.11.4.GIT