Bläddra i källkod

Added ability to skip tripal_core_chado_insert() validation -option in configuration; default is full validation

Lacey Sanderson 12 år sedan
förälder
incheckning
69370bd181

+ 11 - 0
tripal_bulk_loader/tripal_bulk_loader.admin.inc

@@ -72,6 +72,16 @@ function tripal_bulk_loader_configuration_form($form_state = NULL) {
     '#default_value' => variable_get('tripal_bulk_loader_disable_triggers', TRUE),
   );
 
+  $form['speed']['no_validate'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Skip Validation at the Tripal Core API level'),
+    '#description' => t('If an error is encountered, the Tripal core API will try
+      to provide informative error messages. With this turned off, you will not benifit
+      from these more informative error messages; however, your job will load faster
+      since it doesn\'t have to do the additional checking before inserting.'),
+    '#default_value' => variable_get('tripal_bulk_loader_skip_validation', FALSE),
+  );
+
   $form['speed']['transactions'] = array(
     '#type' => 'radios',
     '#title' => t('Transaction Rollback when an error is encountered'),
@@ -103,6 +113,7 @@ function tripal_bulk_loader_configuration_form_submit($form, $form_state) {
 
   variable_set('tripal_bulk_loader_prepare', $form_state['values']['prepare']);
   variable_set('tripal_bulk_loader_disable_triggers', $form_state['values']['disable_triggers']);
+  variable_set('tripal_bulk_loader_skip_validation', $form_state['values']['no_validate']);
   variable_set('tripal_bulk_loader_transactions',$form_state['values']['transactions']);
 
 }

+ 6 - 1
tripal_bulk_loader/tripal_bulk_loader.loader.inc

@@ -474,7 +474,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $field2c
 
 
   if (!preg_match('/select/', $table_data['mode'])) {
-    //watchdog('T_bulk_loader',$header.': Inserting:'.print_r($values, TRUE), array(), WATCHDOG_NOTICE);
+    // Use prepared statement?
     if (variable_get('tripal_bulk_loader_prepare',TRUE)) {
       $options = array('statement_name' => 'record_'.$priority);
       if ($line_num == 1 && $group_index == 1) {
@@ -485,6 +485,11 @@ function process_data_array_for_line($priority, &$data, &$default_data, $field2c
       $options = array();
     }
 
+    // Skip tripal_core_chado_insert() built-in validation?
+    if (variable_get('tripal_bulk_loader_skip_validation', FALSE)) {
+      $options['skip_validation'] = TRUE;
+    }
+
     $record = tripal_core_chado_insert($table, $values, $options);
 
     if (!$record) {