v5:reference:connection:setcustommetatype
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
v5:reference:connection:setcustommetatype [2021/01/12 04:08] – mnewnham | v5:reference:connection:setcustommetatype [2021/01/17 04:11] – [Using a closure] mnewnham | ||
---|---|---|---|
Line 9: | Line 9: | ||
| | ||
| | ||
- | mixed $handler | + | string $dictionayType, |
+ | mixed $handleAsType=false, | ||
+ | mixed $callBack=false | ||
) | ) | ||
</ | </ | ||
Line 15: | Line 17: | ||
The function '' | The function '' | ||
------------------------------------------------------- | ------------------------------------------------------- | ||
- | ===== MetaType | + | ===== $metaType |
- | A valid metatype | + | An existing or new type. The type definition should be an uppercase alpha-numeric value, e.g. **P** |
- | ===== ActualType | + | ===== $actualType ===== |
- | A Database specific field type, mapped to the metaType | + | The physical data type as provided by the database, for example the POINT data type in the mySQL returns 255. |
+ | |||
+ | ===== $dictionaryType | ||
+ | A Database specific field type, mapped to the metaType, e.g. **POINT**. This tells ADOdb how to handle the data n inserts and updates. | ||
+ | ===== $handleAsType ==== | ||
+ | One of the standard [[v5: | ||
===== Data Handler ===== | ===== Data Handler ===== | ||
- | The handler can be one of three types: | + | The handler can be one of these types: |
- | - Not set: No post processing of data prior to insertion of data | + | - Not set: No pre-processing of data prior to insertion of data. |
- | - String: Post processing of data based on the string value of a specific [[v5: | + | |
- Object: An anonymous function that can be used to process data. | - Object: An anonymous function that can be used to process data. | ||
+ | The callback function can be used to apply any changes to the data **prior** to the processing as type. | ||
===== Examples ===== | ===== Examples ===== | ||
==== Using A Passthrough Handler | ==== Using A Passthrough Handler | ||
Line 42: | Line 49: | ||
/* | /* | ||
* Now tell ADOdb how to handle the data in inserts and updates | * Now tell ADOdb how to handle the data in inserts and updates | ||
- | * see the entry for setCustomMetaType for an explanation | ||
*/ | */ | ||
$ok = $db-> | $ok = $db-> | ||
Line 65: | Line 71: | ||
}; | }; | ||
- | $ok = $db-> | + | $ok = $db-> |
</ | </ | ||
Line 74: | Line 80: | ||
* We must define the custom type before loading the data dictionary | * We must define the custom type before loading the data dictionary | ||
*/ | */ | ||
- | $ok = $db-> | + | $ok = $db-> |
- | $ok = $db-> | + | |
/* | /* |
v5/reference/connection/setcustommetatype.txt · Last modified: 2021/01/20 01:30 by mnewnham