Source for file INFA_OCSP_DBOBJ.phpclass

Documentation is available at INFA_OCSP_DBOBJ.phpclass

  1. <?php
  2. /**
  3.   * interface file INFA_OCSP_DBOBJ.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms
  7.   * @category   field
  8.   *
  9.   * @author     Peter Krebs <pitlinz@sourceforge.net>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   ***/
  13.  
  14.  
  15. /**
  16.   * interface to handle a database connection object
  17.   *
  18.   * @project    Open CSP-Management
  19.   * @package    dbms
  20.   *
  21.   * @author     Peter Krebs <pitlinz@sourceforge.net>
  22.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  23.   * 
  24.   * @since pk-08-01-31
  25.   */
  26. interface INFA_OCSP_DBOBJ
  27. {
  28.  
  29.     // ------------------------------------------------------
  30.     // class methods 
  31.     // ------------------------------------------------------
  32.     
  33.     // ---------------------------------------------------------------------------
  34.     // getter / setter
  35.     // ---------------------------------------------------------------------------    
  36.  
  37.     /**
  38.      * returns the dbType
  39.      * @return string 
  40.      */
  41.     public function getDBType();
  42.     
  43.     
  44.     /**
  45.       * checks if a table exists
  46.       *
  47.       * @param string $aTable table name
  48.       * @param boolean   $debug  since pk-03-10-24
  49.       *
  50.       * @returns bool
  51.       * 
  52.       */
  53.     public function tblExists($aTable,$debug=False);    
  54.     
  55.     // ------------------------------------------------------
  56.     // query methods
  57.     // ------------------------------------------------------
  58.      
  59.     /**
  60.       * generates a query and returns an array of the resultset
  61.       *
  62.       * limit <> a multidimensional array is returned (see queryArray)
  63.       * if limit = 1 a single array is returned (see quickQuery)
  64.       *
  65.       * conditions:
  66.       *     if the column starts with a ? the value is assumed to be an sql statement
  67.       *     if the column starts with a ~ a like condition is created
  68.       *     else  column=slashedvalue(value) is added to the query
  69.       *
  70.       * @param string $aTable (the table name)
  71.       * @param array $conditions (array(COLUMN => VALUE)) if VALUE does not starts with a '¿' t
  72.       * @param int $offset 
  73.       * @param int $limit (0 is unlimeted)
  74.       * @param string $orderBy (comma seperated list of fields to order)
  75.       * @param boolean $debug 
  76.       *
  77.       * @return array 
  78.       * @access public
  79.       *
  80.       *
  81.       */
  82.     public function getArray($aTable,$conditions=NULL,$offset=0,$limit=0,$orderBy="",$debug=FALSE);
  83.  
  84.     /**
  85.       * returns (a column) of the first row match
  86.       *
  87.       * if $colNr > -1 the column value at position $colNr in
  88.       * the select statement is returned (NOTE: index starts at 0)
  89.       *
  90.       * if $colNr < 0 a array is returend
  91.       * if $usNames the DB-column names are the index otherwise
  92.       * the index of the returned are is the number in the select order
  93.       *
  94.       * @param string $aQuery 
  95.       * @param int $colNr 
  96.       * @param boolean $withErrMsg 
  97.       * @param boolean $useNames 
  98.       * @param boolean $secMode 
  99.       * @param boolean $debug 
  100.       *
  101.       * @returns mixed
  102.       *
  103.       ***/
  104.     public function quickQuery($aQuery,$colNr=-1,$withErrMsg=False,$useNames=True,$secMode=True,$debug=False);    
  105.     
  106.     // ------------------------------------------------------
  107.     // data manipulation methods
  108.     // ------------------------------------------------------
  109.     
  110.     /**
  111.       * inserts a valueArr into the table
  112.       *
  113.       * inserts a new row out of an array
  114.       * returns the value of the auto_increment field or TRUE
  115.       * in case of an error it returns FALSE
  116.       *
  117.       * @param string $table      name of the table to insert
  118.       * @param array $valueArr   key=>value array
  119.       * @param boolean $debug      show debug information
  120.       * @param string $idFld 
  121.       *
  122.       * @returns int    key of auto-key or TRUE on success FALSE in case of error
  123.       *
  124.       */
  125.     public function insertArray($table,$valueArr,$debug=FALSE,$idFld="")
  126.  
  127.  
  128.     /**
  129.       * replace existing row or insert now if not exists
  130.       *
  131.       * inserts a row or update an existing row
  132.       * all existing values not in $valueArr (assoc)
  133.       * will be handeld by db spezifaction
  134.       * see mysql Doc: {@link http://www.mysql.com/doc/en/REPLACE.html}
  135.       *
  136.       * @param string $table name of the DBTABLE
  137.       * @param array $valueArr value array with FIELDNAME as Index
  138.       * @param boolean $debug show debug information
  139.       *
  140.       * @returns bool TRUE on success FALSE in case of error
  141.       *
  142.       */
  143.     public function replaceArray($table,&$valueArr,$debug=FALSE);
  144.  
  145.     /**
  146.      * updates $values in $aTable where $conditions
  147.      *
  148.      * @param string $aTable 
  149.      * @param array $conditions 
  150.      * @param array $values 
  151.      * @param int $limit 
  152.      * @param boolean $debug 
  153.      * 
  154.      * @return int number of effekted rows
  155.      * 
  156.      * @version pk-08-04-07
  157.      */
  158.     function updateArray($aTable,$conditions,$values,$limit 0,$debug false);    
  159.  
  160.     /**
  161.      * deletes an existing row where the primary key must be set in $valueArr
  162.      * 
  163.      * @param string $table name of the DBTABLE
  164.      * @param array $valueArr value array with FIELDNAME as Index
  165.      * @param boolean $debug show debug information
  166.      *
  167.      * @returns bool TRUE on success FALSE in case of error
  168.      *
  169.      */
  170.     public function deleteArray($table,&$valueArr,$debug=FALSE);        
  171.     
  172.     
  173.     // ------------------------------------------------------
  174.     // where condition functions 
  175.     // ------------------------------------------------------ 
  176.     
  177.     /**
  178.       * returns $aValue with slashes to use to create query strings
  179.       *
  180.       * @param string $aValue 
  181.       *
  182.       * @returns string
  183.       *
  184.       *
  185.       */
  186.     public function qs_getSlashedValue($aValue);    
  187.     
  188.     /**
  189.       * returns a sql statement for use in search
  190.       *
  191.       * @param string $searchStr 
  192.       * @param boolean $toUpper convert the searchStr to upper cases or leave it as is
  193.       * @param boolean $inline enclose the searchStr in placeholders (%search%)
  194.       * @param boolean $debug 
  195.       *
  196.       * @returns string
  197.       *
  198.       */
  199.     public function qs_getLikeStmt($searchStr,$toUpper=FALSE,$inline=TRUE,$debug=FALSE)
  200.     
  201. }
  202. ?>

Documentation generated on Thu, 08 Jan 2009 17:44:28 +0100 by phpDocumentor 1.4.0a2