Bläddra i källkod

Debugging with CH

spficklin 12 år sedan
förälder
incheckning
e6a6f7b11a
2 ändrade filer med 13 tillägg och 8 borttagningar
  1. 1 0
      tripal_bulk_loader/tripal_bulk_loader.loader.inc
  2. 12 8
      tripal_core/api/get_FKs.php

+ 1 - 0
tripal_bulk_loader/tripal_bulk_loader.loader.inc

@@ -562,6 +562,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
       // the tripal_core_chado_(select|insert|update) from recursing on 
       // foreign keys and make the loader go faster.
       if (count($duplicate[0]) == 1) {
+        print_r($duplicate);
         foreach($duplicate[0] as $key => $value){ 
           $data[$priority]['values_array'] = $value;
         } 

+ 12 - 8
tripal_core/api/get_FKs.php

@@ -1,5 +1,5 @@
 <?php
-// This script will generate an updated schema API array for each 
+// This script will add FK relatinsions to an existing schema API array for each 
 // Chado table.  It requires Chado is installed in a 'chado' schema of 
 // the drupal database.  It also requires existing schema hooks for 
 // version of Chado.  The goal is to use the output of this script to 
@@ -58,26 +58,30 @@ function get_chado_fk_relationships($version){
     
   // iterate through the tables and get the foreign keys
   print "<?php\n";
-  foreach ($tables as $table){
+  $referring = array();
+  foreach ($tables as $table) {
 
      // get the existing table array
      $table_arr = tripal_core_get_chado_table_schema($table);
      
-     if(empty($table_arr)){
-        print "ERROR: emptye table definition $table\n";
+     if (empty($table_arr)) {
+        print "ERROR: empty table definition $table\n";
      }
 
      // get the foreign keys and add them to the array
      $fks = db_query($sql,$table);
-     while($fk = db_fetch_object($fks)){
+     while ($fk = db_fetch_object($fks)) {
         $table_arr['foreign keys'][$fk->foreign_table_name]['table'] = $fk->foreign_table_name;
         $table_arr['foreign keys'][$fk->foreign_table_name]['columns'][$fk->column_name] = $fk->foreign_column_name;
+        $reffering[$fk->foreign_table_name] = $table;
       }
       
       // reformat the array to be more legible
-      $arr = var_export($table_arr,1);
-      $arr = preg_replace("/\n\s+array/","array",$arr); // move array( to previous line
-      $arr = preg_replace("/\n/","\n  ",$arr); // add indentation
+      $arr = var_export($table_arr, 1);
+      $arr = preg_replace("/\n\s+array/","array", $arr); // move array( to previous line
+      $arr = preg_replace("/\n/","\n  ", $arr); // add indentation
+      $arr = preg_replace("/true/","TRUE", $arr); // add indentation
+      $arr = preg_replace("/array \(/","array(", $arr); // add indentation      
       
       // print out the new Schema API function for this table
 print "/**