Changes between Version 2 and Version 3 of commonMethods

Show
Ignore:
Timestamp:
04/16/08 19:01:13 (2 years ago)
Author:
malko (IP: 192.168.0.254)
Comment:

indentation

Legend:

Unmodified
Added
Removed
Modified
  • commonMethods

    v2 v3  
    88=== db::function setDefaultConnectionStr($connectionStr) === 
    99set the default connection string to be used when calling db::getInsance() with no arguments.  
    10 @param string $connectionStr the connection string is a semi colon separated list 
     10 - @param string $connectionStr the connection string is a semi colon separated list 
    1111                              of connection parameter in the order they appear in the constructor 
    1212                              preceeded by !classname:// 
     
    2424---- 
    2525=== db::getInstance($connectionStr=null,$setDefault=false) === 
    26 static method that return a single instance of the database corresponding to the given connection String. 
    27 This method must be copyed in the exended class as php is not able to get the name of the calling class (waiting php >= 5.3 for late static binding to get rid of this). 
    28 @param string $connectionStr the connection string is a semi colon separated list 
     26static method that return a single instance of the database corresponding to the given connection String.[[BR]] 
     27This method '''must''' be copyed in the exended class as php is not able to get the name of the calling class (waiting php >= 5.3 for late static binding to get rid of this). 
     28 - @param string $connectionStr the connection string is a semi colon separated list 
    2929                              of connection parameter in the order they appear in the constructor 
    3030                              preceeded by !classname:// 
     
    3333                              and a sqlitedb one will look like: 
    3434                              "!sqlitedb://dbfile" 
    35 @param bool $setDefault      if true then this database connection will be the default one 
     35 - @param bool $setDefault      if true then this database connection will be the default one 
    3636                              returned when no arguments are given. 
    3737                              For conveniance the first call to this method 
    3838                              will set the corresponding instance the default one 
    3939                              if none has been set before 
    40 @return db instance 
     40 - @return db instance 
    4141example 
    4242{{{ 
     
    4747---- 
    4848=== default __construct() === 
    49 '''''This way of creating an instance is not encourage anymore!''''' 
    50 @deprecated use @see getInstance instead 
     49'''''This way of creating an instance is not encourage anymore! ''''' 
     50 - @deprecated use @see getInstance instead 
    5151constructor stay public even if we have getInstance for 2 reason 
    5252 1. backward compatibility with existing scripts 
     
    5959== Selection methods == 
    6060=== select_rows($tables,$fields = '*', $conds = null,$result_type = 'ASSOC') === 
    61 send a select query to $table on requested $fields (all by default) and conforming to clause defined with $conditions 
     61send a select query to $table on requested $fields (all by default) and conforming to clause defined with $conditions[[BR]] 
    6262see process_conds for more info on $conditions parameter 
    63 @param string|array $Table 
    64 @param string|array $fields 
    65 @param string|array $conditions 
    66 @param string $res_type 'ASSOC', 'NUM' et 'BOTH' 
    67 @Return  array | false 
     63 - @param string|array $Table 
     64 - @param string|array $fields 
     65 - @param string|array $conditions 
     66 - @param string $res_type 'ASSOC', 'NUM' et 'BOTH' 
     67 - @Return  array | false 
    6868{{{ 
    6969#!php  
     
    7777equal to $res = select_rows followed by $res = $res[0]; 
    7878So most of the time you will use it with a condition clause ending by 'LIMIT 0,1' 
    79 @see select_rows for details 
    80 @return array of fields 
     79 - @see select_rows for details 
     80 - @return array of fields 
    8181{{{ 
    8282#!php  
     
    8787 
    8888=== select_associative($tables,$fields='*',$conds=null,$index_field='id',$value_fields=null,$keep_index=FALSE) === 
    89 just a quick way to do a select_rows followed by a associative_array_from_q2a_res 
     89just a quick way to do a select_rows followed by a associative_array_from_q2a_res[[BR]] 
    9090see both thoose method for more information about parameters or return values 
    9191''(in fact you will certainly rarely use associative_array_from_q2a_res but use select_associative most of the time)'' 
     
    117117=== select_value($table,$field,$conds=null) === 
    118118select a single value in database 
    119 @param string $table 
    120 @param string $field the field name where to pick-up value 
    121 @param mixed conds 
    122 @return mixed or FALSE 
     119 - @param string $table 
     120 - @param string $field the field name where to pick-up value 
     121 - @param mixed conds 
     122 - @return mixed or FALSE 
    123123{{{ 
    124124#!php  
     
    130130=== select_col($table,$field,$conds=null) === 
    131131select a single field in table and return all values 
    132 @param string $table 
    133 @param string $field name of the single field to retrieve 
    134 @param mixed  $conds 
    135 @return array or FALSE 
     132 - @param string $table 
     133 - @param string $field name of the single field to retrieve 
     134 - @param mixed  $conds 
     135 - @return array or FALSE 
    136136{{{ 
    137137#!php  
     
    142142 
    143143=== select_slice($table,$fields='*',$conds=null,$pageId=1,$pageNbRows=10) ===  
    144 This method is an helper to easily create page navigation for large result sets. 
     144This method is an helper to easily create page navigation for large result sets.[[BR]] 
    145145You can configure the navigationStr with set_slice_attrs() method 
    146 @param string|array $table 
    147 @param string|array $fields 
    148 @param string|array $conditions 
    149 @param int          $pageId     the page to query and return (start at 1) 
    150 @param int          $pageNbRows the max number of results by page. 
    151 @return array  array((array) results,(str) navigationstring, (int) totalrows) or false on empty results 
     146 - @param string|array $table 
     147 - @param string|array $fields 
     148 - @param string|array $conditions 
     149 - @param int          $pageId     the page to query and return (start at 1) 
     150 - @param int          $pageNbRows the max number of results by page. 
     151 - @return array  array((array) results,(str) navigationstring, (int) totalrows) or false on empty results 
    152152{{{ 
    153153#!php  
     
    160160 
    161161=== query_to_array($Q_str,$result_type='ASSOC') === 
    162 return the result of a query to an array. 
     162return the result of a query to an array.[[BR]] 
    163163Typically you will use this one for more advanced queries. 
    164 @param string $Q_str SQL query 
    165 @param string $result_type 'ASSOC', 'NUM' et 'BOTH' 
    166 @return array | false if no result 
     164 - @param string $Q_str SQL query 
     165 - @param string $result_type 'ASSOC', 'NUM' et 'BOTH' 
     166 - @return array | false if no result 
    167167 
    168168{{{ 
     
    177177=== get_count($table,$conds=null) === 
    178178get the number of row in $table 
    179 @param string $table table name 
    180 @param mixed  $conds 
    181 @return int 
     179 - @param string $table table name 
     180 - @param mixed  $conds 
     181 - @return int 
    182182{{{ 
    183183#!php  
     
    188188 
    189189=== associative_array_from_q2a_res($index_field='id',$value_fields=null,$res = null,$keep_index=FALSE,$sort_keys=FALSE) === 
    190 return an associative array indexed by $index_field with values $value_fields from a db->select_rows result. 
     190return an associative array indexed by $index_field with values $value_fields from a db->select_rows result.[[BR]] 
    191191Most of the time you will preferably use db->select_associative in place of this one. 
    192 @param string $index_field default value is id 
    193 @param mixed $value_fields (string field name or array of fields name default is null so keep all fields 
    194 @param array $res the mysqldb->select_rows result 
    195 @param bool $keep_index if set to true then the index field will be keep in the values associated (unused if $value_fields is string) 
    196 @param bool $sort_keys will automaticly sort the array by key if set to true @deprecated argument 
    197 @return array 
     192 - @param string $index_field default value is id 
     193 - @param mixed $value_fields (string field name or array of fields name default is null so keep all fields 
     194 - @param array $res the mysqldb->select_rows result 
     195 - @param bool $keep_index if set to true then the index field will be keep in the values associated (unused if $value_fields is string) 
     196 - @param bool $sort_keys will automaticly sort the array by key if set to true @deprecated argument 
     197 - @return array