summaryrefslogtreecommitdiffstats
path: root/user_guide/database
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide/database')
-rw-r--r--user_guide/database/active_record.html74
-rw-r--r--user_guide/database/forge.html62
-rw-r--r--user_guide/database/index.html2
3 files changed, 69 insertions, 69 deletions
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index afdc9b5ef..f3bde15e4 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -129,8 +129,8 @@ $query = $this->db->get('mytable');<br />
<p class="important"><strong>Note:</strong> If you are selecting all (*) from a table you do not need to use this function. When omitted, CodeIgniter assumes you wish to SELECT *</p>
<p>$this-&gt;db-&gt;select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.</p>
-<p><code> $this-&gt;db-&gt;select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE); <br />
- $query = $this-&gt;db-&gt;get('mytable');<br />
+<p><code>$this-&gt;db-&gt;select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE); <br />
+$query = $this-&gt;db-&gt;get('mytable');<br />
</code></p>
<h2>$this->db->select_max();</h2>
<p>Writes a "SELECT MAX(field)" portion for your query. You can optionally include a second parameter to rename the resulting field.</p>
@@ -280,30 +280,30 @@ $this->db->or_where('id >', $id);
<h2>$this->db->where_in();</h2>
<p>Generates a WHERE field IN ('item', 'item') SQL query joined with AND if appropriate</p>
<p><code>
- $names = array('Frank', 'Todd', 'James');<br />
- $this->db->where_in('username', $names);<br />
- // Produces: WHERE username IN ('Frank', 'Todd', 'James')</code></p>
+ $names = array('Frank', 'Todd', 'James');<br />
+ $this->db->where_in('username', $names);<br />
+ // Produces: WHERE username IN ('Frank', 'Todd', 'James')</code></p>
<h2>$this->db->or_where_in();</h2>
<p>Generates a WHERE field IN ('item', 'item') SQL query joined with OR if appropriate</p>
<p><code>
- $names = array('Frank', 'Todd', 'James');<br />
- $this->db->or_where_in('username', $names);<br />
- // Produces: OR username IN ('Frank', 'Todd', 'James')</code></p>
-
+ $names = array('Frank', 'Todd', 'James');<br />
+ $this->db->or_where_in('username', $names);<br />
+ // Produces: OR username IN ('Frank', 'Todd', 'James')</code></p>
+
<h2>$this->db->where_not_in();</h2>
<p>Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate</p>
<p><code>
- $names = array('Frank', 'Todd', 'James');<br />
- $this->db->where_not_in('username', $names);<br />
- // Produces: WHERE username NOT IN ('Frank', 'Todd', 'James')</code></p>
+ $names = array('Frank', 'Todd', 'James');<br />
+ $this->db->where_not_in('username', $names);<br />
+ // Produces: WHERE username NOT IN ('Frank', 'Todd', 'James')</code></p>
<h2>$this->db->or_where_not_in();</h2>
<p>Generates a WHERE field NOT IN ('item', 'item') SQL query joined with OR if appropriate</p>
<p><code>
- $names = array('Frank', 'Todd', 'James');<br />
- $this->db->or_where_not_in('username', $names);<br />
- // Produces: OR username NOT IN ('Frank', 'Todd', 'James')</code></p>
+ $names = array('Frank', 'Todd', 'James');<br />
+ $this->db->or_where_not_in('username', $names);<br />
+ // Produces: OR username NOT IN ('Frank', 'Todd', 'James')</code></p>
<h2>$this->db->like();</h2>
<p>This function enables you to generate <strong>LIKE</strong> clauses, useful for doing searches.</p>
@@ -327,7 +327,7 @@ $this->db->or_where('id >', $id);
<code>$this->db->like('title', 'match', 'before');
<br />
// Produces: WHERE title LIKE '%match' <br />
- <br />
+ <br />
$this-&gt;db-&gt;like('title', 'match', 'after'); <br />
// Produces: WHERE title LIKE 'match%' <br />
<br />
@@ -341,7 +341,7 @@ $this->db->or_where('id >', $id);
$this->db->like($array);
<br /><br />// WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%'</code></li>
- </ol>
+ </ol>
<h2>$this->db->or_like();</h2>
@@ -387,9 +387,9 @@ $this-&gt;db-&gt;or_not_like('body', 'match'); <br />
</h2>
<p>Adds the &quot;DISTINCT&quot; keyword to a query</p>
<p><code>$this-&gt;db-&gt;distinct();<br />
- $this-&gt;db-&gt;get('table');<br />
- <br />
- // Produces: SELECT DISTINCT * FROM table</code></p>
+ $this-&gt;db-&gt;get('table');<br />
+ <br />
+ // Produces: SELECT DISTINCT * FROM table</code></p>
<h2>$this->db->having();</h2>
<p>Permits you to write the HAVING portion of your query. There are 2 possible syntaxe, 1 argument or 2:</p>
@@ -435,10 +435,10 @@ The second parameter lets you set the direction of the result. Options are <kbd
<p>Or multiple function calls can be made if you need multiple fields.</p>
<p><code>$this->db->order_by("title", "desc");<br />
- $this->db->order_by("name", "asc"); <br />
- <br />
- // Produces: ORDER BY title DESC, name ASC
- </code></p>
+ $this->db->order_by("name", "asc"); <br />
+ <br />
+ // Produces: ORDER BY title DESC, name ASC
+ </code></p>
<p class="important">Note: order_by() was formerly known as orderby(), which has been deprecated.</p>
<p class="important">Note: random ordering is not currently supported in Oracle or MSSQL drivers. These will default to 'ASC'.</p>
<h2>$this->db->limit();</h2>
@@ -543,12 +543,12 @@ $this-&gt;db-&gt;set('status', $status);<br />
$this-&gt;db-&gt;insert('mytable'); </code>
<p><strong>set()</strong> will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE. To illustrate the difference, here is set() used both with and without the escape parameter.</p>
<p><code>$this-&gt;db-&gt;set('field', 'field+1', FALSE);<br />
- $this-&gt;db-&gt;insert('mytable'); <br />
- // gives INSERT INTO mytable (field) VALUES (field+1)<br />
- <br />
- $this-&gt;db-&gt;set('field', 'field+1');<br />
- $this-&gt;db-&gt;insert('mytable'); <br />
- // gives INSERT INTO mytable (field) VALUES ('field+1')</code></p>
+ $this-&gt;db-&gt;insert('mytable'); <br />
+ // gives INSERT INTO mytable (field) VALUES (field+1)<br />
+ <br />
+ $this-&gt;db-&gt;set('field', 'field+1');<br />
+ $this-&gt;db-&gt;insert('mytable'); <br />
+ // gives INSERT INTO mytable (field) VALUES ('field+1')</code></p>
<p>You can also pass an associative array to this function:</p>
<code>
$array = array('name' => $name, 'title' => $title, 'status' => $status);<br /><br />
@@ -657,19 +657,19 @@ $this->db->delete('mytable', array('id' => $id));
the data to the second parameter of the function:</p>
<p><code> $this->db->where('id', $id);<br />
- $this->db->delete('mytable'); <br />
- <br />
- // Produces:<br />
- // DELETE FROM mytable <br />
- // WHERE id = $id</code></p>
+ $this->db->delete('mytable'); <br />
+ <br />
+ // Produces:<br />
+ // DELETE FROM mytable <br />
+ // WHERE id = $id</code></p>
<p>An array of table names can be passed into delete() if you would like to delete data from more then 1 table.</p>
<p><code>$tables = array('table1', 'table2', 'table3');<br />
$this-&gt;db-&gt;where('id', '5');<br />
$this-&gt;db-&gt;delete($tables);</code></p>
<p>If you want to delete all data from a table, you can use the <dfn>truncate()</dfn> function, or <dfn>empty_table()</dfn>.</p>
<h2>$this-&gt;db-&gt;empty_table();</h2>
-<p>Generates a delete SQL string and runs the query.<code> $this-&gt;db-&gt;empty_table('mytable'); <br />
- <br />
+<p>Generates a delete SQL string and runs the query.<code> $this-&gt;db-&gt;empty_table('mytable'); <br />
+ <br />
// Produces<br />
// DELETE FROM mytable</code></p>
<h2>$this-&gt;db-&gt;truncate();</h2>
diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html
index 12ac62f57..bc67436bb 100644
--- a/user_guide/database/forge.html
+++ b/user_guide/database/forge.html
@@ -116,27 +116,27 @@ already be running, since the forge class relies on it.</p>
<p>Fields are created via an associative array. Within the array you must include a 'type' key that relates to the datatype of the field. For example, INT, VARCHAR, TEXT, etc. Many datatypes (for example VARCHAR) also require a 'constraint' key.</p>
<p><code>$fields = array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'users' =&gt; array(<br />
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'type' =&gt; 'VARCHAR',<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'constraint' =&gt; '100',<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
+ <br />
// will translate to &quot;users VARCHAR(100)&quot; when the field is added.</code></p>
<p>Additionally, the following key/values can be used:</p>
<ul>
- <li>unsigned/true : to generate &quot;UNSIGNED&quot; in the field definition.</li>
- <li>default/value : to generate a default value in the field definition.</li>
- <li>null/true : to generate &quot;NULL&quot; in the field definition. Without this, the field will default to &quot;NOT NULL&quot;.</li>
- <li>auto_increment/true : generates an auto_increment flag on the field. Note that the field type must be a type that supports this, such as integer.</li>
- </ul>
+ <li>unsigned/true : to generate &quot;UNSIGNED&quot; in the field definition.</li>
+ <li>default/value : to generate a default value in the field definition.</li>
+ <li>null/true : to generate &quot;NULL&quot; in the field definition. Without this, the field will default to &quot;NOT NULL&quot;.</li>
+ <li>auto_increment/true : generates an auto_increment flag on the field. Note that the field type must be a type that supports this, such as integer.</li>
+ </ul>
<p><code>$fields = array(<br />
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'blog_id' =&gt; array(<br />
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'type' =&gt; 'INT',<br />
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'type' =&gt; 'VARCHAR',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'constraint' =&gt; '100',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<br />
@@ -161,22 +161,22 @@ already be running, since the forge class relies on it.</p>
<h3>Creating an id field</h3>
<p>There is a special exception for creating id fields. A field with type id will automatically be assinged as an INT(9) auto_incrementing Primary Key.</p>
<p><code>$this-&gt;dbforge-&gt;add_field('id');<br />
- // gives id INT(9) NOT NULL AUTO_INCREMENT</code></p>
+ // gives id INT(9) NOT NULL AUTO_INCREMENT</code></p>
<h2><a name="add_key" id="add_key"></a>Adding Keys</h2>
<p>Generally speaking, you'll want your table to have Keys. This is accomplished with <dfn>$this-&gt;dbforge-&gt;add_key('field')</dfn>. An optional second parameter set to TRUE will make it a primary key. Note that <dfn>add_key()</dfn> must be followed by a call to <dfn>create_table()</dfn>.</p>
<p>Multiple column non-primary keys must be sent as an array. Sample output below is for MySQL.</p>
<p><code>$this-&gt;dbforge-&gt;add_key('blog_id', TRUE);<br />
- // gives PRIMARY KEY `blog_id` (`blog_id`)<br />
- <br />
- $this-&gt;dbforge-&gt;add_key('blog_id', TRUE);<br />
- $this-&gt;dbforge-&gt;add_key('site_id', TRUE);<br />
- // gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)<br />
+ // gives PRIMARY KEY `blog_id` (`blog_id`)<br />
+ <br />
+ $this-&gt;dbforge-&gt;add_key('blog_id', TRUE);<br />
+ $this-&gt;dbforge-&gt;add_key('site_id', TRUE);<br />
+ // gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)<br />
<br />
- $this-&gt;dbforge-&gt;add_key('blog_name');<br />
- // gives KEY `blog_name` (`blog_name`)<br />
- <br />
- $this-&gt;dbforge-&gt;add_key(array('blog_name', 'blog_label'));<br />
- // gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`)</code></p>
+ $this-&gt;dbforge-&gt;add_key('blog_name');<br />
+ // gives KEY `blog_name` (`blog_name`)<br />
+ <br />
+ $this-&gt;dbforge-&gt;add_key(array('blog_name', 'blog_label'));<br />
+ // gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`)</code></p>
<h2><a name="create_table" id="create_table"></a>Creating a table</h2>
<p>After fields and keys have been declared, you can create a new table with</p>
<p><code>$this-&gt;dbforge-&gt;create_table('table_name');<br />
@@ -196,7 +196,7 @@ already be running, since the forge class relies on it.</p>
<h2>$this-&gt;dbforge-&gt;add_column()</h2>
<p>The add_column() function is used to modify an existing table. It accepts the same field array as above, and can be used for an unlimited number of additional fields.</p>
<p><code>$fields = array(<br />
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'preferences' =&gt; array('type' =&gt; 'TEXT')<br />
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'preferences' =&gt; array('type' =&gt; 'TEXT')<br />
);<br />
$this-&gt;dbforge-&gt;add_column('table_name', $fields);<br />
<br />
@@ -213,8 +213,8 @@ $this-&gt;dbforge-&gt;add_column('table_name', $fields);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<br />
);<br />
$this-&gt;dbforge-&gt;modify_column('table_name', $fields);<br />
- <br />
- // gives ALTER TABLE table_name CHANGE old_name new_name TEXT </code></p>
+ <br />
+ // gives ALTER TABLE table_name CHANGE old_name new_name TEXT </code></p>
<p>&nbsp;</p>
</div>
<!-- END CONTENT -->
diff --git a/user_guide/database/index.html b/user_guide/database/index.html
index a6854b5bb..5dcea988a 100644
--- a/user_guide/database/index.html
+++ b/user_guide/database/index.html
@@ -76,7 +76,7 @@ structures and Active Record patterns. The database functions offer clear, simpl
<li><a href="call_function.html">Custom Function Calls</a></li>
<li><a href="caching.html">Query Caching</a></li>
<li><a href="forge.html">Database manipulation with Database Forge</a></li>
- <li><a href="utilities.html">Database Utilities Class</a></li>
+ <li><a href="utilities.html">Database Utilities Class</a></li>
</ul>