Re: DBD::SQL::Nano ORDER BY statements ending in ";"?

Charles Jardine <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On 13/12/13 12:06, Mark Lawrence wrote:
> I'm getting the the following error using DBI::SQL::Nano:
>
>      DBD::DBM::db prepare failed: Bad ORDER BY clause ';'
>          at /home/wose/.cpan/build/DBI-1.630-ZpcutD/blib/
>          lib/DBI/DBD/SqlEngine.pm line 333.
>
> for the following statement:
>
>      SELECT
>          name, phone
>      FROM
>          users
>      ORDER BY
>          name
>      ;
>
> As I understand the Nano docs the ORDER BY statement is actually ok,
> but the error isn't.
>
> If I remove the ORDER BY I get
>
>      Couldn't find WHERE clause in '
>      ;'
>
> For:
>
>      SELECT
>          name, phone
>      FROM
>          users
>      ;
>
> So it looks to be a general issue with a trailing ";". Am I reading
> this right?

See the last paragraph of the following subsection of the DBI
documentation:

  http://search.cpan.org/~timb/DBI/DBI.pm#prepare

It says:

> Some command-line SQL tools use statement terminators, like a
> semicolon, to indicate the end of a statement. Such terminators
> should not normally be used with the DBI.

-- 
Charles Jardine - Computing Service, University of Cambridge
[email protected]    Tel: +44 1223 334506, Fax: +44 1223 334679
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.