Why would you want to convert something to a string that is already cross 
platform compatible?

If you need to store the value in a different DB, then converting it locally to 
a native int64 and then into whatever DB construct would be way more efficient 
than hauling around string conversions. 

Im of course assuming your going to be transmitting this over some network 
protocol or file format from system to system of varying endianess?





--- On Mon, 5/4/09, Sam Carleton <scarle...@gmail.com> wrote:

> From: Sam Carleton <scarle...@gmail.com>
> Subject: Re: [sqlite] OT: how best to convert sqlite3_int64 to and from 
> string in a cross platform fashion?
> To: kennethinbox-sql...@yahoo.com, "General Discussion of SQLite Database" 
> <sqlite-users@sqlite.org>
> Date: Monday, May 4, 2009, 10:29 AM
> Ken,
> 
> this is true, except that I might migrate the system to
> some other database someday that wants to use something else
> as PK other than an int or int64 (MS SQL is optimized for
> guid's not int), so passing around the id's as strings keeps
> all the middle and front end code neutral :)
> 
> Sam
> 
> Ken wrote:
> > You could just pass the sqlite3_int64 value. It is
> portable between systems. Search through the sqlite3 code
> and there are routines that do the conversions from the
> sqlite3_int64 to a native int64 type. They basically perform
> bit shifting and will be much faster than the string
> conversions.
> > 
> > HTH,
> > Ken
> 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to