From: x2000habouzit Date: Fri, 20 Feb 2004 11:12:52 +0000 (+0000) Subject: on se dépèche d'utilise la killer feature de debug sql intégré à la lib diogenes :) X-Git-Tag: xorg/old~1846 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=816ffcbe4a58edf05ab14743ba6a6490a489ea5d;p=platal.git on se dépèche d'utilise la killer feature de debug sql intégré à la lib diogenes :) --- diff --git a/htdocs/mescontacts.php b/htdocs/mescontacts.php index 19d19b4..2b91c7e 100644 --- a/htdocs/mescontacts.php +++ b/htdocs/mescontacts.php @@ -52,9 +52,6 @@ $sql = "SELECT contact AS id, LEFT JOIN geoloc_region AS gr ON (adr.pays = gr.a2 AND adr.region = gr.region) WHERE c.uid = {$_SESSION['uid']} ORDER BY a.nom, a.prenom"; -$globals->db->query($sql); -echo mysql_error(); - $page->mysql_assign($sql,'contacts','nb_contacts'); $page->run(); diff --git a/include/xorg.common.inc.php b/include/xorg.common.inc.php index 01a32aa..cf58913 100644 --- a/include/xorg.common.inc.php +++ b/include/xorg.common.inc.php @@ -28,4 +28,6 @@ session_start(); // connect to database $globals->dbconnect(); $conn = $globals->db->connect_id; +if($site_dev) + $globals->db->trace_on(); ?> diff --git a/include/xorg.page.inc.php b/include/xorg.page.inc.php index 10d63dd..1934041 100644 --- a/include/xorg.page.inc.php +++ b/include/xorg.page.inc.php @@ -60,13 +60,15 @@ class XorgPage extends DiogenesCorePage { } function run($append_to_id="") { - global $baseurl, $site_dev; + global $baseurl, $site_dev, $globals; if($this->_page_type == NO_SKIN) parent::display($this->_tpl); else { if(isset($_SESSION['suid'])) $this->caching=false; $id = $this->make_id($append_to_id); if($site_dev) { + echo $globals->db->trace_format($this, 'database-debug.tpl'); + $this->assign('validate', urlencode($baseurl.'/valid.html')); $result = $this->fetch('skin/'.$_SESSION['skin'], $id); $fd = fopen($this->cache_dir."valid.html","w"); diff --git a/templates/database-debug.tpl b/templates/database-debug.tpl new file mode 100644 index 0000000..9c165a6 --- /dev/null +++ b/templates/database-debug.tpl @@ -0,0 +1,40 @@ +{dynamic} + +{foreach item=query from=$trace_data} +
+ + + + + {if $query.error} + + + + {/if} +
QUERY:
{$query.query|nl2br}
ERROR:
{$query.error|nl2br}
+ + + + + + + + + + + + + + + + + + + + + +
tabletypepossible_keyskeykey_lenrefrowsextra
{$query.explain.table}{$query.explain.type}{$query.explain.possible_keys}{$query.explain.key}{$query.explain.key_len}{$query.explain.ref}{$query.explain.rows}{$query.explain.Extra}
+
+{/foreach} + +{/dynamic}