Re: [sqlite] Should Unary + Cast to a Number?

2005-03-22 Thread David Wheeler
On Mar 17, 2005, at 2:08 PM, Clay Dowling wrote: strftime(buffer, size, "%Y-%m-%sT%H:%M:%S", now); SOAP uses the same format for date/time information, and I've been neck deep in SOAP for the last few weeks. I note that the newly released SQLite 3.2.0 addresses this issue. The "T" is now allowed.

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread David Wheeler
On Mar 17, 2005, at 4:27 PM, Kurt Welgehausen wrote: Well, I might as well use the substr() function, then ... Yes, unless you think %m is more expressive than 6,2 or you want to extract more than one component. sqlite> select * from datetest; k d -- --- 1

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
> Well, I might as well use the substr() function, then ... Yes, unless you think %m is more expressive than 6,2 or you want to extract more than one component. sqlite> select * from datetest; k d -- --- 1 2005-03-17T16:21:30 2

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread David Wheeler
On Mar 17, 2005, at 2:59 PM, Kurt Welgehausen wrote: Sorry, I misunderstood the context. No problem. sqlite> select * from datetest; k d -- --- 1 2005-03-17T16:21:30 sqlite> select strftime("%m", substr(d,1,10)||' '||substr(d,-8,8))

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
Sorry, I misunderstood the context. sqlite> select * from datetest; k d -- --- 1 2005-03-17T16:21:30 sqlite> select strftime("%m", substr(d,1,10)||' '||substr(d,-8,8)) ...> from datetest; strftime("%m",

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread David Wheeler
On Mar 17, 2005, at 2:21 PM, Matt Sergeant wrote: You can force the binding type in DBD::SQLite - see the DBI docs (grep for ":sql_types"). True, but in our application, that would require a lot more book-keeping than we'd like. Adding "+0" seems to do the cast we need to keep up with how

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread David Wheeler
On Mar 17, 2005, at 2:24 PM, Kurt Welgehausen wrote: Yes, I know it supports it without the "T" ... sqlite> select strftime("%Y-%m-%dT%H:%M:%S", 'now', 'localtime'); strftime("%Y-%m-%dT%H:%M:%S", 'now', 'localtime') - 2005-03-17T16:21:30 No: sqlite>

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
> Yes, I know it supports it without the "T" ... sqlite> select strftime("%Y-%m-%dT%H:%M:%S", 'now', 'localtime'); strftime("%Y-%m-%dT%H:%M:%S", 'now', 'localtime') - 2005-03-17T16:21:30

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Matt Sergeant
On 17 Mar 2005, at 15:13, David Wheeler wrote: Probably off-topic for a SQLite list :-) I'm not sure Perl will cast a non-numeric string ("2005-03-22T00:00:00") to a number. What number are you looking for? Actually the code that was cast was "substr(a, 6, 2)", which was evaluating to "03", and

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread David Wheeler
On Mar 17, 2005, at 1:23 PM, Kurt Welgehausen wrote: strftime doesn't support the ISO-8601 format ... I does if you give it the correct format string. Yes, I know it supports it without the "T", but ISO-8601 mandates the presence of the T. Regards, David

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
> strftime doesn't support the ISO-8601 format ... I does if you give it the correct format string. Regards

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread David Wheeler
On Mar 17, 2005, at 11:40 AM, Clark Christensen wrote: Probably off-topic for a SQLite list :-) I'm not sure Perl will cast a non-numeric string ("2005-03-22T00:00:00") to a number. What number are you looking for? Actually the code that was cast was "substr(a, 6, 2)", which was evaluating to

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Clark Christensen
--- David Wheeler <[EMAIL PROTECTED]> wrote: > Hi All, > > Given the below script (using DBD::SQLite 1.08, which > uses SQLite > 3.1.3), the output is just: > >+0 Cast: 2005-03-22T00:00:00 > > I'm wondering, however, if unary + shouldn't also be able > to cast an > expression to a

[sqlite] Should Unary + Cast to a Number?

2005-03-16 Thread David Wheeler
Hi All, Given the below script (using DBD::SQLite 1.08, which uses SQLite 3.1.3), the output is just: +0 Cast: 2005-03-22T00:00:00 I'm wondering, however, if unary + shouldn't also be able to cast an expression to a number...shouldn't it? Thanks, David #!/usr/bin/perl -w use strict; use DBI;