RE: RE: In Need of a Miracle...WAS:Re: Pg Connection WOES on DEAD LINE!

Well I got this from your code...

$sqld="?"; 
$sthd=$dbhd->prepare($sqld);

So evidentally you were doing something wrong that you didn't mean.

Also you might want to read the docs on finish() which in your case you do
not need.

Ilya Sterin

-----Original Message-----
From: michaelw@staff.familyconnect.com
To: Sterin, Ilya; dbi-users@perl.org
Sent: 05/31/2001 9:55 PM
Subject: Re: RE: In Need of a Miracle...WAS:Re: Pg Connection WOES on
DEADLINE!

Thanks, but no...I have read the PLACE HOLDER DOCS...and I AM NOT USING
A
PLACE HOLDER in the portion that FAILS, the only place that uses a PLACE
HOLDER works just fine (which is inserting the sql statement into
another
database)..(See code below:) I am using a DO statement in a manner,
which
according to the documentation of DO is equivalent to saying:

for $urow (@updates) {
$presql=$urow->[1];
$sql=qq{$presql};
$sth=$dbh->prepare($sql);
sth->execute;
dbh->commit;
}

Which is code I have tried with the exact same results. If, on the other
hand, I do what you are suggesting that I am doing:

$sql=qq{?};
$sth=$dbh->prepare($sql);
sth->execute($urow->[1]);
dbh->commit;

Then the process dies, and does not report success....but rather gives
an
invalid method error.   

In theory, if I have $foo="fig", and $bar=$foo, when I access $bar I
should
get "fig", which is what APPEARS to happen at the program level and at
the
proxy level...(i.e. I can see the requests go across the proxy..) but
they
never appear to make it to the database.....So it's more like I just get
$scalar0x000EF (or some other such rot...) which should generate an
error
since sending data by itself generates an error about an improperly
formatted SQL statement.

Whilst I am successfully using the placeholders to insert the actual SQL
statements into another database, that is supposed to just be a
log....actually executing them is what I need to occur...Currently they
are
stored as one string in the database...if an insert occurs, into the
synctable it goes, if a delete occurs, it goes into the table,, if an
UPDATE occurs, a DELETE, then an UPDATE goes into the table.

