hbsqlit3

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  
c:\harbour\contrib\hbsqlit3
hbsqlit3.c
TypeFunctionSourceLine
STATIC HB_GARBAGE_FUNC(hb_sqlite3_Destructor )
static HB_GARBAGE_FUNC( hb_sqlite3_Destructor )
{
   psqlite3 * dbPtr = ( psqlite3 * ) Cargo;

   if( *dbPtr )
   {
      sqlite3 * pDb = ( sqlite3 * ) dbPtr;

      sqlite3_close( pDb );

      *dbPtr = NULL;
   }
}
hbsqlit3.c85
STATIC PSQLITE3hb_parsqlite3( int iParam )
static psqlite3 hb_parsqlite3( int iParam )
{
   psqlite3 * dbPtr = ( psqlite3 * ) hb_parptrGC( hb_sqlite3_Destructor, iParam );

   return dbPtr ? *dbPtr : NULL;
}
hbsqlit3.c103
STATIC VOIDhb_retsqlite3( sqlite3 * pDb )
static void hb_retsqlite3( sqlite3 * pDb )
{
   psqlite3 * dbPtr = ( psqlite3 * ) hb_gcAlloc( sizeof( psqlite3 ), hb_sqlite3_Destructor );

   *dbPtr = pDb;

   hb_retptrGC( ( void * ) dbPtr );
}
hbsqlit3.c110
HB_FUNCSQLITE3_LIBVERSION(void)
HB_FUNC( SQLITE3_LIBVERSION )
{
   hb_retc( sqlite3_libversion() );
}
hbsqlit3.c127
HB_FUNCSQLITE3_LIBVERSION_NUMBER(void)
HB_FUNC( SQLITE3_LIBVERSION_NUMBER )
{
   hb_retni( sqlite3_libversion_number() );
}
hbsqlit3.c132
HB_FUNCSQLITE3_EXTENDED_RESULT_CODES(void)
HB_FUNC( SQLITE3_EXTENDED_RESULT_CODES )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retni( sqlite3_extended_result_codes( db, hb_parl( 2 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c143
HB_FUNCSQLITE3_ERRCODE(void)
HB_FUNC( SQLITE3_ERRCODE )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retni( sqlite3_errcode( db ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c162
HB_FUNCSQLITE3_ERRMSG(void)
HB_FUNC( SQLITE3_ERRMSG )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retc( sqlite3_errmsg( db ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c172
HB_FUNCSQLITE3_SLEEP(void)
HB_FUNC( SQLITE3_SLEEP )
{
   hb_retni( sqlite3_sleep( hb_parni( 1 ) ) );
}
hbsqlit3.c188
HB_FUNCSQLITE3_LAST_INSERT_ROWID(void)
HB_FUNC( SQLITE3_LAST_INSERT_ROWID )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retnint( sqlite3_last_insert_rowid( db ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c199
HB_FUNCSQLITE3_TEMP_DIRECTORY(void)
HB_FUNC( SQLITE3_TEMP_DIRECTORY )
{
   BOOL  bResult = FALSE;

   #ifdef NODLL
   {
      BOOL fFree;
      char * pszDirName = hb_fsNameConv( ( BYTE * ) hb_parc( 1 ), &fFree );

      if( hb_fsIsDirectory( pszDirName ) )
         bResult = TRUE;
      else
      {
         if( hb_parl( 2 ) ) /* create temp directory if not exist */
         {
            if( hb_fsMkDir( pszDirName ) )
               bResult = TRUE;
            else
            {
               HB_TRACE(HB_TR_DEBUG, ("sqlite_temp_directory(): Can't create directory %s", pszDirName));
            }
         }
         else
         {
            HB_TRACE(HB_TR_DEBUG, ("sqlite_temp_directory(): Directory doesn't exist %s", pszDirName));
         }
      }
      
      if( bResult )
         sqlite3_temp_directory = hb_strdup( pszDirName );
      
      if( fFree )
         hb_xfree( pszDirName );
   }
   #endif

   hb_retl( bResult );
}
hbsqlit3.c215
HB_FUNCSQLITE3_OPEN(void)
HB_FUNC( SQLITE3_OPEN )
{
   psqlite3 db;
   BOOL fFree;
   char * pszdbName = ( char * ) hb_fsNameConv( ( BYTE * ) hb_parc( 1 ), &fFree );

   if( hb_fsFile( ( BYTE * ) pszdbName ) || hb_parl( 2 ) )
   {
      if( sqlite3_open( pszdbName, &db ) == SQLITE_OK )
         hb_retsqlite3( db );
      else
      {
         sqlite3_close( db );
      
         hb_retptr( NULL );
      }
   }
   else
   {
      HB_TRACE(HB_TR_DEBUG, ("sqlite3_open(): Database doesn't exist %s", pszdbName));

      hb_retptr( NULL );
   }

   if( fFree )
      hb_xfree( pszdbName );
}
hbsqlit3.c262
HB_FUNCSQLITE3_OPEN_V2(void)
HB_FUNC( SQLITE3_OPEN_V2 )
{
   psqlite3 db;
   BOOL fFree;
   char * pszdbName = ( char * ) hb_fsNameConv( ( BYTE * ) hb_parc( 1 ), &fFree );

   if( sqlite3_open_v2( pszdbName, &db, hb_parni( 2 ), NULL ) == SQLITE_OK )
      hb_retsqlite3( db );
   else
   {
      sqlite3_close( db );

      hb_retptr( NULL );
   }

   if( fFree )
      hb_xfree( pszdbName );
}
hbsqlit3.c290
HB_FUNCSQLITE3_EXEC(void)
HB_FUNC( SQLITE3_EXEC )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
   {
      char * pszErrMsg = NULL;
      int rc = sqlite3_exec( db, hb_parc( 2 ), NULL, 0, &pszErrMsg );

      if( rc != SQLITE_OK )
      {
         HB_TRACE(HB_TR_DEBUG, ("sqlite3_exec(): Returned error: %s", pszErrMsg));
         sqlite3_free( pszErrMsg );
      }

      hb_retni( rc );
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c315
HB_FUNCSQLITE3_PREPARE(void)
HB_FUNC( SQLITE3_PREPARE )
{
   psqlite3 pDb = hb_parsqlite3( 1 );

   if( pDb )
   {
      PHB_ITEM SQL = hb_param( 2, HB_IT_STRING );

      if( SQL )
      {
         char *        pSQL = hb_itemGetCPtr( SQL );
         ULONG         ulLen = hb_itemGetCLen( SQL );
         psqlite3_stmt pStmt;
         const char *  pszTail;

         if( sqlite3_prepare_v2( pDb, pSQL, ulLen, &pStmt, &pszTail ) == SQLITE_OK )
            hb_retptr( pStmt );
         else
         {
            sqlite3_finalize( pStmt );

            hb_retptr( NULL );
         }
      }
      else
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 2 ) );
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c345
HB_FUNCSQLITE3_DB_HANDLE(void)
HB_FUNC( SQLITE3_DB_HANDLE )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retsqlite3( sqlite3_db_handle( pStmt ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c382
HB_FUNCSQLITE3_STEP(void)
HB_FUNC( SQLITE3_STEP )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_step( pStmt ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c398
HB_FUNCSQLITE3_CLEAR_BINDINGS(void)
HB_FUNC( SQLITE3_CLEAR_BINDINGS )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_clear_bindings( pStmt ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c418
HB_FUNCSQLITE3_RESET(void)
HB_FUNC( SQLITE3_RESET )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_reset( pStmt ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c434
HB_FUNCSQLITE3_FINALIZE(void)
HB_FUNC( SQLITE3_FINALIZE )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_finalize( pStmt ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}

hbsqlit3.c450
HB_FUNCSQLITE3_BIND_BLOB(void)
HB_FUNC( SQLITE3_BIND_BLOB )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_blob( pStmt, hb_parni( 2 ), ( const char * ) hb_parcx( 3 ), hb_parcsiz( 3 ) - 1, SQLITE_TRANSIENT ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c482
HB_FUNCSQLITE3_BIND_DOUBLE(void)
HB_FUNC( SQLITE3_BIND_DOUBLE )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_double( pStmt, hb_parni( 2 ), hb_parnd( 3 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c492
HB_FUNCSQLITE3_BIND_INT(void)
HB_FUNC( SQLITE3_BIND_INT )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_int( pStmt, hb_parni( 2 ), hb_parni( 3 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c502
HB_FUNCSQLITE3_BIND_INT64(void)
HB_FUNC( SQLITE3_BIND_INT64 )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );
   sqlite3_int64 int64 = hb_parnint( 3 );

   if( pStmt )
      hb_retni( sqlite3_bind_int64( pStmt, hb_parni( 2 ), int64 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c512
HB_FUNCSQLITE3_BIND_NULL(void)
HB_FUNC( SQLITE3_BIND_NULL )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_null( pStmt, hb_parni( 2 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c523
HB_FUNCSQLITE3_BIND_TEXT(void)
HB_FUNC( SQLITE3_BIND_TEXT )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_text( pStmt, hb_parni( 2 ), ( const char * ) hb_parc( 3 ), hb_parclen( 3 ), SQLITE_TRANSIENT ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c533
HB_FUNCSQLITE3_BIND_ZEROBLOB(void)
HB_FUNC( SQLITE3_BIND_ZEROBLOB )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_zeroblob( pStmt, hb_parni( 2 ), hb_parni( 3 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c543
HB_FUNCSQLITE3_BIND_PARAMETER_COUNT(void)
HB_FUNC( SQLITE3_BIND_PARAMETER_COUNT )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_parameter_count( pStmt ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c559
HB_FUNCSQLITE3_BIND_PARAMETER_INDEX(void)
HB_FUNC( SQLITE3_BIND_PARAMETER_INDEX )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_bind_parameter_index( pStmt, hb_parc( 2 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c575
HB_FUNCSQLITE3_BIND_PARAMETER_NAME(void)
HB_FUNC( SQLITE3_BIND_PARAMETER_NAME )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retc( sqlite3_bind_parameter_name( pStmt, hb_parni( 2 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c591
HB_FUNCSQLITE3_CHANGES(void)
HB_FUNC( SQLITE3_CHANGES )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retni( sqlite3_changes(db) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c607
HB_FUNCSQLITE3_TOTAL_CHANGES(void)
HB_FUNC( SQLITE3_TOTAL_CHANGES )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retni( sqlite3_total_changes(db) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c623
HB_FUNCSQLITE3_COLUMN_COUNT(void)
HB_FUNC( SQLITE3_COLUMN_COUNT )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_column_count( pStmt ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c639
HB_FUNCSQLITE3_COLUMN_TYPE(void)
HB_FUNC( SQLITE3_COLUMN_TYPE )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_column_type( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c665
HB_FUNCSQLITE3_COLUMN_DECLTYPE(void)
HB_FUNC( SQLITE3_COLUMN_DECLTYPE )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retc( sqlite3_column_decltype( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c675
HB_FUNCSQLITE3_COLUMN_NAME(void)
HB_FUNC( SQLITE3_COLUMN_NAME )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retc( sqlite3_column_name( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c691
HB_FUNCSQLITE3_COLUMN_BYTES(void)
HB_FUNC( SQLITE3_COLUMN_BYTES )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_column_bytes( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c714
HB_FUNCSQLITE3_COLUMN_BLOB(void)
HB_FUNC( SQLITE3_COLUMN_BLOB )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
   {
      int index = hb_parni( 2 ) - 1;

      hb_retclen( ( const char * ) sqlite3_column_blob( pStmt, index ), 
                  sqlite3_column_bytes( pStmt, index ) );
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c724
HB_FUNCSQLITE3_COLUMN_DOUBLE(void)
HB_FUNC( SQLITE3_COLUMN_DOUBLE )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retnd( sqlite3_column_double( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c739
HB_FUNCSQLITE3_COLUMN_INT(void)
HB_FUNC( SQLITE3_COLUMN_INT )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retni( sqlite3_column_int( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c749
HB_FUNCSQLITE3_COLUMN_INT64(void)
HB_FUNC( SQLITE3_COLUMN_INT64 )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retnint( sqlite3_column_int64( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c759
HB_FUNCSQLITE3_COLUMN_TEXT(void)
HB_FUNC( SQLITE3_COLUMN_TEXT )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
   {
      int index = hb_parni( 2 ) - 1;
      hb_retclen( ( char * ) sqlite3_column_text( pStmt, index ), 
                  sqlite3_column_bytes( pStmt, index ) );
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c769
HB_FUNCSQLITE3_ENABLE_LOAD_EXTENSION(void)
HB_FUNC( SQLITE3_ENABLE_LOAD_EXTENSION )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retni( sqlite3_enable_load_extension( db, hb_parl( 2 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c789
HB_FUNCSQLITE3_RESET_AUTO_EXTENSION(void)
HB_FUNC( SQLITE3_RESET_AUTO_EXTENSION )
{
   sqlite3_reset_auto_extension();
}
hbsqlit3.c805
HB_FUNCSQLITE3_BUSY_TIMEOUT(void)
HB_FUNC( SQLITE3_BUSY_TIMEOUT )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retni( sqlite3_busy_timeout( db, hb_parni( 2 ) ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c816
HB_FUNCSQLITE3_COMPLETE(void)
HB_FUNC( SQLITE3_COMPLETE )
{
   hb_retl( sqlite3_complete( hb_parc( 1 ) ) );
}
hbsqlit3.c832
HB_FUNCSQLITE3_GET_TABLE(void)
HB_FUNC( SQLITE3_GET_TABLE )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
   {
      PHB_ITEM pResultList = hb_itemArrayNew( 0 );
      int      iRow, iCol;
      char *   pszErrMsg = NULL;
      char **  pResult;

      if( sqlite3_get_table( db, hb_parc( 2 ), &pResult, &iRow, &iCol, &pszErrMsg ) == SQLITE_OK )
      {
         int i, j, k = 0;

         for( i = 0; i < iRow + 1; i++ )
         {
            PHB_ITEM pArray = hb_itemArrayNew( iCol );

            for( j = 1; j <= iCol; j++, k++ )
               hb_arraySetC( pArray, j, pResult[ k ] );

            hb_arrayAddForward( pResultList, pArray );
            hb_itemRelease( pArray );
         }
      }
      else
      {
         HB_TRACE(HB_TR_DEBUG, ("sqlite3_get_table(): Returned error: %s", pszErrMsg));
         sqlite3_free( pszErrMsg );
      }

      sqlite3_free_table( pResult );

      hb_itemReturnRelease( pResultList );
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c843
HB_FUNCSQLITE3_TABLE_COLUMN_METADATA(void)
HB_FUNC( SQLITE3_TABLE_COLUMN_METADATA )
{
   psqlite3 pDb = hb_parsqlite3( 1 );

   if( pDb )
   {
      char const ** pzDataType = NULL;
      char const ** pzCollSeq = NULL;
      int           iNotNull = 0;
      int           iPrimaryKey = 0;
      int           iAutoinc = 0;

      if( sqlite3_table_column_metadata( pDb,
                                         ( const char * ) hb_parc( 2 ) /* zDbName */,
                                         ( const char * ) hb_parc( 3 ) /* zTableName */,
                                         ( const char * ) hb_parc( 4 ) /* zColumnName */,
                                         &pzDataType /* pzDataDtype */,
                                         &pzCollSeq /* pzCollSeq */,
                                         &iNotNull,
                                         &iPrimaryKey,
                                         &iAutoinc ) == SQLITE_OK )
      {
         PHB_ITEM pArray = hb_itemArrayNew( 5 );

         hb_arraySetC( pArray, 1, ( char * ) pzDataType );
         hb_arraySetC( pArray, 2, ( char * ) pzCollSeq );
         hb_arraySetL( pArray, 3, ( BOOL ) iNotNull );
         hb_arraySetL( pArray, 4, ( BOOL ) iPrimaryKey );
         hb_arraySetL( pArray, 5, ( BOOL ) iAutoinc );

         hb_itemReturnRelease( pArray );
      }
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c901
HB_FUNCSQLITE3_COLUMN_DATABASE_NAME(void)
HB_FUNC( SQLITE3_COLUMN_DATABASE_NAME )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retc( sqlite3_column_database_name( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c946
HB_FUNCSQLITE3_COLUMN_TABLE_NAME(void)
HB_FUNC( SQLITE3_COLUMN_TABLE_NAME )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retc( sqlite3_column_table_name( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c956
HB_FUNCSQLITE3_COLUMN_ORIGIN_NAME(void)
HB_FUNC( SQLITE3_COLUMN_ORIGIN_NAME )
{
   psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );

   if( pStmt )
      hb_retc( sqlite3_column_origin_name( pStmt, hb_parni( 2 ) - 1 ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}

#endif

hbsqlit3.c966
HB_FUNCSQLITE3_BLOB_OPEN(void)
HB_FUNC( SQLITE3_BLOB_OPEN )
{
   psqlite3 pDb = hb_parsqlite3( 1 );

   if( pDb )
   {
      sqlite3_blob * ppBlob = NULL;

      if( sqlite3_blob_open( pDb,
                             ( const char * ) hb_parc( 2 ) /* zDb */,
                             ( const char * ) hb_parc( 3 ) /* zTable */,
                             ( const char * ) hb_parc( 4 ) /* zColumn */,
                             ( sqlite3_int64 ) hb_parnint( 5 ) /* iRow */,
                             hb_parni( 6 ) /* flags */,
                             &ppBlob ) == SQLITE_OK )
         hb_retptr( ppBlob );
      else
         hb_retptr( NULL );
   }
   else
      hb_retptr( NULL );
}
hbsqlit3.c991
HB_FUNCSQLITE3_BLOB_CLOSE(void)
HB_FUNC( SQLITE3_BLOB_CLOSE )
{
   sqlite3_blob * pBlob = ( sqlite3_blob * ) hb_parptr( 1 );

   if( pBlob )
      hb_retni( sqlite3_blob_close( pBlob ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c1018
HB_FUNCSQLITE3_BLOB_BYTES(void)
HB_FUNC( SQLITE3_BLOB_BYTES )
{
   sqlite3_blob * pBlob = ( sqlite3_blob * ) hb_parptr( 1 );

   if( pBlob )
      hb_retni( sqlite3_blob_bytes( pBlob ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c1032
HB_FUNCSQLITE3_BLOB_READ(void)
HB_FUNC( SQLITE3_BLOB_READ )
{
   sqlite3_blob * pBlob = ( sqlite3_blob * ) hb_parptr( 1 );

   if( pBlob )
   {
      int    iLen = hb_parni( 2 );
      BYTE * buffer;

      if( iLen == 0 )
         iLen = sqlite3_blob_bytes( pBlob );

      buffer = ( BYTE * ) hb_xgrab( iLen + 1 );
      /*hb_xmemset( buffer, 0, iLen );*/

      if( SQLITE_OK == sqlite3_blob_read( pBlob, buffer, iLen, hb_parni( 3 ) ) ) 
      {
         buffer[ iLen ] = '\0';
         hb_retclen_buffer( ( char * ) buffer, iLen );
      }
      else
         hb_xfree( buffer );
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c1046
HB_FUNCSQLITE3_BLOB_WRITE(void)
HB_FUNC( SQLITE3_BLOB_WRITE )
{
   sqlite3_blob * pBlob = ( sqlite3_blob * ) hb_parptr( 1 );

   if( pBlob )
   {
      int iLen = hb_parni( 3 );

      if( iLen == 0 )
         iLen = hb_parcsiz( 2 ) - 1;

      hb_retni( sqlite3_blob_write( pBlob, hb_parcx( 2 ), iLen, hb_parni( 4 ) ) );
   }
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c1077
HB_FUNCSQLITE3_GET_AUTOCOMMIT(void)
HB_FUNC( SQLITE3_GET_AUTOCOMMIT )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      hb_retl( sqlite3_get_autocommit( db ) );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c1100
HB_FUNCSQLITE3_ENABLE_SHARED_CACHE(void)
HB_FUNC( SQLITE3_ENABLE_SHARED_CACHE )
{
   hb_retni( sqlite3_enable_shared_cache( hb_parl( 1 ) ) );
}
hbsqlit3.c1116
STATIC VOIDSQL3ProfileLog( void * sFile, const char * sProfileMsg, sqlite3_uint64 int64 )
static void SQL3ProfileLog( void * sFile, const char * sProfileMsg, sqlite3_uint64 int64 )
{
   if( sProfileMsg )
   {
      FILE * hFile = fopen( sFile ? ( const char * ) sFile : "hbsq3_pr.log", "a" );
      
      if( hFile )
      {
         fprintf( hFile, "%s - %" PFLL "d\n", sProfileMsg, int64 );
         fclose( hFile );
      }
   }
}
hbsqlit3.c1128
STATIC VOIDSQL3TraceLog( void * sFile, const char * sTraceMsg )
static void SQL3TraceLog( void * sFile, const char * sTraceMsg )
{
   if( sTraceMsg )
   {
      FILE * hFile = fopen( sFile ? ( const char * ) sFile : "hbsq3_tr.log", "a" );
      
      if( hFile )
      {
         fprintf( hFile, "%s \n", sTraceMsg );
         fclose( hFile );
      }
   }
}
hbsqlit3.c1142
HB_FUNCSQLITE3_PROFILE(void)
HB_FUNC( SQLITE3_PROFILE )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      sqlite3_profile( db, hb_parl( 2 ) ? SQL3ProfileLog : NULL, NULL );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c1156
HB_FUNCSQLITE3_TRACE(void)
HB_FUNC( SQLITE3_TRACE )
{
   psqlite3 db = hb_parsqlite3( 1 );

   if( db )
      sqlite3_trace( db, hb_parl( 2 ) ? SQL3TraceLog : NULL, NULL );
   else
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
}
hbsqlit3.c1166
HB_FUNCSQLITE3_FILE_TO_BUFF(void)
HB_FUNC( SQLITE3_FILE_TO_BUFF )
{
   int handle = hb_fsOpen( ( BYTE * ) hb_parc( 1 ), FO_READ );

   if( handle != FS_ERROR )
   {
      BYTE * buffer;
      ULONG  iSize;

      iSize = ( int ) hb_fsSeek( handle, 0, FS_END );
      iSize -= ( int ) hb_fsSeek( handle, 0, FS_SET );
      buffer = ( BYTE * ) hb_xgrab( iSize + 1 );
      iSize = hb_fsReadLarge( handle, buffer, iSize );
      buffer[ iSize ] = '\0';
      hb_fsClose( handle );

      hb_retclen_buffer( ( char * ) buffer, iSize );
   }
   else
      hb_retc_null();
}
hbsqlit3.c1180
HB_FUNCSQLITE3_BUFF_TO_FILE(void)
HB_FUNC( SQLITE3_BUFF_TO_FILE )
{
   int   handle = hb_fsCreate( ( BYTE * ) hb_parc( 1 ), FC_NORMAL );
   ULONG iSize = hb_parcsiz( 2 ) - 1;

   if( handle != FS_ERROR && iSize > 0 )
   {
      hb_retni( hb_fsWriteLarge( handle, ( BYTE * ) hb_parcx( 2 ), iSize ) == iSize ? 0 : -1 );
      hb_fsClose( handle );
   }
   else
      hb_retni( 1 );
}
hbsqlit3.c1202

Page url: http://www.yourdomain.com/help/index.html?hbsqlit3.htm