aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Webster <noxwizard@phpbb.com>2013-11-03 00:37:18 -0500
committerPatrick Webster <noxwizard@phpbb.com>2013-11-03 00:37:18 -0500
commitad44407b19daaa861e91b75c2c40ae4655121e7f (patch)
tree4e088e45ec2dd7172477ae38be53ae399ea8d8df
parent8f88ff093ee1f9f66a91aba46970dcba9188c8c4 (diff)
downloadforums-ad44407b19daaa861e91b75c2c40ae4655121e7f.tar
forums-ad44407b19daaa861e91b75c2c40ae4655121e7f.tar.gz
forums-ad44407b19daaa861e91b75c2c40ae4655121e7f.tar.bz2
forums-ad44407b19daaa861e91b75c2c40ae4655121e7f.tar.xz
forums-ad44407b19daaa861e91b75c2c40ae4655121e7f.zip
[ticket/11990] Remove result_mssqlnative usage in acp_database.php
The class result_mssqlnative was removed in ticket 11980. This removes the dependency on that class from the database backup utility. It is possible to use the sqlsrv functions to retrieve the field information, but they must be then mapped back to type names. That mapping was removed in 11980 and it is easier to just look it up in the information schema table. PHPBB3-11990
-rw-r--r--phpBB/includes/acp/acp_database.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 86879de816..8afc3709b9 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -1607,16 +1607,17 @@ class mssql_extractor extends base_extractor
return;
}
- $sql = "SELECT * FROM $table_name";
- $result_fields = $db->sql_query_limit($sql, 1);
-
- $row = new result_mssqlnative($result_fields);
- $i_num_fields = $row->num_fields();
+ $sql = "SELECT COLUMN_NAME, DATA_TYPE
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = '" . $db->sql_escape($table_name) . "'";
+ $result_fields = $db->sql_query($sql);
- for ($i = 0; $i < $i_num_fields; $i++)
+ $i_num_fields = 0;
+ while ($row = $db->sql_fetchrow($result_fields))
{
- $ary_type[$i] = $row->field_type($i);
- $ary_name[$i] = $row->field_name($i);
+ $ary_type[$i_num_fields] = $row['DATA_TYPE'];
+ $ary_name[$i_num_fields] = $row['COLUMN_NAME'];
+ $i_num_fields++;
}
$db->sql_freeresult($result_fields);