Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

transactions from PHP - double COMMIT required?: msg#00000

Subject: transactions from PHP - double COMMIT required?
Hi,

I  have this problem - after sending a query from PHP script with
BEGIN-COMMIT transaction block that contains an error (e.g. I
intentionally insert wrong data into the field of "date" type) I get
an error (which is OK):ERROR:  date/time field value out of range.

Now, when I try to DELETE or perform some other query later in the
same PHP script  I receive this error:
ERROR: current transaction is aborted, commands ignored until end of
transaction block

I am 100% sure that I have closed the transaction block with
"COMMIT;". When I do the same in the console (psql) I get something
like:

BEGIN; INSERT INTO table1 (somecolumn) VALUES ('somedata'); INSERTsdf; COMMIT;

I get this reply
BEGIN
INSERT 180610 1
ERROR:  syntax error at or near "INSERTsdf" at character 1
ROLLBACK

Everything seems to be logical and works fine. So why this does not
work from PHP? I figured one thing to workaround my problem: I am
sending the query like this:
BEGIN;
(here are few insert queries, one is syntax error);
COMMIT;
Then I check the pg_result of this query in PHP, and if it is FALSE I
have to send another simple query : "COMMIT;" - yes I know this is
second commit already. But it works this way!
It seems like if PHP ignored my COMMIT command from the transaction query.
I also tried sending the transaction query like this:
BEGIN;
some queries;
COMMIT;COMMIT;
but this is not working. I need to send one transaction query, check
if the result is false, then send another COMMIT.

Any ideas where I got something missed?

Regards,
Mike

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
ide.eclipse.wtp...    bug-tracking.ro...    xfree86.cvs/200...    lisp.wxcl.devel...    file-systems.ar...    kde.devel.kwrit...    jakarta.jetspee...    qnx.openqnx.dev...    drivers.openib/...    ports.xbox.deve...    gis.gdal.devel/...    netbsd.ports.ma...    ubuntu.marketin...    systemtap/2005-...    web.omniweb/200...    mail.qmail.ldap...    hardware.soekri...    os.netbsd.devel...    audio.madman.ge...    tv.freeguide-tv...    cluster.openmos...    education.ezpro...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation