summaryrefslogtreecommitdiffstats
path: root/user_guide/database
diff options
context:
space:
mode:
authorPascal Kriete <pascal@pascalkriete.com>2011-08-12 18:54:13 +0200
committerPascal Kriete <pascal@pascalkriete.com>2011-08-12 18:54:13 +0200
commitc4f024641ab69ed9cce62a2864e47e060b81048b (patch)
treea4de86c0c6e95e6042ce66e84bdcd0c18c51d643 /user_guide/database
parentabccc2fa65eea5f64773952661a8ba79e559333b (diff)
parentb0eae5f81a4cb92911bb215ad814ae5caef4f61d (diff)
Merging - fingers crossed
Conflicts: system/database/drivers/mysql/mysql_driver.php system/database/drivers/mysqli/mysqli_driver.php system/libraries/Email.php user_guide/changelog.html user_guide/database/configuration.html user_guide/helpers/url_helper.html user_guide/libraries/cart.html user_guide/libraries/form_validation.html
Diffstat (limited to 'user_guide/database')
-rw-r--r--user_guide/database/configuration.html4
-rw-r--r--user_guide/database/queries.html9
2 files changed, 9 insertions, 4 deletions
diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html
index 51d11c9f2..4ea2e6b3d 100644
--- a/user_guide/database/configuration.html
+++ b/user_guide/database/configuration.html
@@ -132,8 +132,8 @@ for the primary connection, but it too can be renamed to something more relevant
<li><strong>cache_on</strong> - TRUE/FALSE (boolean) - Whether database query caching is enabled, see also <a href="caching.html">Database Caching Class</a>.</li>
<li><strong>cachedir</strong> - The absolute server path to your database query cache directory.</li>
<li><strong>char_set</strong> - The character set used in communicating with the database.</li>
-<li><strong>dbcollat</strong> - The character collation used in communicating with the database. <p class="important"><strong>Note:</strong> For MySQL and MySQLi databases, this setting is only used as a backup if your server is running PHP &lt; 5.2.3 or MySQL &lt; 5.0.7. There is an incompatibility in PHP with mysql_real_escape_string() which can make your site vulnerable to SQL injection if you are using a multi-byte character set and are running versions lower than these. Sites using Latin-1 or UTF-8 database character set and collation are unaffected.</p></li>
-<li><strong>swap_pre</strong> - A default table prefix that should be swapped with <var>dbprefix</var>. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user.</li>
+<li><strong>dbcollat</strong> - The character collation used in communicating with the database. <p class="important"><strong>Note:</strong> For MySQL and MySQLi databases, this setting is only used as a backup if your server is running PHP &lt; 5.2.3 or MySQL &lt; 5.0.7 (and in table creation queries made with DB Forge). There is an incompatibility in PHP with mysql_real_escape_string() which can make your site vulnerable to SQL injection if you are using a multi-byte character set and are running versions lower than these. Sites using Latin-1 or UTF-8 database character set and collation are unaffected.</p></li>
+<li><strong>swap_pre</strong> - A default table prefix that should be swapped with <var>dbprefix</var>. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user.</li>
<li><strong>autoinit</strong> - Whether or not to automatically connect to the database when the library loads. If set to false, the connection will take place prior to executing the first query.</li>
<li><strong>stricton</strong> - TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application.</li>
<li><strong>port</strong> - The database port number. To use this value you have to add a line to the database config array.<code>$db['default']['port'] = 5432;</code>
diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html
index f9f96803f..4c1ddfe7d 100644
--- a/user_guide/database/queries.html
+++ b/user_guide/database/queries.html
@@ -80,11 +80,16 @@ It DOES NOT return a database result set, nor does it set the query timer, or co
It simply lets you submit a query. Most users will rarely use this function.</p>
-<h1>Adding Database prefixes manually</h1>
-<p>If you have configured a database prefix and would like to add it in manually for, you can use the following.</p>
+<h1>Working with Database prefixes manually</h1>
+<p>If you have configured a database prefix and would like to prepend it to a table name for use in a native SQL query for example, then you can use the following:</p>
<p><code>$this-&gt;db-&gt;dbprefix('tablename');<br />
// outputs prefix_tablename</code></p>
+<p>If for any reason you would like to change the prefix programatically without needing to create a new connection, you can use this method:</p>
+<p><code>$this-&gt;db-&gt;set_dbprefix('newprefix');<br /><br />
+$this-&gt;db-&gt;dbprefix('tablename');<br />
+// outputs newprefix_tablename</code></p>
+
<h1>Protecting identifiers</h1>
<p>In many databases it is advisable to protect table and field names - for example with backticks in MySQL. <strong>Active Record queries are automatically protected</strong>, however if you need to manually protect an identifier you can use:</p>