The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Get Type of SQL Errors?
If an SQL query error occurs, is there way to detect what type of error it was? Here are the two basic things I need to detect.
1. A SELECT, UPDATE, DELETE querys: a) It worked, all went well b) Could not find record c) Something else... 2. A INSERT query: a) It worked, all went well b) Duplicate record (ID) found, could not insert c) Something else... I'm sure there is a specific code to find this out but it would probably differ between database types. So, I'm just either looking for a way to have vB tell me or if someone has a nice compiled list of error codes for the supported databases. Thanks To add to the INSERT duplicate error, I'd also need to know if it was a non-unique field/record. I have ID and NAME which both need to be unique. |
#2
|
||||
|
||||
Quote:
You cannot get a duplicate error on a field that is not indexed unique, cause the latter is a pre-requisite for the former. You can index what ever table it is you are taling about so that it has dual primary keys, or the indices on the two fields are unique. Note that select, update and delete will not spit an error if a record is not found, it will simply not do anything to the database/return no rows |
#3
|
|||
|
|||
Ah, I did not realize that vB only supports mySQL. That makes it fairly easy. Do you know what versions of mySQL are supported? Or maybe, do the error codes change between version? I wouldn't think so..
The id will be specified as the primary key and the name is just indexed as unique. I'm assuming there will be a different error code for each.?.? I didn't think about the affected rows for checking if anything was updated, deleted, etc. That will be easy to check for. And for the SELECT statements, it just won't return any rows, correct? Thanks for your help, it's greatly appreciated! |
#4
|
||||
|
||||
Well its LAMP, what other choices are there? Also the vb code is full of mysql specific sqls.
Quote:
Quote:
Quote:
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|