What's the difference between saying:
$sql=qq{INSERT INTO sometable VALUES('data','data','data');
and:
$presql="INSERT INTO sometable VALUES('data','data','data');";
$sql=qq{$presql};

Which is in effect what I am doing. In theory both $sql statements
should
be seen the same by the prepare portion of the statement....



----- Original Message -----
From: Sterin, Ilya <Isterin@ciber.com>
Sent: Thursday, May 31, 2001 8:19:30 PM
To: Michael Wray <michaelw@staff.familyconnect.com>;
<dbi-users@perl.org>
Subject: RE: In Need of a Miracle...WAS:Re: Pg Connection WOES on
DEADLINE!

> Pleeaassee read the placeholders docs.  You can't use a place holder
in
> place of the whole query.  Placeholder are used for values, for
example...
> 
> "insert into table_1 values (?, 1, ?)"
> "select foo1, foo2 from bar where col1 = ?"
> etc....
> 
> Place holders can't even be used to substitute table nor column names.
> 
> perldoc DBI and perldoc DBD::Pg are your friends.
> 
> Ilya Sterin
> 
> -----Original Message-----
> From: Michael Wray [mailto:michaelw@staff.familyconnect.com]
> Sent: Thursday, May 31, 2001 7:58 PM
> To: dbi-users@perl.org
> Subject: In Need of a Miracle...WAS:Re: Pg Connection WOES on
DEADLINE!
> 
> 
> Thanks to all the responses!  Rerecording the SQL statements into the
> syncmaster is now working....HOWEVER,  Executing them is not....the
original
> SQL statements are coming from an MSSQL Servers Sync table (which is
where
> @updates comes from...)
> 
> Here's what I am doing now:
> 
>    #Prepare SQL Statement for Updateing SYNCMASTERS LIST And
Destination
> Dbase
> 
>   $sql="INSERT INTO syncrecords  VALUES(?,?)";
>   $sth=$dbh->prepare($sql);
>   $sqld="?";
>   $sthd=$dbhd->prepare($sqld);
>   #### UPDATE SYNCMASTER And Destination######
>   for my $urow(@updates) {
> #  print "INSERT INTO syncrecords  VALUES ($urow->[0],$urow->[1])\n";
>   $sth->execute($urow->[0],$urow->[1]);
>   $dbh->commit;
>   $success=$dbhd->do ("$urow->[1]");
>   print "\$success=$success\n";
>   print "DEBUG:\n CODE: do
(\"\$urow->[1]\");\ngenerates:\n$urow->[1]\n
BUT
> does ABSOSMURFLY NOTHING!\n";
>   $dbhd->commit;
> 
>   }	 #End of FOR for updating SYNCMASTER/UPDATES
> 
> 
> 
>   $dbhd->commit;
>   print"finished\n\n";
>   #$sthd->finish();
>   $dbhd->disconnect();
>     } # end of Inner For Loop
>   $sths->finish();
>   $dbhs->disconnect();
>   }
> 
>   $dbhs->disconnect();
>   $sth->finish();
>   $dbh->disconnect();
> 
> 
> 
> The problem now being that while $success equals 1 (or true I presume)
no
> errors are reported and no data ends up in the table. In looking at
the
docs
> for ERROR trapping, I have yet to figure out how to trace what's
actually
> happening at this level, just on the CONNECTION level have I figured
that
> out,
> or by watching the Proxy Server in debug mode, which also indicates
success
> on
> these statements.
> I suspect my problem lies in the fact that I'm actually giving the
WHOLE
SQL
> statement as a variable, which cannot be helped in this case, I cannot
think
> of
> a way around this issue....especially since an UPDATE is a DELETE
followed
> by
> an INSERT and assumptions are that table and fieldnames are all
> lowercase..which they are...so I can do a blind replica....
>   I have tried isolating one insert statement and issuing it in a
similar
> fashion with the same results, here is the output of program:
> 
> $success=1
> DEBUG:
>  CODE: do ("$urow->[1]");
> generates:
> insert into synctest1 values(49,'test3',20,'1998-05-20 00:00:00','1')
>  BUT does ABSOSMURFLY NOTHING!
> $success=1
> DEBUG:
>  CODE: do ("$urow->[1]");
> generates:
> delete from synctest1 where synctestid = 49
>  BUT does ABSOSMURFLY NOTHING!
> $success=1
> DEBUG:
>  CODE: do ("$urow->[1]");
> generates:
> insert into synctest1 values (49,'test3',20,'1998-05-20 00:00:00','0')
>  BUT does ABSOSMURFLY NOTHING!
> $success=1
> DEBUG:
>  CODE: do ("$urow->[1]");
> generates:
> delete from synctest1 where synctestid = 49
>  BUT does ABSOSMURFLY NOTHING!
> $success=1
> DEBUG:
>  CODE: do ("$urow->[1]");
> generates:
> insert into synctest1 values(49,'test3',20,'1998-05-20 00:00:00','1')
>  BUT does ABSOSMURFLY NOTHING!
> finished
> 
> --
> Michael Wray
> Network Administrator
> FamilyConnect, Inc.
0
Isterin
6/1/2001 2:50:42 PM
perl.dbi.users 11099 articles. 1 followers. Follow

0 Replies
547 Views

Similar Articles

[PageSpeed] 9

Reply:

Similar Artilces:

Re: RE: In Need of a Miracle...WAS:Re: Pg Connection WOES on DEADLINE!
Thanks, but no...I have read the PLACE HOLDER DOCS...and I AM NOT USING A PLACE HOLDER in the portion that FAILS, the only place that uses a PLACE HOLDER works just fine (which is inserting the sql statement into another database)..(See code below:) I am using a DO statement in a manner, which according to the documentation of DO is equivalent to saying: for $urow (@updates) { $presql=$urow->[1]; $sql=qq{$presql}; $sth=$dbh->prepare($sql); sth->execute; dbh->commit; } Which is code I have tried with the exact same results. If, on the other hand, I do what you are s...

Re: In Need of a Miracle...WAS:Re: Pg Connection WOES on DEADLINE!
I hate to tell you this, but in the code snippet below, you ARE using a placeholder for the whole query. The following two lines should probably be deleted, as they do nothing helpful: $sqld="?"; $sthd=$dbhd->prepare($sqld); 'do' statements don't need to be prepared.The $dbhd->do should have its double quotes removed, for reasons others have pointed out. Also, 'do' returns the number of rows affected, not just pass/fail, so what you have in $success is the number of rows that DBI thinks were inserted. Have you tried connecting to the targe...

