SQL Buddy - Web based MySQL administration http://www.sqlbuddy.com/ include_browse.php - not called directly, but from browse.php and query.php MIT license 2008 Calvin Lough <http://calv.in> */ $totalRows = 0; $insertCount = 0; $queryTime = 0; $perPage = isset($sbconfig) && array_key_exists("RowsPerPage", $sbconfig) ? $sbconfig['RowsPerPage'] : 100; $displayLimit = 1000; $query = trim($query); if ($query) { if (!isset($queryTable)) { $querySplit = splitQueryText($query); } else { $querySplit[] = $query; } foreach ($querySplit as $q) { $q = trim($q, "\n"); if ($q != "") { if (isset($queryTable)) { $totalRows = $conn->tableRowCount($queryTable); if ($start > $totalRows) { $start = 0; } $q = "{$q} {$sort} LIMIT {$start}, {$perPage}"; } $queryStartTime = microtime_float(); $dataSql = $conn->query($q) or $dbError[] = $conn->error();
/* SQL Buddy - Web based MySQL administration http://www.sqlbuddy.com/ ajaxfulltext.php - fetches full text for browse tab MIT license 2008 Calvin Lough <http://calv.in> */ include "functions.php"; loginCheck(); if (isset($db)) { $conn->selectDB($db); } if (isset($_POST['query'])) { $queryList = splitQueryText($_POST['query']); foreach ($queryList as $query) { $sql = $conn->query($query); } } if ($conn->getAdapter() == "mysql") { $structureSql = $conn->describeTable($table); while ($structureRow = $conn->fetchAssoc($structureSql)) { $types[$structureRow['Field']] = $structureRow['Type']; } } if ($conn->isResultSet($sql)) { $row = $conn->fetchAssoc($sql); foreach ($row as $key => $value) { echo "<div class=\"fulltexttitle\">" . $key . "</div>"; echo "<div class=\"fulltextbody\">";
http://www.sqlbuddy.com/ browse.php - browse table - just grabs variables and passes them to include_browse.php MIT license 2008 Calvin Lough <http://calv.in> */ include "functions.php"; loginCheck(); requireDatabaseAndTableBeDefined(); if (isset($db)) { $conn->selectDB($db); } //run delete queries if (isset($_POST['runQuery'])) { $runQuery = $_POST['runQuery']; $queryList = splitQueryText($runQuery); foreach ($queryList as $query) { $conn->query($query); } } if ($conn->getAdapter() == "sqlite") { $query = "SELECT * FROM '{$table}'"; } else { $query = "SELECT * FROM `{$table}`"; } $queryTable = $table; if (isset($_POST['s'])) { $start = (int) $_POST['s']; } else { $start = 0; }
$columnCount++; } } } $insertCount = 0; $skipCount = 0; if (isset($file) && is_uploaded_file($file)) { if (isset($format) && $format == "SQL") { $lines = file($file); // the file() function doesn't handle mac line endings correctly if (sizeof($lines) == 1 && strpos($lines[0], "\r") > 0) { $lines = explode("\r", $lines[0]); } $commentFree = array_map("stripCommentLines", $lines); $contents = trim(implode('', $commentFree)); $statements = splitQueryText($contents); } else { $statements = file($file); // see previous comment if (sizeof($statements) == 1 && strpos($statements[0], "\r") > 0) { $statements = explode("\r", $statements[0]); } } foreach ($statements as $statement) { $statement = trim($statement); if ($statement) { if (isset($format) && $format == "SQL") { $importQuery = $conn->query($statement) or $dbErrors[] = $conn->error(); $affected = (int) $conn->affectedRows($importQuery); $insertCount += $affected; } else {