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
  #1  
Old   
Martin Bowes
 
Posts: n/a

Default [Info-Ingres] Perl DBI ...parameter placeholders - 07-01-2011 , 06:44 AM






Hi All,

OK, I'm a little bit thick I grant but...why isn't this working?

$sth = $dbh->prepare("execute procedure test_proc(a = ?)");

$a = 1;
$sth->execute($a);

In fact it dies at the prepare with: E_US09C4 Syntax error on line 1. Lastsymbol read was: 'execute'.

Martin Bowes

Reply With Quote
  #2  
Old   
Karl Schendel
 
Posts: n/a

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






On Jul 1, 2011, at 7:44 AM, Martin Bowes wrote:

Quote:
Hi All,

OK, I'm a little bit thick I grant but…why isn't this working?

$sth = $dbh->prepare("execute procedure test_proc(a = ?)");

$a = 1;
$sth->execute($a);

In fact it dies at the prepare with: E_US09C4 Syntax error on line 1. Last symbol read was: 'execute'.
You can't prepare an execute. I don't know if there is any deep dark
reason, or if it's just because execute isn't one of the statements
listed in the grammar for "prepare_stmt_list".

Karl

Reply With Quote
  #3  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 07-01-2011 , 07:14 AM



Which probably explains why prepare("...(a = 1)") also failed with this error.

Seems like I have to:
$stmt = "execute procedure test_proc(a = $a)";
$dbh->do($stmt);

Marty

-----Original Message-----
From: Karl Schendel [mailto:schendel (AT) kbcomputer (DOT) com]
Sent: 01 July 2011 13:02
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] Perl DBI ...parameter placeholders


On Jul 1, 2011, at 7:44 AM, Martin Bowes wrote:

Quote:
Hi All,

OK, I'm a little bit thick I grant but...why isn't this working?

$sth = $dbh->prepare("execute procedure test_proc(a = ?)");

$a = 1;
$sth->execute($a);

In fact it dies at the prepare with: E_US09C4 Syntax error on line 1. Last symbol read was: 'execute'.
You can't prepare an execute. I don't know if there is any deep dark
reason, or if it's just because execute isn't one of the statements
listed in the grammar for "prepare_stmt_list".

Karl




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

Reply With Quote
  #4  
Old   
nikosv
 
Posts: n/a

Default Re: Perl DBI ...parameter placeholders - 07-02-2011 , 06:57 AM



On Jul 1, 3:14*pm, Martin Bowes <martin.bo... (AT) ctsu (DOT) ox.ac.uk> wrote:
Quote:
Which probably explains why prepare("...(a = 1)") also failed with *this error.

Seems like I have to:
$stmt = "execute procedure test_proc(a = $a)";
$dbh->do($stmt);

Marty *

-----Original Message-----
From: Karl Schendel [mailto:schen... (AT) kbcomputer (DOT) com]
Sent: 01 July 2011 13:02
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] Perl DBI ...parameter placeholders

On Jul 1, 2011, at 7:44 AM, Martin Bowes wrote:

Hi All,

OK, I'm a little bit thick I grant but...why isn't this working?

$sth = $dbh->prepare("execute procedure test_proc(a = ?)");

$a = 1;
$sth->execute($a);

In fact it dies at the prepare with: E_US09C4 Syntax error on line 1. *Last symbol read was: 'execute'.

You can't prepare an execute. *I don't know if there is any deep dark
reason, or if it's just because execute isn't one of the statements
listed in the grammar for "prepare_stmt_list".

Karl

_______________________________________________
Info-Ingres mailing list
Info-Ing... (AT) kettleriverconsulting (DOT) comhttp://ext-cando.kettleriverconsulting.com/mailman/listinfo/info-ingres
Martin,
try the following :

my $sth = $dbh->prepare(q{
BEGIN
test_proc(?);
END;
});

$sth->bind_param( 1 );

$sth->execute ();

Reply With Quote
  #5  
Old   
nikosv
 
Posts: n/a

Default Re: Perl DBI ...parameter placeholders - 07-02-2011 , 07:03 AM



On Jul 1, 3:14*pm, Martin Bowes <martin.bo... (AT) ctsu (DOT) ox.ac.uk> wrote:
Quote:
Which probably explains why prepare("...(a = 1)") also failed with *this error.