RE: Re: [wxperl-users] Re: Re: EVT_QUERY_END_SESSION
you putted the EVT_CLOSE to the wrong place... or do you have a reason why you need it to be there? $app ist not the window, but you could use EVT_CLOSE on $frame too. i changed your minimal sample that it works. hope it helps greeting Marco ---- use Wx; ########################### package MyApp; use strict; use vars qw(@ISA); @ISA=qw(Wx::App); sub OnInit { my( $this ) = @_; my( $frame ) = MyFrame->new( "Minimal wxPerl app", Wx::Point->new( 50, 50 ), Wx::Size->new( 450, 350 ) ); ...

Thanks. Working! Re: Re: RE: RE: DBI->Connect returning UNDEF in cgi but not in standalone prog
--Next_1111523273---0-202.54.124.151-25290 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Guys,=0AIts working. Thanks all.=0Aspecial thanks to Reidy Ron and Bill Cos= ta.=0A=0AThe suggestion Ron gave was absolutely correct. There were a whole= lot of env variables different/missing between the 2 environments.=0A=0ATh= e one which finally made it work was=0A$ENV{'TNS_ADMIN'} =3D '/var/opt/orac= le/network/admin';=0A=0AThanks again,=0ASunil=0A =A0=0A=0A=0AOn Wed, 23 Mar= 2005 Sunil A.V. wrote :=0...

RE : RE : RE : RE : Regular expressions
Here is a sample of what your piece of code returns on my Aix box. 44520 -> /prog/gena/8.1.1/bin/dispatch 44650 -> reproject 45176 -> aioserver 45432 -> aioserver 45724 -> -ksh 46002 -> /bin/bsh 46232 -> /usr/dt/bin/dtterm 46584 -> /usr/bin/ksh 46820 -> /usr/dt/bin/ttsession 47060 -> /bin/bsh 47304 -> /usr/dt/bin/dtlogin 47396 -> /usr/dt/bin/dtterm 47722 -> dtfile 47942 -> /usr/dt/bin/dtsession 48272 -> dtfile 48568 -> ora_cjq0_gist 48758 -> gxtrackd 49032 -> dtwm 49330 -> /usr/lib/lpd/pio/etc/piohpnpf 49592 -> b...

RE: RE: RE: RE: [wxperl-users] wxTreeCtrl, edit an treeItem
>>Found a fix ( I hope ); download the modified wx22_9.dll from >>http://wwwstud.dsi.unive.it/~mbarbon/wx/wx22_9.dll.gz >>uncompress it and put it in $PERL/site/lib/auto/Wx >>( make a backup of the original one, of course ). >>This fixes your problem with tree control, but may introduce >>new ones ( it is a fix backported from wxWIndows 2.3 ). >> >>Regards >>Mattia > >hey thanks man! >i had no time to work on my application but i checked the wxwindows >mailinglist archive. you asked for a code change as workaround......

Re: Re:
Sorry about that, my mistake, the patched method goes like this: procedure DeallocateHWnd(Wnd: HWND); var Instance: Pointer; begin Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); if Instance <> @DefWindowProc then begin { make sure we restore the default windows procedure before freeing memory } SetWindowLong(Wnd, GWL_WNDPROC, Longint(@DefWindowProc)); FreeObjectInstance(Instance); end; DestroyWindow(Wnd); end; "Andreas Hausladen" <AndreasDOTHausladen@gObviousToBeRemovedmx.de> wrote in message news:99620@f...

RE : RE : RE : RE : Regular expressions #2
No worries :-) It works now, thanks a lot :-) Best regards, Steve Hemond Programmeur Analyste / Analyst Programmer Smurfit-Stone, Ressources Foresti=E8res La Tuque, P.Q. Tel.: (819) 676-8100 X2833 shemond@smurfit.com=20 > -----Original Message----- > From: drieux [mailto:drieux@wetware.com]=20 > Sent: Wednesday, December 17, 2003 1:38 PM > To: Perl Perl > Subject: Re: RE : RE : RE : Regular expressions >=20 >=20 >=20 > On Dec 17, 2003, at 10:24 AM, drieux wrote: >=20 > > > > open(PS, "ps -efA|") or...

Re: RE: I need the DBI Module
I have to thank you for the detail of "BDB" instead of "DBD" that was the = whole problem to begin with. To answer your curiosity I did get to download the DBI from search.cpan.org= yesterday but for some reason the files where corrupted when I tried to = use them. So I wrote and asked for a place to download without giving my = personal reason which I found to be pointless. That for some reason made = you curious. But thanks to other very nice people that sent me different = reliable url's where I did get to download and use. =20 By the way, if you are goin...

RE: [wxperl-users] Re to Marco: Re: EVT_QUERY_END_SESSION
> > you putted the EVT_CLOSE to the wrong place... > > > > or do you have a reason why you need it to be there? > > $app ist not the window, but you could use EVT_CLOSE on $frame too. > > I know that EVT_CLOSE is for frame. What I want is a event for the app,= when > the app goes to be closed! Maybe the only way is to check the close in the > topwindow! ah, ok. that's easy if you don't want to veto the exit: ### code start my($app) =3D MyApp->new(); $app->MainLoop(); print "here's definitly the last point before t...

Re: Re: Re: Re: cross cluster read fails
--Boundary_(ID_HDBIpKP7HBB79jluGvYvuw) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 8BIT Content-disposition: inline �Hi Alan One more thing before we go further :) I wrote a simple perl script that accepts a file name, prints it out, opens the file (dies if open unsuccessful or prints �open successful�) 1>I passed my local directory filename, it prints �open successful� 2> Now I just add �abcd::� in front of it, and the perl script fails with Remote node is unknown D...

Re: Re: Re: RE: capture a website and process its data
--Next_1077222091---0-202.54.124.153-17281 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Rob,=0AI implemented your code and it gave perfectly desired answers. Bu= t I couldn't understand most of it. So, currently I went ahead with Dan's t= ips on my code only and would try to understand your code later after I mee= t a deadline for a small project of mine in college for tomorrow! So, no qu= estions as of now. =0A=0Acheers.=0AK(ay).=0A=0A=0AOn Thu, 19 Feb 2004 Rob D= ixon wrote :=0A>Scott E Robinso...

RE: RE: Re: Tri-grams?
------_=_NextPart_001_01C6380E.13FCCC91 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable -----Original Message----- From: amit hetawal [mailto:amit_h123@rediffmail.com] Sent: Wednesday, February 22, 2006 16:00 To: Wagner, David --- Senior Programmer Analyst --- WGO Subject: Re: RE: Re: Tri-grams? hi there the sequnce with alpha _ _ is valid but not _ _ _ I replaced the 4 four lines in your program with the following four line= s. =20 next if ( $char !~ /[a-z]/i ); my $char2 =3D substr $_, $ii+1, 1; ...

RE: Re: Re: Sub not working as it should
You don't need to be sorry - it's the right choice ;-) Philipp > -----Original Message----- > > I am sorry I am migrating over to perl (love the built > in debugger) > --- Saadat Saeed <saadat_saeed@yahoo.com> wrote: > > Thanks for the quick reponse - looks like I confuse > > my > > vbscript skills a bit... I am new to perl and am > > migrating over to vbscript! > > > > Regards > > > > > > --- Jeff 'japhy' Pinyan <japhy@perlmonk.org> wrote: > > > On Jan 21, Saadat S...

Web resources about - RE: RE: In Need of a Miracle...WAS:Re: Pg Connection WOES on DEAD LINE! - perl.dbi.users

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

Sydney's beauty relies on its visual and physical connection to nature
Landowners, custodians and developers must collaborate to create a healthy environment, happy residents and a more productive city.

Adam Savage from 'MythBusters' has an incredible connection to the 'Star Wars' franchise
Adam Savage, co-host of the popular " MythBusters " television show, soured on the plot of "Interstellar." But when it comes to the newest films ...

Heavyset woman with facial hair arrested in connection to downto - CBS News 8 - San Diego, CA News Station ...
Police were on the lookout Thursday for a heavyset woman with facial hair who stabbed a man in the East Village.

10th person arrested in connection with Paris attacks
CNN 10th person arrested in connection with Paris attacks CNN (CNN) Belgian police have arrested a 10th person in connection with last month's ...

Should auld connections be forgot...
This environmental testing company has strict data-retention requirements and they go beyond the data, reports a pilot fish on the scene. "Per ...

UK Police Make Arrest in Connection With VTech Hacking
British law enforcement officials arrest a 21-year-old man in connection with attack on toy maker VTech that exposed 6 million parents and children ...

Resources last updated: 1/1/2016 8:01:06 PM