RE: Memoizing non-place-holding sql statements to place-holding
- From: h-taguchi@xxxxxxxxxxx
- Date: Tue, 23 Aug 2005 10:49:21 +0900
> >>> my @new_values = ();
> >>> my @place_holders =
> >>> map {
> >>> if (/^CURRENT TIMESTAMP$/) {
> >>> $_;
> >>> } else {
> >>> push @new_values => $_;
> >>> "?";
> >>> }
> >>> } @args
> >>> ;
> >>
> >
> >SQL::Statement can do this?
> >
> Yes. The snippet I sent before will automatically turn #1 into #2.
>
> #1 INSERT INTO MyTbl (col1,CURRENT_TIMESTAMP,col2)
> VALUES (7,'o''brian') };
>
> #2 INSERT INTO MYTBL (COL1,CURRENT_TIMESTAMP,COL2)
> VALUES (?,?)
>
> And return (7,q{o'brian}) as @vals.
I'm dealing with:
INSERT INTO MyTbl (col1,record_ts,col2)
VALUES (7,CURRENT TIMESTAMP,'o''brian') };
SQL ERROR: 'CURRENT TIMESTAMP' is not a valid value or is not quoted!
"CURRENT TIMESTAMP" is a keyword used by DB2.
Regards,
Hirosi Taguti
h-taguchi@xxxxxxxxxxx
.
- Follow-Ups:
- Re: Memoizing non-place-holding sql statements to place-holding
- From: Jeff Zucker
- Re: Memoizing non-place-holding sql statements to place-holding
- Prev by Date: Re: Memoizing non-place-holding sql statements to place-holding
- Next by Date: Re: Memoizing non-place-holding sql statements to place-holding
- Previous by thread: Re: Memoizing non-place-holding sql statements to place-holding
- Next by thread: Re: Memoizing non-place-holding sql statements to place-holding
- Index(es):