|
|
|
Как отследить ошибку при insert, update?
|
|||
|---|---|---|---|
|
#18+
Искал в форуме, не нашел... Если в PB9 пишем insert или update чего либо, то может не произойти insert в таблицу, скажем по причине, что какая-либо переменная null или не соответствует столбцу в таблице. У меня в таком случае не происходит ошибки, Builder просто игнорит запись. Вопрос, как отследить insert и update и удостовериться, что запись проскочила успешно... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.03.2006, 11:37 |
|
||
|
Как отследить ошибку при insert, update?
|
|||
|---|---|---|---|
|
#18+
if sqlca.sqlcode<>0 then //действия в случае ошибки end if ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.03.2006, 11:40 |
|
||
|
Как отследить ошибку при insert, update?
|
|||
|---|---|---|---|
|
#18+
А COMMIT выполнил? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.03.2006, 12:09 |
|
||
|
Как отследить ошибку при insert, update?
|
|||
|---|---|---|---|
|
#18+
Да, commit выполняется в конце... просто некоторые записи баговые могут быть, ошибки отслеживаются конечно, но на всякий пожарный стоит от дурачка предостеречься... Бывает, что foreigh key не существует, в общем заморочек много... надо отследить, вставляется она или нет... if sqlca.sqlcode<>0 then ... еще не пробовал, ща к обеду допишу основное, если получится, отпишу... Вот примерно что делается. insert into t3_classifier_value (t3cfv_classifier_value_id, t3lvn_level_name_id, t3cfv_value, t3cfv_parent_level_id, t3cfv_code) Values(:dPKVALId, :dLVLVALId, :sValVAL, :dParVALID, :sCodeVAL) using sqlca; ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.03.2006, 12:17 |
|
||
|
Как отследить ошибку при insert, update?
|
|||
|---|---|---|---|
|
#18+
PowerBuilder Help Using SQL in scripts General information PowerScript supports standard embedded SQL statements and dynamic SQL statements in scripts. ... Error handling in scripts The scripts shown in the SQL examples above do not include error handling, but it is good practice to test the success and failure codes (the SQLCode attribute) in the transaction object after every statement . Value Meaning 0 Success100 Fetched row not found-1 Error; the statement failed. Use SQLErrText or SQLDBCode to obtain the detail. After certain statements such as DELETE, FETCH, and UPDATE, you should also check the SQLNRows property of the transaction object to make sure the action affected at least one row. About SQLErrText and SQLDBCode The string SQLErrText in the transaction object contains the database vendor-supplied error message. The long named SQLDBCode in the transaction object contains the database vendor-supplied status code: IF SQLCA.SQLCode = -1 THEN MessageBox("SQL error", SQLCA.SQLErrText) END IF ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.03.2006, 12:53 |
|
||
|
Как отследить ошибку при insert, update?
|
|||
|---|---|---|---|
|
#18+
Все спасибо, тема закрыта ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.03.2006, 13:00 |
|
||
|
Как отследить ошибку при insert, update?
|
|||
|---|---|---|---|
|
#18+
Коннектился к SAPDB и SQL типа UPDATE table ... set ...=... WHERE ... = ...; если WHERE не находит соотв. записей в sqlcode выдавал 100 , а намедне подконектился к DB2 и увидел sqlcode = -1 , sqldbcode=100 где-то можно это настроить, чтобы не править код ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.09.2006, 22:04 |
|
||
|
|

start [/forum/topic.php?fid=15&fpage=67&tid=1337615]: |
0ms |
get settings: |
8ms |
get forum list: |
14ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
27ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
44ms |
get tp. blocked users: |
2ms |
| others: | 243ms |
| total: | 357ms |

| 0 / 0 |
