[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5RC1-5890-g362aa51
Marc Delisle
lem9 at users.sourceforge.net
Thu Jul 22 20:11:06 CEST 2010
The branch, master has been updated
via 362aa516ac7b4b384e9cfb5d7aa7683b6b38515d (commit)
from ec9a60f8e09463ea34cdd11849b4c2357c4351e5 (commit)
- Log -----------------------------------------------------------------
commit 362aa516ac7b4b384e9cfb5d7aa7683b6b38515d
Author: Marc Delisle <marc at infomarc.info>
Date: Thu Jul 22 14:10:58 2010 -0400
undefined $primary_field
-----------------------------------------------------------------------
Summary of changes:
libraries/blobstreaming.lib.php | 31 +++++++++++++++++++++++++++++++
tbl_replace.php | 4 ++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/libraries/blobstreaming.lib.php b/libraries/blobstreaming.lib.php
index abbe047..5403e76 100644
--- a/libraries/blobstreaming.lib.php
+++ b/libraries/blobstreaming.lib.php
@@ -473,4 +473,35 @@ function PMA_BS_getURL($reference)
$bs_url = 'http://' . $bs_server . '/' . rtrim($reference);
return $bs_url;
}
+
+/**
+ * returns the field name for a primary key of a given table in a given database
+ *
+ * @access public
+ * @param string - database name
+ * @param string - table name
+ * @uses PMA_DBI_select_db()
+ * @uses PMA_backquote()
+ * @uses PMA_DBI_query()
+ * @uses PMA_DBI_fetch_assoc()
+ * @return string - field name for primary key
+*/
+function PMA_BS_GetPrimaryField($db_name, $tbl_name)
+{
+ // select specified database
+ PMA_DBI_select_db($db_name);
+
+ // retrieve table fields
+ $query = "SHOW FULL FIELDS FROM " . PMA_backquote($tbl_name);
+ $result = PMA_DBI_query($query);
+
+ // while there are records to parse
+ while ($data = PMA_DBI_fetch_assoc($result)) {
+ if ("PRI" == $data['Key']) {
+ return $data['Field'];
+ }
+ }
+ // return NULL on no primary key
+ return NULL;
+}
?>
diff --git a/tbl_replace.php b/tbl_replace.php
index 48b98c1..d3271ac 100644
--- a/tbl_replace.php
+++ b/tbl_replace.php
@@ -210,6 +210,10 @@ foreach ($loop_array as $rowcount => $where_clause) {
? $_REQUEST['auto_increment']['multi_edit'][$rowcount]
: null;
+ if ($blob_streaming_active) {
+ $primary_field = PMA_BS_GetPrimaryField($GLOBALS['db'], $GLOBALS['table']);
+ }
+
// Fetch the current values of a row to use in case we have a protected field
// @todo possibly move to ./libraries/tbl_replace_fields.inc.php
if ($is_insert && $using_key && isset($me_fields_type) && is_array($me_fields_type) && isset($where_clause)) {
hooks/post-receive
--
phpMyAdmin
More information about the Git
mailing list