Re: [sqlite] null handling import

2011-08-17 Thread matthew (matthew.jsoft) white
table. Matt --- On Wed, 17/8/11, Stephan Beal wrote: From: Stephan Beal Subject: Re: [sqlite] null handling import To: "General Discussion of SQLite Database" Date: Wednesday, 17 August, 2011, 18:13 On Wed, Aug 17, 2011 at 7:12 PM, matthew (matthew.jsoft) white < matthew.js

Re: [sqlite] null handling import

2011-08-17 Thread Stephan Beal
On Wed, Aug 17, 2011 at 7:12 PM, matthew (matthew.jsoft) white < matthew.js...@btinternet.com> wrote: > I didn't realise that views could be written to. > i didn't, either. Thank you very much for posting a follow-up with your results. i now have some experimentation to do... Happy Hacking! --

Re: [sqlite] null handling import

2011-08-17 Thread matthew (matthew.jsoft) white
dable form which allows them to be easy visually scanned and DIFF'ed when testing the AWK conversion programs. I didn't realise that views could be written to. Cheers,  Matt --- On Sun, 14/8/11, BareFeetWare wrote: From: BareFeetWare Subject: Re: [sqlite] null handling import To: &quo

Re: [sqlite] null handling import

2011-08-14 Thread Jean-Christophe Deschamps
Mattew, > Obviously I am not as well versed in sqlite as you are. I hate to > hate myself, but am still continuing with reading somewhat ancient > files into a somewhat cohorrent database. > >Thanking you for your time and trouble, > > Matthew > >p.s. shame about the parsing of comma delim

Re: [sqlite] null handling import

2011-08-13 Thread BareFeetWare
Oops, I forgot the "new." prefixes. That trigger should be: create trigger "Import insert" instead of insert on Import begin insert into Person (Name, Email) select case when new.Name = '' then null else new.Name end , case when new.Email = '' then null else new.Email end ; end ; Or more simply

Re: [sqlite] null handling import

2011-08-13 Thread BareFeetWare
> On 13 Aug 2011, at 7:58am, matthew (matthew.jsoft) white wrote: > >> I was just wondering if sq3 has some kind of mechanism to parse blank >> records as null instead of empty strings. One way to do this is to import into a view and use a trigger to convert the rows how you like. For example:

Re: [sqlite] null handling import

2011-08-13 Thread Simon Slavin
On 13 Aug 2011, at 9:58pm, matthew (matthew.jsoft) white wrote: > Thanking you for your time and trouble, Don't worry, giving advice like that is exactly what this list is for. Everyone has to learn sometime and even SQLite is so complicated you can't pick it all up at once. Good luck with t

Re: [sqlite] null handling import

2011-08-13 Thread matthew (matthew.jsoft) white
though. Goodnight. --- On Sat, 13/8/11, Simon Slavin wrote: From: Simon Slavin Subject: Re: [sqlite] null handling import To: "General Discussion of SQLite Database" Date: Saturday, 13 August, 2011, 19:46 On 13 Aug 2011, at 7:05pm, matthew (matthew.jsoft) white wrote: >  Didn

Re: [sqlite] null handling import

2011-08-13 Thread Simon Slavin
On 13 Aug 2011, at 7:05pm, matthew (matthew.jsoft) white wrote: > Didn't know about the "typeoff" function. Is this anything like the CAST sql > syntax or is it peculiar to sqlite? One of SQLite's built in functions: http://www.sqlite.org/lang_corefunc.html Simon. ___

Re: [sqlite] null handling import

2011-08-13 Thread matthew (matthew.jsoft) white
ly meld some dubious text file formats from differing countries into some sort of a unified database. Thanking you for the clarification regarding the treatment of empty strings in sqlite,   Matthew --- On Sat, 13/8/11, Simon Slavin wrote: From: Simon Slavin Subject: Re: [sqlite] null handling

Re: [sqlite] null handling import

2011-08-13 Thread Simon Slavin
On 13 Aug 2011, at 4:50pm, matthew (matthew.jsoft) white wrote: > I'm not too clear about your answer. Could you please elaborate? > > Your response about zero length strings certainly helps with my understanding > of the output of select statements, in that when you see a blank field it is >

Re: [sqlite] null handling import

2011-08-13 Thread matthew (matthew.jsoft) white
keyboards which is never used. This makes it clear to me that a field is definitely null as opposed to a zero length string. Sincerly,   Matthew --- On Sat, 13/8/11, Simon Slavin wrote: From: Simon Slavin Subject: Re: [sqlite] null handling import To: "General Discussion of SQLite Databa

Re: [sqlite] null handling import

2011-08-13 Thread Simon Slavin
On 13 Aug 2011, at 7:58am, matthew (matthew.jsoft) white wrote: > I've modified all scripts which replaces empty strings with 'null' , and > every things hunky dory. I was just wondering if sq3 has some kind of > mechanism to parse blank records as null instead of empty strings. Probably not,

Re: [sqlite] null handling import

2011-08-12 Thread matthew (matthew.jsoft) white
lued logic, but was trying to clarify whether or not dot_importing supports NULLs at all? Sincerely,   Matthew n Sat, 13/8/11, H. Phil Duby wrote: From: H. Phil Duby Subject: Re: [sqlite] null handling import To: "General Discussion of SQLite Database" Date: Saturday, 13 August

Re: [sqlite] null handling import

2011-08-12 Thread H. Phil Duby
On Fri, Aug 12, 2011 at 14:59, matthew (matthew.jsoft) white wrote: > > This may seem obvious for seasoned users, but sqlite3 always turns every > blank input token into an empty string. > > For example, say you are dot.importing a colon separated file such as :- > > create table foo ( col1 integ

[sqlite] null handling import

2011-08-12 Thread matthew (matthew.jsoft) white
This may seem obvious for seasoned users, but sqlite3 always turns every blank input token into an empty string. For example, say you are dot.importing a colon separated file such as :- create table foo ( col1 integer, col2 varchar(100) ); .separator ":" 1001:'a_string'  -- dynamic string