Seems like I have to:
$stmt = "execute procedure test_proc(a = $a)";
$dbh->do($stmt);

Marty *

-----Original Message-----
From: Karl Schendel [mailto:schen... (AT) kbcomputer (DOT) com]
Sent: 01 July 2011 13:02
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] Perl DBI ...parameter placeholders

On Jul 1, 2011, at 7:44 AM, Martin Bowes wrote:

Hi All,

OK, I'm a little bit thick I grant but...why isn't this working?

$sth = $dbh->prepare("execute procedure test_proc(a = ?)");

$a = 1;
$sth->execute($a);

In fact it dies at the prepare with: E_US09C4 Syntax error on line 1. *Last symbol read was: 'execute'.

You can't prepare an execute. *I don't know if there is any deep dark
reason, or if it's just because execute isn't one of the statements
listed in the grammar for "prepare_stmt_list".

Karl

_______________________________________________
Info-Ingres mailing list
Info-Ing... (AT) kettleriverconsulting (DOT) comhttp://ext-cando.kettleriverconsulting.com/mailman/listinfo/info-ingres
Hi Martin,
try the following :

my $sth = $dbh->prepare(q{
BEGIN
test_proc(?);
END;
});

$sth->bind_param( 1 );

$sth->execute ();

Reply With Quote
  #6  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 07-04-2011 , 05:30 AM



Hi Niko,

Sorry but that doesn't work either. I get a syntax error on the BEGIN.

Marty

my $sth = $dbh->prepare(q{
BEGIN
test_proc(?);
END;
});

$sth->bind_param( 1 );

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

Reply With Quote
  #7  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 07-04-2011 , 06:34 AM



Quote:
OK, I'm a little bit thick I grant but...why isn't this working?

$sth = $dbh->prepare("execute procedure test_proc(a = ?)");

$a = 1;
$sth->execute($a);

In fact it dies at the prepare with: E_US09C4 Syntax error on line 1. *Last symbol read was: 'execute'.

You can't prepare an execute. *I don't know if there is any deep dark
reason, or if it's just because execute isn't one of the statements
listed in the grammar for "prepare_stmt_list".
Actually, if we can't prepare an execute then as a consequence, we can't get back parameters passed by reference.

It also appears that there is no means in DBI to get back a return value from a procedure.

Marty

Reply With Quote
  #8  
Old   
nikosv
 
Posts: n/a

Default Re: Perl DBI ...parameter placeholders - 07-04-2011 , 12:36 PM



On Jul 4, 2:34*pm, Martin Bowes <martin.bo... (AT) ctsu (DOT) ox.ac.uk> wrote:
Quote:
OK, I'm a little bit thick I grant but...why isn't this working?

$sth = $dbh->prepare("execute procedure test_proc(a = ?)");

$a = 1;
$sth->execute($a);

In fact it dies at the prepare with: E_US09C4 Syntax error on line 1.Last symbol read was: 'execute'.

You can't prepare an execute. I don't know if there is any deep dark
reason, or if it's just because execute isn't one of the statements
listed in the grammar for "prepare_stmt_list".

Actually, if we can't prepare an execute then as a consequence, we can't get back parameters passed by reference.

It also appears that there is no means in DBI to get back a return value from a procedure.

Marty
it works for Oracle...(wow where did that flying keyboard come from
lol
maybe it is not supported by DBD::Ingres. and here is the
confirmation :
http://search.cpan.org/~timb/dbd-sum...red_Procedures

maybe go for DBD::ODBC instead

Reply With Quote
  #9  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 07-05-2011 , 07:28 AM



Quote:
it works for Oracle...(wow where did that flying keyboard come from
lol
maybe it is not supported by DBD::Ingres. and here is the
confirmation :
http://search.cpan.org/~timb/dbd-sum...red_Procedures

maybe go for DBD::ODBC instead
I've also found that part of the manual dealing with dynamic SQL and there is a statement to the effect that 'execute procedure' can't be prepared. Although for the life of me other than programmatic complexity I can't think of why this should be so.

Marty

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

Default Re: [Info-Ingres] Perl DBI ...parameter placeholders - 09-22-2011 , 05:17 AM



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

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.