Re: [libdbi-users] sqlite and sqlite3 drivers CHAR as TEXT or INTEGER

2008-10-24 Thread Claudiu CISMARU
On Friday 24 October 2008 14:10:09 João Henrique Freitas wrote:
> Ok
> 
> I can't do a atoi() because is out of my control. But in change the
> struct of table to include a CHAR(1) than CHAR. And I can get CHAR(1)
> like string.

I think you don't think this in C...

-- 
  Claudiu Nicolaie CISMARU
  GNU GPG Key: http://claudiu.targujiu.net/key.gpg
  T: 0755135455
  E: [EMAIL PROTECTED], [EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part.
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] sqlite and sqlite3 drivers CHAR as TEXT or INTEGER

2008-10-24 Thread Markus Hoenicka
Quoting João Henrique Freitas <[EMAIL PROTECTED]>:

> Ok
>
> I can't do a atoi() because is out of my control. But in change the
> struct of table to include a CHAR(1) than CHAR. And I can get CHAR(1)
> like string.
>

I can't claim that this was an ingenious design decision back then as  
it is too long ago to remember for sure. But in retrospect I feel what  
you describe here offers users a choice of how to treat a single char.  
Either as a tiny integer (CHAR) or as a one-byte text [CHAR(1)]. It is  
probably best to keep this behaviour.

regards,
Markus

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] sqlite and sqlite3 drivers CHAR as TEXT or INTEGER

2008-10-24 Thread João Henrique Freitas
Ok

I can't do a atoi() because is out of my control. But in change the
struct of table to include a CHAR(1) than CHAR. And I can get CHAR(1)
like string.

thanks

On Thu, Oct 23, 2008 at 11:10 AM, Claudiu CISMARU
<[EMAIL PROTECTED]> wrote:
>
>> But http://sqlite.org/datatypes.html and
>> http://sqlite.org/datatype3.html says:
>>
>> "The search for these strings in the type declaration is case
>> insensitive, of course. If any of the above strings occur anywhere in
>> the type declaration, then the datatype of the column is text. Notice
>> that the type "VARCHAR" contains "CHAR" as a substring so it is
>> considered text."
>>
>> "If the datatype of the column contains any of the strings "CHAR",
>> "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the
>> type VARCHAR contains the string "CHAR" and is thus assigned TEXT
>> affinity."
>>
>> I think the sqlite and sqlite3 drivers must treat CHAR as TEXT not
>> INTEGER (TINY).
>>
>> It's right?
>
> I don't really think. This text explain how the data it's represented
> internally, inside the sqlite database file, not how it's presented to
> the user. In fact, the driver helps you, transforming that data to a
> numerical value, as you use it in your software. If it remains text,
> then you have to call atoi() on that field to get the numerical value.
>
> --
>  Claudiu Nicolaie CISMARU
>  GNU GPG Key: http://claudiu.targujiu.net/key.gpg
>  T: 0755135455
>  E: [EMAIL PROTECTED], [EMAIL PROTECTED]
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> libdbi-users mailing list
> libdbi-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libdbi-users
>
>



-- 
---
João Henrique Freitas - joaohf_at_gmail.com
Campinas-SP-Brasil
BSD051283
LPI 1
http://www.joaohfreitas.eti.br
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] sqlite and sqlite3 drivers CHAR as TEXT or INTEGER

2008-10-24 Thread Claudiu CISMARU

> But http://sqlite.org/datatypes.html and 
> http://sqlite.org/datatype3.html says: 
> 
> "The search for these strings in the type declaration is case
> insensitive, of course. If any of the above strings occur anywhere in
> the type declaration, then the datatype of the column is text. Notice
> that the type "VARCHAR" contains "CHAR" as a substring so it is
> considered text."
> 
> "If the datatype of the column contains any of the strings "CHAR",
> "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the
> type VARCHAR contains the string "CHAR" and is thus assigned TEXT
> affinity."
> 
> I think the sqlite and sqlite3 drivers must treat CHAR as TEXT not
> INTEGER (TINY).
> 
> It's right?

I don't really think. This text explain how the data it's represented 
internally, inside the sqlite database file, not how it's presented to 
the user. In fact, the driver helps you, transforming that data to a 
numerical value, as you use it in your software. If it remains text, 
then you have to call atoi() on that field to get the numerical value.

-- 
  Claudiu Nicolaie CISMARU
  GNU GPG Key: http://claudiu.targujiu.net/key.gpg
  T: 0755135455
  E: [EMAIL PROTECTED], [EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part.
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] sqlite and sqlite3 drivers CHAR as TEXT or INTEGER

2008-10-23 Thread Claudiu CISMARU

> But http://sqlite.org/datatypes.html and 
> http://sqlite.org/datatype3.html says: 
> 
> "The search for these strings in the type declaration is case
> insensitive, of course. If any of the above strings occur anywhere in
> the type declaration, then the datatype of the column is text. Notice
> that the type "VARCHAR" contains "CHAR" as a substring so it is
> considered text."
> 
> "If the datatype of the column contains any of the strings "CHAR",
> "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the
> type VARCHAR contains the string "CHAR" and is thus assigned TEXT
> affinity."
> 
> I think the sqlite and sqlite3 drivers must treat CHAR as TEXT not
> INTEGER (TINY).
> 
> It's right?

I don't really think. This text explain how the data it's represented 
internally, inside the sqlite database file, not how it's presented to 
the user. In fact, the driver helps you, transforming that data to a 
numerical value, as you use it in your software. If it remains text, 
then you have to call atoi() on that field to get the numerical value.

-- 
  Claudiu Nicolaie CISMARU
  GNU GPG Key: http://claudiu.targujiu.net/key.gpg
  T: 0755135455
  E: [EMAIL PROTECTED], [EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part.
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users