MDB2
[ class tree: MDB2 ] [ index: MDB2 ] [ all elements ]

Source for file Driver_Datatype_skeleton.php

Documentation is available at Driver_Datatype_skeleton.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP versions 4 and 5                                                 |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1998-2004 Manuel Lemos, Tomas V.V.Cox,                 |
  6. // | Stig. S. Bakken, Lukas Smith                                         |
  7. // | All rights reserved.                                                 |
  8. // +----------------------------------------------------------------------+
  9. // | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
  10. // | API as well as database abstraction for PHP applications.            |
  11. // | This LICENSE is in the BSD license style.                            |
  12. // |                                                                      |
  13. // | Redistribution and use in source and binary forms, with or without   |
  14. // | modification, are permitted provided that the following conditions   |
  15. // | are met:                                                             |
  16. // |                                                                      |
  17. // | Redistributions of source code must retain the above copyright       |
  18. // | notice, this list of conditions and the following disclaimer.        |
  19. // |                                                                      |
  20. // | Redistributions in binary form must reproduce the above copyright    |
  21. // | notice, this list of conditions and the following disclaimer in the  |
  22. // | documentation and/or other materials provided with the distribution. |
  23. // |                                                                      |
  24. // | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
  25. // | Lukas Smith nor the names of his contributors may be used to endorse |
  26. // | or promote products derived from this software without specific prior|
  27. // | written permission.                                                  |
  28. // |                                                                      |
  29. // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
  30. // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
  31. // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
  32. // | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
  33. // | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
  34. // | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
  35. // | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
  36. // |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
  37. // | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
  38. // | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
  39. // | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
  40. // | POSSIBILITY OF SUCH DAMAGE.                                          |
  41. // +----------------------------------------------------------------------+
  42. // | Author: YOUR NAME <YOUR EMAIL>                                       |
  43. // +----------------------------------------------------------------------+
  44. //
  45. // $Id: Driver_Datatype_skeleton.php,v 1.6 2005/01/02 21:40:20 lsmith Exp $
  46. //
  47.  
  48. // This is just a skeleton MDB2 driver.
  49. // There may be methods missing as this skeleton is based on the methods
  50. // implemented by the MySQL and PostGreSQL drivers in MDB2.
  51. // Some methods may not have to be implemented in the driver, because the
  52. // implementation in common.php is compatible with the given RDBMS.
  53. // In each of the listed methods I have added comments that tell you where
  54. // to look for a "reference" implementation.
  55. // Some of these methods have been expanded or changed slightly in MDB2.
  56. // Looking in the relevant MDB2 Wrapper should give you some pointers, some
  57. // other difference you will only discover by looking at one of the existing
  58. // MDB2 driver or the common implementation in common.php.
  59. // One thing that will definately have to be modified in all "reference"
  60. // implementations of Metabase methods is the error handling.
  61. // Anyways don't worry if you are having problems: Lukas Smith is here to help!
  62.  
  63. require_once 'MDB2/Driver/Datatype/Common.php';
  64.  
  65. /**
  66.  * MDB2 XXX driver
  67.  *
  68.  * @package MDB2
  69.  * @category Database
  70.  * @author  YOUR NAME <YOUR EMAIL>
  71.  */
  72. class MDB2_Datatype_xxx extends MDB2_Datatype_Common
  73. {
  74.     // }}}
  75.     // {{{ convertResult()
  76.  
  77.     /**
  78.     * convert a value to a RDBMS indepdenant MDB2 type
  79.     *
  80.     * @param mixed  $value   value to be converted
  81.     * @param int    $type    constant that specifies which type to convert to
  82.     * @return mixed converted value
  83.     * @access public
  84.     */
  85.     function convertResult($value$type)
  86.     {
  87.         $db =$GLOBALS['_MDB2_databases'][$this->db_index];
  88.         // take this from the corresponding Metabase driver: ConvertResult()
  89.     }
  90.  
  91.     // }}}
  92.     // {{{ get*Declaration()
  93.  
  94.     // take phpdoc comments from MDB2 common.php: get*Declaration()
  95.  
  96.     function get*Declaration($name$field)
  97.     {
  98.         $db =$GLOBALS['_MDB2_databases'][$this->db_index];
  99.         // take this from the corresponding Metabase driver: Get*FieldValue()
  100.     }
  101.  
  102.     // }}}
  103.     // {{{ quote*()
  104.  
  105.     /**
  106.      * Convert a text value into a DBMS specific format that is suitable to
  107.      * compose query statements.
  108.      *
  109.      * @param resource  $prepared_query query handle from prepare()
  110.      * @param           $parameter 
  111.      * @param           $clob 
  112.      * @return string  text string that represents the given argument value in
  113.      *                  a DBMS specific format.
  114.      * @access public
  115.      */
  116.     function quote*($prepared_query$parameter$clob)
  117.     {
  118.         $db =$GLOBALS['_MDB2_databases'][$this->db_index];
  119.         // take this from the corresponding Metabase driver: Get*FieldValue()
  120.     }
  121.  
  122.     // }}}
  123.     // {{{ quoteClob()
  124.  
  125.     /**
  126.      * Convert a text value into a DBMS specific format that is suitable to
  127.      * compose query statements.
  128.      *
  129.      * @param resource  $prepared_query query handle from prepare()
  130.      * @param           $parameter 
  131.      * @param           $clob 
  132.      * @return string  text string that represents the given argument value in
  133.      *                  a DBMS specific format.
  134.      * @access public
  135.      */
  136.     function quoteClob($prepared_query$parameter$clob)
  137.     {
  138.         $db =$GLOBALS['_MDB2_databases'][$this->db_index];
  139.         // take this from the corresponding Metabase driver: GetCLOBFieldValue()
  140.     }
  141.  
  142.     // }}}
  143.     // {{{ quoteBlob()
  144.  
  145.     /**
  146.      * Convert a text value into a DBMS specific format that is suitable to
  147.      * compose query statements.
  148.      *
  149.      * @param resource  $prepared_query query handle from prepare()
  150.      * @param           $parameter 
  151.      * @param           $blob 
  152.      * @return string  text string that represents the given argument value in
  153.      *                  a DBMS specific format.
  154.      * @access public
  155.      */
  156.     function quoteBlob($prepared_query$parameter$blob)
  157.     {
  158.         $db =$GLOBALS['_MDB2_databases'][$this->db_index];
  159.         // take this from the corresponding Metabase driver: GetBLOBFieldValue()
  160.     }
  161.  
  162.     // }}}
  163. }
  164.  
  165. ?>

Documentation generated on Mon, 11 Mar 2019 14:20:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.