当前位置: 首页>>代码示例>>C#>>正文


C# Pager.xCodecFree方法代码示例

本文整理汇总了C#中Community.CsharpSqlite.Pager.xCodecFree方法的典型用法代码示例。如果您正苦于以下问题:C# Pager.xCodecFree方法的具体用法?C# Pager.xCodecFree怎么用?C# Pager.xCodecFree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Community.CsharpSqlite.Pager的用法示例。


在下文中一共展示了Pager.xCodecFree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: sqlite3PagerClose

    /*
    ** Shutdown the page cache.  Free all memory and close all files.
    **
    ** If a transaction was in progress when this routine is called, that
    ** transaction is rolled back.  All outstanding pages are invalidated
    ** and their memory is freed.  Any attempt to use a page associated
    ** with this page cache after this function returns will likely
    ** result in a coredump.
    **
    ** This function always succeeds. If a transaction is active an attempt
    ** is made to roll it back. If an error occurs during the rollback
    ** a hot journal may be left in the filesystem but no error is returned
    ** to the caller.
    */
    static int sqlite3PagerClose( Pager pPager )
    {
#if SQLITE_TEST
      disable_simulated_io_errors();
#endif
      sqlite3BeginBenignMalloc();
      pPager.errCode = 0;
      pPager.exclusiveMode = false;
      pager_reset( pPager );
      if (
#if SQLITE_OMIT_MEMORYDB
1==MEMDB
#else
 1 == pPager.memDb
#endif
 )
      {
        pager_unlock( pPager );
      }
      else
      {
        /* Set Pager.journalHdr to -1 for the benefit of the pager_playback()
        ** call which may be made from within pagerUnlockAndRollback(). If it
        ** is not -1, then the unsynced portion of an open journal file may
        ** be played back into the database. If a power failure occurs while
        ** this is happening, the database may become corrupt.
        */
        pPager.journalHdr = -1;
        pagerUnlockAndRollback( pPager );
      }
      sqlite3EndBenignMalloc();
#if SQLITE_TEST
      enable_simulated_io_errors();
#endif

      PAGERTRACE( "CLOSE %d\n", PAGERID( pPager ) );
      IOTRACE( "CLOSE %p\n", pPager );
      sqlite3OsClose( pPager.fd );
      //sqlite3_free( ref  pPager.pTmpSpace );
      sqlite3PcacheClose( pPager.pPCache );

#if SQLITE_HAS_CODEC
      if ( pPager.xCodecFree != null ) pPager.xCodecFree(ref pPager.pCodec );
#endif
      Debug.Assert( null == pPager.aSavepoint && !pPager.pInJournal );
      Debug.Assert( !isOpen( pPager.jfd ) && !isOpen( pPager.sjfd ) );

      //sqlite3_free( ref  pPager );
      return SQLITE_OK;
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:64,代码来源:pager_c.cs

示例2: sqlite3PagerSetCodec

/*
** Set or retrieve the codec for this pager
*/
    static void sqlite3PagerSetCodec(
    Pager pPager,
    dxCodec xCodec,                 //void *(*xCodec)(void*,void*,Pgno,int),
    dxCodecSizeChng xCodecSizeChng, //void (*xCodecSizeChng)(void*,int,int),
    dxCodecFree xCodecFree,         //void (*xCodecFree)(void*),
    codec_ctx pCodec
    )
    {
      if ( pPager.xCodecFree != null ) pPager.xCodecFree( ref pPager.pCodec );
      pPager.xCodec = (pPager.memDb!=0) ? null : xCodec;
      pPager.xCodecSizeChng = xCodecSizeChng;
      pPager.xCodecFree = xCodecFree;
      pPager.pCodec = pCodec;
      pagerReportSize( pPager );
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:18,代码来源:pager_c.cs

示例3: sqlite3PagerClose

        /*
        ** Shutdown the page cache.  Free all memory and close all files.
        **
        ** If a transaction was in progress when this routine is called, that
        ** transaction is rolled back.  All outstanding pages are invalidated
        ** and their memory is freed.  Any attempt to use a page associated
        ** with this page cache after this function returns will likely
        ** result in a coredump.
        **
        ** This function always succeeds. If a transaction is active an attempt
        ** is made to roll it back. If an error occurs during the rollback
        ** a hot journal may be left in the filesystem but no error is returned
        ** to the caller.
        */
        static int sqlite3PagerClose( Pager pPager )
        {
            u8[] pTmp = pPager.pTmpSpace;
            #if SQLITE_TEST
              disable_simulated_io_errors();
            #endif
              sqlite3BeginBenignMalloc();
              /* pPager->errCode = 0; */
              pPager.exclusiveMode = false;
            #if !SQLITE_OMIT_WAL
            sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp);
            pPager.pWal = 0;
            #endif
              pager_reset( pPager );
              if (
            #if SQLITE_OMIT_MEMORYDB
            1==MEMDB
            #else
             1 == pPager.memDb
            #endif
             )
              {
            pager_unlock( pPager );
              }
              else
              {
            /* If it is open, sync the journal file before calling UnlockAndRollback.
            ** If this is not done, then an unsynced portion of the open journal
            ** file may be played back into the database. If a power failure occurs
            ** while this is happening, the database could become corrupt.
            **
            ** If an error occurs while trying to sync the journal, shift the pager
            ** into the ERROR state. This causes UnlockAndRollback to unlock the
            ** database and close the journal file without attempting to roll it
            ** back or finalize it. The next database user will have to do hot-journal
            ** rollback before accessing the database file.
            */
            if ( isOpen( pPager.jfd ) )
            {
              pager_error( pPager, pagerSyncHotJournal( pPager ) );
            }
            pagerUnlockAndRollback( pPager );
              }
              sqlite3EndBenignMalloc();
            #if SQLITE_TEST
              enable_simulated_io_errors();
            #endif

              PAGERTRACE( "CLOSE %d\n", PAGERID( pPager ) );
              IOTRACE( "CLOSE %p\n", pPager );
              sqlite3OsClose( pPager.jfd );
              sqlite3OsClose( pPager.fd );
              //sqlite3_free( ref  pTmp );
              sqlite3PcacheClose( pPager.pPCache );

            #if SQLITE_HAS_CODEC
              if ( pPager.xCodecFree != null )
            pPager.xCodecFree( ref pPager.pCodec );
            #endif
              Debug.Assert( null == pPager.aSavepoint && !pPager.pInJournal );
              Debug.Assert( !isOpen( pPager.jfd ) && !isOpen( pPager.sjfd ) );

              //sqlite3_free( ref  pPager );
              return SQLITE_OK;
        }
开发者ID:taxilian,项目名称:some_library,代码行数:79,代码来源:pager_c.cs


注:本文中的Community.CsharpSqlite.Pager.xCodecFree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。