Doing a create table generates a disk I/O error

I open / create a new database with sqlite3_open_v2

  int err = sqlite3_open_v2 (file, &pDb, SQLITE_OPEN_READWRITE | 
SQLITE_OPEN_CREATE, "unix-namedsem") ;

Then call sqlite3_exec with “CREATE TABLE t (id INTEGER PRIMARY KEY ASC)”

This generates a disk I/O error. I assume it is trying to remove a temporary 
file.

Regards

Andy Ling


From: drhsql...@gmail.com [mailto:drhsql...@gmail.com] On Behalf Of Richard Hipp
Sent: 12 August 2014 17:24
To: Andy Ling
Cc: General Discussion of SQLite Database; 王庆刚
Subject: Re: [sqlite] HELP sqlite3 used in vxworks has someproblem?



On Tue, Aug 12, 2014 at 11:40 AM, Andy Ling 
<andy.l...@quantel.com<mailto:andy.l...@quantel.com>> wrote:
> From: drhsql...@gmail.com<mailto:drhsql...@gmail.com> 
> [mailto:drhsql...@gmail.com<mailto:drhsql...@gmail.com>] On Behalf Of Richard 
> Hipp
> Sent: 12 August 2014 15:46

> I put a new snapshot on the download page.  Please try it, *without* 
> SQLITE_ENABLE_LOCKING_MODE.
OK, it builds, but doesn't run.

What are you doing that is causing an unlink() call to fail?  That should be a 
very obscure and infrequent occurrence.  How is this preventing you from 
running simple tests?  What problems does it display?




It is missing the patch to unixDelete. Whilst vxWorks is POSIX compliant, for 
file I/O it is only
compliant if the underlying file system is. We are using dosFs, which isn't. 
This means the error
codes don't match. So we added the following.....

static int unixDelete(
  sqlite3_vfs *NotUsed,     /* VFS containing this as the xDelete method */
  const char *zPath,        /* Name of file to be deleted */
  int dirSync               /* If true, fsync() directory after deleting file */
){
  int rc = SQLITE_OK;
  UNUSED_PARAMETER(NotUsed);
  SimulateIOError(return SQLITE_IOERR_DELETE);
  if( osUnlink(zPath)==(-1) ){
    if( errno==ENOENT ){
      rc = SQLITE_IOERR_DELETE_NOENT;
#if OS_VXWORKS
    }else if( errno==0x380003 ){ /* == S_dosFsLib_FILE_NOT_FOUND */
      rc = SQLITE_IOERR_DELETE_NOENT;
#endif
    }else{
      rc = unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath);
    }
With this patch I have run a few simple commands. Created a table, added a few 
rows and listed them.

The compile options I'm using are -DHAVE_UTIME -DSQLITE_OMIT_LOAD_EXTENSION

Regards

Andy Ling


--
D. Richard Hipp
d...@sqlite.org<mailto:d...@sqlite.org>



--
D. Richard Hipp
d...@sqlite.org<mailto:d...@sqlite.org>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to