Re: perl Pg module and result status
От | Thomas Good |
---|---|
Тема | Re: perl Pg module and result status |
Дата | |
Msg-id | Pine.LNX.4.05.10009220908180.5568-100000@admin.nrnet.org обсуждение исходный текст |
Ответ на | Re: perl Pg module and result status (Fernán Agüero <fernan@iib.unsam.edu.ar>) |
Список | pgsql-general |
On Fri, 22 Sep 2000, [ISO-8859-1] Fern�n Ag�ero wrote: > Hi folks! > > Thanks for the advice. Excuse my delay in replying: I've been filled with > work. > > And yes, I was using the Pg module that comes with pgsql, and not the DBI:Pg > one. Now I switched to DBI and is surprising how much cleaner code you get, > particularly since the checks for errors are done by DBI (PrintErrors => 1, > RaiseErrors => 1). You may wish to turn off RaiseErrors...you can still get the dbi errors by doing: $dbi = $DBI::errstr; Embed this in your query - if (!defined $rv) ... $dbi = $DBI::errstr; and so on. The reason to do this is that you can then write your own stderr and include the dbi errstr...this is very handy if you want to beef up the debugging output that gets dumped to the apache error_log (I use DBI alongside CGI in perl scripts). The problem with RaiseErrors is that it overwrites any stderr the script is looking to dump to the error_log...just an FYI. > I have yet to get into more depth with DBI but, as you said, I find it > easier to get things done. Not to mention the possibility of moving from > one RDMS to another and just changing a couple of lines in the scripts. The author of DBI (Tim Bunce) has an excellent book published by Tim O'Reilly called Programming The Perl DBI Interface. Cheers, Tom -------------------------------------------------------------------- SVCMC - Center for Behavioral Health -------------------------------------------------------------------- Thomas Good tomg@ { admin | q8 } .nrnet.org IS Coordinator / DBA Phone: 718-354-5528 Fax: 718-354-5056 -------------------------------------------------------------------- Powered by: PostgreSQL s l a c k w a r e FreeBSD: RDBMS |---------- linux The Power To Serve --------------------------------------------------------------------
В списке pgsql-general по дате отправления: