[ic] Catch database down
Marco
m.mescoli at omnib.it
Tue Sep 29 16:24:53 UTC 2009
Mike Heins ha scritto:
> Quoting Marco (m.mescoli at omnib.it):
>> Stefan Hornburg (Racke) ha scritto:
>>> Marco wrote:
>>>> [try label=dbdown]
>>>> [query
>>>> type=list
>>>> st=db
>>>> table=my_ic_table
>>>> sql=|SELECT COUNT(*) AS n FROM my_db_table;|]
>>>> [list][sql-param n][/list]
>>>> [/query]
>>>> [/try]
>>>>
>>>> [catch label=dbdown]
>>>> [/table my_ic_table connect failed/]
>>>> my_db_table non connected, database down ?
>>>> [/table my_ic_table connect failed/]
>>>> [/catch]
>>>>
>>>> On database down i get: 'Internal Server Error' without catching.
>>> I tried to reproduce this and found that catching work, but probably some
>>> other part of your code crashes due to missing database connection.
>>>
>>> Check your global error log for the exact error message.
>>>
>>> Regards
>>> Racke
>>>
>> Thanks Racke, now is catching, as you write there were more db
>> connection problems.
>
> You have a query problem. You can't put a semi-colon (;) in those
> queries.
I use this code to test and switch db using a cgi value.
------------- db_catch.html -----------------
[try label=dbdown]
[query type=list st=db table='[cgi tab]' sql=|SELECT COUNT(*) AS n
FROM [cgi tab];|][list][sql-param n][/list][/query]
[/try]
[catch label=dbdown]
[/table timbr_alt connect failed/]
Table timbr_alt not connected
[/table timbr_alt connect failed/]
[/table timbrature connect failed/]
Table timbrature not connected
[/table timbrature connect failed/]
Not specific error
[else]ok[/else]
[/catch]
---------------------------------------------
table timbrature mysql localhost
http://server/cgi-bin/cat/db_catch.html?tab=timbrature
with or without semi-colon i obtain:
mysql up output: 18688 ok
mysql down output: Table timbrature not connected
CORRECT
---------------------------------------------
table timbr_alt mysql remote lan host
http://server/cgi-bin/cat/db_catch.html?tab=timbr_alt
with or without semi-colon i obtain:
mysql up output: 1 ok
mysql down output: Table timbr_alt not connected
CORRECT
---------------------------------------------
http://server/cgi-bin/cat/db_catch.html?tab=not_existent_tab
with or without semi-colon i obtain:
output: ok
catalog error.log: no output
?
Why no ic error ?
Why not semi-colon ?
--
Marco "Fino alla bara sinpara"
Marco "Up to demise we rise"
Marco "apexes"
More information about the interchange-users
mailing list