Re: Perl DBI and placeheld values

Поиск
Список
Период
Сортировка
От Nigel J. Andrews
Тема Re: Perl DBI and placeheld values
Дата
Msg-id Pine.LNX.4.21.0301300107390.2839-100000@ponder.fairway2k.co.uk
обсуждение исходный текст
Ответ на Re: Perl DBI and placeheld values  ("Williams, Travis L, NPONS" <tlw@att.com>)
Список pgsql-general

Thanks for the response. Damn quick as well.

This is exactly what I was meaning about special casing and is the route I'd
finally decided I couldn't avoid.

I have tried to generalise it a bit hoping to be able to catch more expressions
by matching against:

   /cur|now|int|'/

and quoting if it fails. The 'catch-all' in this is probably the single
quote. If it's already got a quote in it then it's unlikely we should be adding
more all around the value. Obviously this is targeted at timestamp types and
will fail miserably should it ever be used to try and use with things like text
columns.


Nigel Andrews


On Wed, 29 Jan 2003, Williams, Travis L, NPONS wrote:

> I construct the ? into a variable before I ever call the prepare.  I go
> through an array and check for things like if the info is all numbers
> then I don't need qoutes.. but if it is numbers and :'s then you'll need
> quotes.. in you situation I would specifically look for
> current_timestamp and make sure it doesn't have quotes.
>
> Travis
>
> -----Original Message-----
> From: Nigel J. Andrews [mailto:nandrews@investsystems.co.uk]
>
> ...
>
> First off this is not really postgresql specific but it is driving me
> nuts.
>
>..
>
> Anyway, back on to the subject. I'm a little stuck and I'm wondering how
> people
> handle the situation where a variable can contain a value _or_ a
> function
> call. For example:
>
> psql> create table mytab ( thetime timestamptz );
>
> perl:
>     $sth = $dbh->prepare('insert into mytab values ( ? )');
>     $sth->execute($thetime);
>
> where $thetime could hold 2003-01-29 13:45:06+00 _or_ current_timestamp.
>
> ...
>
> So just how do others manage this situation without resorting to special
> casing
> everything?


В списке pgsql-general по дате отправления:

Предыдущее
От: "Glen Parker"
Дата:
Сообщение: Re: Dropping column silently kills multi-coumn index (was [ODBC] Error when accessing tables with deleted columns)
Следующее
От: steve
Дата:
Сообщение: Re: unsubscribe