webengine/webkitutils/SqliteSymbian/os.c
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 ** 2005 November 29
       
     3 **
       
     4 ** The author disclaims copyright to this source code.  In place of
       
     5 ** a legal notice, here is a blessing:
       
     6 **
       
     7 **    May you do good and not evil.
       
     8 **    May you find forgiveness for yourself and forgive others.
       
     9 **    May you share freely, never taking more than you give.
       
    10 **
       
    11 ******************************************************************************
       
    12 **
       
    13 ** This file contains OS interface code that is common to all
       
    14 ** architectures.
       
    15 */
       
    16 #define _SQLITE_OS_C_ 1
       
    17 #include "sqliteInt.h"
       
    18 #include "os.h"
       
    19 
       
    20 /*
       
    21 ** The following routines are convenience wrappers around methods
       
    22 ** of the OsFile object.  This is mostly just syntactic sugar.  All
       
    23 ** of this would be completely automatic if SQLite were coded using
       
    24 ** C++ instead of plain old C.
       
    25 */
       
    26 int sqlite3OsClose(OsFile **pId){
       
    27   OsFile *id;
       
    28   if( pId!=0 && (id = *pId)!=0 ){
       
    29     return id->pMethod->xClose(pId);
       
    30   }else{
       
    31     return SQLITE_OK;
       
    32   }
       
    33 }
       
    34 int sqlite3OsOpenDirectory(OsFile *id, const char *zName){
       
    35   return id->pMethod->xOpenDirectory(id, zName);
       
    36 }
       
    37 int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
       
    38   return id->pMethod->xRead(id, pBuf, amt);
       
    39 }
       
    40 int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
       
    41   return id->pMethod->xWrite(id, pBuf, amt);
       
    42 }
       
    43 int sqlite3OsSeek(OsFile *id, i64 offset){
       
    44   return id->pMethod->xSeek(id, offset);
       
    45 }
       
    46 int sqlite3OsTruncate(OsFile *id, i64 size){
       
    47   return id->pMethod->xTruncate(id, size);
       
    48 }
       
    49 int sqlite3OsSync(OsFile *id, int fullsync){
       
    50   return id->pMethod->xSync(id, fullsync);
       
    51 }
       
    52 void sqlite3OsSetFullSync(OsFile *id, int value){
       
    53   id->pMethod->xSetFullSync(id, value);
       
    54 }
       
    55 #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
       
    56 /* This method is currently only used while interactively debugging the 
       
    57 ** pager. More specificly, it can only be used when sqlite3DebugPrintf() is
       
    58 ** included in the build. */
       
    59 int sqlite3OsFileHandle(OsFile *id){
       
    60   return id->pMethod->xFileHandle(id);
       
    61 }
       
    62 #endif
       
    63 int sqlite3OsFileSize(OsFile *id, i64 *pSize){
       
    64   return id->pMethod->xFileSize(id, pSize);
       
    65 }
       
    66 int sqlite3OsLock(OsFile *id, int lockType){
       
    67   return id->pMethod->xLock(id, lockType);
       
    68 }
       
    69 int sqlite3OsUnlock(OsFile *id, int lockType){
       
    70   return id->pMethod->xUnlock(id, lockType);
       
    71 }
       
    72 int sqlite3OsLockState(OsFile *id){
       
    73   return id->pMethod->xLockState(id);
       
    74 }
       
    75 int sqlite3OsCheckReservedLock(OsFile *id){
       
    76   return id->pMethod->xCheckReservedLock(id);
       
    77 }
       
    78 
       
    79 #ifdef SQLITE_ENABLE_REDEF_IO
       
    80 /*
       
    81 ** A function to return a pointer to the virtual function table.
       
    82 ** This routine really does not accomplish very much since the
       
    83 ** virtual function table is a global variable and anybody who
       
    84 ** can call this function can just as easily access the variable
       
    85 ** for themselves.  Nevertheless, we include this routine for
       
    86 ** backwards compatibility with an earlier redefinable I/O
       
    87 ** interface design.
       
    88 */
       
    89 struct sqlite3OsVtbl *sqlite3_os_switch(void){
       
    90   return &sqlite3Os;
       
    91 }
       
    92 #endif