2021-03-31 23:43 UTC+0200 Aleksander Czajczynski (hb fki.pl)

* contrib/hbpgsql/postgres.c
    ! guard PQEXECPARAMS() wrapper from generating unrecoverable error
      on empty parameter array "hb_xgrab requested to allocate zero bytes"

  * contrib/hbpgsql/tpostgre.prg
    ! corrected buggy parameter order in TPQserver():Query()

    * make TPQQuery, TPQRow classes more aware of NIL to NULL conversions,
      added support for inserting and updating empty xBase date value
      should fix issue #234, oRow:FieldPut( <n>, NIL ) also looks good
This commit is contained in:
Aleksander Czajczynski
2021-03-31 23:43:52 +02:00
parent ff3a726edf
commit 8a8575609a
3 changed files with 54 additions and 24 deletions

View File

@@ -688,16 +688,22 @@ HB_FUNC( PQEXECPARAMS )
if( conn && aParam )
{
int n = ( int ) hb_arrayLen( aParam );
int i;
const char ** paramvalues = ( const char ** ) hb_xgrab( sizeof( char * ) * n );
if( ! n )
hb_PGresult_ret( PQexec( conn, hb_parcx( 2 ) ) );
else
{
int i;
for( i = 0; i < n; ++i )
paramvalues[ i ] = hb_arrayGetCPtr( aParam, i + 1 );
const char ** paramvalues = ( const char ** ) hb_xgrab( sizeof( char * ) * n );
hb_PGresult_ret( PQexecParams( conn, hb_parcx( 2 ), n, NULL, paramvalues, NULL, NULL, hb_parnidef( 4, 1 ) ) );
for( i = 0; i < n; ++i )
paramvalues[ i ] = hb_arrayGetCPtr( aParam, i + 1 );
hb_xfree( ( void * ) paramvalues );
hb_PGresult_ret( PQexecParams( conn, hb_parcx( 2 ), n, NULL, paramvalues, NULL, NULL, hb_parnidef( 4, 1 ) ) );
hb_xfree( ( void * ) paramvalues );
}
}
else
hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );