2023-12-07 21:21 UTC+0100 Phil Krylov (phil a t krylov.eu)

; merged:
  2015-04-09 11:34 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    * contrib/hbsqlit3/core.c
    * contrib/hbsqlit3/hbsqlit3.hbx
      + add sqlite3_status64()
      % adjust variable scopes
      ! fix to reset reference parameters in functions with
        functionality disabled
    ; origin: 5bcaa24c93

  2015-09-02 19:11 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
    * contrib/hbsqlit3/core.c
      % use hb_fileLoad()
    ; Commit split from:
    ; origin: 8f534aaa77

  2017-08-01 20:23 UTC Viktor Szakats (vszakats users.noreply.github.com)
    * contrib/hbsqlit3/core.c
    * contrib/sddsqlt3/core.c
      * use new sqlite3_prepare_v3() when built against
        sqlite 3.20.0 or upper.
    * contrib/hbsqlit3/core.c
      + SQLITE3_PREPARE() add 3rd parameter <nPrepFlags>
        Usable if build against sqlite 3.20.0 or upper, ignored otherwise
    * contrib/hbsqlit3/hbsqlit3.ch
      + add SQLITE3_PREPARE_PERSISTENT constant
    ; origin: b33de96c81
This commit is contained in:
Viktor Szakats
2023-11-15 22:36:13 +01:00
committed by Phil Krylov
parent 8220d099e2
commit 38f5ec7738
4 changed files with 78 additions and 29 deletions

View File

@@ -7,6 +7,35 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */
2023-12-07 21:21 UTC+0100 Phil Krylov (phil a t krylov.eu)
; merged:
2015-04-09 11:34 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
* contrib/hbsqlit3/core.c
* contrib/hbsqlit3/hbsqlit3.hbx
+ add sqlite3_status64()
% adjust variable scopes
! fix to reset reference parameters in functions with
functionality disabled
; origin: https://github.com/vszakats/hb/commit/5bcaa24c93bccdbdfe9ea52f3cbf4ebb8837dd5f
2015-09-02 19:11 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
* contrib/hbsqlit3/core.c
% use hb_fileLoad()
; Commit split from:
; origin: https://github.com/vszakats/hb/commit/8f534aaa77ff07ad86db5ad079d376d515561c5a
2017-08-01 20:23 UTC Viktor Szakats (vszakats users.noreply.github.com)
* contrib/hbsqlit3/core.c
* contrib/sddsqlt3/core.c
* use new sqlite3_prepare_v3() when built against
sqlite 3.20.0 or upper.
* contrib/hbsqlit3/core.c
+ SQLITE3_PREPARE() add 3rd parameter <nPrepFlags>
Usable if build against sqlite 3.20.0 or upper, ignored otherwise
* contrib/hbsqlit3/hbsqlit3.ch
+ add SQLITE3_PREPARE_PERSISTENT constant
; origin: https://github.com/vszakats/hb/commit/b33de96c81ac790f390e506160a4d1d8c2b5f4fe
2023-12-07 21:00 UTC+0100 Phil Krylov (phil a t krylov.eu)
* config/win/bcc.mk
* utils/hbmk2/hbmk2.prg

View File

@@ -870,8 +870,15 @@ HB_FUNC( SQLITE3_PREPARE )
const char * pszSQLText = hb_parstr_utf8( 2, &hSQLText, &nSQLText );
psqlite3_stmt pStmt;
const char * pszTail;
int result;
if( sqlite3_prepare_v2( pHbSqlite3->db, pszSQLText, ( int ) nSQLText, &pStmt, &pszTail ) == SQLITE_OK )
#if SQLITE_VERSION_NUMBER >= 3020000
result = sqlite3_prepare_v3( pHbSqlite3->db, pszSQLText, ( int ) nSQLText, ( unsigned int ) hb_parnl( 3 ), &pStmt, &pszTail );
#else
result = sqlite3_prepare_v2( pHbSqlite3->db, pszSQLText, ( int ) nSQLText, &pStmt, &pszTail );
#endif
if( result == SQLITE_OK )
hb_retptr( pStmt );
else
{
@@ -1994,22 +2001,11 @@ HB_FUNC( SQLITE3_TRACE )
HB_FUNC( SQLITE3_FILE_TO_BUFF )
{
HB_FHANDLE handle = hb_fsOpen( hb_parcx( 1 ), FO_READ );
HB_SIZE nSize;
char * pBuffer = ( char * ) hb_fileLoad( hb_parcx( 1 ), 0, &nSize );
if( handle != FS_ERROR )
{
char * buffer;
HB_SIZE nSize;
nSize = hb_fsSeek( handle, 0, FS_END );
hb_fsSeek( handle, 0, FS_SET );
buffer = ( char * ) hb_xgrab( nSize + 1 );
nSize = hb_fsReadLarge( handle, buffer, nSize );
buffer[ nSize ] = '\0';
hb_fsClose( handle );
hb_retclen_buffer( buffer, nSize );
}
if( pBuffer )
hb_retclen_buffer( pBuffer, nSize );
else
hb_retc_null();
}
@@ -2212,15 +2208,13 @@ HB_FUNC( SQLITE3_BACKUP_INIT )
{
#if SQLITE_VERSION_NUMBER >= 3006011
HB_SQLITE3 * pHbSqlite3Dest = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE );
HB_SQLITE3 * pHbSqlite3Source = ( HB_SQLITE3 * ) hb_sqlite3_param( 3, HB_SQLITE3_DB,
HB_TRUE );
sqlite3_backup * pBackup;
HB_SQLITE3 * pHbSqlite3Source = ( HB_SQLITE3 * ) hb_sqlite3_param( 3, HB_SQLITE3_DB, HB_TRUE );
if( pHbSqlite3Dest && pHbSqlite3Dest->db && pHbSqlite3Source && pHbSqlite3Source->db &&
HB_ISCHAR( 2 ) && HB_ISCHAR( 4 ) )
{
pBackup = sqlite3_backup_init( pHbSqlite3Dest->db, hb_parcx(
2 ), pHbSqlite3Source->db, hb_parcx( 4 ) );
sqlite3_backup * pBackup = sqlite3_backup_init( pHbSqlite3Dest->db,
hb_parcx( 2 ), pHbSqlite3Source->db, hb_parcx( 4 ) );
if( pBackup )
hb_retptr( pBackup ); /* FIXME: Create GC collected pointer */
@@ -2354,12 +2348,33 @@ HB_FUNC( SQLITE3_STATUS )
hb_storni( iCurrent, 2 );
hb_storni( iHighwater, 3 );
return;
}
else
hb_retni( -1 );
#else
hb_retni( -1 );
#endif
hb_storni( 0, 3 );
hb_storni( 0, 4 );
hb_retni( -1 );
}
HB_FUNC( SQLITE3_STATUS64 )
{
#if SQLITE_VERSION_NUMBER >= 3080900 && ! defined( HB_LONG_LONG_OFF )
if( hb_pcount() > 3 && ( HB_ISNUM( 2 ) && HB_ISBYREF( 2 ) ) && ( HB_ISNUM( 3 ) && HB_ISBYREF( 3 ) ) )
{
sqlite3_int64 iCurrent, iHighwater;
hb_retni( sqlite3_status( hb_parni( 1 ), &iCurrent, &iHighwater, ( int ) hb_parl( 4 ) ) );
hb_stornint( iCurrent, 2 );
hb_stornint( iHighwater, 3 );
return;
}
#endif
hb_stornint( 0, 2 );
hb_stornint( 0, 3 );
hb_retni( -1 );
}
/**
@@ -2383,12 +2398,13 @@ HB_FUNC( SQLITE3_DB_STATUS )
hb_storni( iCurrent, 3 );
hb_storni( iHighwater, 4 );
return;
}
else
hb_retni( -1 );
#else
hb_retni( -1 );
#endif
hb_storni( 0, 3 );
hb_storni( 0, 4 );
hb_retni( -1 );
}
/**

View File

@@ -180,4 +180,7 @@
#define SQLITE_TRACE_ROW 0x04
#define SQLITE_TRACE_CLOSE 0x08
/* sqlite3_prepare() option (requires sqlite 3.20.0) */
#define SQLITE_PREPARE_PERSISTENT 0x01
#endif

View File

@@ -110,6 +110,7 @@ DYNAMIC sqlite3_sleep
DYNAMIC sqlite3_sourceid
DYNAMIC sqlite3_sql
DYNAMIC sqlite3_status
DYNAMIC sqlite3_status64
DYNAMIC sqlite3_step
DYNAMIC sqlite3_stmt_readonly
DYNAMIC sqlite3_stmt_status