Pat Wibbeler uttered:

A quick search through the sqlite source release led me to believe that
the source may be coded around endian issues.  I guess what I'm looking
for is affirmation or denial of my cursory reading.

If the source is endian dependent, how does sqlite configure and/or make
determine the endian nature of the platform on which it is building?
What does it change?  If I know these things, I suspect that I can build
a project that either runs configure as part of the process, or does the
same things that make/configure do to make endian-ness correct.

If these aren't documented somewhere, I can reverse engineer
configure/make, but I was hoping that someone here might have the
answers.



SQLite database files are stored using network byte order, which is big endian. The C code takes care of translating the on disk network byte order data to host format data. In btree.c, this is handled by the following functions:
  get2byte
  get4byte
  put2byte
  put4byte

In pager.c, this is handled by:
  read32bits
  write32bits
  put32bits
  retrieve32bits

Variable length integers are handled in util.c by:
  sqlite3GetVarint
  sqlite3GetVarint32
  sqlite3PutVarint

The remaining code in SQLite deals with integers in host byte order, and is thus endian-independent.



Thanks again!

Pat

-----Original Message-----
From: John Stanton [mailto:[EMAIL PROTECTED]
Sent: Monday, July 03, 2006 10:04 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] endian-specific code in pure c source release?

Sqlite data is endian agnostic, but the executables are, like any
executables, dependent upon the endian nature of the host processor.

Just compile the Sqlite library for each platform and share the data.

On platforms other than Windows use configure, otherwise use the
prepared windows source.

If you make any extensions to Sqlite, such as your own functions, they
will be platform independent.  By using the regular Sqlite source
distribution you will be able to upgrade easily, and not have your
application rev-locked.

Pat Wibbeler wrote:
For a couple of reasons:
* I'd like to use xcode to build a universal binary.  If I run
./configure, I imagine that any endian specific code that is fixed
using
configure will be set to whatever platform I run configure on (i386 or
ppc).
* I already have the packaged source for a windows build using visual
studio and I'd like to use the same sources if possible to avoid
confusion.

Pat


-----Original Message-----
From: John Stanton [mailto:[EMAIL PROTECTED]
Sent: Monday, July 03, 2006 9:24 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] endian-specific code in pure c source release?

Why not use the regular source and run configure?

Pat Wibbeler wrote:

I'd like to build an xcode project for sqlite.  One straightforward
approach is to take the sqlite-source-3_3_6.zip "pure c" source

release

and build the xcode project from that.

Is there any endian specific code in that source release that might

trip

me up on power pc processors?  I ask this because I know that this
release is "provided as a service to MS-Windows users who lack the

build

support infrastructure of Unix."

Thanks!

Pat




--
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

Reply via email to