For the life of me I cannot figure out where this is going wrong. I
am not a below average intelligence individual, and I have been
working with computers for over 30 years, but this one has me totally
at a loss.
I should point out that while I own MacOS based systems exclusively
for home use, I have never formally developed much on the systems. I
have used REALbasic in the past, along with HyperCard and the like,
but it is only recently that I have commenced attempting to learn
Objective-C and Cocoa programming. I do have years of experience with
Digital (PDP, VAX, Alpha), various UNIX and Windows based systems,
however, and have used all of the major programming languages at one
time or another. Most of my recent professional work is based on
C#/.Net under Windows, where we use SQL Server and MSDE (SQL Server
Express now) almost exclusively.
I wanted to develop some applications to support my hobby and
volunteer work -- officiating for Little League Baseball. Along with
umpiring games, I also manage the District web site, and have written
some code to track and report the results of season games, playoffs
and tournaments. The original code was written in REALbasic, but I
cannot afford to keep buying the new releases for a hobby that
already costs me a significant amount of money each year. To that end
I wanted to use the free XCode tools, which meant learning Objective-
C and Cocoa for reasonable GUI applications. I was disappointed to
find there was not readily available database interface, so I began
writing one for myself in Objective-C.
I had some problems with the original attempt to develop a SQLite
framework, so I decided to simply create an experimental application
and embed the SQLite code, along with my framework classes, and the
trial code in the same application. I organized the project so that
the main project source files were in the project base directory, and
created a subdirectory each for the framework code and the SQLite
source code. This worked fairly well, and I was able to get enough
code written that I could create a new database, create a table, but
some data in the table, and execute a query that returned the results
into an in-memory result set (vaguely similar to what ADO.Net can do,
but FAR simpler). Since none of my immediate applications will result
in huge result sets being generated, I deemed this sufficient.
I developed this trial application with the SQLite 3.2.8 source code,
and it went fairly well. I was even able to step through my framework
classes and even down into the SQLite source to track down how some
operations actually worked. Life was not bad!
Then I decided to replace the SQLite source with the 3.3.0 contents
and see if there were any improvements. As I noted, I simply replaced
the 51 source files in the subdirectory of my project with the same
files from the 3.3.0 source tree, and recompiled. The first thing I
noticed was that there were now only 6 warnings about sign
differences on variable sin assignments or procedure calls, and that
the code seemed to compile just a bit faster. When I attempt to
execute the code, however, it signals a bad exception on a call to
sqlite3OsLock() on line 1969 of pager.c as I am attempting to execute
the SQL statement to create my first table after the database is
created.
1. I cannot locate in the 3.3.0 source code how the reference to
sqlite3OsLock is converted into the virtual table method.
2. There are no longer an os_win.h or os_unix.h file in the source
tree, which is fine.
3. For some reason I can no longer step into my framework code!
4. Naturally, I cannot step into the SQLite code either, since I
cannot step into my framework.
5. I can set a breakpoint in my Objective-C code and step from there,
but sometimes this steps over instead of into!
6. It almost always fails to step into the SQLite C calls.
7. If I set a breakpoint on a SQLite statement, I hit it, but single
stepping is erratic at best, often stepping over and seeming to jump
randomly around in the code rather than sequentially following the
source code.
I am stuck! How do I resolve this problem and get the 3.3.0 code
working once more?
-ken
On 12-Jan-06, at 11:52 PM, [EMAIL PROTECTED] wrote:
The whole OS-backend was reworked for version 3.3.0. So
do not expect to find the same functions in 3.3.0 that you
had in 3.2.8.
unixLock() is actually a virtual method on the OsFile object. Since
SQLite is written in C not C++, we have to explicitly code the
virtual method table. You can find it defined as the IoMethod
structure in os.h. When you open a file, (using, for example,
the sqlite3UnixOpenReadWrite() routine) you get back an object
called OsFile which has as its first field a pointer to the
IoMethod structure. sqlite3OsLock() is really a macro that
resolves to OsFile->pMethod.xLock which should point to the
unixLock() function. (It points to winLock() if you are running
on windows, obviously.)