Re: [sqlite] sqlite3_bind_int64, sqlite3_bind_int, sqlite_uint64

2008-09-04 Thread Roar Bjørgum Rotvik
Martin (OpenGeoMap) wrote:
>>   Neither C nor C++ define the specific sizes of different types.
>>   Therefore, "long long int" can be different sizes on different
>>   platforms, or even within different compilers for the same platform.
>>   Without more information, we cannot say for sure if a "long long int"
>>   is 64 bits or not on your platform.
>>   
> yes, that´s the reason the define new types in QT or in the glib:
> http://library.gnome.org/devel/glib/stable/glib-Basic-Types.html

I thought C99 had spesified these types (i.e. with C99 it is a part of C):
http://en.wikipedia.org/wiki/C99
http://en.wikipedia.org/wiki/Stdint.h

C99 include file stdint.h defines these types:
uint64_t, int64_t, uin32_t, int32_t and so on.

C99 also specifies a boolean value 'bool':
http://en.wikipedia.org/wiki/Stdbool.h

I understand that these types cannot be used directly in code that can be 
compiled on 
older compilers that does not support C99.
But for those older compilers you can define a compability header file that 
defines these 
values.
Then you can use C99 datatypes in your code and it is supported for newer and 
older compilers.

And I personally thinks that using explicit datatypes like uin32_t is way more 
descriptive 
than 'unsigned int' and similar for datatypes where you really need to know the 
length.

-- 
Roar Bjørgum Rotvik
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_bind_int64, sqlite3_bind_int, sqlite_uint64

2008-09-04 Thread Martin (OpenGeoMap)

>
>   Neither C nor C++ define the specific sizes of different types.
>   Therefore, "long long int" can be different sizes on different
>   platforms, or even within different compilers for the same platform.
>   Without more information, we cannot say for sure if a "long long int"
>   is 64 bits or not on your platform.
>   
yes, that´s the reason the define new types in QT or in the glib:
http://library.gnome.org/devel/glib/stable/glib-Basic-Types.html

>   However, most modern desktop systems _do_ define "long long int" to be a
>   64 bit integer.   If you want to find out, just look at the return value
>   from "sizeof(long long int)"-- if it is 8, then it is 64 bits.
>   
>   Regardless, it is extremely unlikely to be greater than 64 bits, so
>   using sqlite_bind_int64() (which does define an explicit 64 bit
>   integer) should be able to hold anything a "long long int" can hold.
>   The compiler should do any required conversion if "long long int" is
>   some other size.
>
>-j
>
>   

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_bind_int64, sqlite3_bind_int, sqlite_uint64

2008-09-03 Thread Jay A. Kreibich
On Wed, Sep 03, 2008 at 04:46:37PM -0700, Joanne Pham scratched on the wall:
> Hi All,
> I have an application which is used one of the variable is "long long int".
> This variable is used for storing the big number and
> I used  sqlite3_bind_int to bind this variable. One for while I have
> seen the negative number in the database for this variable.
> It seems like this variable is overloaded. The sqlite3_bind_int didn't
> work in this case.
> I have read the sqlite'document and found that there are two other
> binding function sqlite3_bind_int64, sqlite_uint64 to bind the columns.
> Which function (sqlite3_bind_int64, sqlite_uint64 ) for me to use if my
> datatype is long long int in C++

  Neither C nor C++ define the specific sizes of different types.
  Therefore, "long long int" can be different sizes on different
  platforms, or even within different compilers for the same platform.
  Without more information, we cannot say for sure if a "long long int"
  is 64 bits or not on your platform.

  However, most modern desktop systems _do_ define "long long int" to be a
  64 bit integer.   If you want to find out, just look at the return value
  from "sizeof(long long int)"-- if it is 8, then it is 64 bits.
  
  Regardless, it is extremely unlikely to be greater than 64 bits, so
  using sqlite_bind_int64() (which does define an explicit 64 bit
  integer) should be able to hold anything a "long long int" can hold.
  The compiler should do any required conversion if "long long int" is
  some other size.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_bind_int64, sqlite3_bind_int, sqlite_uint64

2008-09-03 Thread Joanne Pham
Thanks Igor!
So I should use the function sqlite3_bind_int64 to bind the variable which has 
the datatype as "long long int" rigtht?
Thanks,
JP



- Original Message 
From: Igor Tandetnik <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Wednesday, September 3, 2008 4:58:14 PM
Subject: Re: [sqlite] sqlite3_bind_int64, sqlite3_bind_int, sqlite_uint64

Joanne Pham <[EMAIL PROTECTED]> wrote:
> I have read the sqlite'document and found that there are two other
> binding function sqlite3_bind_int64, sqlite_uint64 to bind the
> columns.
> Which function (sqlite3_bind_int64, sqlite_uint64 ) for me to use if
> my datatype is long long int in C++

sqlite_uint64 is a type, not a function.

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_bind_int64, sqlite3_bind_int, sqlite_uint64

2008-09-03 Thread Igor Tandetnik
Joanne Pham <[EMAIL PROTECTED]> wrote:
> I have read the sqlite'document and found that there are two other
> binding function sqlite3_bind_int64, sqlite_uint64 to bind the
> columns.
> Which function (sqlite3_bind_int64, sqlite_uint64 ) for me to use if
> my datatype is long long int in C++

sqlite_uint64 is a type, not a function.

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3_bind_int64, sqlite3_bind_int, sqlite_uint64

2008-09-03 Thread Joanne Pham
Hi All,
I have an application which is used one of the variable is "long long int". 
This variable is used for storing the big number and
I used  sqlite3_bind_int to bind this variable. One for while I have seen the 
negative number in the database for this variable.
It seems like this variable is overloaded. The sqlite3_bind_int didn't work in 
this case.
I have read the sqlite'document and found that there are two other binding 
function sqlite3_bind_int64, sqlite_uint64 to bind the columns.
Which function (sqlite3_bind_int64, sqlite_uint64 ) for me to use if my 
datatype is long long int in C++
Thanks,
JP


  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users