db_driver_reference.html 80 KB

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