Dear SQLite developers,

I've managed to port SQLite 3.7.9 to HP OpenVMS operating system by
applying some minor
changes to 'amalgation' sqlite3.c source code file. I could not find any
references in the Internet
to SQLite running on VMS, so I hope my work would be useful to other people.

My port isn't complete, as database locking does not work at all: the only
way to open a database
file is to specify "unix-none" driver name as an argument to
sqlite3_open_v2() function. I tried to
port POSIX locking code to VMS, but found that my understanding of locking
code in SQLite
is not enough to accomplish this task, and I currently have no time for a
deeper study.

To build SQLite I used the following DCL command:

CC /OPTIMIZE /DEFINE=(SQLITE_THREADSAFE=0,-
 SQLITE_OMIT_LOAD_EXTENSION=1,SQLITE_OMIT_COMPILEOPTION_DIAGS=1,-
 SQLITE_OMIT_MEMORYDB=1,SQLITE_OMIT_TEMPDB=1,SQLITE_OMIT_DEPRECATED=1,-
 SQLITE_OMIT_SHARED_CACHE=1,_USE_STD_STAT=ENABLE) sqlite3.c

My changes to sqlite3.c file (in a form of a patch) are attached to this
message.

I also think (although I'm not really sure) that I found a bug in SQLite,
which I also had to fix to make
my port work. That fixes are also in the attached patch.

There is a "struct unixFile" which contains field "zPath" - a name of an
open file. This
field is used in several places in SQLite (for example, it is used for
error reporting at robust_close(),
unixSync(), unixTruncate() functions, and to create shared memory filename
in
unixOpenSharedMemory() function).

The problem is that this field is a pointer to a memory area with unknown
lifetime - that is, for
temporary files it references stack (array zTmpname in function
unixOpen()). unixFile structure
itself may (and on many cases will) exist after the memory area which zPath
field points to
will be deallocated and overwritten.

In my patched version of SQLite, zPath field points to a copy of the
original string, so that it can
be used safely until the whole unixFile structure is deallocated.

Any comments to my patch are welcome, and any advice and/or help in porting
SQLite locking
code to VMS will be greatly appreciated.

Best regards,
  Maxim Zinal.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to