SQLite

Check-in [921c7a0ac4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:make os2Truncate() actually do something and fix os2FullPathname() to be more elegant and work more correctly in all cases (Ticket #2904) (CVS 4766)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 921c7a0ac4581255ea5061980ff7991088b9b78a
User & Date: pweilbacher 2008-02-01 00:31:59.000
Context
2008-02-01
01:19
Modify the printf test script so that it does not depend on the platform printf, so that we do not spurious test failures when moving from one platform to another. (CVS 4767) (check-in: 514d7e4743 user: drh tags: trunk)
00:31
make os2Truncate() actually do something and fix os2FullPathname() to be more elegant and work more correctly in all cases (Ticket #2904) (CVS 4766) (check-in: 921c7a0ac4 user: pweilbacher tags: trunk)
2008-01-31
19:34
Fix a problem with virtual tables and left joins introduced by check-in (4761). Ticket #2894 and #2913. (CVS 4765) (check-in: ebeac2a499 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_os2.c.
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
}

/*
** Truncate an open file to a specified size
*/
int os2Truncate( sqlite3_file *id, i64 nByte ){
  APIRET rc = NO_ERROR;
  ULONG filePosition = 0L;
  os2File *pFile = (os2File*)id;
  OSTRACE3( "TRUNCATE %d %lld\n", pFile->h, nByte );
  SimulateIOError( return SQLITE_IOERR_TRUNCATE );
  rc = DosSetFilePtr( pFile->h, nByte, FILE_BEGIN, &filePosition );
  if( rc != NO_ERROR ){
    return SQLITE_IOERR;
  }
  rc = DosSetFilePtr( pFile->h, 0L, FILE_END, &filePosition );
  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.







<



|
<
<
<
<







161
162
163
164
165
166
167

168
169
170
171




172
173
174
175
176
177
178
}

/*
** Truncate an open file to a specified size
*/
int os2Truncate( sqlite3_file *id, i64 nByte ){
  APIRET rc = NO_ERROR;

  os2File *pFile = (os2File*)id;
  OSTRACE3( "TRUNCATE %d %lld\n", pFile->h, nByte );
  SimulateIOError( return SQLITE_IOERR_TRUNCATE );
  rc = DosSetFileSize( pFile->h, nByte );




  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
*/
static int os2FullPathname(
  sqlite3_vfs *pVfs,          /* Pointer to vfs object */
  const char *zRelative,      /* Possibly relative input path */
  int nFull,                  /* Size of output buffer in bytes */
  char *zFull                 /* Output buffer */
){
  if( strchr(zRelative, ':') ){
    sqlite3_snprintf( nFull, zFull, "%s", zRelative );
  }else{
    ULONG ulDriveNum = 0;
    ULONG ulDriveMap = 0;
    ULONG cbzBufLen = SQLITE_TEMPNAME_SIZE;
    char *zBuff = (char*)malloc( cbzBufLen );
    if( zBuff == 0 ){
      return SQLITE_NOMEM;
    }
    DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
    if( DosQueryCurrentDir( ulDriveNum, (PBYTE)zBuff, &cbzBufLen ) == NO_ERROR ){
      sqlite3_snprintf( nFull, zFull, "%c:\\%s\\%s",
                               (char)('A' + ulDriveNum - 1), zBuff, zRelative);
    }
    free( zBuff );
  }
  return SQLITE_OK;
}

#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Interfaces for opening a shared library, finding entry points
** within the shared library, and closing the shared library.
*/







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|







781
782
783
784
785
786
787
788
















789
790
791
792
793
794
795
796
*/
static int os2FullPathname(
  sqlite3_vfs *pVfs,          /* Pointer to vfs object */
  const char *zRelative,      /* Possibly relative input path */
  int nFull,                  /* Size of output buffer in bytes */
  char *zFull                 /* Output buffer */
){
  APIRET rc = DosQueryPathInfo( zRelative, FIL_QUERYFULLNAME, zFull, nFull );
















  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}

#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Interfaces for opening a shared library, finding entry points
** within the shared library, and closing the shared library.
*/