summaryrefslogtreecommitdiff
path: root/drivers/adodb-odbc.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/adodb-odbc.inc.php')
-rw-r--r--drivers/adodb-odbc.inc.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/adodb-odbc.inc.php b/drivers/adodb-odbc.inc.php
index 4ab7a031..52b26307 100644
--- a/drivers/adodb-odbc.inc.php
+++ b/drivers/adodb-odbc.inc.php
@@ -1,6 +1,6 @@
<?php
/*
-@version v5.20.10 08-Mar-2018
+@version v5.21.0-dev ??-???-2016
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
@@ -17,6 +17,18 @@ if (!defined('ADODB_DIR')) die();
define("_ADODB_ODBC_LAYER", 2 );
+/*
+ * These constants are used to set define MetaColumns() method's behavior.
+ * - METACOLUMNS_RETURNS_ACTUAL makes the driver return the actual type,
+ * like all other drivers do (default)
+ * - METACOLUMNS_RETURNS_META is provided for legacy compatibility (makes
+ * driver behave as it did prior to v5.21)
+ *
+ * @see $metaColumnsReturnType
+ */
+DEFINE('METACOLUMNS_RETURNS_ACTUAL', 0);
+DEFINE('METACOLUMNS_RETURNS_META', 1);
+
/*--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------*/
@@ -40,6 +52,11 @@ class ADODB_odbc extends ADOConnection {
var $_has_stupid_odbc_fetch_api_change = true;
var $_lastAffectedRows = 0;
var $uCaseTables = true; // for meta* functions, uppercase table names
+
+ /*
+ * Tells the metaColumns feature whether to return actual or meta type
+ */
+ public $metaColumnsReturnType = METACOLUMNS_RETURNS_ACTUAL;
function __construct()
{
@@ -461,7 +478,16 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
$fld = new ADOFieldObject();
$fld->name = $rs->fields[3];
- $fld->type = $this->ODBCTypes($rs->fields[4]);
+ if ($this->metaColumnsReturnType == METACOLUMNS_RETURNS_META)
+ /*
+ * This is the broken, original value
+ */
+ $fld->type = $this->ODBCTypes($rs->fields[4]);
+ else
+ /*
+ * This is the correct new value
+ */
+ $fld->type = $rs->fields[4];
// ref: http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraccgen/html/msdn_odk.asp
// access uses precision to store length for char/varchar