Changeset 1015

Show
Ignore:
Timestamp:
11/07/2007 05:18:26 PM (11 months ago)
Author:
PugFish
Message:

Comments updated:

  • All comments should be converted now except a few not going into release or being replaced soon after
  • General comment cleanup, made more consistent and a few errors corrected
  • Removed comments from classes implementing interfaces, no point duplicating them
  • Renamed constructor topics

Added result_array() to Database_Result interface

Location:
trunk/system
Files:
32 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/core/Kohana.php

    r939 r1015  
    4343 
    4444        /* 
    45          * Method: __construct 
     45         * Constructor: __construct 
    4646         *  Allows the controller to be a true singleton object. This method *must* 
    4747         *  be called by all controllers. 
  • trunk/system/helpers/form.php

    r959 r1015  
    7676        } 
    7777 
    78         /** 
    79          * Hidden Input Field 
    80          * 
    81          * Generates hidden fields.  You can pass a simple key/value string or an associative 
    82          * array with multiple values. 
    83          * 
    84          * @access  public 
    85          * @param   mixed 
    86          * @param   string 
    87          * @return  string 
    88          */ 
    89         /* 
    90          * Method: open 
     78        /* 
     79         * Method: hidden 
    9180         *  Generates hidden form fields. 
     81         *  You can pass a simple key/value string or an associative array with multiple values. 
    9282         * 
    9383         * Parameters: 
  • trunk/system/libraries/Archive.php

    r1001 r1015  
    1717 
    1818        /* 
    19          * Method: __construct 
     19         * Constructor: __construct 
    2020         *  Loads the archive driver. 
    2121         * 
  • trunk/system/libraries/Cache.php

    r932 r1015  
    1515 
    1616        /* 
    17          * Method: __construct 
     17         * Constructor: __construct 
    1818         *  Set up driver and get groups. 
    1919         * 
  • trunk/system/libraries/Calendar.php

    r932 r1015  
    2020 
    2121        /* 
    22          * Method: __construct 
     22         * Constructor: __construct 
    2323         *  Sets the default time reference. 
    2424         * 
  • trunk/system/libraries/Controller.php

    r932 r1015  
    1111 
    1212        /* 
    13          * Method: __construct 
     13         * Constructor: __construct 
    1414         *  Loads the Input, URI and Loader libraries into the '$this' namespace. 
    1515         */ 
  • trunk/system/libraries/Database.php

    r994 r1015  
    99 *  copyright - (c) 2006 EllisLab, Inc. 
    1010 *  license   - <http://www.codeigniter.com/user_guide/license.html> 
    11  * 
    12  * $Id$ 
    1311 */ 
    1412class Database_Core { 
     
    5048 
    5149        /* 
    52          * Method: __construct 
     50         * Constructor: __construct 
    5351         *  Sets up the database configuration, loads the <Database_Driver>. 
    5452         * 
     
    176174        /* 
    177175         * Method: connect 
    178          *  Simple connect method to get the database queries up and running 
     176         *  Simple connect method to get the database queries up and running. 
    179177         */ 
    180178        public function connect() 
     
    189187        /* 
    190188         * Method: query 
    191          *  Runs a query into the driver and returns the result 
    192          * 
    193          * Parameters: 
    194          *  sql - the sql line to run 
     189         *  Runs a query into the driver and returns the result. 
     190         * 
     191         * Parameters: 
     192         *  sql - sql query to execute 
    195193         * 
    196194         * Returns: 
     
    236234        /* 
    237235         * Method: select 
    238          *  Selects the column names for a database <Database.query> 
    239          * 
    240          * Parameters: 
    241          *  sql - a string or array of column names to <Database.select> 
     236         *  Selects the column names for a database <Database.query>. 
     237         * 
     238         * Parameters: 
     239         *  sql - string or array of column names to <Database.select> 
    242240         * 
    243241         * Returns: 
     
    271269        /* 
    272270         * Method: from 
    273          *  Selects the from table(s) for a database <Database.query> 
    274          * 
    275          * Parameters: 
    276          *  sql - a string or array of tables to <Database.select> 
     271         *  Selects the from table(s) for a database <Database.query>. 
     272         * 
     273         * Parameters: 
     274         *  sql - string or array of tables to <Database.select> 
    277275         * 
    278276         * Returns: 
     
    291289        } 
    292290 
    293         /** 
    294          * Join 
    295          * 
    296          * Generates the JOIN portion of the query 
    297          * 
    298          * @access      public 
    299          * @param       string 
    300          * @param       string  the join condition 
    301          * @param       string  the type of join 
    302          * @return      object 
     291        /* 
     292         * Method: join 
     293         *  Generates the JOIN portion of the query. 
     294         * 
     295         * Parameters: 
     296         *  table - table name 
     297         *  cond  - join condition 
     298         *  type  - type of join (optional) 
     299         * 
     300         * Returns: 
     301         *  The <Database> object 
    303302         */ 
    304303        public function join($table, $cond, $type = '') 
     
    325324        /* 
    326325         * Method: where 
    327          *  Selects the where(s) for a database <Database.query> 
    328          * 
    329          * Parameters: 
    330          *  key - a key string or an array of key/value pairs to match 
    331          *  value - a value to match with the key 
    332          *  quote - don't know what this does... 
     326         *  Selects the where(s) for a database <Database.query>. 
     327         * 
     328         * Parameters: 
     329         *  key   - key name or array of key => value pairs 
     330         *  value - value to match with key 
     331         *  quote - disable quoting of WHERE clause 
    333332         * 
    334333         * Returns: 
     
    348347        /* 
    349348         * Method: orwhere 
    350          *  Selects the or where(s) for a database <Database.query> 
    351          * 
    352          * Parameters: 
    353          *  key - a key string or an array of key/value pairs to match 
    354          *  value - a value to match with the key 
    355          *  quote - don't know what this does... 
     349         *  Selects the or where(s) for a database <Database.query>. 
     350         * 
     351         * Parameters: 
     352         *  key   - key name or array of key => value pairs 
     353         *  value - value to match with key 
     354         *  quote - disable quoting of WHERE clause 
    356355         * 
    357356         * Returns: 
     
    371370        /* 
    372371         * Method: like 
    373          *  Selects the like(s) for a database <Database.query> 
    374          * 
    375          * Parameters: 
    376          *  field - a key string or an array of key/value pairs to match 
    377          *  match - a value to match with the key 
     372         *  Selects the like(s) for a database <Database.query>. 
     373         * 
     374         * Parameters: 
     375         *  field - field name or array of field => match pairs 
     376         *  match - like value to match with field 
    378377         * 
    379378         * Returns: 
     
    388387        /* 
    389388         * Method: orlike 
    390          *  Selects the or like(s) for a database <Database.query> 
    391          * 
    392          * Parameters: 
    393          *  field - a key string or an array of key/value pairs to match 
    394          *  match - a value to match with the key 
     389         *  Selects the or like(s) for a database <Database.query>. 
     390         * 
     391         * Parameters: 
     392         *  field - field name or array of field => match pairs 
     393         *  match - like value to match with field 
    395394         * 
    396395         * Returns: 
     
    405404        /* 
    406405         * Method: groupby 
    407          *  chooses the column to group by in a select <Database.query> 
    408          * 
    409          * Parameters: 
    410          *  by - a column name to group by 
     406         *  chooses the column to group by in a select <Database.query>. 
     407         * 
     408         * Parameters: 
     409         *  by - column name to group by 
    411410         * 
    412411         * Returns: 
     
    435434        /* 
    436435         * Method: having 
    437          *  Selects the having(s) for a database <Database.query> 
    438          * 
    439          * Parameters: 
    440          *  key - a key string or an array of key/value pairs to match 
    441          *  value - a value to match with the key 
     436         *  Selects the having(s) for a database <Database.query>. 
     437         * 
     438         * Parameters: 
     439         *  key   - key name or array of key => value pairs 
     440         *  value - value to match with key 
    442441         * 
    443442         * Returns: 
     
    452451        /* 
    453452         * Method: orhaving 
    454          *  Selects the or having(s) for a database <Database.query> 
    455          * 
    456          * Parameters: 
    457          *  key - a key string or an array of key/value pairs to match 
    458          *  value - a value to match with the key 
     453         *  Selects the or having(s) for a database <Database.query>. 
     454         * 
     455         * Parameters: 
     456         *  key   - key name or array of key => value pairs 
     457         *  value - value to match with key 
    459458         * 
    460459         * Returns: 
     
    469468        /* 
    470469         * Method: orderby 
    471          *  Chooses which column(s) to order the <Database.select> <Database.query> by 
    472          * 
    473          * Parameters: 
    474          *  orderby - column(s) to order on 
    475          *  direction - the direction of the order 
     470         *  Chooses which column(s) to order the <Database.select> <Database.query> by. 
     471         * 
     472         * Parameters: 
     473         *  orderby   - column(s) to order on 
     474         *  direction - direction of the order 
    476475         * 
    477476         * Returns: 
     
    493492        /* 
    494493         * Method: limit 
    495          *  Selects the limit section of a <Database.query> 
    496          * 
    497          * Parameters: 
    498          *  value - the limit 
    499          *  offset - an offset to apply the limit to 
    500          * 
    501          * Returns: 
    502          *  The <Database> object 
    503          */ 
    504         public function limit($value, $offset = FALSE) 
    505         { 
    506                 $this->limit  = (int) $value; 
     494         *  Selects the limit section of a <Database.query>. 
     495         * 
     496         * Parameters: 
     497         *  value  - number of rows to limit result to 
     498         *  offset - offset in result to start returning rows from 
     499         * 
     500         * Returns: 
     501         *  The <Database> object 
     502         */ 
     503        public function limit($limit, $offset = FALSE) 
     504        { 
     505                $this->limit  = (int) $limit; 
    507506                $this->offset = (int) $offset; 
    508507 
     
    512511        /* 
    513512         * Method: offset 
    514          *  Sets the offset portion of a <Database.query> 
    515          * 
    516          * Parameters: 
    517          *  value - the offset value 
     513         *  Sets the offset portion of a <Database.query>. 
     514         * 
     515         * Parameters: 
     516         *  value - offset value 
    518517         * 
    519518         * Returns: 
     
    528527        /* 
    529528         * Method: set 
    530          *  Allows key/value pairs to be set for <Database.insert>ing or <Database.update>ing 
    531          * 
    532          * Parameters: 
    533          *  key - a string or array of key/value pairs 
     529         *  Allows key/value pairs to be set for <Database.insert>ing or <Database.update>ing. 
     530         * 
     531         * Parameters: 
     532         *  key   - key name or array of key => value pairs 
     533         *  value - value to match with key 
    534534         * 
    535535         * Returns: 
     
    553553        /* 
    554554         * Method: get 
    555          *  Compiles the <Database.select> statement based on the other functions called 
    556          *  and runs the query 
    557          * 
    558          * Parameters: 
    559          *  table - the table 
    560          *  limit - the <Database.limit> clause 
    561          *  offset - the <Database.offset> clause 
     555         *  Compiles the <Database.select> statement based on 
     556         *  the other functions called and runs the query. 
     557         * 
     558         * Parameters: 
     559         *  table  - table name 
     560         *  limit  - <Database.limit> clause 
     561         *  offset - <Database.offset> clause 
    562562         * 
    563563         * Returns: 
     
    588588        /* 
    589589         * Method: getwhere 
    590          *  Compiles the <Database.select> statement based on the other functions called 
    591          *  and runs the <Database.query> 
    592          * 
    593          * Parameters: 
    594          *  table - the table 
    595          *  where - the <Database.where> clause 
    596          *  limit - the <Database.limit) clause 
    597          *  offset - the <Database.offset) clause 
     590         *  Compiles the <Database.select> statement based on 
     591         *  the other functions called and runs the <Database.query>. 
     592         * 
     593         * Parameters: 
     594         *  table  - table name 
     595         *  where  - <Database.where> clause 
     596         *  limit  - <Database.limit) clause 
     597         *  offset - <Database.offset) clause 
    598598         * 
    599599         * Returns: 
     
    626626        /* 
    627627         * Method: insert 
    628          *  Compiles an insert string and runs the <Database.query> 
    629          * 
    630          * Parameters: 
    631          *  table - the table 
    632          *  set - an array of key/value pairs to insert 
     628         *  Compiles an insert string and runs the <Database.query>. 
     629         * 
     630         * Parameters: 
     631         *  table - table name 
     632         *  set   - array of key/value pairs to insert 
    633633         * 
    634634         * Returns: 
     
    670670 
    671671        /* 
    672          * Method: insert 
    673          *  Compiles an update string and runs the <Database.query> 
    674          * 
    675          * Parameters: 
    676          *  table - the table 
    677          *  set - an associative array of update values 
    678          *  where - the where clause 
     672         * Method: update 
     673         *  Compiles an update string and runs the <Database.query>. 
     674         * 
     675         * Parameters: 
     676         *  table - table name 
     677         *  set   - associative array of update values 
     678         *  where - <Database.where> clause 
    679679         * 
    680680         * Returns: 
     
    720720 
    721721        /* 
    722          * Method: insert 
    723          *  Compiles a delete string and runs the <Database.query> 
    724          * 
    725          * Parameters: 
    726          *  table - the table 
    727          *  set - an associative array of update values 
    728          *  where - the where clause 
     722         * Method: delete 
     723         *  Compiles a delete string and runs the <Database.query>. 
     724         * 
     725         * Parameters: 
     726         *  table - table name 
     727         *  where - <Database.where> clause 
    729728         * 
    730729         * Returns: 
     
    767766        /* 
    768767         * Method: last_query 
    769          *  returns the last <Database.query> run 
    770          * 
    771          * Returns: 
    772          *  A string containing the lest SQL statement 
     768         *  Returns the last <Database.query> run. 
     769         * 
     770         * Returns: 
     771         *  A string containing the last SQL query 
    773772         */ 
    774773        public function last_query() 
     
    779778        /* 
    780779         * Method: count_records 
    781          *  Count query records 
    782          * 
    783          * Parameters: 
    784          *  table - the table to count 
    785          *  where - an optional WHERE clause to count 
    786          * 
    787          * Returns: 
    788          *  A number containing the records in the query set 
     780         *  Count query records. 
     781         * 
     782         * Parameters: 
     783         *  table - table name 
     784         *  where - <Database.where> clause (optional) 
     785         * 
     786         * Returns: 
     787         *  Number of records 
    789788         */ 
    790789        public function count_records($table = FALSE, $where = NULL) 
     
    811810        /* 
    812811         * Method: reset_select 
    813          *  Resets all private select variables 
     812         *  Resets all private select variables. 
    814813         */ 
    815814        private function reset_select() 
     
    830829        /* 
    831830         * Method: reset_write 
    832          *  Resets all private insert and update variables 
     831         *  Resets all private insert and update variables. 
    833832         */ 
    834833        private function reset_write() 
     
    841840        /* 
    842841         * Method: list_tables 
    843          *  Lists all the tables in the current database 
     842         *  Lists all the tables in the current database. 
    844843         * 
    845844         * Returns: 
     
    857856        /* 
    858857         * Method: table_exists 
    859          *  See if a table exists in the database 
    860          * 
    861          * Parameters: 
    862          *  table_name - the name of the table to check 
    863          * 
    864          * Returns: 
    865          *  TRUE/FALSE 
     858         *  See if a table exists in the database. 
     859         * 
     860         * Parameters: 
     861         *  table_name - table name 
     862         * 
     863         * Returns: 
     864         *  TRUE or FALSE 
    866865         */ 
    867866        public function table_exists($table_name) 
     
    872871        /* 
    873872         * Method: compile_binds 
    874          *  Combine a sql statement with the bind values. Used for safe queries! 
    875          * 
    876          * Parameters: 
    877          *  sql - the query to bind to the values 
    878          *  binds - an array of value to bind to the query 
    879          * 
    880          * Returns: 
    881          *  string containing the final <Database.query> to run 
     873         *  Combine a sql statement with the bind values. Used for safe queries. 
     874         * 
     875         * Parameters: 
     876         *  sql   - query to bind to the values 
     877         *  binds - array of values to bind to the query 
     878         * 
     879         * Returns: 
     880         *  String containing the final <Database.query> to run 
    882881         */ 
    883882        public function compile_binds($sql, $binds) 
     
    904903        /* 
    905904         * Method: field_data 
    906          *  Get the field data for a database table, along with the field's attributes 
    907          * 
    908          * Parameters: 
    909          *  table - the table to process 
    910          * 
    911          * Returns: 
    912          *  array containing the field data 
     905         *  Get the field data for a database table, along with the field's attributes. 
     906         * 
     907         * Parameters: 
     908         *  table - table name 
     909         * 
     910