The branch, master has been updated
via b3939c021af17416deae247d8e3365c8975a9f1f (commit)
via 21e2913adde82d36cfa9ab2daaab90d3a4b185f0 (commit)
via b0a108473e3087fa50b121ed48e16809e9ace20a (commit)
via bbccd32c816b2bf56e3e36c8c0f86a42ca15dd37 (commit)
from 74764f3cf1c238fed2cdb29e62fb59bbcf771c69 (commit)
- Log -----------------------------------------------------------------
commit b3939c021af17416deae247d8e3365c8975a9f1f
Author: Michal ÄŒihaÅ™ <michal(a)cihar.com>
Date: Mon Aug 15 11:41:49 2011 +0200
Remove not needed global $query_default_option
commit 21e2913adde82d36cfa9ab2daaab90d3a4b185f0
Author: Michal ÄŒihaÅ™ <michal(a)cihar.com>
Date: Mon Aug 15 11:37:23 2011 +0200
Remove not needed param from PMA_REL_create_page
commit b0a108473e3087fa50b121ed48e16809e9ace20a
Author: Michal ÄŒihaÅ™ <michal(a)cihar.com>
Date: Mon Aug 15 11:36:13 2011 +0200
Remove not needed param from PMA_REL_create_page
commit bbccd32c816b2bf56e3e36c8c0f86a42ca15dd37
Author: Michal ÄŒihaÅ™ <michal(a)cihar.com>
Date: Mon Aug 15 11:33:00 2011 +0200
Improve coding style
-----------------------------------------------------------------------
Summary of changes:
libraries/relation.lib.php | 5 +-
libraries/schema/User_Schema.class.php | 69 +++++++++++++++++++++-----------
pmd_pdf.php | 18 +++-----
schema_edit.php | 23 ++++-------
schema_export.php | 12 +-----
5 files changed, 64 insertions(+), 63 deletions(-)
diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php
index c24c249..4411743 100644
--- a/libraries/relation.lib.php
+++ b/libraries/relation.lib.php
@@ -1068,10 +1068,9 @@ function PMA_REL_renameField($db, $table, $field, $new_name)
* @param string $newpage
* @param array $cfgRelation
* @param string $db
- * @param string $query_default_option
* @return string $pdf_page_number
*/
-function PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option)
+function PMA_REL_create_page($newpage, $cfgRelation, $db)
{
if (! isset($newpage) || $newpage == '') {
$newpage = __('no description');
@@ -1079,7 +1078,7 @@ function PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option)
$ins_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' (db_name, page_descr)'
. ' VALUES (\'' . PMA_sqlAddSlashes($db) . '\', \'' . PMA_sqlAddSlashes($newpage) . '\')';
- PMA_query_as_controluser($ins_query, false, $query_default_option);
+ PMA_query_as_controluser($ins_query, false);
return PMA_DBI_insert_id(isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : '');
}
?>
diff --git a/libraries/schema/User_Schema.class.php b/libraries/schema/User_Schema.class.php
index 2ea0a2b..aa17c47 100644
--- a/libraries/schema/User_Schema.class.php
+++ b/libraries/schema/User_Schema.class.php
@@ -38,31 +38,52 @@ class PMA_User_Schema
public function processUserChoice()
{
- global $action_choose,$db,$cfgRelation,$cfg,$query_default_option;
+ global $action_choose,$db,$cfgRelation,$cfg;
if (isset($this->action)) {
switch ($this->action) {
case 'selectpage':
$this->chosenPage = $_REQUEST['chpage'];
if ($action_choose=="1") {
- $this->deleteCoordinates($db, $cfgRelation, $this->chosenPage, $query_default_option);
- $this->deletePages($db, $cfgRelation, $this->chosenPage, $query_default_option);
+ $this->deleteCoordinates(
+ $db,
+ $cfgRelation,
+ $this->chosenPage
+ );
+ $this->deletePages(
+ $db,
+ $cfgRelation,
+ $this->chosenPage
+ );
$this->chosenPage = 0;
}
break;
case 'createpage':
- $this->pageNumber = PMA_REL_create_page($_POST['newpage'], $cfgRelation, $db, $query_default_option);
+ $this->pageNumber = PMA_REL_create_page(
+ $_POST['newpage'],
+ $cfgRelation,
+ $db
+ );
$this->autoLayoutForeign = isset($_POST['auto_layout_foreign']) ? "1":NULL;
$this->autoLayoutInternal = isset($_POST['auto_layout_internal']) ? "1":NULL;
- $this->processRelations($db, $this->pageNumber,$cfgRelation,$query_default_option);
+ $this->processRelations(
+ $db,
+ $this->pageNumber,
+ $cfgRelation
+ );
break;
case 'edcoord':
$this->chosenPage = $_POST['chpage'];
$this->c_table_rows = $_POST['c_table_rows'];
- $this->_editCoordinates($db, $cfgRelation,$query_default_option);
+ $this->_editCoordinates($db, $cfgRelation);
break;
case 'delete_old_references':
- $this->_deleteTableRows($delrow,$cfgRelation,$db,$this->chosenPage);
+ $this->_deleteTableRows(
+ $delrow,
+ $cfgRelation,
+ $db,
+ $this->chosenPage
+ );
break;
case 'process_export':
$this->_processExportSchema();
@@ -132,10 +153,10 @@ class PMA_User_Schema
*/
public function selectPage()
{
- global $db,$table,$query_default_option,$cfgRelation;
+ global $db,$table,$cfgRelation;
$page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\'';
- $page_rs = PMA_query_as_controluser($page_query, false, $query_default_option);
+ $page_rs = PMA_query_as_controluser($page_query, false, PMA_DBI_QUERY_STORE);
if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
?>
<form method="get" action="schema_edit.php" name="frm_select_page">
@@ -186,7 +207,7 @@ class PMA_User_Schema
*/
public function showTableDashBoard()
{
- global $db,$cfgRelation,$table,$cfg,$with_field_names,$query_default_option;
+ global $db,$cfgRelation,$table,$cfg,$with_field_names;
/*
* We will need an array of all tables in this db
*/
@@ -209,7 +230,7 @@ class PMA_User_Schema
$page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
. ' AND pdf_page_number = \'' . PMA_sqlAddSlashes($this->chosenPage) . '\'';
- $page_rs = PMA_query_as_controluser($page_query, false, $query_default_option);
+ $page_rs = PMA_query_as_controluser($page_query, false);
$array_sh_page = array();
while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
$array_sh_page[] = $temp_sh_page;
@@ -543,7 +564,7 @@ class PMA_User_Schema
. ' AND table_name = \'' . PMA_sqlAddSlashes($current_row) . '\'' . "\n"
. ' AND pdf_page_number = \'' . PMA_sqlAddSlashes($chpage) . '\'';
echo $del_query;
- PMA_query_as_controluser($del_query, false, $query_default_option);
+ PMA_query_as_controluser($del_query, false);
}
}
@@ -584,12 +605,12 @@ class PMA_User_Schema
* @return void
* @access private
*/
- public function deleteCoordinates($db, $cfgRelation, $choosePage, $query_default_option)
+ public function deleteCoordinates($db, $cfgRelation, $choosePage)
{
$query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
. ' AND pdf_page_number = \'' . PMA_sqlAddSlashes($choosePage) . '\'';
- PMA_query_as_controluser($query, false, $query_default_option);
+ PMA_query_as_controluser($query, false);
}
/**
@@ -601,12 +622,12 @@ class PMA_User_Schema
* @return void
* @access private
*/
- public function deletePages($db, $cfgRelation, $choosePage, $query_default_option)
+ public function deletePages($db, $cfgRelation, $choosePage)
{
$query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
. ' AND page_nr = \'' . PMA_sqlAddSlashes($choosePage) . '\'';
- PMA_query_as_controluser($query, false, $query_default_option);
+ PMA_query_as_controluser($query, false);
}
/**
@@ -618,7 +639,7 @@ class PMA_User_Schema
* @return void
* @access private
*/
- public function processRelations($db, $pageNumber, $cfgRelation, $query_default_option)
+ public function processRelations($db, $pageNumber, $cfgRelation)
{
/*
* A u t o m a t i c l a y o u t
@@ -665,7 +686,7 @@ class PMA_User_Schema
. ' WHERE master_db = \'' . $db . '\''
. ' GROUP BY master_table'
. ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
- $master_tables_rs = PMA_query_as_controluser($master_tables, false, $query_default_option);
+ $master_tables_rs = PMA_query_as_controluser($master_tables, false, PMA_DBI_QUERY_STORE);
if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
/* first put all the master tables at beginning
* of the list, so they are near the center of
@@ -703,7 +724,7 @@ class PMA_User_Schema
}
if (isset($this->autoLayoutInternal) || isset($this->autoLayoutForeign)) {
- $this->addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation,$query_default_option);
+ $this->addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation);
}
$this->chosenPage = $pageNumber;
@@ -719,7 +740,7 @@ class PMA_User_Schema
* @return void
* @access private
*/
- public function addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation,$query_default_option)
+ public function addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation)
{
/*
* Now generate the coordinates for the schema
@@ -737,7 +758,7 @@ class PMA_User_Schema
$insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
. '(db_name, table_name, pdf_page_number, x, y) '
. 'VALUES (\'' . PMA_sqlAddSlashes($db) . '\', \'' . PMA_sqlAddSlashes($current_table) . '\',' . $pageNumber . ',' . $pos_x . ',' . $pos_y . ')';
- PMA_query_as_controluser($insert_query, false, $query_default_option);
+ PMA_query_as_controluser($insert_query, false);
/*
* compute for the next table
@@ -775,7 +796,7 @@ class PMA_User_Schema
* @return void
* @access private
*/
- private function _editCoordinates($db, $cfgRelation,$query_default_option)
+ private function _editCoordinates($db, $cfgRelation)
{
for ($i = 0; $i < $this->c_table_rows; $i++) {
$arrvalue = 'c_table_' . $i;
@@ -792,7 +813,7 @@ class PMA_User_Schema
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddSlashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = \'' . PMA_sqlAddSlashes($this->chosenPage) . '\'';
- $test_rs = PMA_query_as_controluser($test_query, false, $query_default_option);
+ $test_rs = PMA_query_as_controluser($test_query, false, PMA_DBI_QUERY_STORE);
//echo $test_query;
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
@@ -813,7 +834,7 @@ class PMA_User_Schema
. 'VALUES (\'' . PMA_sqlAddSlashes($db) . '\', \'' . PMA_sqlAddSlashes($arrvalue['name']) . '\', \'' . PMA_sqlAddSlashes($this->chosenPage) . '\',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
}
//echo $ch_query;
- PMA_query_as_controluser($ch_query, false, $query_default_option);
+ PMA_query_as_controluser($ch_query, false);
} // end if
} // end for
}
diff --git a/pmd_pdf.php b/pmd_pdf.php
index d697dd5..adf5fac 100644
--- a/pmd_pdf.php
+++ b/pmd_pdf.php
@@ -8,7 +8,7 @@
include_once 'pmd_common.php';
/**
- * If called directly from the designer, first save the positions
+ * If called directly from the designer, first save the positions
*/
if (! isset($scale)) {
$no_die_save_pos = 1;
@@ -25,11 +25,7 @@ if (isset($mode)) {
$scale_q = PMA_sqlAddSlashes($scale);
if ('create_export' == $mode) {
- /*
- * @see pdf_pages.php
- */
- $query_default_option = PMA_DBI_QUERY_STORE;
- $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
+ $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db);
if ($pdf_page_number > 0) {
$message = PMA_Message::success(__('Page has been created'));
$mode = 'export';
@@ -57,7 +53,7 @@ if (isset($mode)) {
' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
AND
' . $pmd_table . '.`db_name`=\''. PMA_sqlAddSlashes($db) .'\'
- AND pdf_page_number = ' . $pdf_page_number_q . ';', true, PMA_DBI_QUERY_STORE);
+ AND pdf_page_number = ' . $pdf_page_number_q . ';', true, PMA_DBI_QUERY_STORE);
}
}
@@ -68,20 +64,20 @@ require_once './libraries/header_meta_style.inc.php';
<body>
<br>
<div>
-<?php
- if (!empty($message)) {
+<?php
+ if (!empty($message)) {
$message->display();
}
?>
<form name="form1" method="post" action="pmd_pdf.php">
-<?php
+<?php
echo PMA_generate_common_hidden_inputs($db);
echo '<div>';
echo '<fieldset><legend>' . __('Import/Export coordinates for PDF schema') . '</legend>';
$choices = array();
-$table_info_result = PMA_query_as_controluser('SELECT * FROM '
+$table_info_result = PMA_query_as_controluser('SELECT * FROM '
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\'');
diff --git a/schema_edit.php b/schema_edit.php
index 4ab41d4..3662b0b 100644
--- a/schema_edit.php
+++ b/schema_edit.php
@@ -20,19 +20,12 @@ require_once './libraries/db_info.inc.php';
/**
* Includ settings for relation stuff
- * get all variables needed for exporting relational schema
+ * get all variables needed for exporting relational schema
* in $cfgRelation
*/
require_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();
-/**
- * This is to avoid "Command out of sync" errors. Before switching this to
- * a value of 0 (for MYSQLI_USE_RESULT), please check the logic
- * to free results wherever needed.
- */
-$query_default_option = PMA_DBI_QUERY_STORE;
-
/**
* Now in ./libraries/relation.lib.php we check for all tables
* that we need, but if we don't find them we are quiet about it
@@ -79,14 +72,14 @@ if ($cfgRelation['pdfwork']) {
* and tables which will be exported as Relational schema
* you can set the table positions on the paper via scratchboard
* for table positions, put the x,y co-ordinates
- *
+ *
* @param string $do It tells what the Schema is supposed to do
- * create and select a page, generate schema etc
+ * create and select a page, generate schema etc
*/
if (isset($_REQUEST['do'])) {
$user_schema->setAction($_REQUEST['do']);
$user_schema->processUserChoice();
- }
+ }
/**
* Show some possibility to select a page for the export of relation schema
@@ -96,14 +89,14 @@ if ($cfgRelation['pdfwork']) {
$user_schema->selectPage();
/**
- * Create a new page where relations will be drawn
+ * Create a new page where relations will be drawn
*/
$user_schema->showCreatePageDialog($db);
/**
- * After selection of page or creating a page
- * It will show you the list of tables
+ * After selection of page or creating a page
+ * It will show you the list of tables
* A dashboard will also be shown where you can position the tables
*/
@@ -114,7 +107,7 @@ if ($cfgRelation['pdfwork']) {
|| ($_REQUEST['do']== 'selectpage' && isset($user_schema->chosenPage) && $user_schema->chosenPage != 0)
|| ($_REQUEST['do'] == 'createpage' && isset($user_schema->chosenPage) && $user_schema->chosenPage != 0))) {
- /**
+ /**
* show Export schema generation options
*/
$user_schema->displaySchemaGenerationOptions();
diff --git a/schema_export.php b/schema_export.php
index 3e1067d..2abe91f 100644
--- a/schema_export.php
+++ b/schema_export.php
@@ -13,7 +13,7 @@ require './libraries/StorageEngine.class.php';
/**
* Include settings for relation stuff
- * get all variables needed for exporting relational schema
+ * get all variables needed for exporting relational schema
* in $cfgRelation
*/
require_once './libraries/relation.lib.php';
@@ -21,14 +21,6 @@ $cfgRelation = PMA_getRelationsParam();
require_once './libraries/transformations.lib.php';
require_once './libraries/Index.class.php';
-
-/**
- * This is to avoid "Command out of sync" errors. Before switching this to
- * a value of 0 (for MYSQLI_USE_RESULT), please check the logic
- * to free results wherever needed.
- */
-$query_default_option = PMA_DBI_QUERY_STORE;
-
include_once("./libraries/schema/Export_Relation_Schema.class.php");
/**
@@ -47,4 +39,4 @@ if (!file_exists('./libraries/schema/' . $path . '_Relation_Schema.class.php'))
PMA_Export_Relation_Schema::dieSchema($_POST['chpage'],$export_type,__('File doesn\'t exist'));
}
include("./libraries/schema/".$path."_Relation_Schema.class.php");
-$obj_schema = eval("new PMA_".$path."_Relation_Schema();");
\ No newline at end of file
+$obj_schema = eval("new PMA_".$path."_Relation_Schema();");
hooks/post-receive
--
phpMyAdmin