From: Vladimir T. <pr...@hm...> - 2003-05-07 08:36:38
|
Hello, All 1)Path: return success isc_database_info 2)Path: set Null to field from parametr String 3)Path: convert DataTime string {ts {d {t to field from parametr String 4)Path: clear SQLFreeStmt(hstmt,SQL_CLOSE) updateCount = insertCount = deleteCount = 0; Index: OdbcStatement.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/OdbcStatement.cpp,v retrieving revision 1.20 diff -u -r1.20 OdbcStatement.cpp --- OdbcStatement.cpp 26 Mar 2003 10:51:48 -0000 1.20 +++ OdbcStatement.cpp 7 May 2003 07:19:08 -0000 @@ -905,6 +905,8 @@ { case SQL_CLOSE: releaseResultSet(); + if(statement) + statement->clearResults(); break; case SQL_UNBIND: @@ -1225,8 +1227,8 @@ cancel = false; numberColumns = 0; - if (resultSet) - releaseResultSet(); +// if (resultSet) + releaseResultSet(); if (!statement->getMoreResults()) return NULL; @@ -1439,6 +1441,15 @@ { statement->setString (parameter, (char*) binding->pointer ); } + // Remove from parametr {t {d {ts + switch(binding->sqlType) + { + case SQL_TYPE_DATE: + case SQL_TYPE_TIME: + case SQL_TYPE_TIMESTAMP: + statement->convStringData (parameter); + break; + } } } break; Index: Attachment.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/Attachment.cpp,v retrieving revision 1.2 diff -u -r1.2 Attachment.cpp --- Attachment.cpp 11 Oct 2002 11:09:05 -0000 1.2 +++ Attachment.cpp 7 May 2003 07:19:35 -0000 @@ -110,7 +110,7 @@ throw SQLEXCEPTION (statusVector [1], text); } - char result [100]; + char result [256]; databaseDialect = SQL_DIALECT_V5; if (!isc_database_info (statusVector, &databaseHandle, sizeof (databaseInfoItems), databaseInfoItems, sizeof (result), result)) Index: Connection.h =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/Connection.h,v retrieving revision 1.8 diff -u -r1.8 Connection.h --- Connection.h 11 Oct 2002 11:09:05 -0000 1.8 +++ Connection.h 7 May 2003 07:19:38 -0000 @@ -296,6 +296,7 @@ virtual bool execute (const char *sqlString) = 0; virtual ResultSet* executeQuery (const char *sqlString) = 0; virtual int getUpdateCount() = 0; + virtual void clearResults() = 0; virtual bool getMoreResults() = 0; virtual void setCursorName (const char *name) = 0; virtual ResultSet* getResultSet() = 0; @@ -330,6 +331,7 @@ virtual int executeUpdate() = 0; virtual void setString(int index, const char * string) = 0; virtual void setString(int index, const char * string, int length) = 0; + virtual void convStringData(int index) = 0; virtual void setByte (int index, char value) = 0; virtual void setShort (int index, short value) = 0; virtual void setInt (int index, long value) = 0; Index: IscCallableStatement.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/IscCallableStatement.cpp,v retrieving revision 1.6 diff -u -r1.6 IscCallableStatement.cpp --- IscCallableStatement.cpp 11 Oct 2002 11:09:05 -0000 1.6 +++ IscCallableStatement.cpp 7 May 2003 07:19:40 -0000 @@ -136,6 +136,11 @@ Parent::setString(index, string, length); } +void IscCallableStatement::convStringData(int index) +{ + Parent::convStringData (index); +} + bool IscCallableStatement::execute() { connection->startTransaction(); @@ -230,6 +235,11 @@ return Parent::getUpdateCount(); } +void IscCallableStatement::clearResults() +{ + Parent::clearResults(); +} + bool IscCallableStatement::getMoreResults() { return Parent::getMoreResults(); Index: IscCallableStatement.h =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/IscCallableStatement.h,v retrieving revision 1.6 diff -u -r1.6 IscCallableStatement.h --- IscCallableStatement.h 11 Oct 2002 11:09:05 -0000 1.6 +++ IscCallableStatement.h 7 May 2003 07:19:41 -0000 @@ -72,6 +72,7 @@ virtual StatementMetaData* getStatementMetaData(); virtual bool execute (const char *sqlString); virtual ResultSet* executeQuery (const char *sqlString); + virtual void clearResults(); virtual int getUpdateCount(); virtual bool getMoreResults(); virtual void setCursorName (const char *name); @@ -85,6 +86,7 @@ virtual void setNull (int index, int type); virtual void setString(int index, const char * string); virtual void setString(int index, const char * string, int length); + virtual void convStringData(int index); virtual void setByte (int index, char value); virtual void setShort (int index, short value); virtual void setInt (int index, long value); Index: IscColumnsResultSet.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/IscColumnsResultSet.cpp,v retrieving revision 1.10 diff -u -r1.10 IscColumnsResultSet.cpp --- IscColumnsResultSet.cpp 26 Mar 2003 10:51:49 -0000 1.10 +++ IscColumnsResultSet.cpp 7 May 2003 07:19:44 -0000 @@ -117,7 +117,6 @@ OutputDebugString (sql.getString()); #endif prepareStatement (sql); - numberColumns = 18; } bool IscColumnsResultSet::next() Index: IscPreparedStatement.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/IscPreparedStatement.cpp,v retrieving revision 1.8 diff -u -r1.8 IscPreparedStatement.cpp --- IscPreparedStatement.cpp 11 Oct 2002 11:09:05 -0000 1.8 +++ IscPreparedStatement.cpp 7 May 2003 07:19:45 -0000 @@ -115,6 +115,11 @@ getParameter (index - 1)->setString (length, string, true); } +void IscPreparedStatement::convStringData(int index) +{ + getParameter (--index)->convertStringData (); +} + bool IscPreparedStatement::execute() { int numberParameters = inputSqlda.getColumnCount(); @@ -205,6 +210,11 @@ return IscStatement::executeQuery (sqlString); } +void IscPreparedStatement::clearResults() +{ + IscStatement::clearResults (); +} + int IscPreparedStatement::getUpdateCount() { return IscStatement::getUpdateCount (); Index: IscPreparedStatement.h =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/IscPreparedStatement.h,v retrieving revision 1.6 diff -u -r1.6 IscPreparedStatement.h --- IscPreparedStatement.h 11 Oct 2002 11:09:05 -0000 1.6 +++ IscPreparedStatement.h 7 May 2003 07:19:46 -0000 @@ -52,6 +52,7 @@ virtual ~IscPreparedStatement(); virtual bool execute (const char *sqlString); virtual ResultSet* executeQuery (const char *sqlString); + virtual void clearResults(); virtual int getUpdateCount(); virtual bool getMoreResults(); virtual void setCursorName (const char *name); @@ -65,6 +66,7 @@ virtual void setNull (int index, int type); virtual void setString(int index, const char * string); virtual void setString(int index, const char * string, int length); + virtual void convStringData(int index); virtual void setByte (int index, char value); //Added by RM virtual void beginBlobDataTransfer(int index); Index: IscStatement.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/IscStatement.cpp,v retrieving revision 1.8 diff -u -r1.8 IscStatement.cpp --- IscStatement.cpp 26 Mar 2003 10:51:49 -0000 1.8 +++ IscStatement.cpp 7 May 2003 07:19:52 -0000 @@ -366,7 +366,7 @@ void IscStatement::clearResults() { - + updateCount = insertCount = deleteCount = 0; } int IscStatement::objectVersion() Index: Sqlda.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/Sqlda.cpp,v retrieving revision 1.5 diff -u -r1.5 Sqlda.cpp --- Sqlda.cpp 25 Nov 2002 18:58:28 -0000 1.5 +++ Sqlda.cpp 7 May 2003 07:19:56 -0000 @@ -623,13 +623,14 @@ var->sqlscale = 0; var->sqldata = (char*) &value->data; - var->sqlind = NULL; + *var->sqlind = 0; switch (value->type) { case Null: - var->sqltype = SQL_LONG; - var->sqlind = &sqlNull; + var->sqltype |= 1; + *var->sqlind = sqlNull; + memset (var->sqldata, 0, var->sqllen); break; case String: Index: Value.cpp =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/Value.cpp,v retrieving revision 1.7 diff -u -r1.7 Value.cpp --- Value.cpp 26 Mar 2003 10:51:50 -0000 1.7 +++ Value.cpp 7 May 2003 07:19:59 -0000 @@ -203,6 +203,35 @@ data.string.string = (char*) string; } +void Value::convertStringData() +{ + char * pt, * ptTmp = data.string.string; + + if (!ptTmp || !*ptTmp) + return; + + while(*ptTmp==' ')ptTmp++; + + if(*ptTmp!='{') + return; + + pt = data.string.string; + + while(*ptTmp && *ptTmp!='\'')ptTmp++; + + if(*ptTmp!='\'') + return; + + ptTmp++; // ch \' + + while(*ptTmp && *ptTmp!='\'') + *pt++=*ptTmp++; + + data.string.length = pt-data.string.string; + *pt = '\0'; + // validate end string check Server +} + char* Value::getString() { switch (type) Index: Value.h =================================================================== RCS file: /cvsroot/firebird/OdbcJdbc/IscDbc/Value.h,v retrieving revision 1.3 diff -u -r1.3 Value.h --- Value.h 2 Jul 2001 22:57:51 -0000 1.3 +++ Value.h 7 May 2003 07:19:59 -0000 @@ -67,6 +67,7 @@ //protected: void setString (int length, const char *string, bool copy); void setString (const char *value, bool copy); + void convertStringData(); public: void setValue (SqlTime value); -- Best regards, Vladimir Tcvigun |