From d9d8ecdfd82f870bfe23b2ad3635ac376ee012a2 Mon Sep 17 00:00:00 2001 From: Jacek Kubica Date: Mon, 15 Oct 2012 19:48:36 +0000 Subject: [PATCH] 2012-10-15 13:43 UTC+0200 Jacek Kubica (jkubica/at/wssk.wroc.pl) * contrib/hbfbird/tfirebrd.prg * contrib/hbfbird/tfirebrd.prg + added support for aliases in sql queries ! proper transtaltion sql TIMESTAMP -> harbour`s T value type --- harbour/contrib/hbfbird/firebird.c | 4 +++- harbour/contrib/hbfbird/tfirebrd.prg | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/harbour/contrib/hbfbird/firebird.c b/harbour/contrib/hbfbird/firebird.c index 50d69ee5a1..edffafb718 100644 --- a/harbour/contrib/hbfbird/firebird.c +++ b/harbour/contrib/hbfbird/firebird.c @@ -412,13 +412,15 @@ HB_FUNC( FBQUERY ) if( var->sqltype & 1 ) var->sqlind = ( short * ) hb_xgrab( sizeof( short ) ); - hb_arrayNew( aTemp, 5 ); + hb_arrayNew( aTemp, 7 ); hb_arraySetC( aTemp, 1, sqlda->sqlvar[ i ].sqlname ); hb_arraySetNL( aTemp, 2, ( long ) dtype ); hb_arraySetNL( aTemp, 3, sqlda->sqlvar[ i ].sqllen ); hb_arraySetNL( aTemp, 4, sqlda->sqlvar[ i ].sqlscale ); hb_arraySetC( aTemp, 5, sqlda->sqlvar[ i ].relname ); + hb_arraySetNL( aTemp, 6, sqlda->sqlvar[ i ].aliasname_length ); // support for aliases + hb_arraySetC( aTemp, 7, sqlda->sqlvar[ i ].aliasname ); // support for aliases hb_arraySetForward( aNew, i + 1, aTemp ); } diff --git a/harbour/contrib/hbfbird/tfirebrd.prg b/harbour/contrib/hbfbird/tfirebrd.prg index 84d3e82de4..2c394ffd8c 100644 --- a/harbour/contrib/hbfbird/tfirebrd.prg +++ b/harbour/contrib/hbfbird/tfirebrd.prg @@ -982,13 +982,13 @@ STATIC FUNCTION StructConvert( aStru, db, dialect ) IF HB_ISARRAY( qry ) DO WHILE FBFetch( qry ) == 0 - AAdd( aDomains, { FBGetdata( qry, 1 ), FBGetdata( qry, 2 ), FBGetdata( qry, 3 ) } ) + AAdd( aDomains, { IIF(FBGetdata( qry, 1 )==NIL,"",FBGetdata( qry, 1 )), IIF(FBGetdata( qry, 2 )==NIL,"",FBGetdata( qry, 2 )), IIF(FBGetdata( qry, 1 )==NIL,"",FBGetdata( qry, 3 )) } ) ENDDO FBFree( qry ) FOR i := 1 TO Len( aStru ) - cField := RTrim( aStru[ i ][ 1 ] ) + cField := RTrim( aStru[ i ][ 7 ] ) nType := aStru[ i ][ 2 ] nSize := aStru[ i ][ 3 ] nDec := aStru[ i ][ 4 ] * -1 @@ -1039,7 +1039,7 @@ STATIC FUNCTION StructConvert( aStru, db, dialect ) nSize := 15 EXIT CASE SQL_TIMESTAMP - cType := "D" + cType := "T" nSize := 8 EXIT CASE SQL_TYPE_DATE