2010-02-03 12:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbpgsql/tpostgre.prg
    + Formatted.
    ! Indented.
    % Optimized to use SWITCH/CASE.
    % Optimized to avoid ASize() and AAdd() in a few places.
    + Using constants for structure array positions.

  * contrib/hbpgsql/tpostgre.prg
  * contrib/hbpgsql/postgres.ch
  * contrib/hbpgsql/postgres.c
    + Added and using HBPG_META_* constants.
This commit is contained in:
Viktor Szakats
2010-02-03 11:48:17 +00:00
parent 887925cd02
commit 6855fe7257
4 changed files with 965 additions and 934 deletions

View File

@@ -17,6 +17,19 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-02-03 12:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbpgsql/tpostgre.prg
+ Formatted.
! Indented.
% Optimized to use SWITCH/CASE.
% Optimized to avoid ASize() and AAdd() in a few places.
+ Using constants for structure array positions.
* contrib/hbpgsql/tpostgre.prg
* contrib/hbpgsql/postgres.ch
* contrib/hbpgsql/postgres.c
+ Added and using HBPG_META_* constants.
2010-02-03 11:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbpgsql/pgrdd.prg
! Fixed to not call ALERT().

View File

@@ -583,6 +583,15 @@ HB_FUNC( PQGETLENGTH )
hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
/* PQMETADATA() positions for array returned */
#define HBPG_META_FIELDNAME 1
#define HBPG_META_FIELDTYPE 2
#define HBPG_META_FIELDLEN 3
#define HBPG_META_FIELDDEC 4
#define HBPG_META_TABLE 5
#define HBPG_META_TABLECOL 6
#define HBPG_META_LEN_ 6
HB_FUNC( PQMETADATA )
{
PGresult * res = hb_PGresult_par( 1 );
@@ -692,13 +701,13 @@ HB_FUNC( PQMETADATA )
}
pField = hb_arrayGetItemPtr( pResult, i + 1 );
hb_arrayNew( pField, 6 );
hb_arraySetC( pField, 1, PQfname( res, i ) );
hb_arraySetC( pField, 2, buf );
hb_arraySetNI( pField, 3, length );
hb_arraySetNI( pField, 4, decimal );
hb_arraySetNL( pField, 5, PQftable( res, i ) );
hb_arraySetNI( pField, 6, PQftablecol( res, i ) );
hb_arrayNew( pField, HBPG_META_LEN_ );
hb_arraySetC( pField, HBPG_META_FIELDNAME, PQfname( res, i ) );
hb_arraySetC( pField, HBPG_META_FIELDTYPE, buf );
hb_arraySetNI( pField, HBPG_META_FIELDLEN , length );
hb_arraySetNI( pField, HBPG_META_FIELDDEC , decimal );
hb_arraySetNL( pField, HBPG_META_TABLE , PQftable( res, i ) );
hb_arraySetNI( pField, HBPG_META_TABLECOL , PQftablecol( res, i ) );
}
hb_itemReturnRelease( pResult );

View File

@@ -52,6 +52,9 @@
*
*/
#ifndef HBPOSTGRES_CH_
#define HBPOSTGRES_CH_
#define CONNECTION_OK 0
#define CONNECTION_BAD 1
#define CONNECTION_STARTED 2
@@ -76,3 +79,14 @@
#define PQTRANS_INTRANS 2
#define PQTRANS_INERROR 3
#define PQTRANS_UNKNOWN 4
/* PQMETADATA() positions for array returned */
#define HBPG_META_FIELDNAME 1
#define HBPG_META_FIELDTYPE 2
#define HBPG_META_FIELDLEN 3
#define HBPG_META_FIELDDEC 4
#define HBPG_META_TABLE 5
#define HBPG_META_TABLECOL 6
#define HBPG_META_LEN_ 6
#endif

File diff suppressed because it is too large Load Diff