utilities.html 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  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>Database Utility Class &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="DB Driver Reference" href="db_driver_reference.html"/>
  17. <link rel="prev" title="Database Forge Class" href="forge.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 current"><a class="current reference internal" href="#">Database Utilities Class</a></li>
  144. <li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">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 current"><a class="current reference internal" href="#">Database Utilities Class</a></li>
  315. <li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">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>Database Utility Class</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="database-utility-class">
  370. <h1>Database Utility Class<a class="headerlink" href="#database-utility-class" title="Permalink to this headline">¶</a></h1>
  371. <p>The Database Utility Class contains methods that help you manage your
  372. database.</p>
  373. <div class="contents local topic" id="contents">
  374. <ul class="simple">
  375. <li><a class="reference internal" href="#initializing-the-utility-class" id="id1">Initializing the Utility Class</a></li>
  376. <li><a class="reference internal" href="#using-the-database-utilities" id="id2">Using the Database Utilities</a><ul>
  377. <li><a class="reference internal" href="#retrieve-list-of-database-names" id="id3">Retrieve list of database names</a></li>
  378. <li><a class="reference internal" href="#determine-if-a-database-exists" id="id4">Determine If a Database Exists</a></li>
  379. <li><a class="reference internal" href="#optimize-a-table" id="id5">Optimize a Table</a></li>
  380. <li><a class="reference internal" href="#repair-a-table" id="id6">Repair a Table</a></li>
  381. <li><a class="reference internal" href="#optimize-a-database" id="id7">Optimize a Database</a></li>
  382. <li><a class="reference internal" href="#export-a-query-result-as-a-csv-file" id="id8">Export a Query Result as a CSV File</a></li>
  383. <li><a class="reference internal" href="#export-a-query-result-as-an-xml-document" id="id9">Export a Query Result as an XML Document</a></li>
  384. </ul>
  385. </li>
  386. <li><a class="reference internal" href="#backup-your-database" id="id10">Backup Your Database</a><ul>
  387. <li><a class="reference internal" href="#database-backup-notes" id="id11">Database Backup Notes</a></li>
  388. <li><a class="reference internal" href="#usage-example" id="id12">Usage Example</a></li>
  389. <li><a class="reference internal" href="#setting-backup-preferences" id="id13">Setting Backup Preferences</a></li>
  390. <li><a class="reference internal" href="#description-of-backup-preferences" id="id14">Description of Backup Preferences</a></li>
  391. </ul>
  392. </li>
  393. <li><a class="reference internal" href="#class-reference" id="id15">Class Reference</a></li>
  394. </ul>
  395. </div>
  396. <div class="section" id="initializing-the-utility-class">
  397. <h2><a class="toc-backref" href="#id1">Initializing the Utility Class</a><a class="headerlink" href="#initializing-the-utility-class" title="Permalink to this headline">¶</a></h2>
  398. <div class="admonition important">
  399. <p class="first admonition-title">Important</p>
  400. <p class="last">In order to initialize the Utility class, your database
  401. driver must already be running, since the utilities class relies on it.</p>
  402. </div>
  403. <p>Load the Utility Class as follows:</p>
  404. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="p">();</span>
  405. </pre></div>
  406. </div>
  407. <p>You can also pass another database object to the DB Utility loader, in case
  408. the database you want to manage isn’t the default one:</p>
  409. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">myutil</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">other_db</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span>
  410. </pre></div>
  411. </div>
  412. <p>In the above example, we’re passing a custom database object as the first
  413. parameter and then tell it to return the dbutil object, instead of
  414. assigning it directly to <code class="docutils literal"><span class="pre">$this-&gt;dbutil</span></code>.</p>
  415. <div class="admonition note">
  416. <p class="first admonition-title">Note</p>
  417. <p class="last">Both of the parameters can be used individually, just pass an empty
  418. value as the first one if you wish to skip it.</p>
  419. </div>
  420. <p>Once initialized you will access the methods using the <code class="docutils literal"><span class="pre">$this-&gt;dbutil</span></code>
  421. object:</p>
  422. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">some_method</span><span class="p">();</span>
  423. </pre></div>
  424. </div>
  425. </div>
  426. <div class="section" id="using-the-database-utilities">
  427. <h2><a class="toc-backref" href="#id2">Using the Database Utilities</a><a class="headerlink" href="#using-the-database-utilities" title="Permalink to this headline">¶</a></h2>
  428. <div class="section" id="retrieve-list-of-database-names">
  429. <h3><a class="toc-backref" href="#id3">Retrieve list of database names</a><a class="headerlink" href="#retrieve-list-of-database-names" title="Permalink to this headline">¶</a></h3>
  430. <p>Returns an array of database names:</p>
  431. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$dbs</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">list_databases</span><span class="p">();</span>
  432. <span class="k">foreach</span> <span class="p">(</span><span class="nv">$dbs</span> <span class="k">as</span> <span class="nv">$db</span><span class="p">)</span>
  433. <span class="p">{</span>
  434. <span class="k">echo</span> <span class="nv">$db</span><span class="p">;</span>
  435. <span class="p">}</span>
  436. </pre></div>
  437. </div>
  438. </div>
  439. <div class="section" id="determine-if-a-database-exists">
  440. <h3><a class="toc-backref" href="#id4">Determine If a Database Exists</a><a class="headerlink" href="#determine-if-a-database-exists" title="Permalink to this headline">¶</a></h3>
  441. <p>Sometimes it’s helpful to know whether a particular database exists.
  442. Returns a boolean TRUE/FALSE. Usage example:</p>
  443. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">database_exists</span><span class="p">(</span><span class="s1">&#39;database_name&#39;</span><span class="p">))</span>
  444. <span class="p">{</span>
  445. <span class="c1">// some code...</span>
  446. <span class="p">}</span>
  447. </pre></div>
  448. </div>
  449. <div class="admonition note">
  450. <p class="first admonition-title">Note</p>
  451. <p class="last">Replace <em>database_name</em> with the name of the database you are
  452. looking for. This method is case sensitive.</p>
  453. </div>
  454. </div>
  455. <div class="section" id="optimize-a-table">
  456. <h3><a class="toc-backref" href="#id5">Optimize a Table</a><a class="headerlink" href="#optimize-a-table" title="Permalink to this headline">¶</a></h3>
  457. <p>Permits you to optimize a table using the table name specified in the
  458. first parameter. Returns TRUE/FALSE based on success or failure:</p>
  459. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">optimize_table</span><span class="p">(</span><span class="s1">&#39;table_name&#39;</span><span class="p">))</span>
  460. <span class="p">{</span>
  461. <span class="k">echo</span> <span class="s1">&#39;Success!&#39;</span><span class="p">;</span>
  462. <span class="p">}</span>
  463. </pre></div>
  464. </div>
  465. <div class="admonition note">
  466. <p class="first admonition-title">Note</p>
  467. <p class="last">Not all database platforms support table optimization. It is
  468. mostly for use with MySQL.</p>
  469. </div>
  470. </div>
  471. <div class="section" id="repair-a-table">
  472. <h3><a class="toc-backref" href="#id6">Repair a Table</a><a class="headerlink" href="#repair-a-table" title="Permalink to this headline">¶</a></h3>
  473. <p>Permits you to repair a table using the table name specified in the
  474. first parameter. Returns TRUE/FALSE based on success or failure:</p>
  475. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">repair_table</span><span class="p">(</span><span class="s1">&#39;table_name&#39;</span><span class="p">))</span>
  476. <span class="p">{</span>
  477. <span class="k">echo</span> <span class="s1">&#39;Success!&#39;</span><span class="p">;</span>
  478. <span class="p">}</span>
  479. </pre></div>
  480. </div>
  481. <div class="admonition note">
  482. <p class="first admonition-title">Note</p>
  483. <p class="last">Not all database platforms support table repairs.</p>
  484. </div>
  485. </div>
  486. <div class="section" id="optimize-a-database">
  487. <h3><a class="toc-backref" href="#id7">Optimize a Database</a><a class="headerlink" href="#optimize-a-database" title="Permalink to this headline">¶</a></h3>
  488. <p>Permits you to optimize the database your DB class is currently
  489. connected to. Returns an array containing the DB status messages or
  490. FALSE on failure.</p>
  491. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$result</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">optimize_database</span><span class="p">();</span>
  492. <span class="k">if</span> <span class="p">(</span><span class="nv">$result</span> <span class="o">!==</span> <span class="k">FALSE</span><span class="p">)</span>
  493. <span class="p">{</span>
  494. <span class="nb">print_r</span><span class="p">(</span><span class="nv">$result</span><span class="p">);</span>
  495. <span class="p">}</span>
  496. </pre></div>
  497. </div>
  498. <div class="admonition note">
  499. <p class="first admonition-title">Note</p>
  500. <p class="last">Not all database platforms support database optimization. It
  501. it is mostly for use with MySQL.</p>
  502. </div>
  503. </div>
  504. <div class="section" id="export-a-query-result-as-a-csv-file">
  505. <h3><a class="toc-backref" href="#id8">Export a Query Result as a CSV File</a><a class="headerlink" href="#export-a-query-result-as-a-csv-file" title="Permalink to this headline">¶</a></h3>
  506. <p>Permits you to generate a CSV file from a query result. The first
  507. parameter of the method must contain the result object from your
  508. query. Example:</p>
  509. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="p">();</span>
  510. <span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">db</span><span class="o">-&gt;</span><span class="na">query</span><span class="p">(</span><span class="s2">&quot;SELECT * FROM mytable&quot;</span><span class="p">);</span>
  511. <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">csv_from_result</span><span class="p">(</span><span class="nv">$query</span><span class="p">);</span>
  512. </pre></div>
  513. </div>
  514. <p>The second, third, and fourth parameters allow you to set the delimiter
  515. newline, and enclosure characters respectively. By default commas are
  516. used as the delimiter, “n” is used as a new line, and a double-quote
  517. is used as the enclosure. Example:</p>
  518. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$delimiter</span> <span class="o">=</span> <span class="s2">&quot;,&quot;</span><span class="p">;</span>
  519. <span class="nv">$newline</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="p">;</span>
  520. <span class="nv">$enclosure</span> <span class="o">=</span> <span class="s1">&#39;&quot;&#39;</span><span class="p">;</span>
  521. <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">csv_from_result</span><span class="p">(</span><span class="nv">$query</span><span class="p">,</span> <span class="nv">$delimiter</span><span class="p">,</span> <span class="nv">$newline</span><span class="p">,</span> <span class="nv">$enclosure</span><span class="p">);</span>
  522. </pre></div>
  523. </div>
  524. <div class="admonition important">
  525. <p class="first admonition-title">Important</p>
  526. <p class="last">This method will NOT write the CSV file for you. It
  527. simply creates the CSV layout. If you need to write the file
  528. use the <a class="reference internal" href="../helpers/file_helper.html"><span class="doc">File Helper</span></a>.</p>
  529. </div>
  530. </div>
  531. <div class="section" id="export-a-query-result-as-an-xml-document">
  532. <h3><a class="toc-backref" href="#id9">Export a Query Result as an XML Document</a><a class="headerlink" href="#export-a-query-result-as-an-xml-document" title="Permalink to this headline">¶</a></h3>
  533. <p>Permits you to generate an XML file from a query result. The first
  534. parameter expects a query result object, the second may contain an
  535. optional array of config parameters. Example:</p>
  536. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="p">();</span>
  537. <span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">db</span><span class="o">-&gt;</span><span class="na">query</span><span class="p">(</span><span class="s2">&quot;SELECT * FROM mytable&quot;</span><span class="p">);</span>
  538. <span class="nv">$config</span> <span class="o">=</span> <span class="k">array</span> <span class="p">(</span>
  539. <span class="s1">&#39;root&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;root&#39;</span><span class="p">,</span>
  540. <span class="s1">&#39;element&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;element&#39;</span><span class="p">,</span>
  541. <span class="s1">&#39;newline&#39;</span> <span class="o">=&gt;</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">,</span>
  542. <span class="s1">&#39;tab&#39;</span> <span class="o">=&gt;</span> <span class="s2">&quot;</span><span class="se">\t</span><span class="s2">&quot;</span>
  543. <span class="p">);</span>
  544. <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">xml_from_result</span><span class="p">(</span><span class="nv">$query</span><span class="p">,</span> <span class="nv">$config</span><span class="p">);</span>
  545. </pre></div>
  546. </div>
  547. <div class="admonition important">
  548. <p class="first admonition-title">Important</p>
  549. <p class="last">This method will NOT write the XML file for you. It
  550. simply creates the XML layout. If you need to write the file
  551. use the <a class="reference internal" href="../helpers/file_helper.html"><span class="doc">File Helper</span></a>.</p>
  552. </div>
  553. </div>
  554. </div>
  555. <div class="section" id="backup-your-database">
  556. <h2><a class="toc-backref" href="#id10">Backup Your Database</a><a class="headerlink" href="#backup-your-database" title="Permalink to this headline">¶</a></h2>
  557. <div class="section" id="database-backup-notes">
  558. <h3><a class="toc-backref" href="#id11">Database Backup Notes</a><a class="headerlink" href="#database-backup-notes" title="Permalink to this headline">¶</a></h3>
  559. <p>Permits you to backup your full database or individual tables. The
  560. backup data can be compressed in either Zip or Gzip format.</p>
  561. <div class="admonition note">
  562. <p class="first admonition-title">Note</p>
  563. <p class="last">This feature is only available for MySQL and Interbase/Firebird databases.</p>
  564. </div>
  565. <div class="admonition note">
  566. <p class="first admonition-title">Note</p>
  567. <p>For Interbase/Firebird databases, the backup file name is the only parameter.</p>
  568. <p class="last">$this-&gt;dbutil-&gt;backup(‘db_backup_filename’);</p>
  569. </div>
  570. <div class="admonition note">
  571. <p class="first admonition-title">Note</p>
  572. <p class="last">Due to the limited execution time and memory available to PHP,
  573. backing up very large databases may not be possible. If your database is
  574. very large you might need to backup directly from your SQL server via
  575. the command line, or have your server admin do it for you if you do not
  576. have root privileges.</p>
  577. </div>
  578. </div>
  579. <div class="section" id="usage-example">
  580. <h3><a class="toc-backref" href="#id12">Usage Example</a><a class="headerlink" href="#usage-example" title="Permalink to this headline">¶</a></h3>
  581. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Load the DB utility class</span>
  582. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="p">();</span>
  583. <span class="c1">// Backup your entire database and assign it to a variable</span>
  584. <span class="nv">$backup</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">backup</span><span class="p">();</span>
  585. <span class="c1">// Load the file helper and write the file to your server</span>
  586. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;file&#39;</span><span class="p">);</span>
  587. <span class="nx">write_file</span><span class="p">(</span><span class="s1">&#39;/path/to/mybackup.gz&#39;</span><span class="p">,</span> <span class="nv">$backup</span><span class="p">);</span>
  588. <span class="c1">// Load the download helper and send the file to your desktop</span>
  589. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;download&#39;</span><span class="p">);</span>
  590. <span class="nx">force_download</span><span class="p">(</span><span class="s1">&#39;mybackup.gz&#39;</span><span class="p">,</span> <span class="nv">$backup</span><span class="p">);</span>
  591. </pre></div>
  592. </div>
  593. </div>
  594. <div class="section" id="setting-backup-preferences">
  595. <h3><a class="toc-backref" href="#id13">Setting Backup Preferences</a><a class="headerlink" href="#setting-backup-preferences" title="Permalink to this headline">¶</a></h3>
  596. <p>Backup preferences are set by submitting an array of values to the first
  597. parameter of the <code class="docutils literal"><span class="pre">backup()</span></code> method. Example:</p>
  598. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$prefs</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
  599. <span class="s1">&#39;tables&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;table1&#39;</span><span class="p">,</span> <span class="s1">&#39;table2&#39;</span><span class="p">),</span> <span class="c1">// Array of tables to backup.</span>
  600. <span class="s1">&#39;ignore&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(),</span> <span class="c1">// List of tables to omit from the backup</span>
  601. <span class="s1">&#39;format&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;txt&#39;</span><span class="p">,</span> <span class="c1">// gzip, zip, txt</span>
  602. <span class="s1">&#39;filename&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;mybackup.sql&#39;</span><span class="p">,</span> <span class="c1">// File name - NEEDED ONLY WITH ZIP FILES</span>
  603. <span class="s1">&#39;add_drop&#39;</span> <span class="o">=&gt;</span> <span class="k">TRUE</span><span class="p">,</span> <span class="c1">// Whether to add DROP TABLE statements to backup file</span>
  604. <span class="s1">&#39;add_insert&#39;</span> <span class="o">=&gt;</span> <span class="k">TRUE</span><span class="p">,</span> <span class="c1">// Whether to add INSERT data to backup file</span>
  605. <span class="s1">&#39;newline&#39;</span> <span class="o">=&gt;</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="c1">// Newline character used in backup file</span>
  606. <span class="p">);</span>
  607. <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">dbutil</span><span class="o">-&gt;</span><span class="na">backup</span><span class="p">(</span><span class="nv">$prefs</span><span class="p">);</span>
  608. </pre></div>
  609. </div>
  610. </div>
  611. <div class="section" id="description-of-backup-preferences">
  612. <h3><a class="toc-backref" href="#id14">Description of Backup Preferences</a><a class="headerlink" href="#description-of-backup-preferences" title="Permalink to this headline">¶</a></h3>
  613. <table border="1" class="docutils">
  614. <colgroup>
  615. <col width="16%" />
  616. <col width="16%" />
  617. <col width="16%" />
  618. <col width="51%" />
  619. </colgroup>
  620. <thead valign="bottom">
  621. <tr class="row-odd"><th class="head">Preference</th>
  622. <th class="head">Default Value</th>
  623. <th class="head">Options</th>
  624. <th class="head">Description</th>
  625. </tr>
  626. </thead>
  627. <tbody valign="top">
  628. <tr class="row-even"><td><strong>tables</strong></td>
  629. <td>empty array</td>
  630. <td>None</td>
  631. <td>An array of tables you want backed up. If left blank all tables will be
  632. exported.</td>
  633. </tr>
  634. <tr class="row-odd"><td><strong>ignore</strong></td>
  635. <td>empty array</td>
  636. <td>None</td>
  637. <td>An array of tables you want the backup routine to ignore.</td>
  638. </tr>
  639. <tr class="row-even"><td><strong>format</strong></td>
  640. <td>gzip</td>
  641. <td>gzip, zip, txt</td>
  642. <td>The file format of the export file.</td>
  643. </tr>
  644. <tr class="row-odd"><td><strong>filename</strong></td>
  645. <td>the current date/time</td>
  646. <td>None</td>
  647. <td>The name of the backed-up file. The name is needed only if you are using
  648. zip compression.</td>
  649. </tr>
  650. <tr class="row-even"><td><strong>add_drop</strong></td>
  651. <td>TRUE</td>
  652. <td>TRUE/FALSE</td>
  653. <td>Whether to include DROP TABLE statements in your SQL export file.</td>
  654. </tr>
  655. <tr class="row-odd"><td><strong>add_insert</strong></td>
  656. <td>TRUE</td>
  657. <td>TRUE/FALSE</td>
  658. <td>Whether to include INSERT statements in your SQL export file.</td>
  659. </tr>
  660. <tr class="row-even"><td><strong>newline</strong></td>
  661. <td>“\n”</td>
  662. <td>“\n”, “\r”, “\r\n”</td>
  663. <td>Type of newline to use in your SQL export file.</td>
  664. </tr>
  665. <tr class="row-odd"><td><strong>foreign_key_checks</strong></td>
  666. <td>TRUE</td>
  667. <td>TRUE/FALSE</td>
  668. <td>Whether output should keep foreign key checks enabled.</td>
  669. </tr>
  670. </tbody>
  671. </table>
  672. </div>
  673. </div>
  674. <div class="section" id="class-reference">
  675. <h2><a class="toc-backref" href="#id15">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline">¶</a></h2>
  676. <dl class="class">
  677. <dt id="CI_DB_utility">
  678. <em class="property">class </em><code class="descname">CI_DB_utility</code><a class="headerlink" href="#CI_DB_utility" title="Permalink to this definition">¶</a></dt>
  679. <dd><dl class="method">
  680. <dt id="CI_DB_utility::backup">
  681. <code class="descname">backup</code><span class="sig-paren">(</span><span class="optional">[</span><em>$params = array()</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::backup" title="Permalink to this definition">¶</a></dt>
  682. <dd><table class="docutils field-list" frame="void" rules="none">
  683. <col class="field-name" />
  684. <col class="field-body" />
  685. <tbody valign="top">
  686. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  687. <li><strong>$params</strong> (<em>array</em>) – An associative array of options</li>
  688. </ul>
  689. </td>
  690. </tr>
  691. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">raw/(g)zipped SQL query string</p>
  692. </td>
  693. </tr>
  694. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  695. </td>
  696. </tr>
  697. </tbody>
  698. </table>
  699. <p>Perform a database backup, per user preferences.</p>
  700. </dd></dl>
  701. <dl class="method">
  702. <dt id="CI_DB_utility::database_exists">
  703. <code class="descname">database_exists</code><span class="sig-paren">(</span><em>$database_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::database_exists" title="Permalink to this definition">¶</a></dt>
  704. <dd><table class="docutils field-list" frame="void" rules="none">
  705. <col class="field-name" />
  706. <col class="field-body" />
  707. <tbody valign="top">
  708. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  709. <li><strong>$database_name</strong> (<em>string</em>) – Database name</li>
  710. </ul>
  711. </td>
  712. </tr>
  713. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE if the database exists, FALSE otherwise</p>
  714. </td>
  715. </tr>
  716. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
  717. </td>
  718. </tr>
  719. </tbody>
  720. </table>
  721. <p>Check for the existence of a database.</p>
  722. </dd></dl>
  723. <dl class="method">
  724. <dt id="CI_DB_utility::list_databases">
  725. <code class="descname">list_databases</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::list_databases" title="Permalink to this definition">¶</a></dt>
  726. <dd><table class="docutils field-list" frame="void" rules="none">
  727. <col class="field-name" />
  728. <col class="field-body" />
  729. <tbody valign="top">
  730. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array of database names found</td>
  731. </tr>
  732. <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
  733. </tr>
  734. </tbody>
  735. </table>
  736. <p>Retrieve a list of all the database names.</p>
  737. </dd></dl>
  738. <dl class="method">
  739. <dt id="CI_DB_utility::optimize_database">
  740. <code class="descname">optimize_database</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::optimize_database" title="Permalink to this definition">¶</a></dt>
  741. <dd><table class="docutils field-list" frame="void" rules="none">
  742. <col class="field-name" />
  743. <col class="field-body" />
  744. <tbody valign="top">
  745. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array of optimization messages or FALSE on failure</td>
  746. </tr>
  747. <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
  748. </tr>
  749. </tbody>
  750. </table>
  751. <p>Optimizes the database.</p>
  752. </dd></dl>
  753. <dl class="method">
  754. <dt id="CI_DB_utility::optimize_table">
  755. <code class="descname">optimize_table</code><span class="sig-paren">(</span><em>$table_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::optimize_table" title="Permalink to this definition">¶</a></dt>
  756. <dd><table class="docutils field-list" frame="void" rules="none">
  757. <col class="field-name" />
  758. <col class="field-body" />
  759. <tbody valign="top">
  760. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  761. <li><strong>$table_name</strong> (<em>string</em>) – Name of the table to optimize</li>
  762. </ul>
  763. </td>
  764. </tr>
  765. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Array of optimization messages or FALSE on failure</p>
  766. </td>
  767. </tr>
  768. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
  769. </td>
  770. </tr>
  771. </tbody>
  772. </table>
  773. <p>Optimizes a database table.</p>
  774. </dd></dl>
  775. <dl class="method">
  776. <dt id="CI_DB_utility::repair_table">
  777. <code class="descname">repair_table</code><span class="sig-paren">(</span><em>$table_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::repair_table" title="Permalink to this definition">¶</a></dt>
  778. <dd><table class="docutils field-list" frame="void" rules="none">
  779. <col class="field-name" />
  780. <col class="field-body" />
  781. <tbody valign="top">
  782. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  783. <li><strong>$table_name</strong> (<em>string</em>) – Name of the table to repair</li>
  784. </ul>
  785. </td>
  786. </tr>
  787. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Array of repair messages or FALSE on failure</p>
  788. </td>
  789. </tr>
  790. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
  791. </td>
  792. </tr>
  793. </tbody>
  794. </table>
  795. <p>Repairs a database table.</p>
  796. </dd></dl>
  797. <dl class="method">
  798. <dt id="CI_DB_utility::csv_from_result">
  799. <code class="descname">csv_from_result</code><span class="sig-paren">(</span><em>$query</em><span class="optional">[</span>, <em>$delim = '</em>, <em>'</em><span class="optional">[</span>, <em>$newline = &quot;n&quot;</em><span class="optional">[</span>, <em>$enclosure = '&quot;'</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::csv_from_result" title="Permalink to this definition">¶</a></dt>
  800. <dd><table class="docutils field-list" frame="void" rules="none">
  801. <col class="field-name" />
  802. <col class="field-body" />
  803. <tbody valign="top">
  804. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  805. <li><strong>$query</strong> (<em>object</em>) – A database result object</li>
  806. <li><strong>$delim</strong> (<em>string</em>) – The CSV field delimiter to use</li>
  807. <li><strong>$newline</strong> (<em>string</em>) – The newline character to use</li>
  808. <li><strong>$enclosure</strong> (<em>string</em>) – The enclosure delimiter to use</li>
  809. </ul>
  810. </td>
  811. </tr>
  812. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The generated CSV file as a string</p>
  813. </td>
  814. </tr>
  815. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  816. </td>
  817. </tr>
  818. </tbody>
  819. </table>
  820. <p>Translates a database result object into a CSV document.</p>
  821. </dd></dl>
  822. <dl class="method">
  823. <dt id="CI_DB_utility::xml_from_result">
  824. <code class="descname">xml_from_result</code><span class="sig-paren">(</span><em>$query</em><span class="optional">[</span>, <em>$params = array()</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_utility::xml_from_result" title="Permalink to this definition">¶</a></dt>
  825. <dd><table class="docutils field-list" frame="void" rules="none">
  826. <col class="field-name" />
  827. <col class="field-body" />
  828. <tbody valign="top">
  829. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  830. <li><strong>$query</strong> (<em>object</em>) – A database result object</li>
  831. <li><strong>$params</strong> (<em>array</em>) – An associative array of preferences</li>
  832. </ul>
  833. </td>
  834. </tr>
  835. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The generated XML document as a string</p>
  836. </td>
  837. </tr>
  838. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  839. </td>
  840. </tr>
  841. </tbody>
  842. </table>
  843. <p>Translates a database result object into an XML document.</p>
  844. </dd></dl>
  845. </dd></dl>
  846. </div>
  847. </div>
  848. </div>
  849. <footer>
  850. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  851. <a href="db_driver_reference.html" class="btn btn-neutral float-right" title="DB Driver Reference">Next <span class="fa fa-arrow-circle-right"></span></a>
  852. <a href="forge.html" class="btn btn-neutral" title="Database Forge Class"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  853. </div>
  854. <hr/>
  855. <div role="contentinfo">
  856. <p>
  857. &copy; Copyright 2014 - 2019, British Columbia Institute of Technology.
  858. Last updated on Sep 19, 2019.
  859. </p>
  860. </div>
  861. 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>.
  862. </footer>
  863. </div>
  864. </div>
  865. </section>
  866. </div>
  867. <script type="text/javascript">
  868. var DOCUMENTATION_OPTIONS = {
  869. URL_ROOT:'../',
  870. VERSION:'3.1.11',
  871. COLLAPSE_INDEX:false,
  872. FILE_SUFFIX:'.html',
  873. HAS_SOURCE: false
  874. };
  875. </script>
  876. <script type="text/javascript" src="../_static/jquery.js"></script>
  877. <script type="text/javascript" src="../_static/underscore.js"></script>
  878. <script type="text/javascript" src="../_static/doctools.js"></script>
  879. <script type="text/javascript" src="../_static/js/theme.js"></script>
  880. <script type="text/javascript">
  881. jQuery(function () {
  882. SphinxRtdTheme.StickyNav.enable();
  883. });
  884. </script>
  885. </body>
  886. </html>