本文整理汇总了C#中sqlite3_file类的典型用法代码示例。如果您正苦于以下问题:C# sqlite3_file类的具体用法?C# sqlite3_file怎么用?C# sqlite3_file使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
sqlite3_file类属于命名空间,在下文中一共展示了sqlite3_file类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: jrnlClose
/*
** Close the file.
*/
static int jrnlClose(sqlite3_file pJfd){
JournalFile p = (JournalFile )pJfd;
if( p.pReal ){
sqlite3OsClose(p.pReal);
}
sqlite3DbFree(db,p.zBuf);
return SQLITE_OK;
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:11,代码来源:journal_c.cs
示例2: sqlite3OsClose
/*
** The following routines are convenience wrappers around methods
** of the sqlite3_file object. This is mostly just syntactic sugar. All
** of this would be completely automatic if SQLite were coded using
** C++ instead of plain old C.
*/
static int sqlite3OsClose (sqlite3_file pId)
{
int rc = SQLITE_OK;
if (pId.pMethods != null) {
rc = pId.pMethods.xClose (pId);
pId.pMethods = null;
}
return rc;
}
开发者ID:mylemans,项目名称:csharp-sqlite-1,代码行数:15,代码来源:os_c.cs
示例3: stmClose
static int stmClose( sqlite3_file id )
{
Debug.Assert( id != null );
#if SQLITE_TEST
OSTRACE( "CLOSE %d %s\n", pFile.pIO.GetHashCode(), rc ? "ok" : "failed" );
OpenCounter( -1 );
#endif
return SQLITE_OK;
}
开发者ID:hanahanaside,项目名称:JPN,代码行数:11,代码来源:stream_c.cs
示例4: SharedLockFile
public virtual int SharedLockFile( sqlite3_file pFile, long offset, long length )
{
Debug.Assert( length == SHARED_SIZE );
Debug.Assert( offset == SHARED_FIRST );
System.Threading.NativeOverlapped ovlp = new System.Threading.NativeOverlapped();
ovlp.OffsetLow = (int)offset;
ovlp.OffsetHigh = 0;
ovlp.EventHandle = IntPtr.Zero;
return LockFileEx( pFile.fs.Handle, LOCKFILE_FAIL_IMMEDIATELY, 0, (uint)length, 0, ref ovlp ) ? 1 : 0;
}
开发者ID:plainprogrammer,项目名称:csharp-sqlite,代码行数:11,代码来源:os_win_c.cs
示例5: stmRead
/*
** Read data from a file into a buffer. Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/
static int stmRead(
sqlite3_file id, /* File to read from */
byte[] pBuf, /* Write content into this buffer */
int amt, /* Number of bytes to read */
sqlite3_int64 offset /* Begin reading at this offset */
)
{
//long rc;
sqlite3_file pFile = id;
int nRead; /* Number of bytes actually read from file */
Debug.Assert( id != null );
#if SQLITE_TEST
if ( SimulateIOError() )
return SQLITE_IOERR_READ;
#endif
#if SQLITE_DEBUG
OSTRACE( "READ %d lock=%d\n", pFile.pIO.GetHashCode(), pFile.locktype );
#endif
if ( pFile.pIO.Seek(offset, SeekOrigin.Begin) != offset )
{
return SQLITE_FULL;
}
try
{
nRead = pFile.pIO.Read( pBuf, 0, amt ); // i if( null==ReadFile(pFile->h, pBuf, amt, &nRead, 0) ){
}
catch ( Exception )
{
pFile.lastErrno = 1;
return winLogError(SQLITE_IOERR_READ, "stmRead", pFile.zPath);
}
if ( nRead < amt )
{
/* Unread parts of the buffer must be zero-filled */
Array.Clear( pBuf, (int)nRead, (int)( amt - nRead ) ); // memset(&((char)pBuf)[nRead], 0, amt-nRead);
return SQLITE_IOERR_SHORT_READ;
}
return SQLITE_OK;
}
开发者ID:hanahanaside,项目名称:JPN,代码行数:49,代码来源:stream_c.cs
示例6: sqlite3WalOpen
/*
** 2010 February 1
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface to the write-ahead logging
** system. Refer to the comments below and the header comment attached to
** the implementation of each function in log.c for further details.
*************************************************************************
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
** C#-SQLite is an independent reimplementation of the SQLite software library
**
** SQLITE_SOURCE_ID: 2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2
**
*************************************************************************
*/
//#if !_WAL_H_
//#define _WAL_H_
//#include "sqliteInt.h"
#if SQLITE_OMIT_WAL
//# define sqlite3WalOpen(x,y,z) 0
static int sqlite3WalOpen(sqlite3_vfs x, sqlite3_file y, string z)
{
return 0;
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:35,代码来源:wal_h.cs
示例7: sqlite3JournalCreate
/*
** If the argument p points to a JournalFile structure, and the underlying
** file has not yet been created, create it now.
*/
int sqlite3JournalCreate(sqlite3_file p){
if( p.pMethods!=&JournalFileMethods ){
return SQLITE_OK;
}
return createFile((JournalFile )p);
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:10,代码来源:journal_c.cs
示例8: SharedLockFile
public override int SharedLockFile( sqlite3_file pFile, long offset, long length )
{
#if !(SQLITE_SILVERLIGHT || WINDOWS_MOBILE)
Debug.Assert( length == SHARED_SIZE );
Debug.Assert( offset == SHARED_FIRST );
try
{
pFile.fs.Lock( offset + pFile.sharedLockByte, 1 );
}
catch ( IOException )
{
return 0;
}
#endif
return 1;
}
开发者ID:Foxbow74,项目名称:my-busycator,代码行数:16,代码来源:os_win_c.cs
示例9: sqlite3MemJournalOpen
/*
** Open a journal file.
*/
static void sqlite3MemJournalOpen( sqlite3_file pJfd )
{
MemJournal p = (MemJournal)pJfd;
//memset( p, 0, sqlite3MemJournalSize() );
p.pFirst = null;
p.endpoint = new FilePoint();
p.readpoint = new FilePoint();
p.pMethods = MemJournalMethods;//(sqlite3_io_methods*)&MemJournalMethods;
}
开发者ID:mind0n,项目名称:csharp-sqlite,代码行数:12,代码来源:memjournal_c.cs
示例10: memjrnlSync
/*
** Sync the file.
**
** Syncing an in-memory journal is a no-op. And, in fact, this routine
** is never called in a working implementation. This implementation
** exists purely as a contingency, in case some malfunction in some other
** part of SQLite causes Sync to be called by mistake.
*/
static int memjrnlSync( sqlite3_file NotUsed, int NotUsed2 )
{
UNUSED_PARAMETER2( NotUsed, NotUsed2 );
return SQLITE_OK;
}
开发者ID:mind0n,项目名称:csharp-sqlite,代码行数:13,代码来源:memjournal_c.cs
示例11: memjrnlWrite
/*
** Write data to the file.
*/
static int memjrnlWrite(
sqlite3_file pJfd, /* The journal file into which to write */
byte[] zBuf, /* Take data to be written from here */
int iAmt, /* Number of bytes to write */
sqlite3_int64 iOfst /* Begin writing at this offset into the file */
)
{
MemJournal p = (MemJournal)pJfd;
int nWrite = iAmt;
byte[] zWrite = zBuf;
int izWrite = 0;
/* An in-memory journal file should only ever be appended to. Random
** access writes are not required by sqlite.
*/
Debug.Assert( iOfst == p.endpoint.iOffset );
UNUSED_PARAMETER( iOfst );
while ( nWrite > 0 )
{
FileChunk pChunk = p.endpoint.pChunk;
int iChunkOffset = (int)( p.endpoint.iOffset % JOURNAL_CHUNKSIZE );
int iSpace = MIN( nWrite, JOURNAL_CHUNKSIZE - iChunkOffset );
if ( iChunkOffset == 0 )
{
/* New chunk is required to extend the file. */
FileChunk pNew = new FileChunk();// sqlite3_malloc( sizeof( FileChunk ) );
if ( null == pNew )
{
return SQLITE_IOERR_NOMEM;
}
pNew.pNext = null;
if ( pChunk != null )
{
Debug.Assert( p.pFirst != null );
pChunk.pNext = pNew;
}
else
{
Debug.Assert( null == p.pFirst );
p.pFirst = pNew;
}
p.endpoint.pChunk = pNew;
}
Buffer.BlockCopy( zWrite, izWrite, p.endpoint.pChunk.zChunk, iChunkOffset, iSpace ); //memcpy( &p.endpoint.pChunk.zChunk[iChunkOffset], zWrite, iSpace );
izWrite += iSpace;//zWrite += iSpace;
nWrite -= iSpace;
p.endpoint.iOffset += iSpace;
}
return SQLITE_OK;
}
开发者ID:mind0n,项目名称:csharp-sqlite,代码行数:57,代码来源:memjournal_c.cs
示例12: jrnlRead
/*
** Read data from the file.
*/
static int jrnlRead(
sqlite3_file *pJfd, /* The journal file from which to read */
void *zBuf, /* Put the results here */
int iAmt, /* Number of bytes to read */
sqlite_int64 iOfst /* Begin reading at this offset */
){
int rc = SQLITE_OK;
JournalFile *p = (JournalFile )pJfd;
if( p->pReal ){
rc = sqlite3OsRead(p->pReal, zBuf, iAmt, iOfst);
}else if( (iAmt+iOfst)>p->iSize ){
rc = SQLITE_IOERR_SHORT_READ;
}else{
memcpy(zBuf, &p->zBuf[iOfst], iAmt);
}
return rc;
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:20,代码来源:journal_c.cs
示例13: sqlite3OsWrite
static int sqlite3OsWrite( sqlite3_file id, byte[] pBuf, int amt, i64 offset )
{
DO_OS_MALLOC_TEST( id );
return id.pMethods.xWrite( id, pBuf, amt, offset );
}
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:5,代码来源:os_c.cs
示例14: sqlite3OsRead
static int sqlite3OsRead( sqlite3_file id, byte[] pBuf, int amt, i64 offset )
{
DO_OS_MALLOC_TEST( id );
if ( pBuf == null )
pBuf = sqlite3Malloc( amt );
return id.pMethods.xRead( id, pBuf, amt, offset );
}
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:7,代码来源:os_c.cs
示例15: DO_OS_MALLOC_TEST
//#define DO_OS_MALLOC_TEST(x)
static void DO_OS_MALLOC_TEST( sqlite3_file x ) { }
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:2,代码来源:os_c.cs
示例16: sqlite3OsCloseFree
static int sqlite3OsCloseFree( sqlite3_file pFile )
{
int rc = SQLITE_OK;
Debug.Assert( pFile != null );
rc = sqlite3OsClose( pFile );
//sqlite3_free( ref pFile );
return rc;
}
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:8,代码来源:os_c.cs
示例17: memjrnlRead
/*
** Read data from the in-memory journal file. This is the implementation
** of the sqlite3_vfs.xRead method.
*/
static int memjrnlRead(
sqlite3_file pJfd, /* The journal file from which to read */
byte[] zBuf, /* Put the results here */
int iAmt, /* Number of bytes to read */
sqlite3_int64 iOfst /* Begin reading at this offset */
)
{
MemJournal p = (MemJournal)pJfd;
byte[] zOut = zBuf;
int nRead = iAmt;
int iChunkOffset;
FileChunk pChunk;
/* SQLite never tries to read past the end of a rollback journal file */
Debug.Assert( iOfst + iAmt <= p.endpoint.iOffset );
if ( p.readpoint.iOffset != iOfst || iOfst == 0 )
{
int iOff = 0;
for ( pChunk = p.pFirst;
ALWAYS( pChunk != null ) && ( iOff + JOURNAL_CHUNKSIZE ) <= iOfst;
pChunk = pChunk.pNext
)
{
iOff += JOURNAL_CHUNKSIZE;
}
}
else
{
pChunk = p.readpoint.pChunk;
}
iChunkOffset = (int)( iOfst % JOURNAL_CHUNKSIZE );
int izOut = 0;
do
{
int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset;
int nCopy = MIN( nRead, ( JOURNAL_CHUNKSIZE - iChunkOffset ) );
Buffer.BlockCopy( pChunk.zChunk, iChunkOffset, zOut, izOut, nCopy ); //memcpy( zOut, pChunk.zChunk[iChunkOffset], nCopy );
izOut += nCopy;// zOut += nCopy;
nRead -= iSpace;
iChunkOffset = 0;
} while ( nRead >= 0 && ( pChunk = pChunk.pNext ) != null && nRead > 0 );
p.readpoint.iOffset = (int)( iOfst + iAmt );
p.readpoint.pChunk = pChunk;
return SQLITE_OK;
}
开发者ID:mind0n,项目名称:csharp-sqlite,代码行数:52,代码来源:memjournal_c.cs
示例18: FILEHANDLEID
//#define FILEHANDLEID(fd) ((int)fd)
static int FILEHANDLEID( sqlite3_file fd )
{
return fd.GetHashCode();
}
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:5,代码来源:pager_c.cs
示例19: memjrnlTruncate
/*
** Truncate the file.
*/
static int memjrnlTruncate( sqlite3_file pJfd, sqlite3_int64 size )
{
MemJournal p = (MemJournal)pJfd;
FileChunk pChunk;
Debug.Assert( size == 0 );
UNUSED_PARAMETER( size );
pChunk = p.pFirst;
while ( pChunk != null )
{
////FileChunk pTmp = pChunk;
pChunk = pChunk.pNext;
//sqlite3_free( ref pTmp );
}
sqlite3MemJournalOpen( pJfd );
return SQLITE_OK;
}
开发者ID:mind0n,项目名称:csharp-sqlite,代码行数:19,代码来源:memjournal_c.cs
示例20: jrnlWrite
/*
** Write data to the file.
*/
static int jrnlWrite(
sqlite3_file pJfd, /* The journal file into which to write */
string zBuf, /* Take data to be written from here */
int iAmt, /* Number of bytes to write */
sqlite_int64 iOfst /* Begin writing at this offset into the file */
){
int rc = SQLITE_OK;
JournalFile p = (JournalFile )pJfd;
if( null==p.pReal && (iOfst+iAmt)>p.nBuf ){
rc = createFile(p);
}
if( rc==SQLITE_OK ){
if( p.pReal ){
rc = sqlite3OsWrite(p.pReal, zBuf, iAmt, iOfst);
}else{
memcpy(p.zBuf[iOfst], zBuf, iAmt);
if( p.iSize<(iOfst+iAmt) ){
p.iSize = (iOfst+iAmt);
}
}
}
return rc;
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:26,代码来源:journal_c.cs
注:本文中的sqlite3_file类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论