From: | David Wheeler <david(at)wheeler(dot)net> |
---|---|
To: | "Jeff Urlwin" <jurlwin(at)bellatlantic(dot)net> |
Cc: | <dbi-dev(at)perl(dot)org>, <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: :PgSQL: More Queestions |
Date: | 2002-11-22 00:11:11 |
Message-ID: | E7F00B44-FDAE-11D6-8943-0003931A964A@wheeler.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On Thursday, November 21, 2002, at 06:45 AM, Jeff Urlwin wrote:
>> It doesn't appear to handle "...""...", though, right? Or am I missing
>> it?
>
> Actually, it does, but completely "accidentally". DBD::ODBC is not
> concerned with the fact that there are " inside the ", so:
> the first quote sets in_literal=1 (true)
> the second quote sets in_literal=0 (false)
> the third puts us right back in_literal=1, so we can keep processing.
> Since there should be an even number of " marks, I think we're OK here.
>
> Seems too simple, but, it works. There may be a case that gets me,
> but I
> don't think so.
No, that makes a *lot* of sense. Allows it to be much more elegant than
when checking for "\"" and '\'' as escapes!
> You probably wouldn't have that prepared as one statement.
> Using, say, SQL Server, you can do something like (pseudo code here
> with
> some exaggeration, but I can actually provide test code that someone
> sent):
>
> sp_pain_to_deal_with(int i) as
>
> if (i == 1)
> select a, b, c from foo; /* returns a, b, c as result set */
> elseif (i == 2)
> delete from foo; /* returns a count, not a result set */
> else
> select d, a, b, f from foo; /* returns something completely
> different */
> end;
Aaah! Get away, get away!!! ;-)
> Or, the more "normal" case:
> $sth = $dbh->prepare("insert a, b, c into foo values (?, ?, ?); select
> @@identidy;");
> which, in one "shot" insert into the table and gets back the
> auto-incremented id for the table (again, there is probably a lot of
> syntax
> issue with the above, but the concept is there).
Hrm, yes. I'm not sure that that's an issue for PostgreSQL.
Regards,
David
--
David Wheeler AIM: dwTheory
david(at)wheeler(dot)net ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: Theory(at)jabber(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | David Wheeler | 2002-11-22 00:21:19 | Re: :PgSQL: More Queestions |
Previous Message | David Wheeler | 2002-11-21 23:38:43 | Re: DBD::PostgreSQL compile time /run time version |