Esempio n. 1
0
        /*
        ** Retrieve the current rowid.
        */
        static int intarrayRowid(sqlite3_vtab_cursor cur, out sqlite_int64 pRowid)
        {
            intarray_cursor pCur = (intarray_cursor)cur;

            pRowid = pCur.i;
            return(SQLITE_OK);
        }
Esempio n. 2
0
        /*
        ** Retrieve the current rowid.
        */
        static int schemaRowid(sqlite3_vtab_cursor cur, out sqlite_int64 pRowid)
        {
            schema_cursor pCur = (schema_cursor)cur;

            pRowid = pCur.rowid;
            return(SQLITE_OK);
        }
Esempio n. 3
0
/*
** 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);
        }
Esempio n. 4
0
/*
** Open a blob handle.
*/
int sqlite3_blob_open(
  sqlite3* db,            /* The database connection */
  string zDb,        /* The attached database containing the blob */
  string zTable,     /* The table containing the blob */
  string zColumn,    /* The column containing the blob */
  sqlite_int64 iRow,      /* The row containing the glob */
  int flags,              /* True -> read/write access, false -> read-only */
  sqlite3_blob **ppBlob   /* Handle for accessing the blob returned here */
){
  int nAttempt = 0;
  int iCol;               /* Index of zColumn in row-record */
Esempio n. 5
0
/*
** Open a blob handle.
*/
        int sqlite3_blob_open(
            sqlite3 *db,          /* The database connection */
            string zDb,           /* The attached database containing the blob */
            string zTable,        /* The table containing the blob */
            string zColumn,       /* The column containing the blob */
            sqlite_int64 iRow,    /* The row containing the glob */
            int flags,            /* True -> read/write access, false -> read-only */
            sqlite3_blob **ppBlob /* Handle for accessing the blob returned here */
            )
        {
            int nAttempt = 0;
            int iCol;     /* Index of zColumn in row-record */
Esempio n. 6
0
/*
** Query the size of the file in bytes.
*/
        static int jrnlFileSize(sqlite3_file pJfd, sqlite_int64 pSize)
        {
            int         rc = SQLITE_OK;
            JournalFile p  = (JournalFile )pJfd;

            if (p.pReal)
            {
                rc = sqlite3OsFileSize(p.pReal, pSize);
            }
            else
            {
                pSize = (sqlite_int64)p.iSize;
            }
            return(rc);
        }
Esempio n. 7
0
/*
** Truncate the file.
*/
        static int jrnlTruncate(sqlite3_file pJfd, sqlite_int64 size)
        {
            int         rc = SQLITE_OK;
            JournalFile p  = (JournalFile )pJfd;

            if (p.pReal)
            {
                rc = sqlite3OsTruncate(p.pReal, size);
            }
            else if (size < p.iSize)
            {
                p.iSize = size;
            }
            return(rc);
        }
Esempio n. 8
0
/*
** 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);
        }
Esempio n. 9
0
/*
** Truncate an tvfs-file.
*/
static int tvfsTruncate(sqlite3_file pFile, sqlite_int64 size){
  int rc = SQLITE_OK;
  TestvfsFd pFd = tvfsGetFd(pFile);
  Testvfs p = (Testvfs )pFd.pVfs.pAppData;

  if ( p.pScript != null && ( p.mask & TESTVFS_TRUNCATE_MASK ) != 0 )
  {
    tvfsExecTcl(p, "xTruncate", 
        TCL.Tcl_NewStringObj(pFd.zFilename, -1), pFd.pShmId,null
    );
    tvfsResultCode(p, ref rc);
  }
  
  if( rc==SQLITE_OK ){
    rc = sqlite3OsTruncate(pFd.pReal, size);
  }
  return rc;
}
Esempio n. 10
0
/*
** 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;
}
Esempio n. 11
0
/*
** Query the size of the file in bytes.
*/
static int jrnlFileSize(sqlite3_file pJfd, sqlite_int64 pSize){
int rc = SQLITE_OK;
JournalFile p = (JournalFile )pJfd;
if( p.pReal ){
rc = sqlite3OsFileSize(p.pReal, pSize);
}else{
pSize = (sqlite_int64) p.iSize;
}
return rc;
}
Esempio n. 12
0
/*
** Truncate the file.
*/
static int jrnlTruncate(sqlite3_file pJfd, sqlite_int64 size){
int rc = SQLITE_OK;
JournalFile p = (JournalFile )pJfd;
if( p.pReal ){
rc = sqlite3OsTruncate(p.pReal, size);
}else if( size<p.iSize ){
p.iSize = size;
}
return rc;
}
Esempio n. 13
0
/*
** 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;
}
Esempio n. 14
0
 /*
 ** Retrieve the current rowid.
 */
 static int intarrayRowid( sqlite3_vtab_cursor cur, out sqlite_int64 pRowid )
 {
   intarray_cursor pCur = (intarray_cursor)cur;
   pRowid = pCur.i;
   return SQLITE_OK;
 }
Esempio n. 15
0
 static int statRowid( sqlite3_vtab_cursor pCursor, out sqlite_int64 pRowid )
 {
   StatCursor pCsr = (StatCursor)pCursor;
   pRowid = pCsr.iPageno;
   return SQLITE_OK;
 }
 /*
 ** Retrieve the current rowid.
 */
 static int schemaRowid( sqlite3_vtab_cursor cur, out sqlite_int64 pRowid )
 {
   schema_cursor pCur = (schema_cursor)cur;
   pRowid = pCur.rowid;
   return SQLITE_OK;
 }
Esempio n. 17
0
/*
** Write data to an tvfs-file.
*/
static int tvfsWrite(
  sqlite3_file pFile, 
  byte[] zBuf, 
  int iAmt, 
  sqlite_int64 iOfst
){
  int rc = SQLITE_OK;
  Debugger.Break();//TODO
  //TestvfsFd pFd = tvfsGetFd(pFile);
  //Testvfs p = (Testvfs )pFd.pVfs.pAppData;

  //if ( p.pScript != null && (p.mask & TESTVFS_WRITE_MASK) != 0 )
  //{
  //  tvfsExecTcl(p, "xWrite", 
  //      TCL.Tcl_NewStringObj(pFd.zFilename, -1), pFd.pShmId, null
  //  );
  //  tvfsResultCode(p, ref rc);
  //}

  //if( rc==SQLITE_OK && tvfsInjectFullerr(p)!=0 ){
  //  rc = SQLITE_FULL;
  //}
  //if ( rc == SQLITE_OK && (p.mask & TESTVFS_WRITE_MASK) != 0 && tvfsInjectIoerr( p ) != 0 )
  //{
  //  rc = SQLITE_IOERR;
  //}
  
  //if( rc==SQLITE_OK ){
  //  rc = sqlite3OsWrite(pFd.pReal, zBuf, iAmt, iOfst);
  //}
  return rc;
}
Esempio n. 18
0
/*
** Read data from an tvfs-file.
*/
static int tvfsRead(
  sqlite3_file pFile, 
  byte[] zBuf, 
  int iAmt, 
  sqlite_int64 iOfst
){
  TestvfsFd p = tvfsGetFd(pFile);
  return sqlite3OsRead(p.pReal, zBuf, iAmt, iOfst);
}
static int tclvarRowid( sqlite3_vtab_cursor cur, out sqlite_int64 pRowid )
{
  pRowid = 0;
  return SQLITE_OK;
}
Esempio n. 20
0
/*
** Return the current file-size of an tvfs-file.
*/
static int tvfsFileSize(sqlite3_file pFile, ref sqlite_int64 pSize){
  TestvfsFd p = tvfsGetFd(pFile);
  return sqlite3OsFileSize(p.pReal, ref pSize);
}
Esempio n. 21
0
 static int tclvarRowid(sqlite3_vtab_cursor cur, out sqlite_int64 pRowid)
 {
     pRowid = 0;
     return(SQLITE_OK);
 }