From b901bd22411c344cb356883aecf9d27bc5d23e6a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 21 Nov 2010 20:18:17 +0000 Subject: [PATCH] 2010-11-21 21:17 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbsqlit3/hdbcsqlt.prg * contrib/hbpgsql/hdbcpg.prg % Minor optimizations. ! Fixed RTEs by EXPORTing two object variables: TSQLTStatement:pRes (used from HDBC code) TSQLTResultSet:nRows I'm not sure this is right solution, f.e. one of them is used internally by HBODBC code. --- harbour/ChangeLog | 12 +++++++++++- harbour/contrib/hbpgsql/hdbcpg.prg | 10 ++++++---- harbour/contrib/hbsqlit3/hdbcsqlt.prg | 10 ++++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 468738cc57..bf62c82ed2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,16 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-21 21:17 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbsqlit3/hdbcsqlt.prg + * contrib/hbpgsql/hdbcpg.prg + % Minor optimizations. + ! Fixed RTEs by EXPORTing two object variables: + TSQLTStatement:pRes (used from HDBC code) + TSQLTResultSet:nRows + I'm not sure this is right solution, f.e. one of them + is used internally by HBODBC code. + 2010-11-21 20:42 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbpgsql/postgres.c + Added PQPREPARE(), PQEXECPREPARED(). Based on code donated by @@ -50,7 +60,7 @@ PQPREPARE() PQEXECPREPARED() - ; TOFIX: Internal are accessing obj vars directly: + ; TOFIX: Internal are accessing obj vars directly: [DONE - by simply exporting it, not necessarily good solution] Error BASE/42 Scope violation (protected): TSQLTSTATEMENT:PRES Called from TSQLTSTATEMENT:PRES(0) Called from TSQLTRESULTSET:NEW(0) diff --git a/harbour/contrib/hbpgsql/hdbcpg.prg b/harbour/contrib/hbpgsql/hdbcpg.prg index cd795a26d4..6a80bb1ab5 100644 --- a/harbour/contrib/hbpgsql/hdbcpg.prg +++ b/harbour/contrib/hbpgsql/hdbcpg.prg @@ -156,11 +156,12 @@ create class TPGStatement var pDB var cSql - var pRes var oRs EXPORTED: + var pRes + method new( pDB, cSql ) method executeQuery( cSql ) method executeUpdate( cSql ) @@ -344,7 +345,6 @@ create class TPGResultSet var lAfterLast INIT .F. var nRow INIT 0 - var nRows INIT 0 var cTableName var aPrimaryKeys @@ -354,6 +354,8 @@ create class TPGResultSet EXPORTED: + var nRows INIT 0 + method new( pDB, pStmt ) method Close() @@ -376,7 +378,7 @@ create class TPGResultSet method getString( nField ) method getNumber( nField ) INLINE val( ::getString( nField ) ) - method getDate( nField ) INLINE StoD( strtran( ::getString( nField ), "-", "" ) ) + method getDate( nField ) INLINE StoD( strtran( ::getString( nField ), "-" ) ) method getBoolean( nField ) INLINE ( ::getString( nField ) == "t" ) method getMetaData() @@ -392,7 +394,7 @@ create class TPGResultSet method updateBuffer( nField, xValue, cType ) method updateString( nField, cValue ) INLINE ::updateBuffer( nField, cValue, "C" ) - method updateNumber( nField, nValue ) INLINE ::updateBuffer( nField, alltrim( str( nValue ) ), "N" ) + method updateNumber( nField, nValue ) INLINE ::updateBuffer( nField, hb_ntos( nValue ), "N" ) method updateDate( nField, dValue ) INLINE ::updateBuffer( nField, dtos( dValue ), "D" ) method updateBoolean( nField, lValue ) INLINE ::updateBuffer( nField, iif( lValue, "t", "f" ), "L" ) diff --git a/harbour/contrib/hbsqlit3/hdbcsqlt.prg b/harbour/contrib/hbsqlit3/hdbcsqlt.prg index 34e9b27161..5ab8534797 100644 --- a/harbour/contrib/hbsqlit3/hdbcsqlt.prg +++ b/harbour/contrib/hbsqlit3/hdbcsqlt.prg @@ -144,11 +144,12 @@ create class TSQLTStatement var pDB var cSql - var pRes var oRs EXPORTED: + var pRes + method new( pDB, cSql ) method executeQuery( cSql ) method executeUpdate( cSql ) @@ -296,7 +297,6 @@ create class TSQLTResultSet var lAfterLast INIT .F. var nRow INIT 0 - var nRows INIT 0 var cTableName var aPrimaryKeys @@ -307,6 +307,8 @@ create class TSQLTResultSet EXPORTED: + var nRows INIT 0 + method new( pDB, pStmt ) method Close() @@ -329,7 +331,7 @@ create class TSQLTResultSet method getString( nField ) method getNumber( nField ) INLINE val( ::getString( nField ) ) - method getDate( nField ) INLINE StoD( strtran( ::getString( nField ), "-", "" ) ) + method getDate( nField ) INLINE StoD( strtran( ::getString( nField ), "-" ) ) method getBoolean( nField ) INLINE ( ::getString( nField ) == "t" ) method getMetaData() @@ -345,7 +347,7 @@ create class TSQLTResultSet method updateBuffer( nField, xValue, cType ) method updateString( nField, cValue ) INLINE ::updateBuffer( nField, cValue, "C" ) - method updateNumber( nField, nValue ) INLINE ::updateBuffer( nField, alltrim( str( nValue ) ), "N" ) + method updateNumber( nField, nValue ) INLINE ::updateBuffer( nField, hb_ntos( nValue ), "N" ) method updateDate( nField, dValue ) INLINE ::updateBuffer( nField, dtos( dValue ), "D" ) method updateBoolean( nField, lValue ) INLINE ::updateBuffer( nField, iif( lValue, "t", "f" ), "L" )