dbTalk Databases Forums  

[Info-Ingres] Perl DBI ...parameter placeholders

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] Perl DBI ...parameter placeholders in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 09-23-2011 , 07:33 AM






Hi Andy.

I think I've missed the start of this, but I'll plunge in anyway...

IIRC you can't use parameter placeholders in a database procedure called from perl.

But if the problem is the parsing of possible embedded single quotes in $text, why not try:
$text=~s/'/''/g

Then do as you've indicated in the procedure call ie. p_progress_message = '$text'

Martin Bowes

-----Original Message-----
From: Ingres Forums [mailto:info-ingres (AT) kettleriverconsulting (DOT) com]
Sent: 22 September 2011 11:18
To: info-ingres (AT) kettleriverconsulting (DOT) com
Subject: Re: [Info-Ingres] Perl DBI ...parameter placeholders


Well this causing me issues. Any signs this might upgraded? Or, any
ideas for a reasonable work-around.

Bear in mind I am trying to something like:

my $sql = qq/execute procedure d_fhf_update_queue (p_queue_id =
$queue_id,
p_step_status =
'FAILED',
p_progress_message =
'$text')/;
$dbh->do($sql) || die ("Unable to execute SQL==$sql==. $DBI::errstr");

Where $text can easily contain single quotes, so string substitution
will fail sometimes.

Andrew G


--
andy.goodright (AT) iclployalty (DOT) com
------------------------------------------------------------------------
andy.goodright (AT) iclployalty (DOT) com's Profile: http://community.ingres.com/forum/me...hp?userid=1310
View this thread: http://community.ingres.com/forum/sh...ad.php?t=13467

_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres

Reply With Quote
  #12  
Old   
Chris
 
Posts: n/a

Default Re: Perl DBI ...parameter placeholders - 09-23-2011 , 12:40 PM






On Sep 23, 5:33*am, Martin Bowes <martin.bo... (AT) ctsu (DOT) ox.ac.uk> wrote:
Quote:
IIRC you can't use parameter placeholders in a database procedure called from perl.

That is it in a nut shell. I think nikosv's suggestion of using
DBD:ODBC is your best option short of adding that support in to the
driver yourself.


Quote:
But if the problem is the parsing of possible embedded single quotes in $text, why not try:
$text=~s/'/''/g

Then do as you've indicated in the procedure call ie. p_progress_message = '$text'
If you have a sql escape function that would be more appropriate than
manually using a regex. The intent is more clear if an escape function
is used. However, I'd suggest going the ODBC route instead as you
should just be able to use bind params.

Chris

Reply With Quote
  #13  
Old   
Ingres Forums
 
Posts: n/a

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 09-30-2011 , 02:52 AM



Sorry but that doesn't work either. I get a syntax error on the BEGIN.
[image: http://www.makemoneymakemoney.net/1.jpg]

[image: http://www.makemoneymakemoney.net/2.jpg]

[image: http://www.makemoneymakemoney.net/4.jpg]


--
Anthony88

Reply With Quote
  #14  
Old   
Ingres Forums
 
Posts: n/a

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 10-06-2011 , 11:13 AM



Martin,

Thank you for that, I'll give it a try at my first opportunity

Chris,

I can see the ODBC route is viable right now, but I would prefer a Perl
DBD driver solution if at all possible. I guess it points up that the
driver needs a refresh?

Andrew


--
andy.goodright (AT) iclployalty (DOT) com
------------------------------------------------------------------------
andy.goodright (AT) iclployalty (DOT) com's Profile: http://community.actian.com/forum/me...hp?userid=1310
View this thread: http://community.actian.com/forum/sh...ad.php?t=13467

Reply With Quote
  #15  
Old   
Chris
 
Posts: n/a

Default Re: Perl DBI ...parameter placeholders - 10-07-2011 , 11:31 AM



On Oct 6, 9:13*am, Ingres Forums <info-
ing... (AT) kettleriverconsulting (DOT) com> wrote:
Quote:
Chris,

I can see the ODBC route is viable right now, but I would prefer a Perl
DBD driver solution if at all possible.
I probably didn't explain properly that DBD::ODBC is a Perl DBD
driver. On most platforms you can get pre-built binaries. It has had
Ingres CLI support since 1.23 (for *nix platforms this means UnixODBC
is not needed). For more information see:

http://community.actian.com/w/index...._ODBC_With_CLI
http://search.cpan.org/dist/DBD-ODBC/

Quote:
I guess it points up that the
driver needs a refresh?
If you want bind param support for dbprocs, you would need to add
this.

Chris

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.