[Removed unused file Adrian Georgescu **20080531214039] hunk ./mysql.phtml 1 - "CDRTool_Session", - "auth" => "CDRTool_Auth", - "perm" => "CDRTool_Perm")); - -$perm->check("sqlquery"); - -$db = new DB_CDRTool; -$db->Halt_On_Error="no"; -if ($action != "Run query") { - -$title="SQL client"; -if (is_readable("local/header.phtml")) { - include("local/header.phtml"); -} else { - include("header.phtml"); -} - -print " -
-"; -$layout = new pageLayoutLocal(); -$layout->showTopMenu($title); - -print " -
-"; - -## Get a database connection -$db = new DB_CDRTool; - -print " -
-

- - - - - -
-

Query examples

-

-

    -
  • Show database table names: show tables -
  • Show fields names of table: describe [tablename] , replace [tablename] with the actual table name -
  • CDR table in the format cdrYYYYMM , YYYY is the year in 4 digits, MM is the month in 2 digits -
  • Show number of records from a cdr table: select count(*) from cdr200101 -
  • To limit the number of records of output, at the end of the query add:
    - limit N,M where N - is the number of records to be returned, and ,M - is optional and move the result pointer at the M-th records in the - result set for example: -
    - - select sum(duration), a_number from cdr200101 where duration > 0 - group by a_number order by duration DESC limit 10 - -

    - will display the top 10 users of the platform. -

-
-

Last 10 queries

- - - -
- -
- -

-Press to display the query output into a new window. -Press to clear the query textbox -

-"; -print " -
-"; - -$layout->showFooter(); -print " - - -"; - -} else { - Header("Content-type: text/plain"); - - //print "action=$action\n"; - //print "query1=$query1\n\n"; - $querysource=addslashes($query1); - $query1=stripslashes($query1); - //print "query1=$query1\n\n"; - - $db->query("insert into lastquery (query,date) values ('$querysource',NOW())"); - $db->query("$query1"); - $rows=$db->num_rows(); - $cols=$db->num_fields(); - while($i<$rows) { - $db->next_record(); - $found=$i+1; - print "$found,"; - $j=0; - while ($j<$cols) { - if ($j>0) { - print ","; - } - $db->p($j); - $j++; - } - print "\n"; - $i++; - } -} - -page_close(); - -?> - rmfile ./mysql.phtml hunk ./phone_images.php 1 -