[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> 5 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * 21 * $Id: dbtable.php,v 1.3 2005/07/10 20:10:08 eldy Exp $ 22 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/system/dbtable.php,v $ 23 */ 24 25 /** 26 \file htdocs/admin/system/dbtable.php 27 \brief Page d'info des contraintes d'une table 28 \version $Revision: 1.3 $ 29 */ 30 31 require ("./pre.inc.php"); 32 include_once $dolibarr_main_document_root."/lib/".$conf->db->type.".lib.php"; 33 34 $langs->load("admin"); 35 36 37 if (!$user->admin) 38 accessforbidden(); 39 40 41 llxHeader(); 42 43 44 print_titre($langs->trans("Table") . " ".$_GET["table"]); 45 46 if ($conf->db->type == 'mysql') 47 { 48 $sql = "SHOW TABLE STATUS LIKE '".$_GET["table"]."'"; 49 $base=1; 50 } 51 52 if ($conf->db->type == 'pgsql') 53 { 54 $sql = "SELECT conname,contype FROM pg_constraint;"; 55 $base=2; 56 } 57 58 print '<br>'; 59 60 $result = $db->query($sql); 61 if ($result) 62 { 63 $num = $db->num_rows(); 64 $var=True; 65 $i=0; 66 while ($i < $num) 67 { 68 $row = $db->fetch_row(); 69 $i++; 70 } 71 } 72 73 74 if ($base==1) 75 { 76 77 $cons = explode(";",$row[14]); 78 79 foreach ($cons as $cc) 80 { 81 $cx = ereg_replace("\) REFER", "", $cc); 82 $cx = ereg_replace("\(`", "", $cx); 83 $cx = ereg_replace("`\)", "", $cx); 84 $cx = ereg_replace("` ", "", $cx); 85 86 $val = explode("`",$cx); 87 88 $link[trim($val[0])][0] = $val[1]; 89 $link[trim($val[0])][1] = $val[2]; 90 91 } 92 93 // var_dump($link); 94 95 print '<table>'; 96 print '<tr class="liste_titre"><td>Champs</td><td>Type</td><td>Index</td><td>Champ lié</td></tr>'; 97 98 $sql = "DESCRIBE ".$_GET["table"]; 99 $result = $db->query($sql); 100 if ($result) 101 { 102 $num = $db->num_rows(); 103 $var=True; 104 $i=0; 105 while ($i < $num) 106 { 107 $row = $db->fetch_row($i); 108 $var=!$var; 109 print "<tr $bc[$var]>"; 110 111 112 print "<td>$row[0]</td>"; 113 print "<td>$row[1]</td>"; 114 print "<td>$row[3]</td>"; 115 print "<td>".$link[$row[0]][0]."."; 116 print $link[$row[0]][1]."</td>"; 117 118 119 print '</tr>'; 120 $i++; 121 } 122 } 123 print '</table>'; 124 125 } 126 127 llxFooter('$Date: 2005/07/10 20:10:08 $ - $Revision: 1.3 $'); 128 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |