sql exception handling

This commit is contained in:
2016-06-01 22:11:53 +10:00
parent 5443d6377b
commit 449605a67d

View File

@@ -6,11 +6,20 @@
function booking_admin() function booking_admin()
{ {
$form = array();
//regenerate all our menu hooks when loading this form //regenerate all our menu hooks when loading this form
menu_rebuild(); menu_rebuild();
//create the mysql view booking_person_view if necessary //create the mysql view booking_person_view if necessary
$sqlview_check = db_query("SELECT 1 FROM {booking_person_view}")->fetchAssoc(); try {
$sqlview_check = db_query("SELECT 1 FROM {booking_person_view}")->fetchAssoc();
watchdog('booking_debug', "<pre>SQL View booking_person_view check\n@info</pre>", array('@info' => print_r( $sqlview_check, true)));
}
catch {
watchdog('booking_debug', "SQL View booking_person_view check does not exist");
_booking_node_create_mysqlview();
}
/*
if (! $sqlview_check) { if (! $sqlview_check) {
watchdog('booking_debug', "SQL View booking_person_view check does not exist"); watchdog('booking_debug', "SQL View booking_person_view check does not exist");
_booking_node_create_mysqlview(); _booking_node_create_mysqlview();
@@ -18,8 +27,7 @@ function booking_admin()
else { else {
watchdog('booking_debug', "<pre>SQL View booking_person_view check\n@info</pre>", array('@info' => print_r( $sqlview_check, true))); watchdog('booking_debug', "<pre>SQL View booking_person_view check\n@info</pre>", array('@info' => print_r( $sqlview_check, true)));
} }
*/
$form = array();
$form['email'] = array( $form['email'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',