From 449605a67d9bb68fd60f9c5029f595c0c5d95614 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 1 Jun 2016 22:11:53 +1000 Subject: [PATCH] sql exception handling --- booking.admin.inc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/booking.admin.inc b/booking.admin.inc index fc709d3..4f19b8e 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -6,11 +6,20 @@ function booking_admin() { + $form = array(); //regenerate all our menu hooks when loading this form menu_rebuild(); //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', "
SQL View booking_person_view check\n@info
", 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) { watchdog('booking_debug', "SQL View booking_person_view check does not exist"); _booking_node_create_mysqlview(); @@ -18,9 +27,8 @@ function booking_admin() else { watchdog('booking_debug', "
SQL View booking_person_view check\n@info
", array('@info' => print_r( $sqlview_check, true))); } - - $form = array(); - + */ + $form['email'] = array( '#type' => 'fieldset', '#title' => 'Email Addresses'