diff options
| author | Damien Regad <dregad@mantisbt.org> | 2021-01-24 14:37:08 +0100 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2021-01-24 14:37:08 +0100 |
| commit | 8856265c933087030627484c53d36ed5dae29e86 (patch) | |
| tree | b01995e8724c3d6647590be1e021ac3f959ad8f5 /adodb-lib.inc.php | |
| parent | 1ac1ae3625509e85d7b0b36fe8d55b1a8ba04363 (diff) | |
| parent | d3a7fa0f8c5c2a863da144f3d2b4dfb23396bca9 (diff) | |
| download | adodb-8856265c933087030627484c53d36ed5dae29e86.tar.gz adodb-8856265c933087030627484c53d36ed5dae29e86.tar.bz2 adodb-8856265c933087030627484c53d36ed5dae29e86.zip | |
Merge remote-tracking branch 'origin/master' into master
Diffstat (limited to 'adodb-lib.inc.php')
| -rw-r--r-- | adodb-lib.inc.php | 94 |
1 files changed, 89 insertions, 5 deletions
diff --git a/adodb-lib.inc.php b/adodb-lib.inc.php index c36e0194..9f58a73b 100644 --- a/adodb-lib.inc.php +++ b/adodb-lib.inc.php @@ -996,11 +996,52 @@ static $cacheCols; function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFields, $magicq) { $sql = ''; + + if (array_key_exists($type,$zthis->customMetaTypes)) + { + + $customMetaType = $zthis->customMetaTypes[$type]; + if ($customMetaType['handler'] === false) + /* + * Pass the value through unchanged + */ + $type = 'RAW'; + else if (is_object($customMetaType['handler'])) + { + /* + * An anonymous function + */ + $type = 'CALLBACK'; + $callback = $customMetaType['handler']; + } + else + /* + * Some type of metaType + */ + $type = $customMetaType['handler']; + } + + print_r($customMetaType); exit; - // Based on the datatype of the field - // Format the value properly for the database - switch($type) { - case 'B': + switch($type) { + + case 'RAW': + /* + * Custom field with no handling + */ + $val = $arrFields[$fname]; + break; + + case 'CALLBACK': + /* + * An anonymous function + */ + $val = $callback($var); + break; + + // Based on the datatype of the field + // Format the value properly for the database + case 'B': //in order to handle Blobs correctly, we need //to do some magic for Oracle @@ -1073,8 +1114,51 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields, } } - + + /* + * Upfront check for custom meta types. We do this + * first to allow for overriding of existing types + */ + if (array_key_exists($type,$zthis->customMetaTypes)) + { + + $customMetaType = $zthis->customMetaTypes[$type]; + + if ($customMetaType['handler'] === false) + /* + * Pass the value through unchanged + */ + $type = -1; + else if (is_object($customMetaType['callback'])) + { + /* + * An anonymous function + */ + $type = -1; + + $callback = $customMetaType['callback']; + + $val = $arrFields[$fname]; + $val = $callback($val); + if ($customMetaType['handler']) + $type = $customMetaType['handler']; + } + else + /* + * Some type of metaType + */ + $type = $customMetaType['handler']; + } + switch($type) { + + case -1: + /* + * Custom field with no handling + */ + $val = $arrFields[$fname]; + break; + case "C": case "X": case 'B': |
