本文整理汇总了PHP中PMA_Table::isUpdatableView方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Table::isUpdatableView方法的具体用法?PHP PMA_Table::isUpdatableView怎么用?PHP PMA_Table::isUpdatableView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Table
的用法示例。
在下文中一共展示了PMA_Table::isUpdatableView方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_sendQueryResponseForResultsReturned
/**
* Function to display results when the executed query returns non empty results
*
* @param array $result executed query results
* @param array $analyzed_sql_results analysed sql results
* @param string $db current database
* @param string $table current table
* @param string $disp_mode display mode
* @param string $message message to show
* @param array $sql_data sql data
* @param object $displayResultsObject Instance of DisplayResults.class
* @param string $goto goto page url
* @param string $pmaThemeImage uri of the theme image
* @param string $sql_limit_to_append sql limit to append
* @param int $unlim_num_rows unlimited number of rows
* @param int $num_rows number of rows
* @param string $full_sql_query full sql query
* @param string $disp_query display query
* @param string $disp_message display message
* @param array $profiling_results profiling results
* @param string $query_type query type
* @param array|null $selectedTables array of table names selected from
* the database structure page, for an
* action like check table, optimize
* table, analyze table or repair table
* @param string $sql_query sql query
* @param string $complete_query complete sql query
*
* @return void
*/
function PMA_sendQueryResponseForResultsReturned($result, $analyzed_sql_results, $db, $table, $disp_mode, $message, $sql_data, $displayResultsObject, $goto, $pmaThemeImage, $sql_limit_to_append, $unlim_num_rows, $num_rows, $full_sql_query, $disp_query, $disp_message, $profiling_results, $query_type, $selectedTables, $sql_query, $complete_query)
{
// If we are retrieving the full value of a truncated field or the original
// value of a transformed field, show it here
if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
PMA_sendResponseForGridEdit($result);
// script has exited at this point
}
// Gets the list of fields properties
if (isset($result) && $result) {
$fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
}
// Should be initialized these parameters before parsing
$showtable = isset($showtable) ? $showtable : null;
$url_query = isset($url_query) ? $url_query : null;
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
// hide edit and delete links:
// - for information_schema
// - if the result set does not contain all the columns of a unique key
// (unless this is an updatable view)
$sele_exp_cls = $analyzed_sql_results['analyzed_sql'][0]['select_expr_clause'];
$updatableView = trim($sele_exp_cls) == '*' && PMA_Table::isUpdatableView($db, $table);
$has_unique = PMA_resultSetContainsUniqueKey($db, $table, $fields_meta);
$just_one_table = PMA_resultSetHasJustOneTable($fields_meta);
$editable = ($has_unique || $updatableView) && $just_one_table;
// Displays the results in a table
if (empty($disp_mode)) {
// see the "PMA_setDisplayMode()" function in
// libraries/DisplayResults.class.php
$disp_mode = 'urdr111101';
}
if (!empty($table) && ($GLOBALS['dbi']->isSystemSchema($db) || !$editable)) {
$disp_mode = 'nnnn110111';
}
if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
$disp_mode = 'nnnn000000';
}
if (isset($_REQUEST['table_maintenance'])) {
$scripts->addFile('makegrid.js');
$scripts->addFile('sql.js');
$table_maintenance_html = '';
if (isset($message)) {
$message = PMA_Message::success($message);
$table_maintenance_html = PMA_Util::getMessage($message, $GLOBALS['sql_query'], 'success');
}
$table_maintenance_html .= PMA_getHtmlForSqlQueryResultsTable(isset($sql_data) ? $sql_data : null, $displayResultsObject, $db, $goto, $pmaThemeImage, $url_query, $disp_mode, $sql_limit_to_append, false, $unlim_num_rows, $num_rows, $showtable, $result, $analyzed_sql_results);
if (empty($sql_data) || ($sql_data['valid_queries'] = 1)) {
$response->addHTML($table_maintenance_html);
exit;
}
}
if (!isset($_REQUEST['printview']) || $_REQUEST['printview'] != '1') {
$scripts->addFile('makegrid.js');
$scripts->addFile('sql.js');
unset($GLOBALS['message']);
//we don't need to buffer the output in getMessage here.
//set a global variable and check against it in the function
$GLOBALS['buffer_message'] = false;
}
$print_view_header_html = PMA_getHtmlForPrintViewHeader($db, $full_sql_query, $num_rows);
$previous_update_query_html = PMA_getHtmlForPreviousUpdateQuery(isset($disp_query) ? $disp_query : null, $GLOBALS['cfg']['ShowSQL'], isset($sql_data) ? $sql_data : null, isset($disp_message) ? $disp_message : null);
$profiling_chart_html = PMA_getHtmlForProfilingChart($disp_mode, $db, isset($profiling_results) ? $profiling_results : null);
$missing_unique_column_msg = PMA_getMessageIfMissingColumnIndex($table, $db, $editable);
$bookmark_created_msg = PMA_getBookmarkCreatedMessage();
$table_html = PMA_getHtmlForSqlQueryResultsTable(isset($sql_data) ? $sql_data : null, $displayResultsObject, $db, $goto, $pmaThemeImage, $url_query, $disp_mode, $sql_limit_to_append, $editable, $unlim_num_rows, $num_rows, $showtable, $result, $analyzed_sql_results);
$indexes_problems_html = PMA_getHtmlForIndexesProblems(isset($query_type) ? $query_type : null, isset($selectedTables) ? $selectedTables : null, $db);
$cfgBookmark = PMA_Bookmark_getParams();
if ($cfgBookmark) {
//.........这里部分代码省略.........
示例2: testIsUpdatableView
/**
* Test for isUpdatableView
*
* @return void
*/
public function testIsUpdatableView()
{
$table = new PMA_Table(null, null);
$this->assertEquals(false, $table->isUpdatableView());
//validate that it is the same as DBI fetchResult
$table = new PMA_Table('PMA_BookMark', 'PMA');
$this->assertEquals(true, $table->isUpdatableView());
$table = new PMA_Table('PMA_BookMark_2', 'PMA');
$this->assertEquals(false, $table->isUpdatableView());
}
示例3: PMA_getQueryResponseForResultsReturned
/**
* Function to display results when the executed query returns non empty results
*
* @param object $result executed query results
* @param array $analyzed_sql_results analysed sql results
* @param string $db current database
* @param string $table current table
* @param string $message message to show
* @param array $sql_data sql data
* @param PMA_DisplayResults $displayResultsObject Instance of DisplayResults.class
* @param string $pmaThemeImage uri of the theme image
* @param int $unlim_num_rows unlimited number of rows
* @param int $num_rows number of rows
* @param string $disp_query display query
* @param string $disp_message display message
* @param array $profiling_results profiling results
* @param string $query_type query type
* @param array|null $selectedTables array of table names selected
* from
* the database structure page, for
* an action like check table,
* optimize table, analyze table or
* repair table
* @param string $sql_query sql query
* @param string $complete_query complete sql query
*
* @return string html
*/
function PMA_getQueryResponseForResultsReturned($result, $analyzed_sql_results, $db, $table, $message, $sql_data, $displayResultsObject, $pmaThemeImage, $unlim_num_rows, $num_rows, $disp_query, $disp_message, $profiling_results, $query_type, $selectedTables, $sql_query, $complete_query)
{
// If we are retrieving the full value of a truncated field or the original
// value of a transformed field, show it here
if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
PMA_sendResponseForGridEdit($result);
// script has exited at this point
}
// Gets the list of fields properties
if (isset($result) && $result) {
$fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
}
// Should be initialized these parameters before parsing
$showtable = isset($showtable) ? $showtable : null;
$url_query = isset($url_query) ? $url_query : null;
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
// hide edit and delete links:
// - for information_schema
// - if the result set does not contain all the columns of a unique key
// (unless this is an updatable view)
$updatableView = false;
$statement = $analyzed_sql_results['statement'];
if ($statement instanceof SqlParser\Statements\SelectStatement) {
if (!empty($statement->expr)) {
if ($statement->expr[0]->expr === '*') {
$_table = new PMA_Table($table, $db);
$updatableView = $_table->isUpdatableView();
}
}
}
$has_unique = PMA_resultSetContainsUniqueKey($db, $table, $fields_meta);
$just_one_table = PMA_resultSetHasJustOneTable($fields_meta);
$editable = ($has_unique || $GLOBALS['cfg']['RowActionLinksWithoutUnique'] || $updatableView) && $just_one_table;
$displayParts = array('edit_lnk' => $displayResultsObject::UPDATE_ROW, 'del_lnk' => $displayResultsObject::DELETE_ROW, 'sort_lnk' => '1', 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '0', 'pview_lnk' => '1');
if (!empty($table) && ($GLOBALS['dbi']->isSystemSchema($db) || !$editable)) {
$displayParts = array('edit_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'del_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'sort_lnk' => '1', 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1');
}
if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
$displayParts = array('edit_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'del_lnk' => $displayResultsObject::NO_EDIT_OR_DELETE, 'sort_lnk' => '0', 'nav_bar' => '0', 'bkm_form' => '0', 'text_btn' => '0', 'pview_lnk' => '0');
}
if (isset($_REQUEST['table_maintenance'])) {
$scripts->addFile('makegrid.js');
$scripts->addFile('sql.js');
$table_maintenance_html = '';
if (isset($message)) {
$message = PMA_Message::success($message);
$table_maintenance_html = PMA_Util::getMessage($message, $GLOBALS['sql_query'], 'success');
}
$table_maintenance_html .= PMA_getHtmlForSqlQueryResultsTable($displayResultsObject, $pmaThemeImage, $url_query, $displayParts, false, $unlim_num_rows, $num_rows, $showtable, $result, $analyzed_sql_results);
if (empty($sql_data) || ($sql_data['valid_queries'] = 1)) {
$response->addHTML($table_maintenance_html);
exit;
}
}
if (!isset($_REQUEST['printview']) || $_REQUEST['printview'] != '1') {
$scripts->addFile('makegrid.js');
$scripts->addFile('sql.js');
unset($GLOBALS['message']);
//we don't need to buffer the output in getMessage here.
//set a global variable and check against it in the function
$GLOBALS['buffer_message'] = false;
}
$previous_update_query_html = PMA_getHtmlForPreviousUpdateQuery(isset($disp_query) ? $disp_query : null, $GLOBALS['cfg']['ShowSQL'], isset($sql_data) ? $sql_data : null, isset($disp_message) ? $disp_message : null);
$profiling_chart_html = PMA_getHtmlForProfilingChart($url_query, $db, isset($profiling_results) ? $profiling_results : array());
$missing_unique_column_msg = PMA_getMessageIfMissingColumnIndex($table, $db, $editable, $has_unique);
$bookmark_created_msg = PMA_getBookmarkCreatedMessage();
$table_html = PMA_getHtmlForSqlQueryResultsTable($displayResultsObject, $pmaThemeImage, $url_query, $displayParts, $editable, $unlim_num_rows, $num_rows, $showtable, $result, $analyzed_sql_results);
$indexes_problems_html = PMA_getHtmlForIndexesProblems(isset($query_type) ? $query_type : null, isset($selectedTables) ? $selectedTables : null, $db);
$cfgBookmark = PMA_Bookmark_getParams();
if ($cfgBookmark) {
//.........这里部分代码省略.........
示例4: testIsUpdatableView
/**
* Test for isUpdatableView
*
* @return void
*/
public function testIsUpdatableView()
{
$this->assertEquals(false, PMA_Table::isUpdatableView());
//validate that it is the same as DBI fetchResult
$this->assertEquals(true, PMA_Table::isUpdatableView('PMA', 'PMA_BookMark'));
$this->assertEquals(false, PMA_Table::isUpdatableView('PMA', 'PMA_BookMark_2'));
}
示例5: PMA_resultSetContainsUniqueKey
echo '}';
echo '</script>';
echo '</fieldset>' . "\n";
}
// Displays the results in a table
if (empty($disp_mode)) {
// see the "PMA_setDisplayMode()" function in
// libraries/DisplayResults.class.php
$disp_mode = 'urdr111101';
}
$resultSetContainsUniqueKey = PMA_resultSetContainsUniqueKey($db, $table, $fields_meta);
// hide edit and delete links:
// - for information_schema
// - if the result set does not contain all the columns of a unique key
// and we are not just browing all the columns of an updatable view
$updatableView = $justBrowsing && trim($analyzed_sql[0]['select_expr_clause']) == '*' && PMA_Table::isUpdatableView($db, $table);
$editable = $resultSetContainsUniqueKey || $updatableView;
if (PMA_is_system_schema($db) || !$editable) {
$disp_mode = 'nnnn110111';
$msg = PMA_message::notice(__('This table does not contain a unique column.' . ' Grid edit, checkbox, Edit, Copy and Delete features' . ' are not available.'));
$msg->display();
}
if (isset($label)) {
$msg = PMA_message::success(__('Bookmark %s created'));
$msg->addParam($label);
$msg->display();
}
// Should be initialized these parameters before parsing
$showtable = isset($showtable) ? $showtable : null;
$printview = isset($printview) ? $printview : null;
$url_query = isset($url_query) ? $url_query : null;