in reply to Re: DBD::Sybase prepare statement returns empty query hash but no errstr
in thread DBD::Sybase prepare statement returns empty query hash but no errstr

I use a similar syntax for lining up my source code:

my $st = $dbh->prepare (q[SELECT foo, bar, baz FROM whatever] .q[ WHERE foo = xyz AND bar IS NOT NULL AND ...]);
  • Comment on Re^2: DBD::Sybase prepare statement returns empty query hash but no errstr
  • Download Code

Replies are listed 'Best First'.
Re^3: DBD::Sybase prepare statement returns empty query hash but no errstr
by Jenda (Abbot) on Oct 31, 2019 at 12:23 UTC

    The thing is there's no need to close and reopen the string literal. You are working too hard and if you then need to copy&paste the SQL elsewhere you have to work again.

    my $st = $dbh->prepare(q[ SELECT foo, bar, baz FROM whatever WHERE foo = xyz AND bar IS NOT NULL AND ... ]);

    Jenda
    1984 was supposed to be a warning,
    not a manual!

      You do have to close and reopen the literal if you want Emacs to indent your code properly. Emacs indentation commands will not change multi-line string constants.

        The decision is yours. I'd rather have to eventually (un)indent a bit of SQL manually after some refactoring, than to have to add lots of cruft after pasting the SQL into the code and remove the cruft again when copying the SQL somewhere. With syntax highlighting it's going to stand out enough even if not indented properly.

        Jenda
        1984 was supposed to be a warning,
        not a manual!