Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Some minor notes and corrections. First, hopefully the most important thing to learn from this thread is to always use placeholders. It just saves you so much pain and trouble. :) Louis Gonzales asked: > Two, you didn't actually put ( $1, $2, ...

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> Vielen Glueck mit ihren Aufgabe an der Uni. > > -Will > 8O Who else speaks german on this list ;-) This is really funny. :-) And this is my university [url]http://fh-web1.informatik.fh-wiesbaden.de/go.cfm/fb/6/sprachid/2/lpid/0/sid/0.html[/url] Other question, has anybody experences with PL

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Rutherdale, Will
Vielen Glueck mit ihren Aufgabe an der Uni. -Will -Original Message- From: Christian Stalp [mailto:[EMAIL PROTECTED] Sent: Thursday 23 February 2006 18:24 To: Rutherdale, Will Cc: dbi-users@perl.org Subject: RE: Calling a PostgreSQL function via DBI > I'm glad it worked. > > However

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> I'm glad it worked. > > However I'm still concerned with why you need the nonportable form of > ??::text etc. > > Is this because you are running a user defined function which has no > schema associated with it the way a regular table or view would? > > Is there some way to make it more porta

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Ronald J Kimball
Christian Stalp [mailto:[EMAIL PROTECTED] wrote: > > > > my $sth = $dbh->prepare(<<"EndOfSQL"); > > SELECT neue_auktion ( ?, ?::text, ?::text, > > ?::timestamp, ?::timestamp, > > ?, ?, ? ) > > EndOfSQL > > > > $sth->execute($cookieValue, $uebersch

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Rutherdale, Will
I'm glad it worked. However I'm still concerned with why you need the nonportable form of ??::text etc. Is this because you are running a user defined function which has no schema associated with it the way a regular table or view would? Is there some way to make it more portable, i.e. not nee

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> > my $sth = $dbh->prepare(<<"EndOfSQL"); > SELECT neue_auktion ( ?, ?::text, ?::text, > ?::timestamp, ?::timestamp, > ?, ?, ? ) > EndOfSQL > > $sth->execute($cookieValue, $ueberschrift, $beschreibung, > $system_zeit, "2001-11-11 1

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Louis Gonzales
Christian Stalp wrote: That the way: $arg1 = $cookieValue; $arg2 = $dbh->quote ( $ueberschrift ); $arg3 = $dbh->quote ( $beschreibung ); $arg4 = $system_zeit; $arg5 = "2001-11-11 11:11:11"; $arg6 = $startpreis; $arg7 = $startpreis; $arg8 = $kategorie_nummer; $result = $dbh->prepare ( "SELECT ne

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
That the way: $arg1 = $cookieValue; $arg2 = $dbh->quote ( $ueberschrift ); $arg3 = $dbh->quote ( $beschreibung ); $arg4 = $system_zeit; $arg5 = "2001-11-11 11:11:11"; $arg6 = $startpreis; $arg7 = $startpreis; $arg8 = $kategorie_nummer; $result = $dbh->prepare ( "SELECT neue_auktion ( ?, ?::text, ?

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Ronald J Kimball
Christian Stalp [mailto:[EMAIL PROTECTED] wrote: > > See if this works: > > > > my $sth = $dbh->prepare(<<"EndOfSQL"); > > SELECT neue_auktion ( ?, ?::text, ?::text, > > ?::timestamp, ?::timestamp, > > ?, ?, ? ) > > EndOfSQL > > > > $sth->execute($c

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Louis Gonzales
Christian, On looking at your output once more, if you're trying to insert a string, "2001-11-11 11:11:11::timestamp" into a TIMESTAMP datatype, this won't work. That's why it's complaining about a typecast... this at least makes logical sense to me. You'd have to change the datatype to accept

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> See if this works: > > my $sth = $dbh->prepare(<<"EndOfSQL"); > SELECT neue_auktion ( ?, ?::text, ?::text, > ?::timestamp, ?::timestamp, > ?, ?, ? ) > EndOfSQL > > $sth->execute($cookieValue, $ueberschrift, $beschreibung, > $syste

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Louis Gonzales
Christian Stalp wrote: Bitte kannst du das probieren fuer spass? ( English: Could you just try this for fun :) $arg5 = "\'2001-11-11 11:11:11\'" . "::timestamp"; Was werde denn passiert? (what would happen then? ) The same effect, this is the dump on the website: Software error: [

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> Bitte kannst du das probieren fuer spass? ( English: Could you just > try this for fun :) > > $arg5 = "\'2001-11-11 11:11:11\'" . "::timestamp"; > > Was werde denn passiert? (what would happen then? ) The same effect, this is the dump on the website: Software error: [quote] Abfrage nich

RE: Slow Performance When Using DBI, otherwise Not

2006-02-23 Thread Reidy, Ron
Rhugga, I have never seen this before. What happens if you step through this with the debugger? Are there logon triggers firing for the user during connect? Is your DB using dedicated connections, or MTS? Also, I assume your shell script is connecting to the same DB, over the same network, u

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Rutherdale, Will
In that case $dbh->quote() is considered the portable way of inserting quote marks, in that the underlying db driver, which is hidden from your code, determines in what form those quote marks will be constructed, so as to be compatible with your particular database. If you try 'man DBI' or read

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Ronald J Kimball
Christian Stalp [mailto:[EMAIL PROTECTED] wrote: > yes i seems to be so. I tried it with differnt versions. > Now this is where I stand: > $arg1 = $cookieValue; > $arg2 = $dbh->quote ( $ueberschrift ) . "::text"; > $arg3 = $dbh->quote ( $beschreibung ) . "::text"; > $arg4 = $dbh->quote ( $system_z

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> Ja Christian, > Ich verstehe ein bischen Deutsch, besonders "startzeit" :) Ich habe ein > buch ueber des Lebens Albert Schweizer gelesen, so ich kann 'basic' > Duetsch verstehen. Wow, not bad. And you learned it just with this one book? > > From one of the earlier emails I saw, your variab

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Louis Gonzales
Thank you Will, I'll opt for discontinuing this discussion with you. I apologize to the dbi-user community in general. Sincerely,

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> Based on what you have here, this will bind all of the "arg" variables > with the respective 'positional' "?"s I'd even venture to say, you can > put a little loop on a single bind_param( $i, $arg$i ); where your: > i = index counter # haven't tried that yet, but think it would work.

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Rutherdale, Will
Louis, Perhaps you could attempt to explain, politely this time, what you meant by the following. > As for your select statement with the $arg1, ..., $argN, the bind_param() function will work > on those arguments too, I'd just suggest to use the process of double quoting your string > concaten

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> Halo Christian, > $sqls is the object returned by the prepare() method, as in: > > my $sqls = $dbh->prepare( "insert into table $table ( userNumber, > lastName) values ( ?, ?)" ); > > $sqls->bind_param(1, $user_nummer); > $sqls->bind_param(2, $nachname); > > but, if i understand your last me

Re: Slow Performance When Using DBI, otherwise Not

2006-02-23 Thread Rhugga Harper
I added some debug output and have determined that the latency occurs here, during the call to connect: print "DEBUG 1\n"; my $dbh = DBI->connect($ds, $dbuser, $dbpass); if (!defined($dbh)) { print "Error: main(): database connection failed: $DBI::errstr\n"; cleanup(); exit

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
ah I see, in my case is it $result: $result = $dbh->prepare ( "SELECT neue_auktion ( ?, ?, ?, ?, ?, ?, ?, ? ) " ) or die "Vorbereitung nicht durchfuehrbar!\n"; $result->bind_param ( 1, $arg1 ); $result->bind_param ( 2, $arg2 ); $result->bind_param ( 3, $arg3 ); $result->bind_param ( 4, $arg4 ); $re

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> > > Christian, > As an example, I'd do the following: > > $arg1 = "$cookieValue" . "::numeric"; > ... > > $result = $dbh->prepare ( "insert into kunden ( kid, nachname, ..., ) > values ( ?, ?, ... )" ); > > $sqls->bind_param(1, $user_nummer); > $sqls->bind_param(2, $nachname); > ... > > $sq

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Louis Gonzales
Below in RED, is the post that I addressed with my initial comments, nowhere in there is there anything about "CREATE"'ing any fuctions whatsoever. Below in BLUE, is what was just put out by Christian, can somebody point out to me where the "new" issue of creating fuctions came into play? And

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Rutherdale, Will
This gets back to the point of my earlier posting. Louis's suggestion of using bind_param() is probably correct and the preferred way of doing things. However, his alternative solution with, for instance, $arg4 = "$system_zeit" . "::timestamp"; does not work, because putting quotes around th

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
> Christian, > As an example, I'd do the following: > > $arg1 = "$cookieValue" . "::numeric"; > ... > > $result = $dbh->prepare ( "insert into kunden ( kid, nachname, ..., ) > values ( ?, ?, ... )" ); > > $sqls->bind_param(1, $user_nummer); > $sqls->bind_param(2, $nachname); > ... > > $sqls->

RE: Slow Performance When Using DBI, otherwise Not

2006-02-23 Thread Reidy, Ron
The prepare statement in DBI will prepare and then execute the statement. This is, essentially tow PARSE calls against the dictionary cache. Look at using ora_check_sql (http://search.cpan.org/~timb/DBD-Oracle-1.16/Oracle.pm#Prepare_postpone d_till_execute) to eliminate this issue. If the proble

Using Kerberos enabled connections with Sybase

2006-02-23 Thread Chuck Fox
Hello fellow dbi-users. I am attempting to connect to a 12.5 Sybase server using kerberos enabled connections. My isql and sqsh both correctly connect (sqsh needed a small fix to load the security ). However, I am unable to get DBD::Sybase to load the security modules. Here are the details

Slow Performance When Using DBI, otherwise Not

2006-02-23 Thread Rhugga Harper
I have a Solaris 8 host running perl 5.8 and using DBI version 1.50 and DBD::Oracle version 1.16. The database is Oracle 10.2.0.1 and runs on a different host. If I run this query from a shell script, it completes in under 1 second, however, using a perl script it takes 5-10 seconds. Here is the

RE: Make database handle persist in CGI/DBI application?

2006-02-23 Thread Tantalo, Christopher G
I have run into this myself. The scope of dbh doesn't exist in your sub function. I make the my $dbh declaration to an our $dbh. This seems to do the trick for me. Chris --- Just Your Friendly Neighborhood _SPIDEY_ > -Original Message- > Fr

Re: Make database handle persist in CGI/DBI application?

2006-02-23 Thread Alexander Foken
Your CGI is called for each request and then terminated. There is no way to make the DBI handle persistant. (And by the way, if hiding the handle in a hidden field would work, you would create a security hole large enough for a 747.) You need a permanently running server for a persistant handl

Re: Make database handle persist in CGI/DBI application?

2006-02-23 Thread Tom Schindl
Normally you connect like this: -8<- use DBI; my $dbh = DBI->connect($connectionString, $login, $password); &foo($dbh); sub foo { my $dbh = shift; my $sth = $dbh->prepare($cmd); } -8<- Did you thought about using mod_perl there Apache::AuthDBI

Re: Make database handle persist in CGI/DBI application?

2006-02-23 Thread Tyler MacDonald
Mary Anderson <[EMAIL PROTECTED]> wrote: > I have tried passing the handle in as a ref parameter, using $dbhRef = /*dbh > (maybe this one was done incorrectly) and tried passing a $dbhRef as a > value on a hidden textfield. None of these work. I tend to get > "not an array" when I try to do $$d

Make database handle persist in CGI/DBI application?

2006-02-23 Thread Mary Anderson
Hi all, I am writing a Web app in perl/cgi/dbi which (1) attempts to verify logins by checking against database user passwords, and (2) follows good dbi practices by logging the user in once at the beginning of the session instead of logging in immediately prior to accessing the database.

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Louis Gonzales
Rutherdale, Will wrote: Louis, I'm sure the construct you give below has no effect in Perl. "$someVariable" is identical to $someVariable. Perhaps what you meant was $arg1 = $dbh->quote( $someVariable ) . "::someText"; -Will -Original Message- From: Louis Gonzales [mailto:[EMAIL PROT

RE: Calling a PostgreSQL function via DBI

2006-02-23 Thread Rutherdale, Will
Louis, I'm sure the construct you give below has no effect in Perl. "$someVariable" is identical to $someVariable. Perhaps what you meant was $arg1 = $dbh->quote( $someVariable ) . "::someText"; -Will -Original Message- From: Louis Gonzales [mailto:[EMAIL PROTECTED] Sent: Thursday 23 F

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Louis Gonzales
Christian Stalp wrote: Back to the problem with my plpgsql-procedures. I have another problem with another procedure, with even more aguments: $arg1 = $cookieValue . "::numeric"; $arg2 = $ueberschrift . "::text"; $arg3 = $beschreibung . "::text"; $arg4 = $system_zeit . "::timestamp"; $arg5 = "2

Re: Calling a PostgreSQL function via DBI

2006-02-23 Thread Christian Stalp
Back to the problem with my plpgsql-procedures. I have another problem with another procedure, with even more aguments: $arg1 = $cookieValue . "::numeric"; $arg2 = $ueberschrift . "::text"; $arg3 = $beschreibung . "::text"; $arg4 = $system_zeit . "::timestamp"; $arg5 = "2001-11-11 11:11:11" . "::t