Hi, I am in the process of porting sqlite (version 2.8.13) to vxworks. I
am running into some problems.
It seems to work when I invoke the shell with no database (:memory:). I
can then create tables, insert records, etc. In general I can submit SQL
queries at will.  However, when I invoke the shell with a database
filename, whether the file exists or not, I get the error:
SQL error: database is locked
It seems that the database is write-locked to start the transaction and
then an attempt to get a read lock fails. There is only one task
(thread) running which is running the shell application.
I should mention that I have made a number of changes, some temporary to
get it running.
1.- Shortened temporary file names.
2.- unlink does not do anything (I think this results in temporary files
being persistent).
3.- __DJGPP__ is defined so that fcntl is a nop (no file locking).
4.- The shell only takes one argument, the database name.

After I exit the shell, there are 3 files created: mydatabase,
mydatabase-journal, and the temporary file (normally sqlite_xyzzzz..).

A side question I have is: Can you disable transactions ? If so, how ?

Any help would be much appreciated.

Thanks.

Juan//

What follows is a trace from a bunch of debug statements I have added in
the process of debugging my port. I hope it helps:

>sqlite_shell_main("/tffs0/mydatabase")

sqlite> create table autos(year smallint, make varchar(32), model
varchar(32), id smallint);

sqlite_open: Enter
sqlite_open: Call sqliteBtreeFactory
sqliteBtreeFactory: Enter
sqliteBtreeFactory: Call sqliteBtreeOpen
sqliteBtreeOpen: Enter
sqlitepager_open: Enter (filename = /tffs0/mydatabase)
sqliteOsOpenReadWrite: Enter (filename = /tffs0/mydatabase)
sqliteOsOpenReadWrite: opened file /tffs0/mydatabase
sqliteOsOpenReadWrite: id = 0x1ed63e0
findLockInfo: nRef = 1
findLockInfo: cnt = 0
sqliteOsOpenReadWrite: SQLITE_OK
sqlitepager_open: sqliteOsOpenReadWrite returned 0
sqlitepager_open: SQLITE_OK
sqliteBtreeOpen: SQLITE_OK
sqliteInit: Enter
sqliteInitOne: Enter
sqliteStartTable: Call sqliteBtreeFactory
sqliteBtreeFactory: Enter
sqliteBtreeOpen: Enter
sqlitepager_open: Enter (filename = (null))
sqlitepager_opentemp: Enter
sqliteOsTempFileName: zBuf = /sql_
sqliteOsOpenExclusive: Enter (filename = /tffs0/sql_B3j)
sqliteOsOpenExclusive: opened /tffs0/sql_B3j (fd = 47).
findLockInfo: found pLock (nRef = 2)
sqliteOsOpenExclusive: delFlag. unlink file /tffs0/sql_B3j
sqliteOsOpenExclusive: SQLITE_OK
sqlitepager_opentemp: rc = 0
sqlitepager_open: sqlitepager_opentemp returned 0
sqlitepager_open: SQLITE_OK
sqliteBtreeOpen: SQLITE_OK
fileBtreeCursor: Enter
lockBtree: Enter
lockBtree: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: First page. Get a read lock !
sqliteOsReadLock: Enter
sqliteOsReadLock: id->pLock->cnt = 0
sqliteOsReadLock: id->locked = 0
sqliteOsReadLock: s = 0
sqliteOsReadLock: increment nLock
sqliteOsReadLock: pLock->cnt (0x1ecc65c) set to 1
sqliteOsReadLock: id->pLock->cnt = 1
sqliteOsReadLock: id->locked = 1
sqliteOsReadLock: returns Something
sqlitepager_pagecount: Enter (file = /tffs0/mydatabase)
sqlitepager_get: SQLITE_OK
sqlitepager_pagecount: Enter (file = /tffs0/mydatabase)
lockBtree: return 0
fileBtreeCursor: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
fileBtreeCursor: SQLITE_OK
fileBtreeGetMeta: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
fileBtreeGetMeta: SQLITE_OK
fileBtreeCursor: Enter
lockBtree: Enter
lockBtree: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: First page. Get a read lock !
sqliteOsReadLock: Enter
sqliteOsReadLock: id->pLock->cnt = 1
sqliteOsReadLock: id->locked = 0
sqliteOsReadLock: pLock->cnt (0x1ecc65c) incremented to 2
sqliteOsReadLock: id->pLock->cnt = 2
sqliteOsReadLock: id->locked = 1
sqliteOsReadLock: returns Something
sqlitepager_pagecount: Enter (file = /tffs0/sql_B3j)
sqlitepager_get: SQLITE_OK
sqlitepager_pagecount: Enter (file = /tffs0/sql_B3j)
lockBtree: return 0
fileBtreeCursor: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
fileBtreeCursor: SQLITE_OK
moveToRoot: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
sqliteOsUnlock: pLock->cnt (0x1ecc65c) decremented to 1
sqliteOsUnlock: return Something
fileBtreeCursor: Enter
fileBtreeCursor: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
fileBtreeCursor: SQLITE_OK
fileBtreeGetMeta: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
fileBtreeGetMeta: SQLITE_OK
moveToRoot: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
sqliteOsUnlock: pLock->cnt (0x1ecc65c) set to 0
sqliteOsUnlock: return Something
sqliteInitOne: Final returns 0
sqliteInit: sqliteInitOne returned 0
sqliteInit: returns 0
sqlite_open: sqliteInit returned 0
sqlite_open: return db = 0x1ecc424
fileBtreeBeginTrans: Enter
lockBtree: Enter
lockBtree: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: First page. Get a read lock !
sqliteOsReadLock: Enter
sqliteOsReadLock: id->pLock->cnt = 0
sqliteOsReadLock: id->locked = 0
sqliteOsReadLock: s = 0
sqliteOsReadLock: increment nLock
sqliteOsReadLock: pLock->cnt (0x1ecc65c) set to 1 
sqliteOsReadLock: id->pLock->cnt = 1
sqliteOsReadLock: id->locked = 1
sqliteOsReadLock: returns Something
sqlitepager_pagecount: Enter (file = /tffs0/mydatabase)
sqlitepager_get: SQLITE_OK
sqlitepager_pagecount: Enter (file = /tffs0/mydatabase)
lockBtree: return 0
sqlitepager_begin: Enter
sqliteOsWriteLock: pLock->cnt (0x1ecc65c) set to -1 
sqliteOsWriteLock: return Something
pager_open_journal: Enter
sqlitepager_pagecount: Enter (file = /tffs0/mydatabase)
sqlitepager_pagecount: dbSize >= 0
pager_open_journal: Call OsOpenExclusive on /tffs0/mydatabase-journal 
with delFlag = 0
sqliteOsOpenExclusive: Enter (filename = /tffs0/mydatabase-journal)
sqliteOsOpenExclusive: opened /tffs0/mydatabase-journal (fd = 48).
findLockInfo: found pLock (nRef = 3)
sqliteOsOpenExclusive: SQLITE_OK
sqliteOsOpenReadOnly: opened directory /tffs0 for read only
sqlitepager_pagecount: Enter (file = /tffs0/mydatabase)
sqlitepager_write: Enter
sqlitepager_begin: Enter
newDatabase: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
sqlitepager_write: Enter
sqlitepager_begin: Enter
fileBtreeGetMeta: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: SQLITE_OK
fileBtreeGetMeta: SQLITE_OK

fileBtreeBeginTrans: Enter
lockBtree: Enter
lockBtree: Calling sqlitepager_get
sqlitepager_get: Enter
sqlitepager_get: First page. Get a read lock !
sqliteOsReadLock: Enter
sqliteOsReadLock: id->pLock->cnt = -1
sqliteOsReadLock: id->locked = 0
sqliteOsReadLock: set SQLITE_BUSY
sqliteOsReadLock: id->pLock->cnt = -1
sqliteOsReadLock: id->locked = 0
sqliteOsReadLock: returns SQLITE_BUSY
sqlitepager_get: Error Getting a read lock !
OP_Transaction: SQLITE_BUSY
pager_playback: Enter
sqliteOsReadLock: Enter
sqliteOsReadLock: id->pLock->cnt = -1
sqliteOsReadLock: id->locked = 1
sqliteOsReadLock: s = 0
sqliteOsReadLock: pLock->cnt (0x1ecc65c) set to 1
sqliteOsReadLock: id->pLock->cnt = 1
sqliteOsReadLock: id->locked = 1
sqliteOsReadLock: returns 
pager_playback: returning 0
sqliteOsUnlock: pLock->cnt (0x1ecc65c) set to 0
sqliteOsUnlock: return Something

SQL error: database is locked

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to