in reply to Re: Re: DBD::SQLite
in thread Error querying DBD::SQLite

From the MySQL Manual - 14.1.7 SELECT Syntax:

From MySQL 4.1.0 on, you are allowed to specify DUAL as a dummy table name in situations where no tables are referenced:
mysql> SELECT 1 + 1 FROM DUAL; -> 2
DUAL is purely a compatibility feature. Some other servers require this syntax.

Update: If DBD::SQLite does not support this yet, the author might want to consider adding support soon.

Replies are listed 'Best First'.
Re: Re: Re: Re: DBD::SQLite
by castaway (Parson) on Apr 13, 2004 at 08:35 UTC
    I dont really see why SQLite should implement some arbitrary functionality just because people are used to it in some other databases. Especially as 1) its not in the standard, and 2) other databases do it differently (eg DB2 - 'VALUES(1+1)' gives the expected result there). Getting SQLite to implement it is like .. umm.. praising browsers for inventing their own tags etc.

    Also I dont really see the need for it, since you can select an expression from any known table to get that result.

    An expression function in DBI, which uses whatever each DBD locally implements, might be useful. But then, why bother, as if you're using DBI/Perl anyway, you can already do expressions.

    C.

Re: Re: Re: Re: DBD::SQLite
by liz (Monsignor) on Apr 13, 2004 at 07:53 UTC
    And before version 4.1.0, it's also legal in MySQL to simply do:
    SELECT 1+1;

    Liz

Re: Re: Re: Re: DBD::SQLite
by davido (Cardinal) on Apr 13, 2004 at 05:08 UTC
    The dummy table DUAL usage makes sense to me. But I was diving heavily into the docs for DBD::SQLite and SQLite the database yesterday and never saw mention of DUAL. Just to be sure before posting this followup I double-checked the SQLite documentation using a word search for /\bdual\b/i and didn't find any use of that word in SQLite's documentation, at least in the context of a dummy table.

    Nevertheless, I'm glad to have learned something new that I can apply to other DB implementations. And to your point, perhaps 'soon' the SQLite author will decide to implement the feature. :)


    Dave