blob: 24a7a1e9e68d11eb17f02ba2c596cee18b9fe527 [file] [log] [blame]
Andrey Andreevc5769952019-01-16 17:49:35 +02001
2
3<!DOCTYPE html>
4<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
5<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
6<head>
7 <meta charset="utf-8">
8 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
10 <title>DB Driver Reference &mdash; CodeIgniter 3.1.10 documentation</title>
11
12
13
14
15 <link rel="shortcut icon" href="../_static/ci-icon.ico"/>
16
17
18
19 <link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
20
21
22
23
24
25
26
27
28
29 <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
30
31
32
33 <link rel="index" title="Index"
34 href="../genindex.html"/>
35 <link rel="search" title="Search" href="../search.html"/>
36 <link rel="top" title="CodeIgniter 3.1.10 documentation" href="../index.html"/>
37 <link rel="up" title="Database Reference" href="index.html"/>
38 <link rel="next" title="Helpers" href="../helpers/index.html"/>
39 <link rel="prev" title="Database Utility Class" href="utilities.html"/>
40
41
42 <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
43
44</head>
45
46<body class="wy-body-for-nav" role="document">
47
48 <div id="nav">
49 <div id="nav_inner">
50
51
52
53 <div id="pulldown-menu" class="ciNav">
54 <ul>
55<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
56</ul>
57<ul>
58<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
59<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
60<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
61<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
62<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
63</ul>
64</li>
65</ul>
66<ul>
67<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
68<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
69<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
70<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
71<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
72<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
73<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
74</ul>
75</li>
76</ul>
77<ul>
78<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
79<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
80<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
81<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
82<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
83</ul>
84</li>
85</ul>
86<ul>
87<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
88<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
89<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
90</ul>
91</li>
92</ul>
93<ul>
94<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
95<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
96<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
97<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
98<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
99<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
100<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
101<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
102<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
103<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
104<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
105<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
106<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
107<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
108<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
109<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
110<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
111<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
112<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
113<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
114<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
115<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
116<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
117<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
118<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
119<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
120<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
121</ul>
122</li>
123</ul>
124<ul>
125<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul>
126<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li>
127<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li>
128<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li>
129<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li>
130<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li>
131<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li>
132<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li>
133<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li>
134<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li>
135<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li>
136<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li>
137<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li>
138<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li>
139<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li>
140<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li>
141<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li>
142<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li>
143<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li>
144<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li>
145<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li>
146<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li>
147<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li>
148<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li>
149<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li>
150<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li>
151<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li>
152<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li>
153<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li>
154<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
155<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li>
156</ul>
157</li>
158</ul>
159<ul class="current">
160<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current">
161<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li>
162<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li>
163<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li>
164<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li>
165<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li>
166<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li>
167<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li>
168<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li>
169<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li>
170<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li>
171<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li>
172<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li>
173<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li>
174<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Driver Reference</a></li>
175</ul>
176</li>
177</ul>
178<ul>
179<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
180<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
181<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
182<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
183<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
184<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
185<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
186<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
187<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
188<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
189<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
190<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
191<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
192<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
193<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
194<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
195<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
196<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
197<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
198<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
199<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
200<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
201</ul>
202</li>
203</ul>
204
205 </div>
206
207
208 </div>
209</div>
210<div id="nav2">
211 <a href="#" id="openToc">
212 <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" />
213 </a>
214</div>
215
216 <div class="wy-grid-for-nav">
217
218
219 <nav data-toggle="wy-nav-shift" class="wy-nav-side">
220 <div class="wy-side-nav-search">
221
222 <a href="../index.html" class="fa fa-home"> CodeIgniter</a>
223
224
225<div role="search">
226 <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
227 <input type="text" name="q" placeholder="Search docs" />
228 <input type="hidden" name="check_keywords" value="yes" />
229 <input type="hidden" name="area" value="default" />
230 </form>
231</div>
232 </div>
233
234 <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
235
236
237
238 <ul>
239<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
240</ul>
241<ul>
242<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
243<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
244<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
245<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
246<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
247</ul>
248</li>
249</ul>
250<ul>
251<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
252<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
253<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
254<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
255<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
256<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
257<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
258</ul>
259</li>
260</ul>
261<ul>
262<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
263<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
264<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
265<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
266<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
267</ul>
268</li>
269</ul>
270<ul>
271<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
272<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
273<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
274</ul>
275</li>
276</ul>
277<ul>
278<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
279<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
280<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
281<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
282<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
283<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
284<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
285<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
286<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
287<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
288<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
289<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
290<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
291<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
292<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
293<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
294<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
295<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
296<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
297<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
298<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
299<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
300<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
301<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
302<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
303<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
304<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
305</ul>
306</li>
307</ul>
308<ul>
309<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul>
310<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li>
311<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li>
312<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li>
313<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li>
314<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li>
315<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li>
316<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li>
317<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li>
318<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li>
319<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li>
320<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li>
321<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li>
322<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li>
323<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li>
324<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li>
325<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li>
326<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li>
327<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li>
328<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li>
329<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li>
330<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li>
331<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li>
332<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li>
333<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li>
334<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li>
335<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li>
336<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li>
337<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li>
338<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
339<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li>
340</ul>
341</li>
342</ul>
343<ul class="current">
344<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current">
345<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li>
346<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li>
347<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li>
348<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li>
349<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li>
350<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li>
351<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li>
352<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li>
353<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li>
354<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li>
355<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li>
356<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li>
357<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li>
358<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Driver Reference</a></li>
359</ul>
360</li>
361</ul>
362<ul>
363<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
364<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
365<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
366<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
367<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
368<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
369<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
370<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
371<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
372<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
373<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
374<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
375<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
376<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
377<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
378<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
379<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
380<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
381<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
382<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
383<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
384<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
385</ul>
386</li>
387</ul>
388
389
390
391 </div>
392 &nbsp;
393 </nav>
394
395 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
396
397
398 <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
399 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
400 <a href="../index.html">CodeIgniter</a>
401 </nav>
402
403
404
405 <div class="wy-nav-content">
406 <div class="rst-content">
407 <div role="navigation" aria-label="breadcrumbs navigation">
408 <ul class="wy-breadcrumbs">
409 <li><a href="../index.html">Docs</a> &raquo;</li>
410
411 <li><a href="index.html">Database Reference</a> &raquo;</li>
412
413 <li>DB Driver Reference</li>
414 <li class="wy-breadcrumbs-aside">
415
416 </li>
417 <div style="float:right;margin-left:5px;" id="closeMe">
418 <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" />
419 </div>
420 </ul>
421 <hr/>
422</div>
423 <div role="main" class="document">
424
425 <div class="section" id="db-driver-reference">
426<h1>DB Driver Reference<a class="headerlink" href="#db-driver-reference" title="Permalink to this headline"></a></h1>
427<p>This is the platform-independent base DB implementation class.
428This class will not be called directly. Rather, the adapter
429class for the specific database will extend and instantiate it.</p>
430<p>The how-to material for this has been split over several articles.
431This article is intended to be a reference for them.</p>
432<div class="admonition important">
433<p class="first admonition-title">Important</p>
434<p class="last">Not all methods are supported by all database drivers,
435some of them may fail (and return FALSE) if the underlying
436driver does not support them.</p>
437</div>
438<dl class="class">
439<dt id="CI_DB_driver">
440<em class="property">class </em><code class="descname">CI_DB_driver</code><a class="headerlink" href="#CI_DB_driver" title="Permalink to this definition"></a></dt>
441<dd><dl class="method">
442<dt id="CI_DB_driver::initialize">
443<code class="descname">initialize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::initialize" title="Permalink to this definition"></a></dt>
444<dd><table class="docutils field-list" frame="void" rules="none">
445<col class="field-name" />
446<col class="field-body" />
447<tbody valign="top">
448<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td>
449</tr>
450<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
451</tr>
452</tbody>
453</table>
454<p>Initialize database settings, establish a connection to
455the database.</p>
456</dd></dl>
457
458<dl class="method">
459<dt id="CI_DB_driver::db_connect">
460<code class="descname">db_connect</code><span class="sig-paren">(</span><em>$persistent = TRUE</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::db_connect" title="Permalink to this definition"></a></dt>
461<dd><table class="docutils field-list" frame="void" rules="none">
462<col class="field-name" />
463<col class="field-body" />
464<tbody valign="top">
465<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
466<li><strong>$persistent</strong> (<em>bool</em>) – Whether to establish a persistent connection or a regular one</li>
467</ul>
468</td>
469</tr>
470<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Database connection resource/object or FALSE on failure</p>
471</td>
472</tr>
473<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
474</td>
475</tr>
476</tbody>
477</table>
478<p>Establish a connection with the database.</p>
479<div class="admonition note">
480<p class="first admonition-title">Note</p>
481<p class="last">The returned value depends on the underlying
482driver in use. For example, a <code class="docutils literal"><span class="pre">mysqli</span></code> instance
483will be returned with the ‘mysqli’ driver.</p>
484</div>
485</dd></dl>
486
487<dl class="method">
488<dt id="CI_DB_driver::db_pconnect">
489<code class="descname">db_pconnect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::db_pconnect" title="Permalink to this definition"></a></dt>
490<dd><table class="docutils field-list" frame="void" rules="none">
491<col class="field-name" />
492<col class="field-body" />
493<tbody valign="top">
494<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Database connection resource/object or FALSE on failure</td>
495</tr>
496<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">mixed</td>
497</tr>
498</tbody>
499</table>
500<p>Establish a persistent connection with the database.</p>
501<div class="admonition note">
502<p class="first admonition-title">Note</p>
503<p class="last">This method is just an alias for <code class="docutils literal"><span class="pre">db_connect(TRUE)</span></code>.</p>
504</div>
505</dd></dl>
506
507<dl class="method">
508<dt id="CI_DB_driver::reconnect">
509<code class="descname">reconnect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::reconnect" title="Permalink to this definition"></a></dt>
510<dd><table class="docutils field-list" frame="void" rules="none">
511<col class="field-name" />
512<col class="field-body" />
513<tbody valign="top">
514<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td>
515</tr>
516<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
517</tr>
518</tbody>
519</table>
520<p>Keep / reestablish the database connection if no queries
521have been sent for a length of time exceeding the
522server’s idle timeout.</p>
523</dd></dl>
524
525<dl class="method">
526<dt id="CI_DB_driver::db_select">
527<code class="descname">db_select</code><span class="sig-paren">(</span><span class="optional">[</span><em>$database = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::db_select" title="Permalink to this definition"></a></dt>
528<dd><table class="docutils field-list" frame="void" rules="none">
529<col class="field-name" />
530<col class="field-body" />
531<tbody valign="top">
532<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
533<li><strong>$database</strong> (<em>string</em>) – Database name</li>
534</ul>
535</td>
536</tr>
537<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
538</td>
539</tr>
540<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
541</td>
542</tr>
543</tbody>
544</table>
545<p>Select / switch the current database.</p>
546</dd></dl>
547
548<dl class="method">
549<dt id="CI_DB_driver::db_set_charset">
550<code class="descname">db_set_charset</code><span class="sig-paren">(</span><em>$charset</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::db_set_charset" title="Permalink to this definition"></a></dt>
551<dd><table class="docutils field-list" frame="void" rules="none">
552<col class="field-name" />
553<col class="field-body" />
554<tbody valign="top">
555<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
556<li><strong>$charset</strong> (<em>string</em>) – Character set name</li>
557</ul>
558</td>
559</tr>
560<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
561</td>
562</tr>
563<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
564</td>
565</tr>
566</tbody>
567</table>
568<p>Set client character set.</p>
569</dd></dl>
570
571<dl class="method">
572<dt id="CI_DB_driver::platform">
573<code class="descname">platform</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::platform" title="Permalink to this definition"></a></dt>
574<dd><table class="docutils field-list" frame="void" rules="none">
575<col class="field-name" />
576<col class="field-body" />
577<tbody valign="top">
578<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Platform name</td>
579</tr>
580<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
581</tr>
582</tbody>
583</table>
584<p>The name of the platform in use (mysql, mssql, etc…).</p>
585</dd></dl>
586
587<dl class="method">
588<dt id="CI_DB_driver::version">
589<code class="descname">version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::version" title="Permalink to this definition"></a></dt>
590<dd><table class="docutils field-list" frame="void" rules="none">
591<col class="field-name" />
592<col class="field-body" />
593<tbody valign="top">
594<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The version of the database being used</td>
595</tr>
596<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
597</tr>
598</tbody>
599</table>
600<p>Database version number.</p>
601</dd></dl>
602
603<dl class="method">
604<dt id="CI_DB_driver::query">
605<code class="descname">query</code><span class="sig-paren">(</span><em>$sql</em><span class="optional">[</span>, <em>$binds = FALSE</em><span class="optional">[</span>, <em>$return_object = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::query" title="Permalink to this definition"></a></dt>
606<dd><table class="docutils field-list" frame="void" rules="none">
607<col class="field-name" />
608<col class="field-body" />
609<tbody valign="top">
610<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
611<li><strong>$sql</strong> (<em>string</em>) – The SQL statement to execute</li>
612<li><strong>$binds</strong> (<em>array</em>) – An array of binding data</li>
613<li><strong>$return_object</strong> (<em>bool</em>) – Whether to return a result object or not</li>
614</ul>
615</td>
616</tr>
617<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE for successful “write-type” queries, CI_DB_result instance (method chaining) on “query” success, FALSE on failure</p>
618</td>
619</tr>
620<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
621</td>
622</tr>
623</tbody>
624</table>
625<p>Execute an SQL query.</p>
626<p>Accepts an SQL string as input and returns a result object
627upon successful execution of a “read” type query.</p>
628<p>Returns:</p>
629<blockquote>
630<div><ul class="simple">
631<li>Boolean TRUE upon successful execution of a “write type” queries</li>
632<li>Boolean FALSE upon failure</li>
633<li><code class="docutils literal"><span class="pre">CI_DB_result</span></code> object for “read type” queries</li>
634</ul>
635</div></blockquote>
636</dd></dl>
637
638<dl class="method">
639<dt id="CI_DB_driver::simple_query">
640<code class="descname">simple_query</code><span class="sig-paren">(</span><em>$sql</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::simple_query" title="Permalink to this definition"></a></dt>
641<dd><table class="docutils field-list" frame="void" rules="none">
642<col class="field-name" />
643<col class="field-body" />
644<tbody valign="top">
645<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
646<li><strong>$sql</strong> (<em>string</em>) – The SQL statement to execute</li>
647</ul>
648</td>
649</tr>
650<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Whatever the underlying driver’s “query” function returns</p>
651</td>
652</tr>
653<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
654</td>
655</tr>
656</tbody>
657</table>
658<p>A simplified version of the <code class="docutils literal"><span class="pre">query()</span></code> method, appropriate
659for use when you don’t need to get a result object or to
660just send a query to the database and not care for the result.</p>
661</dd></dl>
662
663<dl class="method">
664<dt id="CI_DB_driver::affected_rows">
665<code class="descname">affected_rows</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::affected_rows" title="Permalink to this definition"></a></dt>
666<dd><table class="docutils field-list" frame="void" rules="none">
667<col class="field-name" />
668<col class="field-body" />
669<tbody valign="top">
670<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Number of rows affected</td>
671</tr>
672<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td>
673</tr>
674</tbody>
675</table>
676<p>Returns the number of rows <em>changed</em> by the last executed query.</p>
677<p>Useful for checking how much rows were created, updated or deleted
678during the last executed query.</p>
679</dd></dl>
680
681<dl class="method">
682<dt id="CI_DB_driver::trans_strict">
683<code class="descname">trans_strict</code><span class="sig-paren">(</span><span class="optional">[</span><em>$mode = TRUE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::trans_strict" title="Permalink to this definition"></a></dt>
684<dd><table class="docutils field-list" frame="void" rules="none">
685<col class="field-name" />
686<col class="field-body" />
687<tbody valign="top">
688<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
689<li><strong>$mode</strong> (<em>bool</em>) – Strict mode flag</li>
690</ul>
691</td>
692</tr>
693<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
694</td>
695</tr>
696</tbody>
697</table>
698<p>Enable/disable transaction “strict” mode.</p>
699<p>When strict mode is enabled, if you are running multiple
700groups of transactions and one group fails, all subsequent
701groups will be rolled back.</p>
702<p>If strict mode is disabled, each group is treated
703autonomously, meaning a failure of one group will not
704affect any others.</p>
705</dd></dl>
706
707<dl class="method">
708<dt id="CI_DB_driver::trans_off">
709<code class="descname">trans_off</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::trans_off" title="Permalink to this definition"></a></dt>
710<dd><table class="docutils field-list" frame="void" rules="none">
711<col class="field-name" />
712<col class="field-body" />
713<tbody valign="top">
714<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">void</td>
715</tr>
716</tbody>
717</table>
718<p>Disables transactions at run-time.</p>
719</dd></dl>
720
721<dl class="method">
722<dt id="CI_DB_driver::trans_start">
723<code class="descname">trans_start</code><span class="sig-paren">(</span><span class="optional">[</span><em>$test_mode = FALSE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::trans_start" title="Permalink to this definition"></a></dt>
724<dd><table class="docutils field-list" frame="void" rules="none">
725<col class="field-name" />
726<col class="field-body" />
727<tbody valign="top">
728<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
729<li><strong>$test_mode</strong> (<em>bool</em>) – Test mode flag</li>
730</ul>
731</td>
732</tr>
733<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
734</td>
735</tr>
736<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
737</td>
738</tr>
739</tbody>
740</table>
741<p>Start a transaction.</p>
742</dd></dl>
743
744<dl class="method">
745<dt id="CI_DB_driver::trans_complete">
746<code class="descname">trans_complete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::trans_complete" title="Permalink to this definition"></a></dt>
747<dd><table class="docutils field-list" frame="void" rules="none">
748<col class="field-name" />
749<col class="field-body" />
750<tbody valign="top">
751<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td>
752</tr>
753<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
754</tr>
755</tbody>
756</table>
757<p>Complete Transaction.</p>
758</dd></dl>
759
760<dl class="method">
761<dt id="CI_DB_driver::trans_status">
762<code class="descname">trans_status</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::trans_status" title="Permalink to this definition"></a></dt>
763<dd><table class="docutils field-list" frame="void" rules="none">
764<col class="field-name" />
765<col class="field-body" />
766<tbody valign="top">
767<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE if the transaction succeeded, FALSE if it failed</td>
768</tr>
769<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
770</tr>
771</tbody>
772</table>
773<p>Lets you retrieve the transaction status flag to
774determine if it has failed.</p>
775</dd></dl>
776
777<dl class="method">
778<dt id="CI_DB_driver::compile_binds">
779<code class="descname">compile_binds</code><span class="sig-paren">(</span><em>$sql</em>, <em>$binds</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::compile_binds" title="Permalink to this definition"></a></dt>
780<dd><table class="docutils field-list" frame="void" rules="none">
781<col class="field-name" />
782<col class="field-body" />
783<tbody valign="top">
784<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
785<li><strong>$sql</strong> (<em>string</em>) – The SQL statement</li>
786<li><strong>$binds</strong> (<em>array</em>) – An array of binding data</li>
787</ul>
788</td>
789</tr>
790<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The updated SQL statement</p>
791</td>
792</tr>
793<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
794</td>
795</tr>
796</tbody>
797</table>
798<p>Compiles an SQL query with the bind values passed for it.</p>
799</dd></dl>
800
801<dl class="method">
802<dt id="CI_DB_driver::is_write_type">
803<code class="descname">is_write_type</code><span class="sig-paren">(</span><em>$sql</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::is_write_type" title="Permalink to this definition"></a></dt>
804<dd><table class="docutils field-list" frame="void" rules="none">
805<col class="field-name" />
806<col class="field-body" />
807<tbody valign="top">
808<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
809<li><strong>$sql</strong> (<em>string</em>) – The SQL statement</li>
810</ul>
811</td>
812</tr>
813<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE if the SQL statement is of “write type”, FALSE if not</p>
814</td>
815</tr>
816<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
817</td>
818</tr>
819</tbody>
820</table>
821<p>Determines if a query is of a “write” type (such as
822INSERT, UPDATE, DELETE) or “read” type (i.e. SELECT).</p>
823</dd></dl>
824
825<dl class="method">
826<dt id="CI_DB_driver::elapsed_time">
827<code class="descname">elapsed_time</code><span class="sig-paren">(</span><span class="optional">[</span><em>$decimals = 6</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::elapsed_time" title="Permalink to this definition"></a></dt>
828<dd><table class="docutils field-list" frame="void" rules="none">
829<col class="field-name" />
830<col class="field-body" />
831<tbody valign="top">
832<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
833<li><strong>$decimals</strong> (<em>int</em>) – The number of decimal places</li>
834</ul>
835</td>
836</tr>
837<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The aggregate query elapsed time, in microseconds</p>
838</td>
839</tr>
840<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
841</td>
842</tr>
843</tbody>
844</table>
845<p>Calculate the aggregate query elapsed time.</p>
846</dd></dl>
847
848<dl class="method">
849<dt id="CI_DB_driver::total_queries">
850<code class="descname">total_queries</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::total_queries" title="Permalink to this definition"></a></dt>
851<dd><table class="docutils field-list" frame="void" rules="none">
852<col class="field-name" />
853<col class="field-body" />
854<tbody valign="top">
855<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The total number of queries executed</td>
856</tr>
857<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td>
858</tr>
859</tbody>
860</table>
861<p>Returns the total number of queries that have been
862executed so far.</p>
863</dd></dl>
864
865<dl class="method">
866<dt id="CI_DB_driver::last_query">
867<code class="descname">last_query</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::last_query" title="Permalink to this definition"></a></dt>
868<dd><table class="docutils field-list" frame="void" rules="none">
869<col class="field-name" />
870<col class="field-body" />
871<tbody valign="top">
872<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The last query executed</td>
873</tr>
874<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
875</tr>
876</tbody>
877</table>
878<p>Returns the last query that was executed.</p>
879</dd></dl>
880
881<dl class="method">
882<dt id="CI_DB_driver::escape">
883<code class="descname">escape</code><span class="sig-paren">(</span><em>$str</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::escape" title="Permalink to this definition"></a></dt>
884<dd><table class="docutils field-list" frame="void" rules="none">
885<col class="field-name" />
886<col class="field-body" />
887<tbody valign="top">
888<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
889<li><strong>$str</strong> (<em>mixed</em>) – The value to escape, or an array of multiple ones</li>
890</ul>
891</td>
892</tr>
893<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The escaped value(s)</p>
894</td>
895</tr>
896<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
897</td>
898</tr>
899</tbody>
900</table>
901<p>Escapes input data based on type, including boolean and
902NULLs.</p>
903</dd></dl>
904
905<dl class="method">
906<dt id="CI_DB_driver::escape_str">
907<code class="descname">escape_str</code><span class="sig-paren">(</span><em>$str</em><span class="optional">[</span>, <em>$like = FALSE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::escape_str" title="Permalink to this definition"></a></dt>
908<dd><table class="docutils field-list" frame="void" rules="none">
909<col class="field-name" />
910<col class="field-body" />
911<tbody valign="top">
912<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
913<li><strong>$str</strong> (<em>mixed</em>) – A string value or array of multiple ones</li>
914<li><strong>$like</strong> (<em>bool</em>) – Whether or not the string will be used in a LIKE condition</li>
915</ul>
916</td>
917</tr>
918<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The escaped string(s)</p>
919</td>
920</tr>
921<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
922</td>
923</tr>
924</tbody>
925</table>
926<p>Escapes string values.</p>
927<div class="admonition warning">
928<p class="first admonition-title">Warning</p>
929<p class="last">The returned strings do NOT include quotes
930around them.</p>
931</div>
932</dd></dl>
933
934<dl class="method">
935<dt id="CI_DB_driver::escape_like_str">
936<code class="descname">escape_like_str</code><span class="sig-paren">(</span><em>$str</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::escape_like_str" title="Permalink to this definition"></a></dt>
937<dd><table class="docutils field-list" frame="void" rules="none">
938<col class="field-name" />
939<col class="field-body" />
940<tbody valign="top">
941<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
942<li><strong>$str</strong> (<em>mixed</em>) – A string value or array of multiple ones</li>
943</ul>
944</td>
945</tr>
946<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The escaped string(s)</p>
947</td>
948</tr>
949<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
950</td>
951</tr>
952</tbody>
953</table>
954<p>Escape LIKE strings.</p>
955<p>Similar to <code class="docutils literal"><span class="pre">escape_str()</span></code>, but will also escape the <code class="docutils literal"><span class="pre">%</span></code>
956and <code class="docutils literal"><span class="pre">_</span></code> wildcard characters, so that they don’t cause
957false-positives in LIKE conditions.</p>
958<div class="admonition important">
959<p class="first admonition-title">Important</p>
960<p class="last">The <code class="docutils literal"><span class="pre">escape_like_str()</span></code> method uses ‘!’ (exclamation mark)
961to escape special characters for <em>LIKE</em> conditions. Because this
962method escapes partial strings that you would wrap in quotes
963yourself, it cannot automatically add the <code class="docutils literal"><span class="pre">ESCAPE</span> <span class="pre">'!'</span></code>
964condition for you, and so you’ll have to manually do that.</p>
965</div>
966</dd></dl>
967
968<dl class="method">
969<dt id="CI_DB_driver::primary">
970<code class="descname">primary</code><span class="sig-paren">(</span><em>$table</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::primary" title="Permalink to this definition"></a></dt>
971<dd><table class="docutils field-list" frame="void" rules="none">
972<col class="field-name" />
973<col class="field-body" />
974<tbody valign="top">
975<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
976<li><strong>$table</strong> (<em>string</em>) – Table name</li>
977</ul>
978</td>
979</tr>
980<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The primary key name, FALSE if none</p>
981</td>
982</tr>
983<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
984</td>
985</tr>
986</tbody>
987</table>
988<p>Retrieves the primary key of a table.</p>
989<div class="admonition note">
990<p class="first admonition-title">Note</p>
991<p class="last">If the database platform does not support primary
992key detection, the first column name may be assumed
993as the primary key.</p>
994</div>
995</dd></dl>
996
997<dl class="method">
998<dt id="CI_DB_driver::count_all">
999<code class="descname">count_all</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::count_all" title="Permalink to this definition"></a></dt>
1000<dd><table class="docutils field-list" frame="void" rules="none">
1001<col class="field-name" />
1002<col class="field-body" />
1003<tbody valign="top">
1004<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1005<li><strong>$table</strong> (<em>string</em>) – Table name</li>
1006</ul>
1007</td>
1008</tr>
1009<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Row count for the specified table</p>
1010</td>
1011</tr>
1012<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
1013</td>
1014</tr>
1015</tbody>
1016</table>
1017<p>Returns the total number of rows in a table, or 0 if no
1018table was provided.</p>
1019</dd></dl>
1020
1021<dl class="method">
1022<dt id="CI_DB_driver::list_tables">
1023<code class="descname">list_tables</code><span class="sig-paren">(</span><span class="optional">[</span><em>$constrain_by_prefix = FALSE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::list_tables" title="Permalink to this definition"></a></dt>
1024<dd><table class="docutils field-list" frame="void" rules="none">
1025<col class="field-name" />
1026<col class="field-body" />
1027<tbody valign="top">
1028<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1029<li><strong>$constrain_by_prefix</strong> (<em>bool</em>) – TRUE to match table names by the configured dbprefix</li>
1030</ul>
1031</td>
1032</tr>
1033<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Array of table names or FALSE on failure</p>
1034</td>
1035</tr>
1036<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
1037</td>
1038</tr>
1039</tbody>
1040</table>
1041<p>Gets a list of the tables in the current database.</p>
1042</dd></dl>
1043
1044<dl class="method">
1045<dt id="CI_DB_driver::table_exists">
1046<code class="descname">table_exists</code><span class="sig-paren">(</span><em>$table_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::table_exists" title="Permalink to this definition"></a></dt>
1047<dd><table class="docutils field-list" frame="void" rules="none">
1048<col class="field-name" />
1049<col class="field-body" />
1050<tbody valign="top">
1051<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1052<li><strong>$table_name</strong> (<em>string</em>) – The table name</li>
1053</ul>
1054</td>
1055</tr>
1056<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE if that table exists, FALSE if not</p>
1057</td>
1058</tr>
1059<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
1060</td>
1061</tr>
1062</tbody>
1063</table>
1064<p>Determine if a particular table exists.</p>
1065</dd></dl>
1066
1067<dl class="method">
1068<dt id="CI_DB_driver::list_fields">
1069<code class="descname">list_fields</code><span class="sig-paren">(</span><em>$table</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::list_fields" title="Permalink to this definition"></a></dt>
1070<dd><table class="docutils field-list" frame="void" rules="none">
1071<col class="field-name" />
1072<col class="field-body" />
1073<tbody valign="top">
1074<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1075<li><strong>$table</strong> (<em>string</em>) – The table name</li>
1076</ul>
1077</td>
1078</tr>
1079<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Array of field names or FALSE on failure</p>
1080</td>
1081</tr>
1082<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
1083</td>
1084</tr>
1085</tbody>
1086</table>
1087<p>Gets a list of the field names in a table.</p>
1088</dd></dl>
1089
1090<dl class="method">
1091<dt id="CI_DB_driver::field_exists">
1092<code class="descname">field_exists</code><span class="sig-paren">(</span><em>$field_name</em>, <em>$table_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::field_exists" title="Permalink to this definition"></a></dt>
1093<dd><table class="docutils field-list" frame="void" rules="none">
1094<col class="field-name" />
1095<col class="field-body" />
1096<tbody valign="top">
1097<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1098<li><strong>$table_name</strong> (<em>string</em>) – The table name</li>
1099<li><strong>$field_name</strong> (<em>string</em>) – The field name</li>
1100</ul>
1101</td>
1102</tr>
1103<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE if that field exists in that table, FALSE if not</p>
1104</td>
1105</tr>
1106<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
1107</td>
1108</tr>
1109</tbody>
1110</table>
1111<p>Determine if a particular field exists.</p>
1112</dd></dl>
1113
1114<dl class="method">
1115<dt id="CI_DB_driver::field_data">
1116<code class="descname">field_data</code><span class="sig-paren">(</span><em>$table</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::field_data" title="Permalink to this definition"></a></dt>
1117<dd><table class="docutils field-list" frame="void" rules="none">
1118<col class="field-name" />
1119<col class="field-body" />
1120<tbody valign="top">
1121<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1122<li><strong>$table</strong> (<em>string</em>) – The table name</li>
1123</ul>
1124</td>
1125</tr>
1126<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Array of field data items or FALSE on failure</p>
1127</td>
1128</tr>
1129<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
1130</td>
1131</tr>
1132</tbody>
1133</table>
1134<p>Gets a list containing field data about a table.</p>
1135</dd></dl>
1136
1137<dl class="method">
1138<dt id="CI_DB_driver::escape_identifiers">
1139<code class="descname">escape_identifiers</code><span class="sig-paren">(</span><em>$item</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::escape_identifiers" title="Permalink to this definition"></a></dt>
1140<dd><table class="docutils field-list" frame="void" rules="none">
1141<col class="field-name" />
1142<col class="field-body" />
1143<tbody valign="top">
1144<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1145<li><strong>$item</strong> (<em>mixed</em>) – The item or array of items to escape</li>
1146</ul>
1147</td>
1148</tr>
1149<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The input item(s), escaped</p>
1150</td>
1151</tr>
1152<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p>
1153</td>
1154</tr>
1155</tbody>
1156</table>
1157<p>Escape SQL identifiers, such as column, table and names.</p>
1158</dd></dl>
1159
1160<dl class="method">
1161<dt id="CI_DB_driver::insert_string">
1162<code class="descname">insert_string</code><span class="sig-paren">(</span><em>$table</em>, <em>$data</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::insert_string" title="Permalink to this definition"></a></dt>
1163<dd><table class="docutils field-list" frame="void" rules="none">
1164<col class="field-name" />
1165<col class="field-body" />
1166<tbody valign="top">
1167<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1168<li><strong>$table</strong> (<em>string</em>) – The target table</li>
1169<li><strong>$data</strong> (<em>array</em>) – An associative array of key/value pairs</li>
1170</ul>
1171</td>
1172</tr>
1173<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The SQL INSERT statement, as a string</p>
1174</td>
1175</tr>
1176<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
1177</td>
1178</tr>
1179</tbody>
1180</table>
1181<p>Generate an INSERT statement string.</p>
1182</dd></dl>
1183
1184<dl class="method">
1185<dt id="CI_DB_driver::update_string">
1186<code class="descname">update_string</code><span class="sig-paren">(</span><em>$table</em>, <em>$data</em>, <em>$where</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::update_string" title="Permalink to this definition"></a></dt>
1187<dd><table class="docutils field-list" frame="void" rules="none">
1188<col class="field-name" />
1189<col class="field-body" />
1190<tbody valign="top">
1191<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1192<li><strong>$table</strong> (<em>string</em>) – The target table</li>
1193<li><strong>$data</strong> (<em>array</em>) – An associative array of key/value pairs</li>
1194<li><strong>$where</strong> (<em>mixed</em>) – The WHERE statement conditions</li>
1195</ul>
1196</td>
1197</tr>
1198<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The SQL UPDATE statement, as a string</p>
1199</td>
1200</tr>
1201<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
1202</td>
1203</tr>
1204</tbody>
1205</table>
1206<p>Generate an UPDATE statement string.</p>
1207</dd></dl>
1208
1209<dl class="method">
1210<dt id="CI_DB_driver::call_function">
1211<code class="descname">call_function</code><span class="sig-paren">(</span><em>$function</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::call_function" title="Permalink to this definition"></a></dt>
1212<dd><table class="docutils field-list" frame="void" rules="none">
1213<col class="field-name" />
1214<col class="field-body" />
1215<tbody valign="top">
1216<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1217<li><strong>$function</strong> (<em>string</em>) – Function name</li>
1218</ul>
1219</td>
1220</tr>
1221<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The function result</p>
1222</td>
1223</tr>
1224<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
1225</td>
1226</tr>
1227</tbody>
1228</table>
1229<p>Runs a native PHP function , using a platform agnostic
1230wrapper.</p>
1231</dd></dl>
1232
1233<dl class="method">
1234<dt id="CI_DB_driver::cache_set_path">
1235<code class="descname">cache_set_path</code><span class="sig-paren">(</span><span class="optional">[</span><em>$path = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::cache_set_path" title="Permalink to this definition"></a></dt>
1236<dd><table class="docutils field-list" frame="void" rules="none">
1237<col class="field-name" />
1238<col class="field-body" />
1239<tbody valign="top">
1240<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1241<li><strong>$path</strong> (<em>string</em>) – Path to the cache directory</li>
1242</ul>
1243</td>
1244</tr>
1245<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
1246</td>
1247</tr>
1248</tbody>
1249</table>
1250<p>Sets the directory path to use for caching storage.</p>
1251</dd></dl>
1252
1253<dl class="method">
1254<dt id="CI_DB_driver::cache_on">
1255<code class="descname">cache_on</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::cache_on" title="Permalink to this definition"></a></dt>
1256<dd><table class="docutils field-list" frame="void" rules="none">
1257<col class="field-name" />
1258<col class="field-body" />
1259<tbody valign="top">
1260<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE if caching is on, FALSE if not</td>
1261</tr>
1262<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
1263</tr>
1264</tbody>
1265</table>
1266<p>Enable database results caching.</p>
1267</dd></dl>
1268
1269<dl class="method">
1270<dt id="CI_DB_driver::cache_off">
1271<code class="descname">cache_off</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::cache_off" title="Permalink to this definition"></a></dt>
1272<dd><table class="docutils field-list" frame="void" rules="none">
1273<col class="field-name" />
1274<col class="field-body" />
1275<tbody valign="top">
1276<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE if caching is on, FALSE if not</td>
1277</tr>
1278<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
1279</tr>
1280</tbody>
1281</table>
1282<p>Disable database results caching.</p>
1283</dd></dl>
1284
1285<dl class="method">
1286<dt id="CI_DB_driver::cache_delete">
1287<code class="descname">cache_delete</code><span class="sig-paren">(</span><span class="optional">[</span><em>$segment_one = ''</em><span class="optional">[</span>, <em>$segment_two = ''</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::cache_delete" title="Permalink to this definition"></a></dt>
1288<dd><table class="docutils field-list" frame="void" rules="none">
1289<col class="field-name" />
1290<col class="field-body" />
1291<tbody valign="top">
1292<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1293<li><strong>$segment_one</strong> (<em>string</em>) – First URI segment</li>
1294<li><strong>$segment_two</strong> (<em>string</em>) – Second URI segment</li>
1295</ul>
1296</td>
1297</tr>
1298<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
1299</td>
1300</tr>
1301<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
1302</td>
1303</tr>
1304</tbody>
1305</table>
1306<p>Delete the cache files associated with a particular URI.</p>
1307</dd></dl>
1308
1309<dl class="method">
1310<dt id="CI_DB_driver::cache_delete_all">
1311<code class="descname">cache_delete_all</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::cache_delete_all" title="Permalink to this definition"></a></dt>
1312<dd><table class="docutils field-list" frame="void" rules="none">
1313<col class="field-name" />
1314<col class="field-body" />
1315<tbody valign="top">
1316<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td>
1317</tr>
1318<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
1319</tr>
1320</tbody>
1321</table>
1322<p>Delete all cache files.</p>
1323</dd></dl>
1324
1325<dl class="method">
1326<dt id="CI_DB_driver::close">
1327<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::close" title="Permalink to this definition"></a></dt>
1328<dd><table class="docutils field-list" frame="void" rules="none">
1329<col class="field-name" />
1330<col class="field-body" />
1331<tbody valign="top">
1332<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">void</td>
1333</tr>
1334</tbody>
1335</table>
1336<p>Close the DB Connection.</p>
1337</dd></dl>
1338
1339<dl class="method">
1340<dt id="CI_DB_driver::display_error">
1341<code class="descname">display_error</code><span class="sig-paren">(</span><span class="optional">[</span><em>$error = ''</em><span class="optional">[</span>, <em>$swap = ''</em><span class="optional">[</span>, <em>$native = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::display_error" title="Permalink to this definition"></a></dt>
1342<dd><table class="docutils field-list" frame="void" rules="none">
1343<col class="field-name" />
1344<col class="field-body" />
1345<tbody valign="top">
1346<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1347<li><strong>$error</strong> (<em>string</em>) – The error message</li>
1348<li><strong>$swap</strong> (<em>string</em>) – Any “swap” values</li>
1349<li><strong>$native</strong> (<em>bool</em>) – Whether to localize the message</li>
1350</ul>
1351</td>
1352</tr>
1353<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">void</p>
1354</td>
1355</tr>
1356<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Displays the DB error screensends the application/views/errors/error_db.php template</p>
1357</td>
1358</tr>
1359<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
1360</td>
1361</tr>
1362</tbody>
1363</table>
1364<p>Display an error message and stop script execution.</p>
1365<p>The message is displayed using the
1366<em>application/views/errors/error_db.php</em> template.</p>
1367</dd></dl>
1368
1369<dl class="method">
1370<dt id="CI_DB_driver::protect_identifiers">
1371<code class="descname">protect_identifiers</code><span class="sig-paren">(</span><em>$item</em><span class="optional">[</span>, <em>$prefix_single = FALSE</em><span class="optional">[</span>, <em>$protect_identifiers = NULL</em><span class="optional">[</span>, <em>$field_exists = TRUE</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_driver::protect_identifiers" title="Permalink to this definition"></a></dt>
1372<dd><table class="docutils field-list" frame="void" rules="none">
1373<col class="field-name" />
1374<col class="field-body" />
1375<tbody valign="top">
1376<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1377<li><strong>$item</strong> (<em>string</em>) – The item to work with</li>
1378<li><strong>$prefix_single</strong> (<em>bool</em>) – Whether to apply the dbprefix even if the input item is a single identifier</li>
1379<li><strong>$protect_identifiers</strong> (<em>bool</em>) – Whether to quote identifiers</li>
1380<li><strong>$field_exists</strong> (<em>bool</em>) – Whether the supplied item contains a field name or not</li>
1381</ul>
1382</td>
1383</tr>
1384<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The modified item</p>
1385</td>
1386</tr>
1387<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
1388</td>
1389</tr>
1390</tbody>
1391</table>
1392<p>Takes a column or table name (optionally with an alias)
1393and applies the configured <em>dbprefix</em> to it.</p>
1394<p>Some logic is necessary in order to deal with
1395column names that include the path.</p>
1396<p>Consider a query like this:</p>
1397<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">SELECT</span> <span class="o">*</span> <span class="nx">FROM</span> <span class="nx">hostname</span><span class="o">.</span><span class="nx">database</span><span class="o">.</span><span class="nx">table</span><span class="o">.</span><span class="nx">column</span> <span class="k">AS</span> <span class="nx">c</span> <span class="nx">FROM</span> <span class="nx">hostname</span><span class="o">.</span><span class="nx">database</span><span class="o">.</span><span class="nx">table</span>
1398</pre></div>
1399</div>
1400<p>Or a query with aliasing:</p>
1401<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">SELECT</span> <span class="nx">m</span><span class="o">.</span><span class="nx">member_id</span><span class="p">,</span> <span class="nx">m</span><span class="o">.</span><span class="nx">member_name</span> <span class="nx">FROM</span> <span class="nx">members</span> <span class="k">AS</span> <span class="nx">m</span>
1402</pre></div>
1403</div>
1404<p>Since the column name can include up to four segments
1405(host, DB, table, column) or also have an alias prefix,
1406we need to do a bit of work to figure this out and
1407insert the table prefix (if it exists) in the proper
1408position, and escape only the correct identifiers.</p>
1409<p>This method is used extensively by the Query Builder class.</p>
1410</dd></dl>
1411
1412</dd></dl>
1413
1414</div>
1415
1416
1417 </div>
1418 <footer>
1419
1420 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
1421
1422 <a href="../helpers/index.html" class="btn btn-neutral float-right" title="Helpers">Next <span class="fa fa-arrow-circle-right"></span></a>
1423
1424
1425 <a href="utilities.html" class="btn btn-neutral" title="Database Utility Class"><span class="fa fa-arrow-circle-left"></span> Previous</a>
1426
1427 </div>
1428
1429
1430 <hr/>
1431
1432 <div role="contentinfo">
1433 <p>
1434 &copy; Copyright 2014 - 2019, British Columbia Institute of Technology.
1435 Last updated on Jan 16, 2019.
1436 </p>
1437 </div>
1438
1439 Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
1440
1441</footer>
1442 </div>
1443 </div>
1444
1445 </section>
1446
1447 </div>
1448
1449
1450
1451
1452
1453 <script type="text/javascript">
1454 var DOCUMENTATION_OPTIONS = {
1455 URL_ROOT:'../',
1456 VERSION:'3.1.10',
1457 COLLAPSE_INDEX:false,
1458 FILE_SUFFIX:'.html',
1459 HAS_SOURCE: false
1460 };
1461 </script>
1462 <script type="text/javascript" src="../_static/jquery.js"></script>
1463 <script type="text/javascript" src="../_static/underscore.js"></script>
1464 <script type="text/javascript" src="../_static/doctools.js"></script>
1465
1466
1467
1468
1469
1470 <script type="text/javascript" src="../_static/js/theme.js"></script>
1471
1472
1473
1474
1475 <script type="text/javascript">
1476 jQuery(function () {
1477 SphinxRtdTheme.StickyNav.enable();
1478 });
1479 </script>
1480
1481
1482</body>
1483</html>