Re: [sqlite] Boolean and DataReader

2014-02-01 Thread Igor Tandetnik
On 2/1/2014 12:26 PM, Klaas V wrote: |Igor Tandetnik wrote: | On 1/30/2014 7:20 PM, James K. Lowden wrote: |or define a constraint | | colname boolean check (colname in ('Y', 'N')) | |Of course you can use 0 and 1, but there's no technical advantage |There is a tiny adv

Re: [sqlite] Boolean and DataReader

2014-02-01 Thread Klaas V
|Igor Tandetnik wrote: | On 1/30/2014 7:20 PM, James K. Lowden wrote: |or define a constraint | |colname boolean check (colname in ('Y', 'N')) | |Of course you can use 0 and 1, but there's no technical advantage |There is a tiny advantage. Values 0 and 1 are special-cased in

Re: [sqlite] Boolean and DataReader

2014-01-31 Thread Johnny
Dear Keith, the point is the following you define a sqlite field as BOOLEAN at that poit the sqlite ADO.NET maps it to System.Boolean and it takes into account of an integer affinity You put a wrong "Y" in, if there is no check constraint, sqlite is typeless and accept it. It does not smell like an

Re: [sqlite] Boolean and DataReader

2014-01-31 Thread Keith Medcalf
Behalf Of Johnny >Sent: Friday, 31 January, 2014 13:41 >To: sqlite-users@sqlite.org >Subject: Re: [sqlite] Boolean and DataReader > >But sqlite is typeless... so the affinity does not change much... :-( >A constraint check in (0,1) is needed for a reliable boolean type > > &g

Re: [sqlite] Boolean and DataReader

2014-01-31 Thread Johnny
But sqlite is typeless... so the affinity does not change much... :-( A constraint check in (0,1) is needed for a reliable boolean type -- View this message in context: http://sqlite.1065341.n5.nabble.com/Boolean-and-DataReader-tp73521p73600.html Sent from the SQLite mailing list archive at Nab

Re: [sqlite] Boolean and DataReader

2014-01-31 Thread Johnny
Good point, in terms of integer affinity I think that a Boolean_INT is the way to go. I have posted a bugfix request on sqliteadmin forum but I don't think it is supported any longer... It is using a non standard Y/N :( On c# side GetBoolean is the best approach as opposite to the bool casting. I t

Re: [sqlite] Boolean and DataReader

2014-01-30 Thread Keith Medcalf
rg >Subject: Re: [sqlite] Boolean and DataReader > >I'm not one of the sqlite dev'rs for sure, >but I immagine that the .net driver has been done with their cooperation >In any case the funny thing is that >(in a particular situation: after a "wrong" insert of "

Re: [sqlite] Boolean and DataReader

2014-01-30 Thread Igor Tandetnik
On 1/30/2014 7:20 PM, James K. Lowden wrote: or define a constraint colname boolean check (colname in ('Y', 'N')) Of course you can use 0 and 1, but there's no technical advantage There is a tiny advantage. Values 0 and 1 are special-cased in SQLite's file format, and occupy only one

Re: [sqlite] Boolean and DataReader

2014-01-30 Thread James K. Lowden
On Thu, 30 Jan 2014 10:49:39 -0500 Stephen Chrzanowski wrote: > What I might suggest you do is instead of checking GetBoolean (Since > it is extremely picky apparently) is use GetInteger != 0. If the > result is ZERO this will return FALSE. (1 != 0 = TRUE; 0 != 0 = > FALSE) If the result is any

Re: [sqlite] Boolean and DataReader

2014-01-30 Thread Stephen Chrzanowski
I don't use .NET anything, so I can't speak on it. However, with my wrapper in Delphi, if I store a value as 1 or '1', returning a .AsInteger will succeed. The wrapper is smart enough to decide if it is actually a number. I don't recall if it'll throw an exception if the value in the database is

Re: [sqlite] Boolean and DataReader

2014-01-30 Thread Johnny
I'm not one of the sqlite dev'rs for sure, but I immagine that the .net driver has been done with their cooperation In any case the funny thing is that (in a particular situation: after a "wrong" insert of "1" instead of 1, fault of sqlite admin) my Wrapper level - can I say that the ADO .net Syst

Re: [sqlite] Boolean and DataReader

2014-01-30 Thread Stephen Chrzanowski
Just to make it crystal clear, to a developer actually calling the SQLite functions (I'm talking about [ PrepareSQL_v2 ] and such, not [ select * from table ]), SQLite is TYPELESS which means there is no data type that is kept track of for any field. This means that even if you define a column as

Re: [sqlite] Boolean and DataReader

2014-01-30 Thread Johnny
I just want to keep track of the issue as it is and of the complete solution. Problem was due to a wrong sqlite initialization of the Boolean as a text instead of integer when I used the boolean checkbox of the EditData tab in SQLite Administrator software. Fixing that and making DR.GetBoolean work

Re: [sqlite] Boolean and DataReader

2014-01-29 Thread Johnny
Simon, as I wrote before the native type is numeric. You're right about typeof showing that type, of course. But inside sqlite the dump command reads Boolean. I also confirm that the application is working, in particular the getBoolean does not throw any exception and Properly reads the value. Tel

Re: [sqlite] Boolean and DataReader

2014-01-29 Thread Simon Slavin
On 29 Jan 2014, at 10:19pm, Johnny wrote: > Now I'm using the sql browser to create a table column of type numeric > Boolean. No you're not. See section 1.1 of If some application presents a boolean type to you and then it's being done inside that appl

Re: [sqlite] Boolean and DataReader

2014-01-29 Thread Johnny
For the sake of clarity. Now I'm using the sql browser to create a table column of type numeric Boolean. Now also my c# DataReader method getBoolean is working fine.. It correctly interprets the type Boolean defined on the sqlite db. Problem solved, I think :-) -- View this message in context:

Re: [sqlite] Boolean and DataReader

2014-01-29 Thread Johnny
>From the db standpoint your answer is perfect and you also replied very quickly, so thank you! Just of curiosity, who is the developer team (or the support team) of sqlite software products like sqlite admin or .net data driver? I mean - from the client connection layer, how can you miss the oppor

Re: [sqlite] Boolean and DataReader

2014-01-29 Thread Gerry Snyder
On 1/29/2014 1:08 PM, Johnny wrote: Sorry, I have again a question about reading a sqlite db from c#. Suppose you have a simple Boolean column in a table. I want to use a .net DataReader (connected layer). My question is: Why I get a cast exception when calling the getBoolean method (solution A)?

[sqlite] Boolean and DataReader

2014-01-29 Thread Johnny
Sorry, I have again a question about reading a sqlite db from c#. Suppose you have a simple Boolean column in a table. I want to use a .net DataReader (connected layer). My question is: Why I get a cast exception when calling the getBoolean method (solution A)? Casting the DataReader to Boolean (so