v5:reference:connection:setcustomactualtype
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
v5:reference:connection:setcustomactualtype [2021/01/12 03:58] – mnewnham | v5:reference:connection:setcustomactualtype [2021/01/18 03:59] (current) – removed mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== setCustomActualType ====== | ||
- | ~~NOTOC~~ | ||
- | <WRAP right box> | ||
- | **From Version 5.22**\\ | ||
- | ==See Also== | ||
- | [[v5: | ||
- | == Syntax == | ||
- | bool setCustomActualType( | ||
- | | ||
- | | ||
- | ) | ||
- | </ | ||
- | ===== Description ===== | ||
- | The function '' | ||
- | |||
- | ===== Examples ===== | ||
- | ==== Creating A New Type ==== | ||
- | The system can be expanded to accept geometry type data types by creating new types | ||
- | <code php> | ||
- | |||
- | /* | ||
- | * $db = MySQL connection assumed | ||
- | */ | ||
- | |||
- | /* | ||
- | * First link the MySQL geometry type to a new metaType | ||
- | */ | ||
- | $ok = $db-> | ||
- | |||
- | /* | ||
- | * Now tell ADOdb how to handle the data in inserts and updates | ||
- | * see the entry for setCustomMetaType for an explanation | ||
- | */ | ||
- | $ok = $db-> | ||
- | |||
- | /* | ||
- | * Insert a record with a point column | ||
- | */ | ||
- | $ar = array(); | ||
- | $ar[' | ||
- | |||
- | /* | ||
- | * Use getinsertsql to generate the insert statement | ||
- | */ | ||
- | $sql = " | ||
- | $result = $db-> | ||
- | |||
- | $sql = $db-> | ||
- | |||
- | /* | ||
- | * returns " | ||
- | */ | ||
- | </ | ||
- | |||
- | ===== Overriding An Existing Type ===== | ||
- | The system can be used to control the behavior of existing types. For example, in ADOdb V5.22, the **D** metaType in the Microsoft SQL Server points to Physical DATE type field, instead of the DATETIME field previously used. To make code compatible with previous versions, the following method can be used. | ||
- | <code php> | ||
- | |||
- | /* | ||
- | * $db = SQL Server connection assumed | ||
- | */ | ||
- | |||
- | /* | ||
- | * Point the actual type to a D metatype. | ||
- | */ | ||
- | $db-> | ||
- | |||
- | /* | ||
- | * Next, point the metaType D back to the datetime2 type, and tell it | ||
- | * to handle the data as datetime | ||
- | */ | ||
- | $db-> | ||
- | </ | ||
v5/reference/connection/setcustomactualtype.1610420313.txt.gz · Last modified: 2021/01/12 03:58 by mnewnham