note 72570 added to function.mssql-query

From: Date: Wed, 24 Jan 2007 18:57:30 +0000
Subject: note 72570 added to function.mssql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-122149@lists.php.net to get a copy of this message
It is annoying that MSSQL does not return proper error numbers. For example: run a simple "INSERT INTO ..." query that will cause an error and see it. All I get is: Code: HY000 Message: (below) SQLSTATE[HY000]: General error: 10007 INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK...'. The conflict occurred in database 'DB...', table 'TBL...', column 'COL...'. [10007] (severity 5) [INSERT INTO ... ] 'HY000' does not help me at all and same thing is returned for other errors as well. (I am not sure, but if 10007 is the number I am looking for, I do NOT want to parse the error messages. Then why do we have the notion of "err_code and err_message"?) I think, running the following just after the 'failed' query may help: $err = your_query_and_fetch_row_func ('select @@error'); Cheers! Murat P.S. Firebird rocks! ;) ---- Server IP: 85.116.0.130 Probable Submitter: 82.144.250.86 ---- Manual Page -- http://www.php.net/manual/en/function.mssql-query.php Edit -- https://master.php.net/note/edit/72570 Del: integrated -- https://master.php.net/note/delete/72570/integrated Del: useless -- https://master.php.net/note/delete/72570/useless Del: bad code -- https://master.php.net/note/delete/72570/bad+code Del: spam -- https://master.php.net/note/delete/72570/spam Del: non-english -- https://master.php.net/note/delete/72570/non-english Del: in docs -- https://master.php.net/note/delete/72570/in+docs Del: other reasons-- https://master.php.net/note/delete/72570 Reject -- https://master.php.net/note/reject/72570 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122149) next »