diff options
Diffstat (limited to 'user_guide/database')
-rw-r--r-- | user_guide/database/caching.html | 642 | ||||
-rw-r--r-- | user_guide/database/call_function.html | 529 | ||||
-rw-r--r-- | user_guide/database/configuration.html | 758 | ||||
-rw-r--r-- | user_guide/database/connecting.html | 641 | ||||
-rw-r--r-- | user_guide/database/db_driver_reference.html | 1483 | ||||
-rw-r--r-- | user_guide/database/examples.html | 597 | ||||
-rw-r--r-- | user_guide/database/forge.html | 1034 | ||||
-rw-r--r-- | user_guide/database/helpers.html | 592 | ||||
-rw-r--r-- | user_guide/database/index.html | 514 | ||||
-rw-r--r-- | user_guide/database/metadata.html | 614 | ||||
-rw-r--r-- | user_guide/database/queries.html | 658 | ||||
-rw-r--r-- | user_guide/database/query_builder.html | 2714 | ||||
-rw-r--r-- | user_guide/database/results.html | 1231 | ||||
-rw-r--r-- | user_guide/database/transactions.html | 615 | ||||
-rw-r--r-- | user_guide/database/utilities.html | 993 |
15 files changed, 0 insertions, 13615 deletions
diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html deleted file mode 100644 index a6e160823..000000000 --- a/user_guide/database/caching.html +++ /dev/null @@ -1,642 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Database Caching Class — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Database Forge Class" href="forge.html"/> - <link rel="prev" title="Custom Function Calls" href="call_function.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Database Caching Class</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="database-caching-class"> -<h1>Database Caching Class<a class="headerlink" href="#database-caching-class" title="Permalink to this headline">¶</a></h1> -<p>The Database Caching Class permits you to cache your queries as text -files for reduced database load.</p> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">This class is initialized automatically by the database -driver when caching is enabled. Do NOT load this class manually.</p> -</div> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">Not all query result functions are available when you -use caching. Please read this page carefully.</p> -</div> -<div class="section" id="enabling-caching"> -<h2>Enabling Caching<a class="headerlink" href="#enabling-caching" title="Permalink to this headline">¶</a></h2> -<p>Caching is enabled in three steps:</p> -<ul class="simple"> -<li>Create a writable directory on your server where the cache files can -be stored.</li> -<li>Set the path to your cache folder in your -application/config/database.php file.</li> -<li>Enable the caching feature, either globally by setting the preference -in your application/config/database.php file, or manually as -described below.</li> -</ul> -<p>Once enabled, caching will happen automatically whenever a page is -loaded that contains database queries.</p> -</div> -<div class="section" id="how-does-caching-work"> -<h2>How Does Caching Work?<a class="headerlink" href="#how-does-caching-work" title="Permalink to this headline">¶</a></h2> -<p>CodeIgniter’s query caching system happens dynamically when your pages -are viewed. When caching is enabled, the first time a web page is -loaded, the query result object will be serialized and stored in a text -file on your server. The next time the page is loaded the cache file -will be used instead of accessing your database. Your database usage can -effectively be reduced to zero for any pages that have been cached.</p> -<p>Only read-type (SELECT) queries can be cached, since these are the only -type of queries that produce a result. Write-type (INSERT, UPDATE, etc.) -queries, since they don’t generate a result, will not be cached by the -system.</p> -<p>Cache files DO NOT expire. Any queries that have been cached will remain -cached until you delete them. The caching system permits you clear -caches associated with individual pages, or you can delete the entire -collection of cache files. Typically you’ll want to use the housekeeping -functions described below to delete cache files after certain events -take place, like when you’ve added new information to your database.</p> -</div> -<div class="section" id="will-caching-improve-your-site-s-performance"> -<h2>Will Caching Improve Your Site’s Performance?<a class="headerlink" href="#will-caching-improve-your-site-s-performance" title="Permalink to this headline">¶</a></h2> -<p>Getting a performance gain as a result of caching depends on many -factors. If you have a highly optimized database under very little load, -you probably won’t see a performance boost. If your database is under -heavy use you probably will see an improved response, assuming your -file-system is not overly taxed. Remember that caching simply changes -how your information is retrieved, shifting it from being a database -operation to a file-system one.</p> -<p>In some clustered server environments, for example, caching may be -detrimental since file-system operations are so intense. On single -servers in shared environments, caching will probably be beneficial. -Unfortunately there is no single answer to the question of whether you -should cache your database. It really depends on your situation.</p> -</div> -<div class="section" id="how-are-cache-files-stored"> -<h2>How are Cache Files Stored?<a class="headerlink" href="#how-are-cache-files-stored" title="Permalink to this headline">¶</a></h2> -<p>CodeIgniter places the result of EACH query into its own cache file. -Sets of cache files are further organized into sub-folders corresponding -to your controller functions. To be precise, the sub-folders are named -identically to the first two segments of your URI (the controller class -name and function name).</p> -<p>For example, let’s say you have a controller called blog with a function -called comments that contains three queries. The caching system will -create a cache folder called blog+comments, into which it will write -three cache files.</p> -<p>If you use dynamic queries that change based on information in your URI -(when using pagination, for example), each instance of the query will -produce its own cache file. It’s possible, therefore, to end up with -many times more cache files than you have queries.</p> -</div> -<div class="section" id="managing-your-cache-files"> -<h2>Managing your Cache Files<a class="headerlink" href="#managing-your-cache-files" title="Permalink to this headline">¶</a></h2> -<p>Since cache files do not expire, you’ll need to build deletion routines -into your application. For example, let’s say you have a blog that -allows user commenting. Whenever a new comment is submitted you’ll want -to delete the cache files associated with the controller function that -serves up your comments. You’ll find two delete functions described -below that help you clear data.</p> -</div> -<div class="section" id="not-all-database-functions-work-with-caching"> -<h2>Not All Database Functions Work with Caching<a class="headerlink" href="#not-all-database-functions-work-with-caching" title="Permalink to this headline">¶</a></h2> -<p>Lastly, we need to point out that the result object that is cached is a -simplified version of the full result object. For that reason, some of -the query result functions are not available for use.</p> -<p>The following functions ARE NOT available when using a cached result -object:</p> -<ul class="simple"> -<li>num_fields()</li> -<li>field_names()</li> -<li>field_data()</li> -<li>free_result()</li> -</ul> -<p>Also, the two database resources (result_id and conn_id) are not -available when caching, since result resources only pertain to run-time -operations.</p> -<div class="section" id="function-reference"> -<h3>Function Reference<a class="headerlink" href="#function-reference" title="Permalink to this headline">¶</a></h3> -</div> -</div> -<div class="section" id="this-db-cache-on-this-db-cache-off"> -<h2>$this->db->cache_on() / $this->db->cache_off()<a class="headerlink" href="#this-db-cache-on-this-db-cache-off" title="Permalink to this headline">¶</a></h2> -<p>Manually enables/disables caching. This can be useful if you want to -keep certain queries from being cached. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Turn caching on</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">cache_on</span><span class="p">();</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SELECT * FROM mytable"</span><span class="p">);</span> - -<span class="c1">// Turn caching off for this one query</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">cache_off</span><span class="p">();</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SELECT * FROM members WHERE member_id = '</span><span class="si">$current_user</span><span class="s2">'"</span><span class="p">);</span> - -<span class="c1">// Turn caching back on</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">cache_on</span><span class="p">();</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SELECT * FROM another_table"</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="this-db-cache-delete"> -<h2>$this->db->cache_delete()<a class="headerlink" href="#this-db-cache-delete" title="Permalink to this headline">¶</a></h2> -<p>Deletes the cache files associated with a particular page. This is -useful if you need to clear caching after you update your database.</p> -<p>The caching system saves your cache files to folders that correspond to -the URI of the page you are viewing. For example, if you are viewing a -page at example.com/index.php/blog/comments, the caching system will put -all cache files associated with it in a folder called blog+comments. To -delete those particular cache files you will use:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">cache_delete</span><span class="p">(</span><span class="s1">'blog'</span><span class="p">,</span> <span class="s1">'comments'</span><span class="p">);</span> -</pre></div> -</div> -<p>If you do not use any parameters the current URI will be used when -determining what should be cleared.</p> -</div> -<div class="section" id="this-db-cache-delete-all"> -<h2>$this->db->cache_delete_all()<a class="headerlink" href="#this-db-cache-delete-all" title="Permalink to this headline">¶</a></h2> -<p>Clears all existing cache files. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">cache_delete_all</span><span class="p">();</span> -</pre></div> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="forge.html" class="btn btn-neutral float-right" title="Database Forge Class">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="call_function.html" class="btn btn-neutral" title="Custom Function Calls"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html deleted file mode 100644 index 4b3bc3565..000000000 --- a/user_guide/database/call_function.html +++ /dev/null @@ -1,529 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Custom Function Calls — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Database Caching Class" href="caching.html"/> - <link rel="prev" title="Database Metadata" href="metadata.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Custom Function Calls</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="custom-function-calls"> -<h1>Custom Function Calls<a class="headerlink" href="#custom-function-calls" title="Permalink to this headline">¶</a></h1> -<div class="section" id="this-db-call-function"> -<h2>$this->db->call_function();<a class="headerlink" href="#this-db-call-function" title="Permalink to this headline">¶</a></h2> -<p>This function enables you to call PHP database functions that are not -natively included in CodeIgniter, in a platform independent manner. For -example, let’s say you want to call the mysql_get_client_info() -function, which is <strong>not</strong> natively supported by CodeIgniter. You could -do so like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">call_function</span><span class="p">(</span><span class="s1">'get_client_info'</span><span class="p">);</span> -</pre></div> -</div> -<p>You must supply the name of the function, <strong>without</strong> the mysql_ -prefix, in the first parameter. The prefix is added automatically based -on which database driver is currently being used. This permits you to -run the same function on different database platforms. Obviously not all -function calls are identical between platforms, so there are limits to -how useful this function can be in terms of portability.</p> -<p>Any parameters needed by the function you are calling will be added to -the second parameter.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">call_function</span><span class="p">(</span><span class="s1">'some_function'</span><span class="p">,</span> <span class="nv">$param1</span><span class="p">,</span> <span class="nv">$param2</span><span class="p">,</span> <span class="nx">etc</span><span class="o">..</span><span class="p">);</span> -</pre></div> -</div> -<p>Often, you will either need to supply a database connection ID or a -database result ID. The connection ID can be accessed using:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">conn_id</span><span class="p">;</span> -</pre></div> -</div> -<p>The result ID can be accessed from within your result object, like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SOME QUERY"</span><span class="p">);</span> - -<span class="nv">$query</span><span class="o">-></span><span class="na">result_id</span><span class="p">;</span> -</pre></div> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="caching.html" class="btn btn-neutral float-right" title="Database Caching Class">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="metadata.html" class="btn btn-neutral" title="Database Metadata"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html deleted file mode 100644 index 0b968db06..000000000 --- a/user_guide/database/configuration.html +++ /dev/null @@ -1,758 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Database Configuration — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Connecting to your Database" href="connecting.html"/> - <link rel="prev" title="Database Quick Start: Example Code" href="examples.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Database Configuration</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="database-configuration"> -<h1>Database Configuration<a class="headerlink" href="#database-configuration" title="Permalink to this headline">¶</a></h1> -<p>CodeIgniter has a config file that lets you store your database -connection values (username, password, database name, etc.). The config -file is located at application/config/database.php. You can also set -database connection values for specific -<a class="reference internal" href="../libraries/config.html"><span class="doc">environments</span></a> by placing <strong>database.php</strong> -in the respective environment config folder.</p> -<p>The config settings are stored in a multi-dimensional array with this -prototype:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$db</span><span class="p">[</span><span class="s1">'default'</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'dsn'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'hostname'</span> <span class="o">=></span> <span class="s1">'localhost'</span><span class="p">,</span> - <span class="s1">'username'</span> <span class="o">=></span> <span class="s1">'root'</span><span class="p">,</span> - <span class="s1">'password'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'database'</span> <span class="o">=></span> <span class="s1">'database_name'</span><span class="p">,</span> - <span class="s1">'dbdriver'</span> <span class="o">=></span> <span class="s1">'mysqli'</span><span class="p">,</span> - <span class="s1">'dbprefix'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'pconnect'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'db_debug'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'cache_on'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'cachedir'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'char_set'</span> <span class="o">=></span> <span class="s1">'utf8'</span><span class="p">,</span> - <span class="s1">'dbcollat'</span> <span class="o">=></span> <span class="s1">'utf8_general_ci'</span><span class="p">,</span> - <span class="s1">'swap_pre'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'encrypt'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'compress'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'stricton'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'failover'</span> <span class="o">=></span> <span class="k">array</span><span class="p">()</span> -<span class="p">);</span> -</pre></div> -</div> -<p>Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might -require a full DSN string to be provided. If that is the case, you -should use the ‘dsn’ configuration setting, as if you’re using the -driver’s underlying native PHP extension, like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// PDO</span> -<span class="nv">$db</span><span class="p">[</span><span class="s1">'default'</span><span class="p">][</span><span class="s1">'dsn'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'pgsql:host=localhost;port=5432;dbname=database_name'</span><span class="p">;</span> - -<span class="c1">// Oracle</span> -<span class="nv">$db</span><span class="p">[</span><span class="s1">'default'</span><span class="p">][</span><span class="s1">'dsn'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'//localhost/XE'</span><span class="p">;</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If you do not specify a DSN string for a driver that requires it, CodeIgniter -will try to build it with the rest of the provided settings.</p> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If you provide a DSN string and it is missing some valid settings (e.g. the -database character set), which are present in the rest of the configuration -fields, CodeIgniter will append them.</p> -</div> -<p>You can also specify failovers for the situation when the main connection cannot connect for some reason. -These failovers can be specified by setting the failover for a connection like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$db</span><span class="p">[</span><span class="s1">'default'</span><span class="p">][</span><span class="s1">'failover'</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="k">array</span><span class="p">(</span> - <span class="s1">'hostname'</span> <span class="o">=></span> <span class="s1">'localhost1'</span><span class="p">,</span> - <span class="s1">'username'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'password'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'database'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'dbdriver'</span> <span class="o">=></span> <span class="s1">'mysqli'</span><span class="p">,</span> - <span class="s1">'dbprefix'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'pconnect'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'db_debug'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'cache_on'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'cachedir'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'char_set'</span> <span class="o">=></span> <span class="s1">'utf8'</span><span class="p">,</span> - <span class="s1">'dbcollat'</span> <span class="o">=></span> <span class="s1">'utf8_general_ci'</span><span class="p">,</span> - <span class="s1">'swap_pre'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'encrypt'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'compress'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'stricton'</span> <span class="o">=></span> <span class="k">FALSE</span> - <span class="p">),</span> - <span class="k">array</span><span class="p">(</span> - <span class="s1">'hostname'</span> <span class="o">=></span> <span class="s1">'localhost2'</span><span class="p">,</span> - <span class="s1">'username'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'password'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'database'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'dbdriver'</span> <span class="o">=></span> <span class="s1">'mysqli'</span><span class="p">,</span> - <span class="s1">'dbprefix'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'pconnect'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'db_debug'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'cache_on'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'cachedir'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'char_set'</span> <span class="o">=></span> <span class="s1">'utf8'</span><span class="p">,</span> - <span class="s1">'dbcollat'</span> <span class="o">=></span> <span class="s1">'utf8_general_ci'</span><span class="p">,</span> - <span class="s1">'swap_pre'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'encrypt'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'compress'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'stricton'</span> <span class="o">=></span> <span class="k">FALSE</span> - <span class="p">)</span> - <span class="p">);</span> -</pre></div> -</div> -<p>You can specify as many failovers as you like.</p> -<p>The reason we use a multi-dimensional array rather than a more simple -one is to permit you to optionally store multiple sets of connection -values. If, for example, you run multiple environments (development, -production, test, etc.) under a single installation, you can set up a -connection group for each, then switch between groups as needed. For -example, to set up a “test” environment you would do this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$db</span><span class="p">[</span><span class="s1">'test'</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'dsn'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'hostname'</span> <span class="o">=></span> <span class="s1">'localhost'</span><span class="p">,</span> - <span class="s1">'username'</span> <span class="o">=></span> <span class="s1">'root'</span><span class="p">,</span> - <span class="s1">'password'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'database'</span> <span class="o">=></span> <span class="s1">'database_name'</span><span class="p">,</span> - <span class="s1">'dbdriver'</span> <span class="o">=></span> <span class="s1">'mysqli'</span><span class="p">,</span> - <span class="s1">'dbprefix'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'pconnect'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'db_debug'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'cache_on'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'cachedir'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'char_set'</span> <span class="o">=></span> <span class="s1">'utf8'</span><span class="p">,</span> - <span class="s1">'dbcollat'</span> <span class="o">=></span> <span class="s1">'utf8_general_ci'</span><span class="p">,</span> - <span class="s1">'swap_pre'</span> <span class="o">=></span> <span class="s1">''</span><span class="p">,</span> - <span class="s1">'compress'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'encrypt'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'stricton'</span> <span class="o">=></span> <span class="k">FALSE</span><span class="p">,</span> - <span class="s1">'failover'</span> <span class="o">=></span> <span class="k">array</span><span class="p">()</span> -<span class="p">);</span> -</pre></div> -</div> -<p>Then, to globally tell the system to use that group you would set this -variable located in the config file:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$active_group</span> <span class="o">=</span> <span class="s1">'test'</span><span class="p">;</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">The name ‘test’ is arbitrary. It can be anything you want. By -default we’ve used the word “default” for the primary connection, -but it too can be renamed to something more relevant to your project.</p> -</div> -<div class="section" id="query-builder"> -<h2>Query Builder<a class="headerlink" href="#query-builder" title="Permalink to this headline">¶</a></h2> -<p>The <a class="reference internal" href="query_builder.html"><span class="doc">Query Builder Class</span></a> is globally enabled or -disabled by setting the $query_builder variable in the database -configuration file to TRUE/FALSE (boolean). The default setting is TRUE. -If you are not using the -query builder class, setting it to FALSE will utilize fewer resources -when the database classes are initialized.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query_builder</span> <span class="o">=</span> <span class="k">TRUE</span><span class="p">;</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">that some CodeIgniter classes such as Sessions require Query -Builder to be enabled to access certain functionality.</p> -</div> -</div> -<div class="section" id="explanation-of-values"> -<h2>Explanation of Values:<a class="headerlink" href="#explanation-of-values" title="Permalink to this headline">¶</a></h2> -<table border="1" class="docutils"> -<colgroup> -<col width="17%" /> -<col width="83%" /> -</colgroup> -<thead valign="bottom"> -<tr class="row-odd"><th class="head">Name Config</th> -<th class="head">Description</th> -</tr> -</thead> -<tbody valign="top"> -<tr class="row-even"><td><strong>dsn</strong></td> -<td>The DSN connect string (an all-in-one configuration sequence).</td> -</tr> -<tr class="row-odd"><td><strong>hostname</strong></td> -<td>The hostname of your database server. Often this is ‘localhost’.</td> -</tr> -<tr class="row-even"><td><strong>username</strong></td> -<td>The username used to connect to the database.</td> -</tr> -<tr class="row-odd"><td><strong>password</strong></td> -<td>The password used to connect to the database.</td> -</tr> -<tr class="row-even"><td><strong>database</strong></td> -<td>The name of the database you want to connect to.</td> -</tr> -<tr class="row-odd"><td><strong>dbdriver</strong></td> -<td>The database type. ie: mysqli, postgre, odbc, etc. Must be specified in lower case.</td> -</tr> -<tr class="row-even"><td><strong>dbprefix</strong></td> -<td>An optional table prefix which will added to the table name when running -<a class="reference internal" href="query_builder.html"><span class="doc">Query Builder</span></a> queries. This permits multiple CodeIgniter -installations to share one database.</td> -</tr> -<tr class="row-odd"><td><strong>pconnect</strong></td> -<td>TRUE/FALSE (boolean) - Whether to use a persistent connection.</td> -</tr> -<tr class="row-even"><td><strong>db_debug</strong></td> -<td>TRUE/FALSE (boolean) - Whether database errors should be displayed.</td> -</tr> -<tr class="row-odd"><td><strong>cache_on</strong></td> -<td>TRUE/FALSE (boolean) - Whether database query caching is enabled, -see also <a class="reference internal" href="caching.html"><span class="doc">Database Caching Class</span></a>.</td> -</tr> -<tr class="row-even"><td><strong>cachedir</strong></td> -<td>The absolute server path to your database query cache directory.</td> -</tr> -<tr class="row-odd"><td><strong>char_set</strong></td> -<td>The character set used in communicating with the database.</td> -</tr> -<tr class="row-even"><td><strong>dbcollat</strong></td> -<td><p class="first">The character collation used in communicating with the database</p> -<div class="last admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Only used in the ‘mysql’ and ‘mysqli’ drivers.</p> -</div> -</td> -</tr> -<tr class="row-odd"><td><strong>swap_pre</strong></td> -<td>A default table prefix that should be swapped with dbprefix. This is useful for distributed -applications where you might run manually written queries, and need the prefix to still be -customizable by the end user.</td> -</tr> -<tr class="row-even"><td><strong>schema</strong></td> -<td>The database schema, defaults to ‘public’. Used by PostgreSQL and ODBC drivers.</td> -</tr> -<tr class="row-odd"><td><strong>encrypt</strong></td> -<td><p class="first">Whether or not to use an encrypted connection.</p> -<blockquote class="last"> -<div><ul class="simple"> -<li>‘mysql’ (deprecated), ‘sqlsrv’ and ‘pdo/sqlsrv’ drivers accept TRUE/FALSE</li> -<li>‘mysqli’ and ‘pdo/mysql’ drivers accept an array with the following options:<ul> -<li>‘ssl_key’ - Path to the private key file</li> -<li>‘ssl_cert’ - Path to the public key certificate file</li> -<li>‘ssl_ca’ - Path to the certificate authority file</li> -<li>‘ssl_capath’ - Path to a directory containing trusted CA certificates in PEM format</li> -<li>‘ssl_cipher’ - List of <em>allowed</em> ciphers to be used for the encryption, separated by colons (‘:’)</li> -<li>‘ssl_verify’ - TRUE/FALSE; Whether to verify the server certificate or not (‘mysqli’ only)</li> -</ul> -</li> -</ul> -</div></blockquote> -</td> -</tr> -<tr class="row-even"><td><strong>compress</strong></td> -<td>Whether or not to use client compression (MySQL only).</td> -</tr> -<tr class="row-odd"><td><strong>stricton</strong></td> -<td>TRUE/FALSE (boolean) - Whether to force “Strict Mode” connections, good for ensuring strict SQL -while developing an application.</td> -</tr> -<tr class="row-even"><td><strong>port</strong></td> -<td><p class="first">The database port number. To use this value you have to add a line to the database config array.</p> -<div class="last highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$db</span><span class="p">[</span><span class="s1">'default'</span><span class="p">][</span><span class="s1">'port'</span><span class="p">]</span> <span class="o">=</span> <span class="mi">5432</span><span class="p">;</span> -</pre></div> -</div> -</td> -</tr> -</tbody> -</table> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Depending on what database platform you are using (MySQL, PostgreSQL, -etc.) not all values will be needed. For example, when using SQLite you -will not need to supply a username or password, and the database name -will be the path to your database file. The information above assumes -you are using MySQL.</p> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="connecting.html" class="btn btn-neutral float-right" title="Connecting to your Database">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="examples.html" class="btn btn-neutral" title="Database Quick Start: Example Code"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/connecting.html b/user_guide/database/connecting.html deleted file mode 100644 index 2986162fd..000000000 --- a/user_guide/database/connecting.html +++ /dev/null @@ -1,641 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Connecting to your Database — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Queries" href="queries.html"/> - <link rel="prev" title="Database Configuration" href="configuration.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Connecting to your Database</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="connecting-to-your-database"> -<h1>Connecting to your Database<a class="headerlink" href="#connecting-to-your-database" title="Permalink to this headline">¶</a></h1> -<p>There are two ways to connect to a database:</p> -<div class="section" id="automatically-connecting"> -<h2>Automatically Connecting<a class="headerlink" href="#automatically-connecting" title="Permalink to this headline">¶</a></h2> -<p>The “auto connect” feature will load and instantiate the database class -with every page load. To enable “auto connecting”, add the word database -to the library array, as indicated in the following file:</p> -<p>application/config/autoload.php</p> -</div> -<div class="section" id="manually-connecting"> -<h2>Manually Connecting<a class="headerlink" href="#manually-connecting" title="Permalink to this headline">¶</a></h2> -<p>If only some of your pages require database connectivity you can -manually connect to your database by adding this line of code in any -function where it is needed, or in your class constructor to make the -database available globally in that class.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">();</span> -</pre></div> -</div> -<p>If the above function does <strong>not</strong> contain any information in the first -parameter it will connect to the group specified in your database config -file. For most people, this is the preferred method of use.</p> -<div class="section" id="available-parameters"> -<h3>Available Parameters<a class="headerlink" href="#available-parameters" title="Permalink to this headline">¶</a></h3> -<ol class="arabic simple"> -<li>The database connection values, passed either as an array or a DSN -string.</li> -<li>TRUE/FALSE (boolean). Whether to return the connection ID (see -Connecting to Multiple Databases below).</li> -<li>TRUE/FALSE (boolean). Whether to enable the Query Builder class. Set -to TRUE by default.</li> -</ol> -</div> -<div class="section" id="manually-connecting-to-a-database"> -<h3>Manually Connecting to a Database<a class="headerlink" href="#manually-connecting-to-a-database" title="Permalink to this headline">¶</a></h3> -<p>The first parameter of this function can <strong>optionally</strong> be used to -specify a particular database group from your config file, or you can -even submit connection values for a database that is not specified in -your config file. Examples:</p> -<p>To choose a specific group from your config file you can do this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">(</span><span class="s1">'group_name'</span><span class="p">);</span> -</pre></div> -</div> -<p>Where group_name is the name of the connection group from your config -file.</p> -<p>To connect manually to a desired database you can pass an array of -values:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$config</span><span class="p">[</span><span class="s1">'hostname'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'localhost'</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'username'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'myusername'</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'password'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'mypassword'</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'database'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'mydatabase'</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'dbdriver'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'mysqli'</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'dbprefix'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">''</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'pconnect'</span><span class="p">]</span> <span class="o">=</span> <span class="k">FALSE</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'db_debug'</span><span class="p">]</span> <span class="o">=</span> <span class="k">TRUE</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'cache_on'</span><span class="p">]</span> <span class="o">=</span> <span class="k">FALSE</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'cachedir'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">''</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'char_set'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'utf8'</span><span class="p">;</span> -<span class="nv">$config</span><span class="p">[</span><span class="s1">'dbcollat'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'utf8_general_ci'</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">(</span><span class="nv">$config</span><span class="p">);</span> -</pre></div> -</div> -<p>For information on each of these values please see the <a class="reference internal" href="configuration.html"><span class="doc">configuration -page</span></a>.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p>For the PDO driver, you should use the $config[‘dsn’] setting -instead of ‘hostname’ and ‘database’:</p> -<div class="last line-block"> -<div class="line"><br /></div> -<div class="line">$config[‘dsn’] = ‘mysql:host=localhost;dbname=mydatabase’;</div> -</div> -</div> -<p>Or you can submit your database values as a Data Source Name. DSNs must -have this prototype:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$dsn</span> <span class="o">=</span> <span class="s1">'dbdriver://username:password@hostname/database'</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">(</span><span class="nv">$dsn</span><span class="p">);</span> -</pre></div> -</div> -<p>To override default config values when connecting with a DSN string, add -the config variables as a query string.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$dsn</span> <span class="o">=</span> <span class="s1">'dbdriver://username:password@hostname/database?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=/path/to/cache'</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">(</span><span class="nv">$dsn</span><span class="p">);</span> -</pre></div> -</div> -</div> -</div> -<div class="section" id="connecting-to-multiple-databases"> -<h2>Connecting to Multiple Databases<a class="headerlink" href="#connecting-to-multiple-databases" title="Permalink to this headline">¶</a></h2> -<p>If you need to connect to more than one database simultaneously you can -do so as follows:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$DB1</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">(</span><span class="s1">'group_one'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -<span class="nv">$DB2</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">(</span><span class="s1">'group_two'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -</pre></div> -</div> -<p>Note: Change the words “group_one” and “group_two” to the specific -group names you are connecting to (or you can pass the connection values -as indicated above).</p> -<p>By setting the second parameter to TRUE (boolean) the function will -return the database object.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p>When you connect this way, you will use your object name to issue -commands rather than the syntax used throughout this guide. In other -words, rather than issuing commands with:</p> -<div class="last line-block"> -<div class="line"><br /></div> -<div class="line">$this->db->query();</div> -<div class="line">$this->db->result();</div> -<div class="line">etc…</div> -<div class="line"><br /></div> -<div class="line">You will instead use:</div> -<div class="line"><br /></div> -<div class="line">$DB1->query();</div> -<div class="line">$DB1->result();</div> -<div class="line">etc…</div> -</div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p>You don’t need to create separate database configurations if you -only need to use a different database on the same connection. You -can switch to a different database when you need to, like this:</p> -<div class="last line-block"> -<div class="line">$this->db->db_select($database2_name);</div> -</div> -</div> -</div> -<div class="section" id="reconnecting-keeping-the-connection-alive"> -<h2>Reconnecting / Keeping the Connection Alive<a class="headerlink" href="#reconnecting-keeping-the-connection-alive" title="Permalink to this headline">¶</a></h2> -<p>If the database server’s idle timeout is exceeded while you’re doing -some heavy PHP lifting (processing an image, for instance), you should -consider pinging the server by using the reconnect() method before -sending further queries, which can gracefully keep the connection alive -or re-establish it.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">reconnect</span><span class="p">();</span> -</pre></div> -</div> -</div> -<div class="section" id="manually-closing-the-connection"> -<h2>Manually closing the Connection<a class="headerlink" href="#manually-closing-the-connection" title="Permalink to this headline">¶</a></h2> -<p>While CodeIgniter intelligently takes care of closing your database -connections, you can explicitly close the connection.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">close</span><span class="p">();</span> -</pre></div> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="queries.html" class="btn btn-neutral float-right" title="Queries">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="configuration.html" class="btn btn-neutral" title="Database Configuration"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/db_driver_reference.html b/user_guide/database/db_driver_reference.html deleted file mode 100644 index 916a467fe..000000000 --- a/user_guide/database/db_driver_reference.html +++ /dev/null @@ -1,1483 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>DB Driver Reference — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Helpers" href="../helpers/index.html"/> - <link rel="prev" title="Database Utility Class" href="utilities.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <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" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>DB Driver Reference</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="db-driver-reference"> -<h1>DB Driver Reference<a class="headerlink" href="#db-driver-reference" title="Permalink to this headline">¶</a></h1> -<p>This is the platform-independent base DB implementation class. -This class will not be called directly. Rather, the adapter -class for the specific database will extend and instantiate it.</p> -<p>The how-to material for this has been split over several articles. -This article is intended to be a reference for them.</p> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">Not all methods are supported by all database drivers, -some of them may fail (and return FALSE) if the underlying -driver does not support them.</p> -</div> -<dl class="class"> -<dt id="CI_DB_driver"> -<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> -<dd><dl class="method"> -<dt id="CI_DB_driver::initialize"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -<p>Initialize database settings, establish a connection to -the database.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::db_connect"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$persistent</strong> (<em>bool</em>) – Whether to establish a persistent connection or a regular one</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Establish a connection with the database.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">The returned value depends on the underlying -driver in use. For example, a <code class="docutils literal"><span class="pre">mysqli</span></code> instance -will be returned with the ‘mysqli’ driver.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::db_pconnect"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Database connection resource/object or FALSE on failure</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">mixed</td> -</tr> -</tbody> -</table> -<p>Establish a persistent connection with the database.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">This method is just an alias for <code class="docutils literal"><span class="pre">db_connect(TRUE)</span></code>.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::reconnect"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -<p>Keep / reestablish the database connection if no queries -have been sent for a length of time exceeding the -server’s idle timeout.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::db_select"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$database</strong> (<em>string</em>) – Database name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Select / switch the current database.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::db_set_charset"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$charset</strong> (<em>string</em>) – Character set name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Set client character set.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::platform"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Platform name</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td> -</tr> -</tbody> -</table> -<p>The name of the platform in use (mysql, mssql, etc…).</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::version"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The version of the database being used</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td> -</tr> -</tbody> -</table> -<p>Database version number.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::query"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$sql</strong> (<em>string</em>) – The SQL statement to execute</li> -<li><strong>$binds</strong> (<em>array</em>) – An array of binding data</li> -<li><strong>$return_object</strong> (<em>bool</em>) – Whether to return a result object or not</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Execute an SQL query.</p> -<p>Accepts an SQL string as input and returns a result object -upon successful execution of a “read” type query.</p> -<p>Returns:</p> -<blockquote> -<div><ul class="simple"> -<li>Boolean TRUE upon successful execution of a “write type” queries</li> -<li>Boolean FALSE upon failure</li> -<li><code class="docutils literal"><span class="pre">CI_DB_result</span></code> object for “read type” queries</li> -</ul> -</div></blockquote> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::simple_query"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$sql</strong> (<em>string</em>) – The SQL statement to execute</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>A simplified version of the <code class="docutils literal"><span class="pre">query()</span></code> method, appropriate -for use when you don’t need to get a result object or to -just send a query to the database and not care for the result.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::affected_rows"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Number of rows affected</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td> -</tr> -</tbody> -</table> -<p>Returns the number of rows <em>changed</em> by the last executed query.</p> -<p>Useful for checking how much rows were created, updated or deleted -during the last executed query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::trans_strict"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$mode</strong> (<em>bool</em>) – Strict mode flag</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p> -</td> -</tr> -</tbody> -</table> -<p>Enable/disable transaction “strict” mode.</p> -<p>When strict mode is enabled, if you are running multiple -groups of transactions and one group fails, all subsequent -groups will be rolled back.</p> -<p>If strict mode is disabled, each group is treated -autonomously, meaning a failure of one group will not -affect any others.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::trans_off"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">void</td> -</tr> -</tbody> -</table> -<p>Disables transactions at run-time.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::trans_start"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$test_mode</strong> (<em>bool</em>) – Test mode flag</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Start a transaction.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::trans_complete"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -<p>Complete Transaction.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::trans_status"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<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> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -<p>Lets you retrieve the transaction status flag to -determine if it has failed.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::compile_binds"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$sql</strong> (<em>string</em>) – The SQL statement</li> -<li><strong>$binds</strong> (<em>array</em>) – An array of binding data</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The updated SQL statement</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles an SQL query with the bind values passed for it.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::is_write_type"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$sql</strong> (<em>string</em>) – The SQL statement</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Determines if a query is of a “write” type (such as -INSERT, UPDATE, DELETE) or “read” type (i.e. SELECT).</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::elapsed_time"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$decimals</strong> (<em>int</em>) – The number of decimal places</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Calculate the aggregate query elapsed time.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::total_queries"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The total number of queries executed</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td> -</tr> -</tbody> -</table> -<p>Returns the total number of queries that have been -executed so far.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::last_query"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The last query executed</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td> -</tr> -</tbody> -</table> -<p>Returns the last query that was executed.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::escape"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$str</strong> (<em>mixed</em>) – The value to escape, or an array of multiple ones</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The escaped value(s)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Escapes input data based on type, including boolean and -NULLs.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::escape_str"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$str</strong> (<em>mixed</em>) – A string value or array of multiple ones</li> -<li><strong>$like</strong> (<em>bool</em>) – Whether or not the string will be used in a LIKE condition</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The escaped string(s)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Escapes string values.</p> -<div class="admonition warning"> -<p class="first admonition-title">Warning</p> -<p class="last">The returned strings do NOT include quotes -around them.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::escape_like_str"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$str</strong> (<em>mixed</em>) – A string value or array of multiple ones</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The escaped string(s)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Escape LIKE strings.</p> -<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> -and <code class="docutils literal"><span class="pre">_</span></code> wildcard characters, so that they don’t cause -false-positives in LIKE conditions.</p> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">The <code class="docutils literal"><span class="pre">escape_like_str()</span></code> method uses ‘!’ (exclamation mark) -to escape special characters for <em>LIKE</em> conditions. Because this -method escapes partial strings that you would wrap in quotes -yourself, it cannot automatically add the <code class="docutils literal"><span class="pre">ESCAPE</span> <span class="pre">'!'</span></code> -condition for you, and so you’ll have to manually do that.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::primary"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Retrieves the primary key of a table.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If the database platform does not support primary -key detection, the first column name may be assumed -as the primary key.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::count_all"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the total number of rows in a table, or 0 if no -table was provided.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::list_tables"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$constrain_by_prefix</strong> (<em>bool</em>) – TRUE to match table names by the configured dbprefix</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>Gets a list of the tables in the current database.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::table_exists"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table_name</strong> (<em>string</em>) – The table name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Determine if a particular table exists.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::list_fields"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – The table name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>Gets a list of the field names in a table.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::field_exists"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table_name</strong> (<em>string</em>) – The table name</li> -<li><strong>$field_name</strong> (<em>string</em>) – The field name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Determine if a particular field exists.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::field_data"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – The table name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>Gets a list containing field data about a table.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::escape_identifiers"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$item</strong> (<em>mixed</em>) – The item or array of items to escape</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The input item(s), escaped</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Escape SQL identifiers, such as column, table and names.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::insert_string"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – The target table</li> -<li><strong>$data</strong> (<em>array</em>) – An associative array of key/value pairs</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Generate an INSERT statement string.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::update_string"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – The target table</li> -<li><strong>$data</strong> (<em>array</em>) – An associative array of key/value pairs</li> -<li><strong>$where</strong> (<em>mixed</em>) – The WHERE statement conditions</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Generate an UPDATE statement string.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::call_function"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$function</strong> (<em>string</em>) – Function name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The function result</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Runs a native PHP function , using a platform agnostic -wrapper.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::cache_set_path"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$path</strong> (<em>string</em>) – Path to the cache directory</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p> -</td> -</tr> -</tbody> -</table> -<p>Sets the directory path to use for caching storage.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::cache_on"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE if caching is on, FALSE if not</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -<p>Enable database results caching.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::cache_off"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE if caching is on, FALSE if not</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -<p>Disable database results caching.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::cache_delete"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$segment_one</strong> (<em>string</em>) – First URI segment</li> -<li><strong>$segment_two</strong> (<em>string</em>) – Second URI segment</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Delete the cache files associated with a particular URI.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::cache_delete_all"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> -</tr> -</tbody> -</table> -<p>Delete all cache files.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::close"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">void</td> -</tr> -</tbody> -</table> -<p>Close the DB Connection.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::display_error"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$error</strong> (<em>string</em>) – The error message</li> -<li><strong>$swap</strong> (<em>string</em>) – Any “swap” values</li> -<li><strong>$native</strong> (<em>bool</em>) – Whether to localize the message</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">void</p> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Display an error message and stop script execution.</p> -<p>The message is displayed using the -<em>application/views/errors/error_db.php</em> template.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_driver::protect_identifiers"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$item</strong> (<em>string</em>) – The item to work with</li> -<li><strong>$prefix_single</strong> (<em>bool</em>) – Whether to apply the dbprefix even if the input item is a single identifier</li> -<li><strong>$protect_identifiers</strong> (<em>bool</em>) – Whether to quote identifiers</li> -<li><strong>$field_exists</strong> (<em>bool</em>) – Whether the supplied item contains a field name or not</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The modified item</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Takes a column or table name (optionally with an alias) -and applies the configured <em>dbprefix</em> to it.</p> -<p>Some logic is necessary in order to deal with -column names that include the path.</p> -<p>Consider a query like this:</p> -<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> -</pre></div> -</div> -<p>Or a query with aliasing:</p> -<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> -</pre></div> -</div> -<p>Since the column name can include up to four segments -(host, DB, table, column) or also have an alias prefix, -we need to do a bit of work to figure this out and -insert the table prefix (if it exists) in the proper -position, and escape only the correct identifiers.</p> -<p>This method is used extensively by the Query Builder class.</p> -</dd></dl> - -</dd></dl> - -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="../helpers/index.html" class="btn btn-neutral float-right" title="Helpers">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="utilities.html" class="btn btn-neutral" title="Database Utility Class"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/examples.html b/user_guide/database/examples.html deleted file mode 100644 index bc1a46c4f..000000000 --- a/user_guide/database/examples.html +++ /dev/null @@ -1,597 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Database Quick Start: Example Code — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Database Configuration" href="configuration.html"/> - <link rel="prev" title="Database Reference" href="index.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <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" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Database Quick Start: Example Code</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="database-quick-start-example-code"> -<h1>Database Quick Start: Example Code<a class="headerlink" href="#database-quick-start-example-code" title="Permalink to this headline">¶</a></h1> -<p>The following page contains example code showing how the database class -is used. For complete details please read the individual pages -describing each function.</p> -<div class="section" id="initializing-the-database-class"> -<h2>Initializing the Database Class<a class="headerlink" href="#initializing-the-database-class" title="Permalink to this headline">¶</a></h2> -<p>The following code loads and initializes the database class based on -your <a class="reference internal" href="configuration.html"><span class="doc">configuration</span></a> settings:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">database</span><span class="p">();</span> -</pre></div> -</div> -<p>Once loaded the class is ready to be used as described below.</p> -<p>Note: If all your pages require database access you can connect -automatically. See the <a class="reference internal" href="connecting.html"><span class="doc">connecting</span></a> page for details.</p> -</div> -<div class="section" id="standard-query-with-multiple-results-object-version"> -<h2>Standard Query With Multiple Results (Object Version)<a class="headerlink" href="#standard-query-with-multiple-results-object-version" title="Permalink to this headline">¶</a></h2> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT name, title, email FROM my_table'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">title</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">email</span><span class="p">;</span> -<span class="p">}</span> - -<span class="k">echo</span> <span class="s1">'Total Results: '</span> <span class="o">.</span> <span class="nv">$query</span><span class="o">-></span><span class="na">num_rows</span><span class="p">();</span> -</pre></div> -</div> -<p>The above result() function returns an array of <strong>objects</strong>. Example: -$row->title</p> -</div> -<div class="section" id="standard-query-with-multiple-results-array-version"> -<h2>Standard Query With Multiple Results (Array Version)<a class="headerlink" href="#standard-query-with-multiple-results-array-version" title="Permalink to this headline">¶</a></h2> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT name, title, email FROM my_table'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result_array</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'title'</span><span class="p">];</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'name'</span><span class="p">];</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'email'</span><span class="p">];</span> -<span class="p">}</span> -</pre></div> -</div> -<p>The above result_array() function returns an array of standard array -indexes. Example: $row[‘title’]</p> -</div> -<div class="section" id="standard-query-with-single-result"> -<h2>Standard Query With Single Result<a class="headerlink" href="#standard-query-with-single-result" title="Permalink to this headline">¶</a></h2> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT name FROM my_table LIMIT 1'</span><span class="p">);</span> -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">row</span><span class="p">();</span> -<span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> -</pre></div> -</div> -<p>The above row() function returns an <strong>object</strong>. Example: $row->name</p> -</div> -<div class="section" id="standard-query-with-single-result-array-version"> -<h2>Standard Query With Single Result (Array version)<a class="headerlink" href="#standard-query-with-single-result-array-version" title="Permalink to this headline">¶</a></h2> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT name FROM my_table LIMIT 1'</span><span class="p">);</span> -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">row_array</span><span class="p">();</span> -<span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'name'</span><span class="p">];</span> -</pre></div> -</div> -<p>The above row_array() function returns an <strong>array</strong>. Example: -$row[‘name’]</p> -</div> -<div class="section" id="standard-insert"> -<h2>Standard Insert<a class="headerlink" href="#standard-insert" title="Permalink to this headline">¶</a></h2> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$sql</span> <span class="o">=</span> <span class="s2">"INSERT INTO mytable (title, name) VALUES ("</span><span class="o">.</span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">escape</span><span class="p">(</span><span class="nv">$title</span><span class="p">)</span><span class="o">.</span><span class="s2">", "</span><span class="o">.</span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">escape</span><span class="p">(</span><span class="nv">$name</span><span class="p">)</span><span class="o">.</span><span class="s2">")"</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="nv">$sql</span><span class="p">);</span> -<span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">affected_rows</span><span class="p">();</span> -</pre></div> -</div> -</div> -<div class="section" id="query-builder-query"> -<h2>Query Builder Query<a class="headerlink" href="#query-builder-query" title="Permalink to this headline">¶</a></h2> -<p>The <a class="reference internal" href="query_builder.html"><span class="doc">Query Builder Pattern</span></a> gives you a simplified -means of retrieving data:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">title</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p>The above get() function retrieves all the results from the supplied -table. The <a class="reference internal" href="query_builder.html"><span class="doc">Query Builder</span></a> class contains a full -compliment of functions for working with data.</p> -</div> -<div class="section" id="query-builder-insert"> -<h2>Query Builder Insert<a class="headerlink" href="#query-builder-insert" title="Permalink to this headline">¶</a></h2> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="nv">$title</span><span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="nv">$name</span><span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="nv">$date</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span> <span class="c1">// Produces: INSERT INTO mytable (title, name, date) VALUES ('{$title}', '{$name}', '{$date}')</span> -</pre></div> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="configuration.html" class="btn btn-neutral float-right" title="Database Configuration">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="index.html" class="btn btn-neutral" title="Database Reference"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html deleted file mode 100644 index a4f065bbf..000000000 --- a/user_guide/database/forge.html +++ /dev/null @@ -1,1034 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Database Forge Class — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Database Utility Class" href="utilities.html"/> - <link rel="prev" title="Database Caching Class" href="caching.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Database Forge Class</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="database-forge-class"> -<h1><a class="toc-backref" href="#id1">Database Forge Class</a><a class="headerlink" href="#database-forge-class" title="Permalink to this headline">¶</a></h1> -<p>The Database Forge Class contains methods that help you manage your -database.</p> -<div class="contents topic" id="table-of-contents"> -<p class="topic-title first">Table of Contents</p> -<ul class="simple"> -<li><a class="reference internal" href="#database-forge-class" id="id1">Database Forge Class</a><ul> -<li><a class="reference internal" href="#initializing-the-forge-class" id="id2">Initializing the Forge Class</a></li> -<li><a class="reference internal" href="#creating-and-dropping-databases" id="id3">Creating and Dropping Databases</a></li> -<li><a class="reference internal" href="#creating-and-dropping-tables" id="id4">Creating and Dropping Tables</a><ul> -<li><a class="reference internal" href="#adding-fields" id="id5">Adding fields</a></li> -<li><a class="reference internal" href="#adding-keys" id="id6">Adding Keys</a></li> -<li><a class="reference internal" href="#creating-a-table" id="id7">Creating a table</a></li> -<li><a class="reference internal" href="#dropping-a-table" id="id8">Dropping a table</a></li> -<li><a class="reference internal" href="#renaming-a-table" id="id9">Renaming a table</a></li> -</ul> -</li> -<li><a class="reference internal" href="#modifying-tables" id="id10">Modifying Tables</a><ul> -<li><a class="reference internal" href="#adding-a-column-to-a-table" id="id11">Adding a Column to a Table</a></li> -<li><a class="reference internal" href="#dropping-a-column-from-a-table" id="id12">Dropping a Column From a Table</a></li> -<li><a class="reference internal" href="#modifying-a-column-in-a-table" id="id13">Modifying a Column in a Table</a></li> -</ul> -</li> -<li><a class="reference internal" href="#class-reference" id="id14">Class Reference</a></li> -</ul> -</li> -</ul> -</div> -<div class="section" id="initializing-the-forge-class"> -<h2><a class="toc-backref" href="#id2">Initializing the Forge Class</a><a class="headerlink" href="#initializing-the-forge-class" title="Permalink to this headline">¶</a></h2> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">In order to initialize the Forge class, your database -driver must already be running, since the forge class relies on it.</p> -</div> -<p>Load the Forge Class as follows:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">dbforge</span><span class="p">()</span> -</pre></div> -</div> -<p>You can also pass another database object to the DB Forge loader, in case -the database you want to manage isn’t the default one:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">myforge</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">dbforge</span><span class="p">(</span><span class="nv">$this</span><span class="o">-></span><span class="na">other_db</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -</pre></div> -</div> -<p>In the above example, we’re passing a custom database object as the first -parameter and then tell it to return the dbforge object, instead of -assigning it directly to <code class="docutils literal"><span class="pre">$this->dbforge</span></code>.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Both of the parameters can be used individually, just pass an empty -value as the first one if you wish to skip it.</p> -</div> -<p>Once initialized you will access the methods using the <code class="docutils literal"><span class="pre">$this->dbforge</span></code> -object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">some_method</span><span class="p">();</span> -</pre></div> -</div> -</div> -<div class="section" id="creating-and-dropping-databases"> -<h2><a class="toc-backref" href="#id3">Creating and Dropping Databases</a><a class="headerlink" href="#creating-and-dropping-databases" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->dbforge->create_database(‘db_name’)</strong></p> -<p>Permits you to create the database specified in the first parameter. -Returns TRUE/FALSE based on success or failure:</p> -<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">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">create_database</span><span class="p">(</span><span class="s1">'my_db'</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="s1">'Database created!'</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p><strong>$this->dbforge->drop_database(‘db_name’)</strong></p> -<p>Permits you to drop the database specified in the first parameter. -Returns TRUE/FALSE based on success or failure:</p> -<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">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">drop_database</span><span class="p">(</span><span class="s1">'my_db'</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="s1">'Database deleted!'</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -</div> -<div class="section" id="creating-and-dropping-tables"> -<h2><a class="toc-backref" href="#id4">Creating and Dropping Tables</a><a class="headerlink" href="#creating-and-dropping-tables" title="Permalink to this headline">¶</a></h2> -<p>There are several things you may wish to do when creating tables. Add -fields, add keys to the table, alter columns. CodeIgniter provides a -mechanism for this.</p> -<div class="section" id="adding-fields"> -<h3><a class="toc-backref" href="#id5">Adding fields</a><a class="headerlink" href="#adding-fields" title="Permalink to this headline">¶</a></h3> -<p>Fields are created via an associative array. Within the array you must -include a ‘type’ key that relates to the datatype of the field. For -example, INT, VARCHAR, TEXT, etc. Many datatypes (for example VARCHAR) -also require a ‘constraint’ key.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$fields</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'users'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'VARCHAR'</span><span class="p">,</span> - <span class="s1">'constraint'</span> <span class="o">=></span> <span class="s1">'100'</span><span class="p">,</span> - <span class="p">),</span> -<span class="p">);</span> -<span class="c1">// will translate to "users VARCHAR(100)" when the field is added.</span> -</pre></div> -</div> -<p>Additionally, the following key/values can be used:</p> -<ul class="simple"> -<li>unsigned/true : to generate “UNSIGNED” in the field definition.</li> -<li>default/value : to generate a default value in the field definition.</li> -<li>null/true : to generate “NULL” in the field definition. Without this, -the field will default to “NOT NULL”.</li> -<li>auto_increment/true : generates an auto_increment flag on the -field. Note that the field type must be a type that supports this, -such as integer.</li> -<li>unique/true : to generate a unique key for the field definition.</li> -</ul> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$fields</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'blog_id'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'INT'</span><span class="p">,</span> - <span class="s1">'constraint'</span> <span class="o">=></span> <span class="mi">5</span><span class="p">,</span> - <span class="s1">'unsigned'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="s1">'auto_increment'</span> <span class="o">=></span> <span class="k">TRUE</span> - <span class="p">),</span> - <span class="s1">'blog_title'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'VARCHAR'</span><span class="p">,</span> - <span class="s1">'constraint'</span> <span class="o">=></span> <span class="s1">'100'</span><span class="p">,</span> - <span class="s1">'unique'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="p">),</span> - <span class="s1">'blog_author'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'type'</span> <span class="o">=></span><span class="s1">'VARCHAR'</span><span class="p">,</span> - <span class="s1">'constraint'</span> <span class="o">=></span> <span class="s1">'100'</span><span class="p">,</span> - <span class="s1">'default'</span> <span class="o">=></span> <span class="s1">'King of Town'</span><span class="p">,</span> - <span class="p">),</span> - <span class="s1">'blog_description'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'TEXT'</span><span class="p">,</span> - <span class="s1">'null'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> - <span class="p">),</span> -<span class="p">);</span> -</pre></div> -</div> -<p>After the fields have been defined, they can be added using -<code class="docutils literal"><span class="pre">$this->dbforge->add_field($fields);</span></code> followed by a call to the -<code class="docutils literal"><span class="pre">create_table()</span></code> method.</p> -<p><strong>$this->dbforge->add_field()</strong></p> -<p>The add fields method will accept the above array.</p> -<div class="section" id="passing-strings-as-fields"> -<h4>Passing strings as fields<a class="headerlink" href="#passing-strings-as-fields" title="Permalink to this headline">¶</a></h4> -<p>If you know exactly how you want a field to be created, you can pass the -string into the field definitions with add_field()</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_field</span><span class="p">(</span><span class="s2">"label varchar(100) NOT NULL DEFAULT 'default label'"</span><span class="p">);</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Passing raw strings as fields cannot be followed by <code class="docutils literal"><span class="pre">add_key()</span></code> calls on those fields.</p> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Multiple calls to add_field() are cumulative.</p> -</div> -</div> -<div class="section" id="creating-an-id-field"> -<h4>Creating an id field<a class="headerlink" href="#creating-an-id-field" title="Permalink to this headline">¶</a></h4> -<p>There is a special exception for creating id fields. A field with type -id will automatically be assigned as an INT(9) auto_incrementing -Primary Key.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_field</span><span class="p">(</span><span class="s1">'id'</span><span class="p">);</span> -<span class="c1">// gives id INT(9) NOT NULL AUTO_INCREMENT</span> -</pre></div> -</div> -</div> -</div> -<div class="section" id="adding-keys"> -<h3><a class="toc-backref" href="#id6">Adding Keys</a><a class="headerlink" href="#adding-keys" title="Permalink to this headline">¶</a></h3> -<p>Generally speaking, you’ll want your table to have Keys. This is -accomplished with $this->dbforge->add_key(‘field’). An optional second -parameter set to TRUE will make it a primary key. Note that add_key() -must be followed by a call to create_table().</p> -<p>Multiple column non-primary keys must be sent as an array. Sample output -below is for MySQL.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_key</span><span class="p">(</span><span class="s1">'blog_id'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -<span class="c1">// gives PRIMARY KEY `blog_id` (`blog_id`)</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_key</span><span class="p">(</span><span class="s1">'blog_id'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_key</span><span class="p">(</span><span class="s1">'site_id'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -<span class="c1">// gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_key</span><span class="p">(</span><span class="s1">'blog_name'</span><span class="p">);</span> -<span class="c1">// gives KEY `blog_name` (`blog_name`)</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_key</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">'blog_name'</span><span class="p">,</span> <span class="s1">'blog_label'</span><span class="p">));</span> -<span class="c1">// gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`)</span> -</pre></div> -</div> -</div> -<div class="section" id="creating-a-table"> -<h3><a class="toc-backref" href="#id7">Creating a table</a><a class="headerlink" href="#creating-a-table" title="Permalink to this headline">¶</a></h3> -<p>After fields and keys have been declared, you can create a new table -with</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">create_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">);</span> -<span class="c1">// gives CREATE TABLE table_name</span> -</pre></div> -</div> -<p>An optional second parameter set to TRUE adds an “IF NOT EXISTS” clause -into the definition</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">create_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -<span class="c1">// gives CREATE TABLE IF NOT EXISTS table_name</span> -</pre></div> -</div> -<p>You could also pass optional table attributes, such as MySQL’s <code class="docutils literal"><span class="pre">ENGINE</span></code>:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$attributes</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'ENGINE'</span> <span class="o">=></span> <span class="s1">'InnoDB'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">create_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">,</span> <span class="nv">$attributes</span><span class="p">);</span> -<span class="c1">// produces: CREATE TABLE `table_name` (...) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Unless you specify the <code class="docutils literal"><span class="pre">CHARACTER</span> <span class="pre">SET</span></code> and/or <code class="docutils literal"><span class="pre">COLLATE</span></code> attributes, -<code class="docutils literal"><span class="pre">create_table()</span></code> will always add them with your configured <em>char_set</em> -and <em>dbcollat</em> values, as long as they are not empty (MySQL only).</p> -</div> -</div> -<div class="section" id="dropping-a-table"> -<h3><a class="toc-backref" href="#id8">Dropping a table</a><a class="headerlink" href="#dropping-a-table" title="Permalink to this headline">¶</a></h3> -<p>Execute a DROP TABLE statement and optionally add an IF EXISTS clause.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Produces: DROP TABLE table_name</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">drop_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">);</span> - -<span class="c1">// Produces: DROP TABLE IF EXISTS table_name</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">drop_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span><span class="k">TRUE</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="renaming-a-table"> -<h3><a class="toc-backref" href="#id9">Renaming a table</a><a class="headerlink" href="#renaming-a-table" title="Permalink to this headline">¶</a></h3> -<p>Executes a TABLE rename</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">rename_table</span><span class="p">(</span><span class="s1">'old_table_name'</span><span class="p">,</span> <span class="s1">'new_table_name'</span><span class="p">);</span> -<span class="c1">// gives ALTER TABLE old_table_name RENAME TO new_table_name</span> -</pre></div> -</div> -</div> -</div> -<div class="section" id="modifying-tables"> -<h2><a class="toc-backref" href="#id10">Modifying Tables</a><a class="headerlink" href="#modifying-tables" title="Permalink to this headline">¶</a></h2> -<div class="section" id="adding-a-column-to-a-table"> -<h3><a class="toc-backref" href="#id11">Adding a Column to a Table</a><a class="headerlink" href="#adding-a-column-to-a-table" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->dbforge->add_column()</strong></p> -<p>The <code class="docutils literal"><span class="pre">add_column()</span></code> method is used to modify an existing table. It -accepts the same field array as above, and can be used for an unlimited -number of additional fields.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$fields</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'preferences'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span><span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'TEXT'</span><span class="p">)</span> -<span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">add_column</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="nv">$fields</span><span class="p">);</span> -<span class="c1">// Executes: ALTER TABLE table_name ADD preferences TEXT</span> -</pre></div> -</div> -<p>If you are using MySQL or CUBIRD, then you can take advantage of their -AFTER and FIRST clauses to position the new column.</p> -<p>Examples:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Will place the new column after the `another_field` column:</span> -<span class="nv">$fields</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'preferences'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span><span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'TEXT'</span><span class="p">,</span> <span class="s1">'after'</span> <span class="o">=></span> <span class="s1">'another_field'</span><span class="p">)</span> -<span class="p">);</span> - -<span class="c1">// Will place the new column at the start of the table definition:</span> -<span class="nv">$fields</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'preferences'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span><span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'TEXT'</span><span class="p">,</span> <span class="s1">'first'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">)</span> -<span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="dropping-a-column-from-a-table"> -<h3><a class="toc-backref" href="#id12">Dropping a Column From a Table</a><a class="headerlink" href="#dropping-a-column-from-a-table" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->dbforge->drop_column()</strong></p> -<p>Used to remove a column from a table.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">drop_column</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="s1">'column_to_drop'</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="modifying-a-column-in-a-table"> -<h3><a class="toc-backref" href="#id13">Modifying a Column in a Table</a><a class="headerlink" href="#modifying-a-column-in-a-table" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->dbforge->modify_column()</strong></p> -<p>The usage of this method is identical to <code class="docutils literal"><span class="pre">add_column()</span></code>, except it -alters an existing column rather than adding a new one. In order to -change the name you can add a “name” key into the field defining array.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$fields</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'old_name'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'new_name'</span><span class="p">,</span> - <span class="s1">'type'</span> <span class="o">=></span> <span class="s1">'TEXT'</span><span class="p">,</span> - <span class="p">),</span> -<span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">dbforge</span><span class="o">-></span><span class="na">modify_column</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="nv">$fields</span><span class="p">);</span> -<span class="c1">// gives ALTER TABLE table_name CHANGE old_name new_name TEXT</span> -</pre></div> -</div> -</div> -</div> -<div class="section" id="class-reference"> -<h2><a class="toc-backref" href="#id14">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline">¶</a></h2> -<dl class="class"> -<dt id="CI_DB_forge"> -<em class="property">class </em><code class="descname">CI_DB_forge</code><a class="headerlink" href="#CI_DB_forge" title="Permalink to this definition">¶</a></dt> -<dd><dl class="method"> -<dt id="CI_DB_forge::add_column"> -<code class="descname">add_column</code><span class="sig-paren">(</span><em>$table</em><span class="optional">[</span>, <em>$field = array()</em><span class="optional">[</span>, <em>$_after = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::add_column" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name to add the column to</li> -<li><strong>$field</strong> (<em>array</em>) – Column definition(s)</li> -<li><strong>$_after</strong> (<em>string</em>) – Column for AFTER clause (deprecated)</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a column to a table. Usage: See <a class="reference internal" href="#adding-a-column-to-a-table">Adding a Column to a Table</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::add_field"> -<code class="descname">add_field</code><span class="sig-paren">(</span><em>$field</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::add_field" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$field</strong> (<em>array</em>) – Field definition to add</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_forge instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_forge</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a field to the set that will be used to create a table. Usage: See <a class="reference internal" href="#adding-fields">Adding fields</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::add_key"> -<code class="descname">add_key</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$primary = FALSE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::add_key" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>array</em>) – Name of a key field</li> -<li><strong>$primary</strong> (<em>bool</em>) – Set to TRUE if it should be a primary key or a regular one</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_forge instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_forge</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a key to the set that will be used to create a table. Usage: See <a class="reference internal" href="#adding-keys">Adding Keys</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::create_database"> -<code class="descname">create_database</code><span class="sig-paren">(</span><em>$db_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::create_database" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$db_name</strong> (<em>string</em>) – Name of the database to create</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Creates a new database. Usage: See <a class="reference internal" href="#creating-and-dropping-databases">Creating and Dropping Databases</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::create_table"> -<code class="descname">create_table</code><span class="sig-paren">(</span><em>$table</em><span class="optional">[</span>, <em>$if_not_exists = FALSE</em><span class="optional">[</span>, <em>array $attributes = array()</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::create_table" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Name of the table to create</li> -<li><strong>$if_not_exists</strong> (<em>string</em>) – Set to TRUE to add an ‘IF NOT EXISTS’ clause</li> -<li><strong>$attributes</strong> (<em>string</em>) – An associative array of table attributes</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Creates a new table. Usage: See <a class="reference internal" href="#creating-a-table">Creating a table</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::drop_column"> -<code class="descname">drop_column</code><span class="sig-paren">(</span><em>$table</em>, <em>$column_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::drop_column" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$column_name</strong> (<em>array</em>) – The column name to drop</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Drops a column from a table. Usage: See <a class="reference internal" href="#dropping-a-column-from-a-table">Dropping a Column From a Table</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::drop_database"> -<code class="descname">drop_database</code><span class="sig-paren">(</span><em>$db_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::drop_database" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$db_name</strong> (<em>string</em>) – Name of the database to drop</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Drops a database. Usage: See <a class="reference internal" href="#creating-and-dropping-databases">Creating and Dropping Databases</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::drop_table"> -<code class="descname">drop_table</code><span class="sig-paren">(</span><em>$table_name</em><span class="optional">[</span>, <em>$if_exists = FALSE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::drop_table" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Name of the table to drop</li> -<li><strong>$if_exists</strong> (<em>string</em>) – Set to TRUE to add an ‘IF EXISTS’ clause</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Drops a table. Usage: See <a class="reference internal" href="#dropping-a-table">Dropping a table</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::modify_column"> -<code class="descname">modify_column</code><span class="sig-paren">(</span><em>$table</em>, <em>$field</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::modify_column" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$field</strong> (<em>array</em>) – Column definition(s)</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Modifies a table column. Usage: See <a class="reference internal" href="#modifying-a-column-in-a-table">Modifying a Column in a Table</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_forge::rename_table"> -<code class="descname">rename_table</code><span class="sig-paren">(</span><em>$table_name</em>, <em>$new_table_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_forge::rename_table" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Current of the table</li> -<li><strong>$new_table_name</strong> (<em>string</em>) – New name of the table</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Renames a table. Usage: See <a class="reference internal" href="#renaming-a-table">Renaming a table</a>.</p> -</dd></dl> - -</dd></dl> - -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="utilities.html" class="btn btn-neutral float-right" title="Database Utility Class">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="caching.html" class="btn btn-neutral" title="Database Caching Class"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/helpers.html b/user_guide/database/helpers.html deleted file mode 100644 index d81eb8271..000000000 --- a/user_guide/database/helpers.html +++ /dev/null @@ -1,592 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Query Helper Methods — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Query Builder Class" href="query_builder.html"/> - <link rel="prev" title="Generating Query Results" href="results.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Query Helper Methods</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="query-helper-methods"> -<h1>Query Helper Methods<a class="headerlink" href="#query-helper-methods" title="Permalink to this headline">¶</a></h1> -<div class="section" id="information-from-executing-a-query"> -<h2>Information From Executing a Query<a class="headerlink" href="#information-from-executing-a-query" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->insert_id()</strong></p> -<p>The insert ID number when performing database inserts.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If using the PDO driver with PostgreSQL, or using the Interbase -driver, this function requires a $name parameter, which specifies the -appropriate sequence to check for the insert id.</p> -</div> -<p><strong>$this->db->affected_rows()</strong></p> -<p>Displays the number of affected rows, when doing “write” type queries -(insert, update, etc.).</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">In MySQL “DELETE FROM TABLE” returns 0 affected rows. The database -class has a small hack that allows it to return the correct number of -affected rows. By default this hack is enabled but it can be turned off -in the database driver file.</p> -</div> -<p><strong>$this->db->last_query()</strong></p> -<p>Returns the last query that was run (the query string, not the result). -Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$str</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">last_query</span><span class="p">();</span> - -<span class="c1">// Produces: SELECT * FROM sometable....</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Disabling the <strong>save_queries</strong> setting in your database -configuration will render this function useless.</p> -</div> -</div> -<div class="section" id="information-about-your-database"> -<h2>Information About Your Database<a class="headerlink" href="#information-about-your-database" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->count_all()</strong></p> -<p>Permits you to determine the number of rows in a particular table. -Submit the table name in the first parameter. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">count_all</span><span class="p">(</span><span class="s1">'my_table'</span><span class="p">);</span> - -<span class="c1">// Produces an integer, like 25</span> -</pre></div> -</div> -<p><strong>$this->db->platform()</strong></p> -<p>Outputs the database platform you are running (MySQL, MS SQL, Postgres, -etc…):</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">platform</span><span class="p">();</span> -</pre></div> -</div> -<p><strong>$this->db->version()</strong></p> -<p>Outputs the database version you are running:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">version</span><span class="p">();</span> -</pre></div> -</div> -</div> -<div class="section" id="making-your-queries-easier"> -<h2>Making Your Queries Easier<a class="headerlink" href="#making-your-queries-easier" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->insert_string()</strong></p> -<p>This function simplifies the process of writing database inserts. It -returns a correctly formatted SQL insert string. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span> <span class="o">=></span> <span class="nv">$name</span><span class="p">,</span> <span class="s1">'email'</span> <span class="o">=></span> <span class="nv">$email</span><span class="p">,</span> <span class="s1">'url'</span> <span class="o">=></span> <span class="nv">$url</span><span class="p">);</span> - -<span class="nv">$str</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert_string</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span> -</pre></div> -</div> -<p>The first parameter is the table name, the second is an associative -array with the data to be inserted. The above example produces:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">INSERT</span> <span class="nx">INTO</span> <span class="nx">table_name</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">email</span><span class="p">,</span> <span class="nx">url</span><span class="p">)</span> <span class="nx">VALUES</span> <span class="p">(</span><span class="s1">'Rick'</span><span class="p">,</span> <span class="s1">'rick@example.com'</span><span class="p">,</span> <span class="s1">'example.com'</span><span class="p">)</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Values are automatically escaped, producing safer queries.</p> -</div> -<p><strong>$this->db->update_string()</strong></p> -<p>This function simplifies the process of writing database updates. It -returns a correctly formatted SQL update string. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span> <span class="o">=></span> <span class="nv">$name</span><span class="p">,</span> <span class="s1">'email'</span> <span class="o">=></span> <span class="nv">$email</span><span class="p">,</span> <span class="s1">'url'</span> <span class="o">=></span> <span class="nv">$url</span><span class="p">);</span> - -<span class="nv">$where</span> <span class="o">=</span> <span class="s2">"author_id = 1 AND status = 'active'"</span><span class="p">;</span> - -<span class="nv">$str</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update_string</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">,</span> <span class="nv">$where</span><span class="p">);</span> -</pre></div> -</div> -<p>The first parameter is the table name, the second is an associative -array with the data to be updated, and the third parameter is the -“where” clause. The above example produces:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">UPDATE</span> <span class="nx">table_name</span> <span class="nx">SET</span> <span class="nx">name</span> <span class="o">=</span> <span class="s1">'Rick'</span><span class="p">,</span> <span class="nx">email</span> <span class="o">=</span> <span class="s1">'rick@example.com'</span><span class="p">,</span> <span class="nx">url</span> <span class="o">=</span> <span class="s1">'example.com'</span> <span class="nx">WHERE</span> <span class="nx">author_id</span> <span class="o">=</span> <span class="mi">1</span> <span class="k">AND</span> <span class="nx">status</span> <span class="o">=</span> <span class="s1">'active'</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Values are automatically escaped, producing safer queries.</p> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="query_builder.html" class="btn btn-neutral float-right" title="Query Builder Class">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="results.html" class="btn btn-neutral" title="Generating Query Results"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/index.html b/user_guide/database/index.html deleted file mode 100644 index a18ae458b..000000000 --- a/user_guide/database/index.html +++ /dev/null @@ -1,514 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Database Reference — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="next" title="Database Quick Start: Example Code" href="examples.html"/> - <link rel="prev" title="Zip Encoding Class" href="../libraries/zip.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="current reference internal" href="#">Database Reference</a><ul> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="current reference internal" href="#">Database Reference</a><ul> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li>Database Reference</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="database-reference"> -<h1>Database Reference<a class="headerlink" href="#database-reference" title="Permalink to this headline">¶</a></h1> -<p>CodeIgniter comes with a full-featured and very fast abstracted database -class that supports both traditional structures and Query Builder -patterns. The database functions offer clear, simple syntax.</p> -<div class="toctree-wrapper compound"> -<ul> -<li class="toctree-l1"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l1"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l1"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l1"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l1"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l1"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l1"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l1"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l1"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l1"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l1"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l1"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l1"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l1"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="examples.html" class="btn btn-neutral float-right" title="Database Quick Start: Example Code">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="../libraries/zip.html" class="btn btn-neutral" title="Zip Encoding Class"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/metadata.html b/user_guide/database/metadata.html deleted file mode 100644 index 342a45e4b..000000000 --- a/user_guide/database/metadata.html +++ /dev/null @@ -1,614 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Database Metadata — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Custom Function Calls" href="call_function.html"/> - <link rel="prev" title="Transactions" href="transactions.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Database Metadata</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="database-metadata"> -<h1>Database Metadata<a class="headerlink" href="#database-metadata" title="Permalink to this headline">¶</a></h1> -<div class="section" id="table-metadata"> -<h2>Table MetaData<a class="headerlink" href="#table-metadata" title="Permalink to this headline">¶</a></h2> -<p>These functions let you fetch table information.</p> -<div class="section" id="list-the-tables-in-your-database"> -<h3>List the Tables in Your Database<a class="headerlink" href="#list-the-tables-in-your-database" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->db->list_tables();</strong></p> -<p>Returns an array containing the names of all the tables in the database -you are currently connected to. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$tables</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">list_tables</span><span class="p">();</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$tables</span> <span class="k">as</span> <span class="nv">$table</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$table</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -</div> -<div class="section" id="determine-if-a-table-exists"> -<h3>Determine If a Table Exists<a class="headerlink" href="#determine-if-a-table-exists" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->db->table_exists();</strong></p> -<p>Sometimes it’s helpful to know whether a particular table exists before -running an operation on it. Returns a boolean TRUE/FALSE. Usage example:</p> -<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">-></span><span class="na">db</span><span class="o">-></span><span class="na">table_exists</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">))</span> -<span class="p">{</span> - <span class="c1">// some code...</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Replace <em>table_name</em> with the name of the table you are looking for.</p> -</div> -</div> -</div> -<div class="section" id="field-metadata"> -<h2>Field MetaData<a class="headerlink" href="#field-metadata" title="Permalink to this headline">¶</a></h2> -<div class="section" id="list-the-fields-in-a-table"> -<h3>List the Fields in a Table<a class="headerlink" href="#list-the-fields-in-a-table" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->db->list_fields()</strong></p> -<p>Returns an array containing the field names. This query can be called -two ways:</p> -<p>1. You can supply the table name and call it from the $this->db-> -object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$fields</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">list_fields</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$fields</span> <span class="k">as</span> <span class="nv">$field</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$field</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p>2. You can gather the field names associated with any query you run by -calling the function from your query result object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT * FROM some_table'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">list_fields</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$field</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$field</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -</div> -<div class="section" id="determine-if-a-field-is-present-in-a-table"> -<h3>Determine If a Field is Present in a Table<a class="headerlink" href="#determine-if-a-field-is-present-in-a-table" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->db->field_exists()</strong></p> -<p>Sometimes it’s helpful to know whether a particular field exists before -performing an action. Returns a boolean TRUE/FALSE. Usage example:</p> -<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">-></span><span class="na">db</span><span class="o">-></span><span class="na">field_exists</span><span class="p">(</span><span class="s1">'field_name'</span><span class="p">,</span> <span class="s1">'table_name'</span><span class="p">))</span> -<span class="p">{</span> - <span class="c1">// some code...</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Replace <em>field_name</em> with the name of the column you are looking -for, and replace <em>table_name</em> with the name of the table you are -looking for.</p> -</div> -</div> -<div class="section" id="retrieve-field-metadata"> -<h3>Retrieve Field Metadata<a class="headerlink" href="#retrieve-field-metadata" title="Permalink to this headline">¶</a></h3> -<p><strong>$this->db->field_data()</strong></p> -<p>Returns an array of objects containing field information.</p> -<p>Sometimes it’s helpful to gather the field names or other metadata, like -the column type, max length, etc.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Not all databases provide meta-data.</p> -</div> -<p>Usage example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$fields</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">field_data</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$fields</span> <span class="k">as</span> <span class="nv">$field</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$field</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$field</span><span class="o">-></span><span class="na">type</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$field</span><span class="o">-></span><span class="na">max_length</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$field</span><span class="o">-></span><span class="na">primary_key</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p>If you have run a query already you can use the result object instead of -supplying the table name:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> -<span class="nv">$fields</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">field_data</span><span class="p">();</span> -</pre></div> -</div> -<p>The following data is available from this function if supported by your -database:</p> -<ul class="simple"> -<li>name - column name</li> -<li>max_length - maximum length of the column</li> -<li>primary_key - 1 if the column is a primary key</li> -<li>type - the type of the column</li> -</ul> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="call_function.html" class="btn btn-neutral float-right" title="Custom Function Calls">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="transactions.html" class="btn btn-neutral" title="Transactions"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html deleted file mode 100644 index 473549d90..000000000 --- a/user_guide/database/queries.html +++ /dev/null @@ -1,658 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Queries — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Generating Query Results" href="results.html"/> - <link rel="prev" title="Connecting to your Database" href="connecting.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Queries</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="queries"> -<h1>Queries<a class="headerlink" href="#queries" title="Permalink to this headline">¶</a></h1> -<div class="section" id="query-basics"> -<h2>Query Basics<a class="headerlink" href="#query-basics" title="Permalink to this headline">¶</a></h2> -<div class="section" id="regular-queries"> -<h3>Regular Queries<a class="headerlink" href="#regular-queries" title="Permalink to this headline">¶</a></h3> -<p>To submit a query, use the <strong>query</strong> function:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'YOUR QUERY HERE'</span><span class="p">);</span> -</pre></div> -</div> -<p>The query() function returns a database result <strong>object</strong> when “read” -type queries are run, which you can use to <a class="reference internal" href="results.html"><span class="doc">show your -results</span></a>. When “write” type queries are run it simply -returns TRUE or FALSE depending on success or failure. When retrieving -data you will typically assign the query to your own variable, like -this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'YOUR QUERY HERE'</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="simplified-queries"> -<h3>Simplified Queries<a class="headerlink" href="#simplified-queries" title="Permalink to this headline">¶</a></h3> -<p>The <strong>simple_query</strong> method is a simplified version of the -$this->db->query() method. It DOES -NOT return a database result set, nor does it set the query timer, or -compile bind data, or store your query for debugging. It simply lets you -submit a query. Most users will rarely use this function.</p> -<p>It returns whatever the database drivers’ “execute” function returns. -That typically is TRUE/FALSE on success or failure for write type queries -such as INSERT, DELETE or UPDATE statements (which is what it really -should be used for) and a resource/object on success for queries with -fetchable results.</p> -<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">-></span><span class="na">db</span><span class="o">-></span><span class="na">simple_query</span><span class="p">(</span><span class="s1">'YOUR QUERY'</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="s2">"Success!"</span><span class="p">;</span> -<span class="p">}</span> -<span class="k">else</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="s2">"Query failed!"</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">PostgreSQL’s <code class="docutils literal"><span class="pre">pg_exec()</span></code> function (for example) always -returns a resource on success, even for write type queries. -So take that in mind if you’re looking for a boolean value.</p> -</div> -</div> -</div> -<div class="section" id="working-with-database-prefixes-manually"> -<h2>Working with Database prefixes manually<a class="headerlink" href="#working-with-database-prefixes-manually" title="Permalink to this headline">¶</a></h2> -<p>If you have configured a database prefix and would like to prepend it to -a table name for use in a native SQL query for example, then you can use -the following:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">dbprefix</span><span class="p">(</span><span class="s1">'tablename'</span><span class="p">);</span> <span class="c1">// outputs prefix_tablename</span> -</pre></div> -</div> -<p>If for any reason you would like to change the prefix programatically -without needing to create a new connection, you can use this method:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set_dbprefix</span><span class="p">(</span><span class="s1">'newprefix_'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">dbprefix</span><span class="p">(</span><span class="s1">'tablename'</span><span class="p">);</span> <span class="c1">// outputs newprefix_tablename</span> -</pre></div> -</div> -</div> -<div class="section" id="protecting-identifiers"> -<h2>Protecting identifiers<a class="headerlink" href="#protecting-identifiers" title="Permalink to this headline">¶</a></h2> -<p>In many databases it is advisable to protect table and field names - for -example with backticks in MySQL. <strong>Query Builder queries are -automatically protected</strong>, however if you need to manually protect an -identifier you can use:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">protect_identifiers</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">);</span> -</pre></div> -</div> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">Although the Query Builder will try its best to properly -quote any field and table names that you feed it, note that it -is NOT designed to work with arbitrary user input. DO NOT feed it -with unsanitized user data.</p> -</div> -<p>This function will also add a table prefix to your table, assuming you -have a prefix specified in your database config file. To enable the -prefixing set TRUE (boolean) via the second parameter:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">protect_identifiers</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="escaping-queries"> -<h2>Escaping Queries<a class="headerlink" href="#escaping-queries" title="Permalink to this headline">¶</a></h2> -<p>It’s a very good security practice to escape your data before submitting -it into your database. CodeIgniter has three methods that help you do -this:</p> -<ol class="arabic"> -<li><p class="first"><strong>$this->db->escape()</strong> This function determines the data type so -that it can escape only string data. It also automatically adds -single quotes around the data so you don’t have to:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$sql</span> <span class="o">=</span> <span class="s2">"INSERT INTO table (title) VALUES("</span><span class="o">.</span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">escape</span><span class="p">(</span><span class="nv">$title</span><span class="p">)</span><span class="o">.</span><span class="s2">")"</span><span class="p">;</span> -</pre></div> -</div> -</li> -<li><p class="first"><strong>$this->db->escape_str()</strong> This function escapes the data passed to -it, regardless of type. Most of the time you’ll use the above -function rather than this one. Use the function like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$sql</span> <span class="o">=</span> <span class="s2">"INSERT INTO table (title) VALUES('"</span><span class="o">.</span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">escape_str</span><span class="p">(</span><span class="nv">$title</span><span class="p">)</span><span class="o">.</span><span class="s2">"')"</span><span class="p">;</span> -</pre></div> -</div> -</li> -<li><p class="first"><strong>$this->db->escape_like_str()</strong> This method should be used when -strings are to be used in LIKE conditions so that LIKE wildcards -(‘%’, ‘_’) in the string are also properly escaped.</p> -</li> -</ol> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$search</span> <span class="o">=</span> <span class="s1">'20% raise'</span><span class="p">;</span> -<span class="nv">$sql</span> <span class="o">=</span> <span class="s2">"SELECT id FROM table WHERE column LIKE '%"</span> <span class="o">.</span> - <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">escape_like_str</span><span class="p">(</span><span class="nv">$search</span><span class="p">)</span><span class="o">.</span><span class="s2">"%' ESCAPE '!'"</span><span class="p">;</span> -</pre></div> -</div> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">The <code class="docutils literal"><span class="pre">escape_like_str()</span></code> method uses ‘!’ (exclamation mark) -to escape special characters for <em>LIKE</em> conditions. Because this -method escapes partial strings that you would wrap in quotes -yourself, it cannot automatically add the <code class="docutils literal"><span class="pre">ESCAPE</span> <span class="pre">'!'</span></code> -condition for you, and so you’ll have to manually do that.</p> -</div> -</div> -<div class="section" id="query-bindings"> -<h2>Query Bindings<a class="headerlink" href="#query-bindings" title="Permalink to this headline">¶</a></h2> -<p>Bindings enable you to simplify your query syntax by letting the system -put the queries together for you. Consider the following example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$sql</span> <span class="o">=</span> <span class="s2">"SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?"</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="nv">$sql</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="s1">'live'</span><span class="p">,</span> <span class="s1">'Rick'</span><span class="p">));</span> -</pre></div> -</div> -<p>The question marks in the query are automatically replaced with the -values in the array in the second parameter of the query function.</p> -<p>Binding also work with arrays, which will be transformed to IN sets:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$sql</span> <span class="o">=</span> <span class="s2">"SELECT * FROM some_table WHERE id IN ? AND status = ? AND author = ?"</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="nv">$sql</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">),</span> <span class="s1">'live'</span><span class="p">,</span> <span class="s1">'Rick'</span><span class="p">));</span> -</pre></div> -</div> -<p>The resulting query will be:</p> -<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">some_table</span> <span class="nx">WHERE</span> <span class="nx">id</span> <span class="nx">IN</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">6</span><span class="p">)</span> <span class="k">AND</span> <span class="nx">status</span> <span class="o">=</span> <span class="s1">'live'</span> <span class="k">AND</span> <span class="nx">author</span> <span class="o">=</span> <span class="s1">'Rick'</span> -</pre></div> -</div> -<p>The secondary benefit of using binds is that the values are -automatically escaped, producing safer queries. You don’t have to -remember to manually escape data; the engine does it automatically for -you.</p> -</div> -<div class="section" id="handling-errors"> -<h2>Handling Errors<a class="headerlink" href="#handling-errors" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->error();</strong></p> -<p>If you need to get the last error that has occurred, the error() method -will return an array containing its code and message. Here’s a quick -example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">simple_query</span><span class="p">(</span><span class="s1">'SELECT `example_field` FROM `example_table`'</span><span class="p">))</span> -<span class="p">{</span> - <span class="nv">$error</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">error</span><span class="p">();</span> <span class="c1">// Has keys 'code' and 'message'</span> -<span class="p">}</span> -</pre></div> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="results.html" class="btn btn-neutral float-right" title="Generating Query Results">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="connecting.html" class="btn btn-neutral" title="Connecting to your Database"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/query_builder.html b/user_guide/database/query_builder.html deleted file mode 100644 index 7252cfa15..000000000 --- a/user_guide/database/query_builder.html +++ /dev/null @@ -1,2714 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Query Builder Class — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Transactions" href="transactions.html"/> - <link rel="prev" title="Query Helper Methods" href="helpers.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Query Builder Class</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="query-builder-class"> -<h1>Query Builder Class<a class="headerlink" href="#query-builder-class" title="Permalink to this headline">¶</a></h1> -<p>CodeIgniter gives you access to a Query Builder class. This pattern -allows information to be retrieved, inserted, and updated in your -database with minimal scripting. In some cases only one or two lines -of code are necessary to perform a database action. -CodeIgniter does not require that each database table be its own class -file. It instead provides a more simplified interface.</p> -<p>Beyond simplicity, a major benefit to using the Query Builder features -is that it allows you to create database independent applications, since -the query syntax is generated by each database adapter. It also allows -for safer queries, since the values are escaped automatically by the -system.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If you intend to write your own queries you can disable this -class in your database config file, allowing the core database library -and adapter to utilize fewer resources.</p> -</div> -<div class="contents local topic" id="contents"> -<ul class="simple"> -<li><a class="reference internal" href="#selecting-data" id="id1">Selecting Data</a></li> -<li><a class="reference internal" href="#looking-for-specific-data" id="id2">Looking for Specific Data</a></li> -<li><a class="reference internal" href="#looking-for-similar-data" id="id3">Looking for Similar Data</a></li> -<li><a class="reference internal" href="#ordering-results" id="id4">Ordering results</a></li> -<li><a class="reference internal" href="#limiting-or-counting-results" id="id5">Limiting or Counting Results</a></li> -<li><a class="reference internal" href="#query-grouping" id="id6">Query grouping</a></li> -<li><a class="reference internal" href="#inserting-data" id="id7">Inserting Data</a></li> -<li><a class="reference internal" href="#updating-data" id="id8">Updating Data</a></li> -<li><a class="reference internal" href="#deleting-data" id="id9">Deleting Data</a></li> -<li><a class="reference internal" href="#method-chaining" id="id10">Method Chaining</a></li> -<li><a class="reference internal" href="#query-builder-caching" id="id11">Query Builder Caching</a></li> -<li><a class="reference internal" href="#resetting-query-builder" id="id12">Resetting Query Builder</a></li> -<li><a class="reference internal" href="#class-reference" id="id13">Class Reference</a></li> -</ul> -</div> -<div class="section" id="selecting-data"> -<h2><a class="toc-backref" href="#id1">Selecting Data</a><a class="headerlink" href="#selecting-data" title="Permalink to this headline">¶</a></h2> -<p>The following functions allow you to build SQL <strong>SELECT</strong> statements.</p> -<p><strong>$this->db->get()</strong></p> -<p>Runs the selection query and returns the result. Can be used by itself -to retrieve all records from a table:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> <span class="c1">// Produces: SELECT * FROM mytable</span> -</pre></div> -</div> -<p>The second and third parameters enable you to set a limit and offset -clause:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">);</span> - -<span class="c1">// Executes: SELECT * FROM mytable LIMIT 20, 10</span> -<span class="c1">// (in MySQL. Other databases have slightly different syntax)</span> -</pre></div> -</div> -<p>You’ll notice that the above function is assigned to a variable named -$query, which can be used to show the results:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">title</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p>Please visit the <a class="reference internal" href="results.html"><span class="doc">result functions</span></a> page for a full -discussion regarding result generation.</p> -<p><strong>$this->db->get_compiled_select()</strong></p> -<p>Compiles the selection query just like <strong>$this->db->get()</strong> but does not <em>run</em> -the query. This method simply returns the SQL query as a string.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$sql</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get_compiled_select</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -<span class="k">echo</span> <span class="nv">$sql</span><span class="p">;</span> - -<span class="c1">// Prints string: SELECT * FROM mytable</span> -</pre></div> -</div> -<p>The second parameter enables you to set whether or not the query builder query -will be reset (by default it will be reset, just like when using <cite>$this->db->get()</cite>):</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">limit</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">20</span><span class="p">)</span><span class="o">-></span><span class="na">get_compiled_select</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> - -<span class="c1">// Prints string: SELECT * FROM mytable LIMIT 20, 10</span> -<span class="c1">// (in MySQL. Other databases have slightly different syntax)</span> - -<span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'title, content, date'</span><span class="p">)</span><span class="o">-></span><span class="na">get_compiled_select</span><span class="p">();</span> - -<span class="c1">// Prints string: SELECT title, content, date FROM mytable LIMIT 20, 10</span> -</pre></div> -</div> -<p>The key thing to notice in the above example is that the second query did not -utilize <strong>$this->db->from()</strong> and did not pass a table name into the first -parameter. The reason for this outcome is because the query has not been -executed using <strong>$this->db->get()</strong> which resets values or reset directly -using <strong>$this->db->reset_query()</strong>.</p> -<p><strong>$this->db->get_where()</strong></p> -<p>Identical to the above function except that it permits you to add a -“where” clause in the second parameter, instead of using the db->where() -function:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get_where</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">'id'</span> <span class="o">=></span> <span class="nv">$id</span><span class="p">),</span> <span class="nv">$limit</span><span class="p">,</span> <span class="nv">$offset</span><span class="p">);</span> -</pre></div> -</div> -<p>Please read the about the where function below for more information.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">get_where() was formerly known as getwhere(), which has been removed</p> -</div> -<p><strong>$this->db->select()</strong></p> -<p>Permits you to write the SELECT portion of your query:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'title, content, date'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> - -<span class="c1">// Executes: SELECT title, content, date FROM mytable</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If you are selecting all (*) from a table you do not need to -use this function. When omitted, CodeIgniter assumes that you wish -to select all fields and automatically adds ‘SELECT *’.</p> -</div> -<p><code class="docutils literal"><span class="pre">$this->db->select()</span></code> accepts an optional second parameter. If you set it -to FALSE, CodeIgniter will not try to protect your field or table names. -This is useful if you need a compound select statement where automatic -escaping of fields may break them.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4) AS amount_paid'</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -</pre></div> -</div> -<p><strong>$this->db->select_max()</strong></p> -<p>Writes a <code class="docutils literal"><span class="pre">SELECT</span> <span class="pre">MAX(field)</span></code> portion for your query. You can optionally -include a second parameter to rename the resulting field.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select_max</span><span class="p">(</span><span class="s1">'age'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'members'</span><span class="p">);</span> <span class="c1">// Produces: SELECT MAX(age) as age FROM members</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select_max</span><span class="p">(</span><span class="s1">'age'</span><span class="p">,</span> <span class="s1">'member_age'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'members'</span><span class="p">);</span> <span class="c1">// Produces: SELECT MAX(age) as member_age FROM members</span> -</pre></div> -</div> -<p><strong>$this->db->select_min()</strong></p> -<p>Writes a “SELECT MIN(field)” portion for your query. As with -select_max(), You can optionally include a second parameter to rename -the resulting field.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select_min</span><span class="p">(</span><span class="s1">'age'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'members'</span><span class="p">);</span> <span class="c1">// Produces: SELECT MIN(age) as age FROM members</span> -</pre></div> -</div> -<p><strong>$this->db->select_avg()</strong></p> -<p>Writes a “SELECT AVG(field)” portion for your query. As with -select_max(), You can optionally include a second parameter to rename -the resulting field.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select_avg</span><span class="p">(</span><span class="s1">'age'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'members'</span><span class="p">);</span> <span class="c1">// Produces: SELECT AVG(age) as age FROM members</span> -</pre></div> -</div> -<p><strong>$this->db->select_sum()</strong></p> -<p>Writes a “SELECT SUM(field)” portion for your query. As with -select_max(), You can optionally include a second parameter to rename -the resulting field.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select_sum</span><span class="p">(</span><span class="s1">'age'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'members'</span><span class="p">);</span> <span class="c1">// Produces: SELECT SUM(age) as age FROM members</span> -</pre></div> -</div> -<p><strong>$this->db->from()</strong></p> -<p>Permits you to write the FROM portion of your query:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'title, content, date'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">from</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">();</span> <span class="c1">// Produces: SELECT title, content, date FROM mytable</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">As shown earlier, the FROM portion of your query can be specified -in the $this->db->get() function, so use whichever method you prefer.</p> -</div> -<p><strong>$this->db->join()</strong></p> -<p>Permits you to write the JOIN portion of your query:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'*'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">from</span><span class="p">(</span><span class="s1">'blogs'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">join</span><span class="p">(</span><span class="s1">'comments'</span><span class="p">,</span> <span class="s1">'comments.id = blogs.id'</span><span class="p">);</span> -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">();</span> - -<span class="c1">// Produces:</span> -<span class="c1">// SELECT * FROM blogs JOIN comments ON comments.id = blogs.id</span> -</pre></div> -</div> -<p>Multiple function calls can be made if you need several joins in one -query.</p> -<p>If you need a specific type of JOIN you can specify it via the third -parameter of the function. Options are: left, right, outer, inner, left -outer, and right outer.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">join</span><span class="p">(</span><span class="s1">'comments'</span><span class="p">,</span> <span class="s1">'comments.id = blogs.id'</span><span class="p">,</span> <span class="s1">'left'</span><span class="p">);</span> -<span class="c1">// Produces: LEFT JOIN comments ON comments.id = blogs.id</span> -</pre></div> -</div> -</div> -<div class="section" id="looking-for-specific-data"> -<h2><a class="toc-backref" href="#id2">Looking for Specific Data</a><a class="headerlink" href="#looking-for-specific-data" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->where()</strong></p> -<p>This function enables you to set <strong>WHERE</strong> clauses using one of four -methods:</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">All values passed to this function are escaped automatically, -producing safer queries.</p> -</div> -<ol class="arabic"> -<li><p class="first"><strong>Simple key/value method:</strong></p> -<blockquote> -<div><div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'name'</span><span class="p">,</span> <span class="nv">$name</span><span class="p">);</span> <span class="c1">// Produces: WHERE name = 'Joe'</span> -</pre></div> -</div> -<p>Notice that the equal sign is added for you.</p> -<p>If you use multiple function calls they will be chained together with -AND between them:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'name'</span><span class="p">,</span> <span class="nv">$name</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="nv">$title</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'status'</span><span class="p">,</span> <span class="nv">$status</span><span class="p">);</span> -<span class="c1">// WHERE name = 'Joe' AND title = 'boss' AND status = 'active'</span> -</pre></div> -</div> -</div></blockquote> -</li> -<li><p class="first"><strong>Custom key/value method:</strong></p> -<blockquote> -<div><p>You can include an operator in the first parameter in order to -control the comparison:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'name !='</span><span class="p">,</span> <span class="nv">$name</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id <'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">);</span> <span class="c1">// Produces: WHERE name != 'Joe' AND id < 45</span> -</pre></div> -</div> -</div></blockquote> -</li> -<li><p class="first"><strong>Associative array method:</strong></p> -<blockquote> -<div><div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$array</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'name'</span> <span class="o">=></span> <span class="nv">$name</span><span class="p">,</span> <span class="s1">'title'</span> <span class="o">=></span> <span class="nv">$title</span><span class="p">,</span> <span class="s1">'status'</span> <span class="o">=></span> <span class="nv">$status</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="nv">$array</span><span class="p">);</span> -<span class="c1">// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'</span> -</pre></div> -</div> -<p>You can include your own operators using this method as well:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$array</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'name !='</span> <span class="o">=></span> <span class="nv">$name</span><span class="p">,</span> <span class="s1">'id <'</span> <span class="o">=></span> <span class="nv">$id</span><span class="p">,</span> <span class="s1">'date >'</span> <span class="o">=></span> <span class="nv">$date</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="nv">$array</span><span class="p">);</span> -</pre></div> -</div> -</div></blockquote> -</li> -<li><dl class="first docutils"> -<dt><strong>Custom string:</strong></dt> -<dd><p class="first">You can write your own clauses manually:</p> -<div class="last highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$where</span> <span class="o">=</span> <span class="s2">"name='Joe' AND status='boss' OR status='active'"</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="nv">$where</span><span class="p">);</span> -</pre></div> -</div> -</dd> -</dl> -</li> -</ol> -<p><code class="docutils literal"><span class="pre">$this->db->where()</span></code> accepts an optional third parameter. If you set it to -FALSE, CodeIgniter will not try to protect your field or table names.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'MATCH (field) AGAINST ("value")'</span><span class="p">,</span> <span class="k">NULL</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> -</pre></div> -</div> -<p><strong>$this->db->or_where()</strong></p> -<p>This function is identical to the one above, except that multiple -instances are joined by OR:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'name !='</span><span class="p">,</span> <span class="nv">$name</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">or_where</span><span class="p">(</span><span class="s1">'id >'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">);</span> <span class="c1">// Produces: WHERE name != 'Joe' OR id > 50</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">or_where() was formerly known as orwhere(), which has been -removed.</p> -</div> -<p><strong>$this->db->where_in()</strong></p> -<p>Generates a WHERE field IN (‘item’, ‘item’) SQL query joined with AND if -appropriate</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$names</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'Frank'</span><span class="p">,</span> <span class="s1">'Todd'</span><span class="p">,</span> <span class="s1">'James'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where_in</span><span class="p">(</span><span class="s1">'username'</span><span class="p">,</span> <span class="nv">$names</span><span class="p">);</span> -<span class="c1">// Produces: WHERE username IN ('Frank', 'Todd', 'James')</span> -</pre></div> -</div> -<p><strong>$this->db->or_where_in()</strong></p> -<p>Generates a WHERE field IN (‘item’, ‘item’) SQL query joined with OR if -appropriate</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$names</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'Frank'</span><span class="p">,</span> <span class="s1">'Todd'</span><span class="p">,</span> <span class="s1">'James'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">or_where_in</span><span class="p">(</span><span class="s1">'username'</span><span class="p">,</span> <span class="nv">$names</span><span class="p">);</span> -<span class="c1">// Produces: OR username IN ('Frank', 'Todd', 'James')</span> -</pre></div> -</div> -<p><strong>$this->db->where_not_in()</strong></p> -<p>Generates a WHERE field NOT IN (‘item’, ‘item’) SQL query joined with -AND if appropriate</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$names</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'Frank'</span><span class="p">,</span> <span class="s1">'Todd'</span><span class="p">,</span> <span class="s1">'James'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where_not_in</span><span class="p">(</span><span class="s1">'username'</span><span class="p">,</span> <span class="nv">$names</span><span class="p">);</span> -<span class="c1">// Produces: WHERE username NOT IN ('Frank', 'Todd', 'James')</span> -</pre></div> -</div> -<p><strong>$this->db->or_where_not_in()</strong></p> -<p>Generates a WHERE field NOT IN (‘item’, ‘item’) SQL query joined with OR -if appropriate</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$names</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'Frank'</span><span class="p">,</span> <span class="s1">'Todd'</span><span class="p">,</span> <span class="s1">'James'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">or_where_not_in</span><span class="p">(</span><span class="s1">'username'</span><span class="p">,</span> <span class="nv">$names</span><span class="p">);</span> -<span class="c1">// Produces: OR username NOT IN ('Frank', 'Todd', 'James')</span> -</pre></div> -</div> -</div> -<div class="section" id="looking-for-similar-data"> -<h2><a class="toc-backref" href="#id3">Looking for Similar Data</a><a class="headerlink" href="#looking-for-similar-data" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->like()</strong></p> -<p>This method enables you to generate <strong>LIKE</strong> clauses, useful for doing -searches.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">All values passed to this method are escaped automatically.</p> -</div> -<ol class="arabic"> -<li><p class="first"><strong>Simple key/value method:</strong></p> -<blockquote> -<div><div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> -<span class="c1">// Produces: WHERE `title` LIKE '%match%' ESCAPE '!'</span> -</pre></div> -</div> -<p>If you use multiple method calls they will be chained together with -AND between them:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'body'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> -<span class="c1">// WHERE `title` LIKE '%match%' ESCAPE '!' AND `body` LIKE '%match% ESCAPE '!'</span> -</pre></div> -</div> -<p>If you want to control where the wildcard (%) is placed, you can use -an optional third argument. Your options are ‘before’, ‘after’ and -‘both’ (which is the default).</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">,</span> <span class="s1">'before'</span><span class="p">);</span> <span class="c1">// Produces: WHERE `title` LIKE '%match' ESCAPE '!'</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">,</span> <span class="s1">'after'</span><span class="p">);</span> <span class="c1">// Produces: WHERE `title` LIKE 'match%' ESCAPE '!'</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">,</span> <span class="s1">'both'</span><span class="p">);</span> <span class="c1">// Produces: WHERE `title` LIKE '%match%' ESCAPE '!'</span> -</pre></div> -</div> -</div></blockquote> -</li> -<li><p class="first"><strong>Associative array method:</strong></p> -<blockquote> -<div><div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$array</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'title'</span> <span class="o">=></span> <span class="nv">$match</span><span class="p">,</span> <span class="s1">'page1'</span> <span class="o">=></span> <span class="nv">$match</span><span class="p">,</span> <span class="s1">'page2'</span> <span class="o">=></span> <span class="nv">$match</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="nv">$array</span><span class="p">);</span> -<span class="c1">// WHERE `title` LIKE '%match%' ESCAPE '!' AND `page1` LIKE '%match%' ESCAPE '!' AND `page2` LIKE '%match%' ESCAPE '!'</span> -</pre></div> -</div> -</div></blockquote> -</li> -</ol> -<p><strong>$this->db->or_like()</strong></p> -<p>This method is identical to the one above, except that multiple -instances are joined by OR:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">or_like</span><span class="p">(</span><span class="s1">'body'</span><span class="p">,</span> <span class="nv">$match</span><span class="p">);</span> -<span class="c1">// WHERE `title` LIKE '%match%' ESCAPE '!' OR `body` LIKE '%match%' ESCAPE '!'</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last"><code class="docutils literal"><span class="pre">or_like()</span></code> was formerly known as <code class="docutils literal"><span class="pre">orlike()</span></code>, which has been removed.</p> -</div> -<p><strong>$this->db->not_like()</strong></p> -<p>This method is identical to <code class="docutils literal"><span class="pre">like()</span></code>, except that it generates -NOT LIKE statements:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">not_like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> <span class="c1">// WHERE `title` NOT LIKE '%match% ESCAPE '!'</span> -</pre></div> -</div> -<p><strong>$this->db->or_not_like()</strong></p> -<p>This method is identical to <code class="docutils literal"><span class="pre">not_like()</span></code>, except that multiple -instances are joined by OR:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">or_not_like</span><span class="p">(</span><span class="s1">'body'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> -<span class="c1">// WHERE `title` LIKE '%match% OR `body` NOT LIKE '%match%' ESCAPE '!'</span> -</pre></div> -</div> -<p><strong>$this->db->group_by()</strong></p> -<p>Permits you to write the GROUP BY portion of your query:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">group_by</span><span class="p">(</span><span class="s2">"title"</span><span class="p">);</span> <span class="c1">// Produces: GROUP BY title</span> -</pre></div> -</div> -<p>You can also pass an array of multiple values as well:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">group_by</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s2">"title"</span><span class="p">,</span> <span class="s2">"date"</span><span class="p">));</span> <span class="c1">// Produces: GROUP BY title, date</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">group_by() was formerly known as groupby(), which has been -removed.</p> -</div> -<p><strong>$this->db->distinct()</strong></p> -<p>Adds the “DISTINCT” keyword to a query</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">distinct</span><span class="p">();</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'table'</span><span class="p">);</span> <span class="c1">// Produces: SELECT DISTINCT * FROM table</span> -</pre></div> -</div> -<p><strong>$this->db->having()</strong></p> -<p>Permits you to write the HAVING portion of your query. There are 2 -possible syntaxes, 1 argument or 2:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">having</span><span class="p">(</span><span class="s1">'user_id = 45'</span><span class="p">);</span> <span class="c1">// Produces: HAVING user_id = 45</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">having</span><span class="p">(</span><span class="s1">'user_id'</span><span class="p">,</span> <span class="mi">45</span><span class="p">);</span> <span class="c1">// Produces: HAVING user_id = 45</span> -</pre></div> -</div> -<p>You can also pass an array of multiple values as well:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">having</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">'title ='</span> <span class="o">=></span> <span class="s1">'My Title'</span><span class="p">,</span> <span class="s1">'id <'</span> <span class="o">=></span> <span class="nv">$id</span><span class="p">));</span> -<span class="c1">// Produces: HAVING title = 'My Title', id < 45</span> -</pre></div> -</div> -<p>If you are using a database that CodeIgniter escapes queries for, you -can prevent escaping content by passing an optional third argument, and -setting it to FALSE.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">having</span><span class="p">(</span><span class="s1">'user_id'</span><span class="p">,</span> <span class="mi">45</span><span class="p">);</span> <span class="c1">// Produces: HAVING `user_id` = 45 in some databases such as MySQL</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">having</span><span class="p">(</span><span class="s1">'user_id'</span><span class="p">,</span> <span class="mi">45</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> <span class="c1">// Produces: HAVING user_id = 45</span> -</pre></div> -</div> -<p><strong>$this->db->or_having()</strong></p> -<p>Identical to having(), only separates multiple clauses with “OR”.</p> -</div> -<div class="section" id="ordering-results"> -<h2><a class="toc-backref" href="#id4">Ordering results</a><a class="headerlink" href="#ordering-results" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->order_by()</strong></p> -<p>Lets you set an ORDER BY clause.</p> -<p>The first parameter contains the name of the column you would like to order by.</p> -<p>The second parameter lets you set the direction of the result. -Options are <strong>ASC</strong>, <strong>DESC</strong> AND <strong>RANDOM</strong>.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">order_by</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'DESC'</span><span class="p">);</span> -<span class="c1">// Produces: ORDER BY `title` DESC</span> -</pre></div> -</div> -<p>You can also pass your own string in the first parameter:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">order_by</span><span class="p">(</span><span class="s1">'title DESC, name ASC'</span><span class="p">);</span> -<span class="c1">// Produces: ORDER BY `title` DESC, `name` ASC</span> -</pre></div> -</div> -<p>Or multiple function calls can be made if you need multiple fields.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">order_by</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'DESC'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">order_by</span><span class="p">(</span><span class="s1">'name'</span><span class="p">,</span> <span class="s1">'ASC'</span><span class="p">);</span> -<span class="c1">// Produces: ORDER BY `title` DESC, `name` ASC</span> -</pre></div> -</div> -<p>If you choose the <strong>RANDOM</strong> direction option, then the first parameters will -be ignored, unless you specify a numeric seed value.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">order_by</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'RANDOM'</span><span class="p">);</span> -<span class="c1">// Produces: ORDER BY RAND()</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">order_by</span><span class="p">(</span><span class="mi">42</span><span class="p">,</span> <span class="s1">'RANDOM'</span><span class="p">);</span> -<span class="c1">// Produces: ORDER BY RAND(42)</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">order_by() was formerly known as orderby(), which has been -removed.</p> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Random ordering is not currently supported in Oracle and -will default to ASC instead.</p> -</div> -</div> -<div class="section" id="limiting-or-counting-results"> -<h2><a class="toc-backref" href="#id5">Limiting or Counting Results</a><a class="headerlink" href="#limiting-or-counting-results" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->limit()</strong></p> -<p>Lets you limit the number of rows you would like returned by the query:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">limit</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span> <span class="c1">// Produces: LIMIT 10</span> -</pre></div> -</div> -<p>The second parameter lets you set a result offset.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">limit</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">);</span> <span class="c1">// Produces: LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)</span> -</pre></div> -</div> -<p><strong>$this->db->count_all_results()</strong></p> -<p>Permits you to determine the number of rows in a particular Active -Record query. Queries will accept Query Builder restrictors such as -<code class="docutils literal"><span class="pre">where()</span></code>, <code class="docutils literal"><span class="pre">or_where()</span></code>, <code class="docutils literal"><span class="pre">like()</span></code>, <code class="docutils literal"><span class="pre">or_like()</span></code>, etc. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">count_all_results</span><span class="p">(</span><span class="s1">'my_table'</span><span class="p">);</span> <span class="c1">// Produces an integer, like 25</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">like</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'match'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">from</span><span class="p">(</span><span class="s1">'my_table'</span><span class="p">);</span> -<span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">count_all_results</span><span class="p">();</span> <span class="c1">// Produces an integer, like 17</span> -</pre></div> -</div> -<p>However, this method also resets any field values that you may have passed -to <code class="docutils literal"><span class="pre">select()</span></code>. If you need to keep them, you can pass <code class="docutils literal"><span class="pre">FALSE</span></code> as the -second parameter:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">count_all_results</span><span class="p">(</span><span class="s1">'my_table'</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> -</pre></div> -</div> -<p><strong>$this->db->count_all()</strong></p> -<p>Permits you to determine the number of rows in a particular table. -Submit the table name in the first parameter. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">count_all</span><span class="p">(</span><span class="s1">'my_table'</span><span class="p">);</span> <span class="c1">// Produces an integer, like 25</span> -</pre></div> -</div> -</div> -<div class="section" id="query-grouping"> -<h2><a class="toc-backref" href="#id6">Query grouping</a><a class="headerlink" href="#query-grouping" title="Permalink to this headline">¶</a></h2> -<p>Query grouping allows you to create groups of WHERE clauses by enclosing them in parentheses. This will allow -you to create queries with complex WHERE clauses. Nested groups are supported. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'*'</span><span class="p">)</span><span class="o">-></span><span class="na">from</span><span class="p">(</span><span class="s1">'my_table'</span><span class="p">)</span> - <span class="o">-></span><span class="na">group_start</span><span class="p">()</span> - <span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'a'</span><span class="p">,</span> <span class="s1">'a'</span><span class="p">)</span> - <span class="o">-></span><span class="na">or_group_start</span><span class="p">()</span> - <span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'b'</span><span class="p">,</span> <span class="s1">'b'</span><span class="p">)</span> - <span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'c'</span><span class="p">,</span> <span class="s1">'c'</span><span class="p">)</span> - <span class="o">-></span><span class="na">group_end</span><span class="p">()</span> - <span class="o">-></span><span class="na">group_end</span><span class="p">()</span> - <span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'d'</span><span class="p">,</span> <span class="s1">'d'</span><span class="p">)</span> -<span class="o">-></span><span class="na">get</span><span class="p">();</span> - -<span class="c1">// Generates:</span> -<span class="c1">// SELECT * FROM (`my_table`) WHERE ( `a` = 'a' OR ( `b` = 'b' AND `c` = 'c' ) ) AND `d` = 'd'</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">groups need to be balanced, make sure every group_start() is matched by a group_end().</p> -</div> -<p><strong>$this->db->group_start()</strong></p> -<p>Starts a new group by adding an opening parenthesis to the WHERE clause of the query.</p> -<p><strong>$this->db->or_group_start()</strong></p> -<p>Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with ‘OR’.</p> -<p><strong>$this->db->not_group_start()</strong></p> -<p>Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with ‘NOT’.</p> -<p><strong>$this->db->or_not_group_start()</strong></p> -<p>Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with ‘OR NOT’.</p> -<p><strong>$this->db->group_end()</strong></p> -<p>Ends the current group by adding an closing parenthesis to the WHERE clause of the query.</p> -</div> -<div class="section" id="inserting-data"> -<h2><a class="toc-backref" href="#id7">Inserting Data</a><a class="headerlink" href="#inserting-data" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->insert()</strong></p> -<p>Generates an insert string based on the data you supply, and runs the -query. You can either pass an <strong>array</strong> or an <strong>object</strong> to the -function. Here is an example using an array:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="s1">'My title'</span><span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'My Name'</span><span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="s1">'My date'</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span> -<span class="c1">// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')</span> -</pre></div> -</div> -<p>The first parameter will contain the table name, the second is an -associative array of values.</p> -<p>Here is an example using an object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="cm">/*</span> -<span class="cm">class Myclass {</span> -<span class="cm"> public $title = 'My Title';</span> -<span class="cm"> public $content = 'My Content';</span> -<span class="cm"> public $date = 'My Date';</span> -<span class="cm">}</span> -<span class="cm">*/</span> - -<span class="nv">$object</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Myclass</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$object</span><span class="p">);</span> -<span class="c1">// Produces: INSERT INTO mytable (title, content, date) VALUES ('My Title', 'My Content', 'My Date')</span> -</pre></div> -</div> -<p>The first parameter will contain the table name, the second is an -object.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">All values are escaped automatically producing safer queries.</p> -</div> -<p><strong>$this->db->get_compiled_insert()</strong></p> -<p>Compiles the insertion query just like $this->db->insert() but does not -<em>run</em> the query. This method simply returns the SQL query as a string.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="s1">'My title'</span><span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'My Name'</span><span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="s1">'My date'</span> -<span class="p">);</span> - -<span class="nv">$sql</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="nv">$data</span><span class="p">)</span><span class="o">-></span><span class="na">get_compiled_insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -<span class="k">echo</span> <span class="nv">$sql</span><span class="p">;</span> - -<span class="c1">// Produces string: INSERT INTO mytable (`title`, `name`, `date`) VALUES ('My title', 'My name', 'My date')</span> -</pre></div> -</div> -<p>The second parameter enables you to set whether or not the query builder query -will be reset (by default it will be–just like $this->db->insert()):</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'My Title'</span><span class="p">)</span><span class="o">-></span><span class="na">get_compiled_insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> - -<span class="c1">// Produces string: INSERT INTO mytable (`title`) VALUES ('My Title')</span> - -<span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'content'</span><span class="p">,</span> <span class="s1">'My Content'</span><span class="p">)</span><span class="o">-></span><span class="na">get_compiled_insert</span><span class="p">();</span> - -<span class="c1">// Produces string: INSERT INTO mytable (`title`, `content`) VALUES ('My Title', 'My Content')</span> -</pre></div> -</div> -<p>The key thing to notice in the above example is that the second query did not -utilize <cite>$this->db->from()</cite> nor did it pass a table name into the first -parameter. The reason this worked is because the query has not been executed -using <cite>$this->db->insert()</cite> which resets values or reset directly using -<cite>$this->db->reset_query()</cite>.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">This method doesn’t work for batched inserts.</p> -</div> -<p><strong>$this->db->insert_batch()</strong></p> -<p>Generates an insert string based on the data you supply, and runs the -query. You can either pass an <strong>array</strong> or an <strong>object</strong> to the -function. Here is an example using an array:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="s1">'My title'</span><span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'My Name'</span><span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="s1">'My date'</span> - <span class="p">),</span> - <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="s1">'Another title'</span><span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'Another Name'</span><span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="s1">'Another date'</span> - <span class="p">)</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert_batch</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span> -<span class="c1">// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')</span> -</pre></div> -</div> -<p>The first parameter will contain the table name, the second is an -associative array of values.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">All values are escaped automatically producing safer queries.</p> -</div> -</div> -<div class="section" id="updating-data"> -<h2><a class="toc-backref" href="#id8">Updating Data</a><a class="headerlink" href="#updating-data" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->replace()</strong></p> -<p>This method executes a REPLACE statement, which is basically the SQL -standard for (optional) DELETE + INSERT, using <em>PRIMARY</em> and <em>UNIQUE</em> -keys as the determining factor. -In our case, it will save you from the need to implement complex -logics with different combinations of <code class="docutils literal"><span class="pre">select()</span></code>, <code class="docutils literal"><span class="pre">update()</span></code>, -<code class="docutils literal"><span class="pre">delete()</span></code> and <code class="docutils literal"><span class="pre">insert()</span></code> calls.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="s1">'My title'</span><span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'My Name'</span><span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="s1">'My date'</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">replace</span><span class="p">(</span><span class="s1">'table'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span> - -<span class="c1">// Executes: REPLACE INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')</span> -</pre></div> -</div> -<p>In the above example, if we assume that the <em>title</em> field is our primary -key, then if a row containing ‘My title’ as the <em>title</em> value, that row -will be deleted with our new row data replacing it.</p> -<p>Usage of the <code class="docutils literal"><span class="pre">set()</span></code> method is also allowed and all fields are -automatically escaped, just like with <code class="docutils literal"><span class="pre">insert()</span></code>.</p> -<p><strong>$this->db->set()</strong></p> -<p>This function enables you to set values for inserts or updates.</p> -<p><strong>It can be used instead of passing a data array directly to the insert -or update functions:</strong></p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'name'</span><span class="p">,</span> <span class="nv">$name</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> <span class="c1">// Produces: INSERT INTO mytable (`name`) VALUES ('{$name}')</span> -</pre></div> -</div> -<p>If you use multiple function called they will be assembled properly -based on whether you are doing an insert or an update:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'name'</span><span class="p">,</span> <span class="nv">$name</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'title'</span><span class="p">,</span> <span class="nv">$title</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'status'</span><span class="p">,</span> <span class="nv">$status</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -</pre></div> -</div> -<p><strong>set()</strong> will also accept an optional third parameter (<code class="docutils literal"><span class="pre">$escape</span></code>), that -will prevent data from being escaped if set to FALSE. To illustrate the -difference, here is <code class="docutils literal"><span class="pre">set()</span></code> used both with and without the escape -parameter.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'field'</span><span class="p">,</span> <span class="s1">'field+1'</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id'</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> <span class="c1">// gives UPDATE mytable SET field = field+1 WHERE id = 2</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="s1">'field'</span><span class="p">,</span> <span class="s1">'field+1'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id'</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> <span class="c1">// gives UPDATE `mytable` SET `field` = 'field+1' WHERE `id` = 2</span> -</pre></div> -</div> -<p>You can also pass an associative array to this function:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$array</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="nv">$name</span><span class="p">,</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="nv">$title</span><span class="p">,</span> - <span class="s1">'status'</span> <span class="o">=></span> <span class="nv">$status</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="nv">$array</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -</pre></div> -</div> -<p>Or an object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="cm">/*</span> -<span class="cm">class Myclass {</span> -<span class="cm"> public $title = 'My Title';</span> -<span class="cm"> public $content = 'My Content';</span> -<span class="cm"> public $date = 'My Date';</span> -<span class="cm">}</span> -<span class="cm">*/</span> - -<span class="nv">$object</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Myclass</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">set</span><span class="p">(</span><span class="nv">$object</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">insert</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -</pre></div> -</div> -<p><strong>$this->db->update()</strong></p> -<p>Generates an update string and runs the query based on the data you -supply. You can pass an <strong>array</strong> or an <strong>object</strong> to the function. Here -is an example using an array:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="nv">$title</span><span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="nv">$name</span><span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="nv">$date</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span> -<span class="c1">// Produces:</span> -<span class="c1">//</span> -<span class="c1">// UPDATE mytable</span> -<span class="c1">// SET title = '{$title}', name = '{$name}', date = '{$date}'</span> -<span class="c1">// WHERE id = $id</span> -</pre></div> -</div> -<p>Or you can supply an object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="cm">/*</span> -<span class="cm">class Myclass {</span> -<span class="cm"> public $title = 'My Title';</span> -<span class="cm"> public $content = 'My Content';</span> -<span class="cm"> public $date = 'My Date';</span> -<span class="cm">}</span> -<span class="cm">*/</span> - -<span class="nv">$object</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Myclass</span><span class="p">;</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$object</span><span class="p">);</span> -<span class="c1">// Produces:</span> -<span class="c1">//</span> -<span class="c1">// UPDATE `mytable`</span> -<span class="c1">// SET `title` = '{$title}', `name` = '{$name}', `date` = '{$date}'</span> -<span class="c1">// WHERE id = `$id`</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">All values are escaped automatically producing safer queries.</p> -</div> -<p>You’ll notice the use of the $this->db->where() function, enabling you -to set the WHERE clause. You can optionally pass this information -directly into the update function as a string:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">,</span> <span class="s2">"id = 4"</span><span class="p">);</span> -</pre></div> -</div> -<p>Or as an array:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">'id'</span> <span class="o">=></span> <span class="nv">$id</span><span class="p">));</span> -</pre></div> -</div> -<p>You may also use the $this->db->set() function described above when -performing updates.</p> -<p><strong>$this->db->update_batch()</strong></p> -<p>Generates an update string based on the data you supply, and runs the query. -You can either pass an <strong>array</strong> or an <strong>object</strong> to the function. -Here is an example using an array:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> - <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="s1">'My title'</span> <span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'My Name 2'</span> <span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="s1">'My date 2'</span> - <span class="p">),</span> - <span class="k">array</span><span class="p">(</span> - <span class="s1">'title'</span> <span class="o">=></span> <span class="s1">'Another title'</span> <span class="p">,</span> - <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'Another Name 2'</span> <span class="p">,</span> - <span class="s1">'date'</span> <span class="o">=></span> <span class="s1">'Another date 2'</span> - <span class="p">)</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">update_batch</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="nv">$data</span><span class="p">,</span> <span class="s1">'title'</span><span class="p">);</span> - -<span class="c1">// Produces:</span> -<span class="c1">// UPDATE `mytable` SET `name` = CASE</span> -<span class="c1">// WHEN `title` = 'My title' THEN 'My Name 2'</span> -<span class="c1">// WHEN `title` = 'Another title' THEN 'Another Name 2'</span> -<span class="c1">// ELSE `name` END,</span> -<span class="c1">// `date` = CASE</span> -<span class="c1">// WHEN `title` = 'My title' THEN 'My date 2'</span> -<span class="c1">// WHEN `title` = 'Another title' THEN 'Another date 2'</span> -<span class="c1">// ELSE `date` END</span> -<span class="c1">// WHERE `title` IN ('My title','Another title')</span> -</pre></div> -</div> -<p>The first parameter will contain the table name, the second is an associative -array of values, the third parameter is the where key.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">All values are escaped automatically producing safer queries.</p> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last"><code class="docutils literal"><span class="pre">affected_rows()</span></code> won’t give you proper results with this method, -due to the very nature of how it works. Instead, <code class="docutils literal"><span class="pre">update_batch()</span></code> -returns the number of rows affected.</p> -</div> -<p><strong>$this->db->get_compiled_update()</strong></p> -<p>This works exactly the same way as <code class="docutils literal"><span class="pre">$this->db->get_compiled_insert()</span></code> except -that it produces an UPDATE SQL string instead of an INSERT SQL string.</p> -<p>For more information view documentation for <cite>$this->db->get_compiled_insert()</cite>.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">This method doesn’t work for batched updates.</p> -</div> -</div> -<div class="section" id="deleting-data"> -<h2><a class="toc-backref" href="#id9">Deleting Data</a><a class="headerlink" href="#deleting-data" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->delete()</strong></p> -<p>Generates a delete SQL string and runs the query.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">delete</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">'id'</span> <span class="o">=></span> <span class="nv">$id</span><span class="p">));</span> <span class="c1">// Produces: // DELETE FROM mytable // WHERE id = $id</span> -</pre></div> -</div> -<p>The first parameter is the table name, the second is the where clause. -You can also use the where() or or_where() functions instead of passing -the data to the second parameter of the function:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">delete</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> - -<span class="c1">// Produces:</span> -<span class="c1">// DELETE FROM mytable</span> -<span class="c1">// WHERE id = $id</span> -</pre></div> -</div> -<p>An array of table names can be passed into delete() if you would like to -delete data from more than 1 table.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$tables</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'table1'</span><span class="p">,</span> <span class="s1">'table2'</span><span class="p">,</span> <span class="s1">'table3'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id'</span><span class="p">,</span> <span class="s1">'5'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">delete</span><span class="p">(</span><span class="nv">$tables</span><span class="p">);</span> -</pre></div> -</div> -<p>If you want to delete all data from a table, you can use the truncate() -function, or empty_table().</p> -<p><strong>$this->db->empty_table()</strong></p> -<p>Generates a delete SQL string and runs the -query.:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">empty_table</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> <span class="c1">// Produces: DELETE FROM mytable</span> -</pre></div> -</div> -<p><strong>$this->db->truncate()</strong></p> -<p>Generates a truncate SQL string and runs the query.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">from</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">truncate</span><span class="p">();</span> - -<span class="c1">// or</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">truncate</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> - -<span class="c1">// Produce:</span> -<span class="c1">// TRUNCATE mytable</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If the TRUNCATE command isn’t available, truncate() will -execute as “DELETE FROM table”.</p> -</div> -<p><strong>$this->db->get_compiled_delete()</strong></p> -<p>This works exactly the same way as <code class="docutils literal"><span class="pre">$this->db->get_compiled_insert()</span></code> except -that it produces a DELETE SQL string instead of an INSERT SQL string.</p> -<p>For more information view documentation for $this->db->get_compiled_insert().</p> -</div> -<div class="section" id="method-chaining"> -<h2><a class="toc-backref" href="#id10">Method Chaining</a><a class="headerlink" href="#method-chaining" title="Permalink to this headline">¶</a></h2> -<p>Method chaining allows you to simplify your syntax by connecting -multiple functions. Consider this example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'title'</span><span class="p">)</span> - <span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'id'</span><span class="p">,</span> <span class="nv">$id</span><span class="p">)</span> - <span class="o">-></span><span class="na">limit</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span> - <span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="query-builder-caching"> -<span id="ar-caching"></span><h2><a class="toc-backref" href="#id11">Query Builder Caching</a><a class="headerlink" href="#query-builder-caching" title="Permalink to this headline">¶</a></h2> -<p>While not “true” caching, Query Builder enables you to save (or “cache”) -certain parts of your queries for reuse at a later point in your -script’s execution. Normally, when an Query Builder call is completed, -all stored information is reset for the next call. With caching, you can -prevent this reset, and reuse information easily.</p> -<p>Cached calls are cumulative. If you make 2 cached select() calls, and -then 2 uncached select() calls, this will result in 4 select() calls. -There are three Caching functions available:</p> -<p><strong>$this->db->start_cache()</strong></p> -<p>This function must be called to begin caching. All Query Builder queries -of the correct type (see below for supported queries) are stored for -later use.</p> -<p><strong>$this->db->stop_cache()</strong></p> -<p>This function can be called to stop caching.</p> -<p><strong>$this->db->flush_cache()</strong></p> -<p>This function deletes all items from the Query Builder cache.</p> -<div class="section" id="an-example-of-caching"> -<h3>An example of caching<a class="headerlink" href="#an-example-of-caching" title="Permalink to this headline">¶</a></h3> -<p>Here’s a usage example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">start_cache</span><span class="p">();</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'field1'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">stop_cache</span><span class="p">();</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'tablename'</span><span class="p">);</span> -<span class="c1">//Generates: SELECT `field1` FROM (`tablename`)</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'field2'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'tablename'</span><span class="p">);</span> -<span class="c1">//Generates: SELECT `field1`, `field2` FROM (`tablename`)</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">flush_cache</span><span class="p">();</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="s1">'field2'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">(</span><span class="s1">'tablename'</span><span class="p">);</span> -<span class="c1">//Generates: SELECT `field2` FROM (`tablename`)</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">The following statements can be cached: select, from, join, -where, like, group_by, having, order_by</p> -</div> -</div> -</div> -<div class="section" id="resetting-query-builder"> -<h2><a class="toc-backref" href="#id12">Resetting Query Builder</a><a class="headerlink" href="#resetting-query-builder" title="Permalink to this headline">¶</a></h2> -<p><strong>$this->db->reset_query()</strong></p> -<p>Resetting Query Builder allows you to start fresh with your query without -executing it first using a method like $this->db->get() or $this->db->insert(). -Just like the methods that execute a query, this will <em>not</em> reset items you’ve -cached using <a class="reference internal" href="#query-builder-caching">Query Builder Caching</a>.</p> -<p>This is useful in situations where you are using Query Builder to generate SQL -(ex. <code class="docutils literal"><span class="pre">$this->db->get_compiled_select()</span></code>) but then choose to, for instance, -run the query:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Note that the second parameter of the get_compiled_select method is FALSE</span> -<span class="nv">$sql</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">select</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">'field1'</span><span class="p">,</span><span class="s1">'field2'</span><span class="p">))</span> - <span class="o">-></span><span class="na">where</span><span class="p">(</span><span class="s1">'field3'</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span> - <span class="o">-></span><span class="na">get_compiled_select</span><span class="p">(</span><span class="s1">'mytable'</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span> - -<span class="c1">// ...</span> -<span class="c1">// Do something crazy with the SQL code... like add it to a cron script for</span> -<span class="c1">// later execution or something...</span> -<span class="c1">// ...</span> - -<span class="nv">$data</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">get</span><span class="p">()</span><span class="o">-></span><span class="na">result_array</span><span class="p">();</span> - -<span class="c1">// Would execute and return an array of results of the following query:</span> -<span class="c1">// SELECT field1, field1 from mytable where field3 = 5;</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Double calls to <code class="docutils literal"><span class="pre">get_compiled_select()</span></code> while you’re using the -Query Builder Caching functionality and NOT resetting your queries -will results in the cache being merged twice. That in turn will -i.e. if you’re caching a <code class="docutils literal"><span class="pre">select()</span></code> - select the same field twice.</p> -</div> -</div> -<div class="section" id="class-reference"> -<h2><a class="toc-backref" href="#id13">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline">¶</a></h2> -<dl class="class"> -<dt id="CI_DB_query_builder"> -<em class="property">class </em><code class="descname">CI_DB_query_builder</code><a class="headerlink" href="#CI_DB_query_builder" title="Permalink to this definition">¶</a></dt> -<dd><dl class="method"> -<dt id="CI_DB_query_builder::reset_query"> -<code class="descname">reset_query</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::reset_query" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Resets the current Query Builder state. Useful when you want -to build a query that can be cancelled under certain conditions.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::start_cache"> -<code class="descname">start_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::start_cache" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Starts the Query Builder cache.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::stop_cache"> -<code class="descname">stop_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::stop_cache" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Stops the Query Builder cache.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::flush_cache"> -<code class="descname">flush_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::flush_cache" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Empties the Query Builder cache.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::set_dbprefix"> -<code class="descname">set_dbprefix</code><span class="sig-paren">(</span><span class="optional">[</span><em>$prefix = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::set_dbprefix" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$prefix</strong> (<em>string</em>) – The new prefix to use</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The DB prefix in use</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Sets the database prefix, without having to reconnect.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::dbprefix"> -<code class="descname">dbprefix</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_query_builder::dbprefix" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – The table name to prefix</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The prefixed table name</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Prepends a database prefix, if one exists in configuration.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::count_all_results"> -<code class="descname">count_all_results</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$reset = TRUE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::count_all_results" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$reset</strong> (<em>bool</em>) – Whether to reset values for SELECTs</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Number of rows in the query result</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p> -</td> -</tr> -</tbody> -</table> -<p>Generates a platform-specific query string that counts -all records returned by an Query Builder query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::get"> -<code class="descname">get</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$limit = NULL</em><span class="optional">[</span>, <em>$offset = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::get" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – The table to query</li> -<li><strong>$limit</strong> (<em>int</em>) – The LIMIT clause</li> -<li><strong>$offset</strong> (<em>int</em>) – The OFFSET clause</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_result instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_result</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles and runs SELECT statement based on the already -called Query Builder methods.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::get_where"> -<code class="descname">get_where</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$where = NULL</em><span class="optional">[</span>, <em>$limit = NULL</em><span class="optional">[</span>, <em>$offset = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::get_where" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>mixed</em>) – The table(s) to fetch data from; string or array</li> -<li><strong>$where</strong> (<em>string</em>) – The WHERE clause</li> -<li><strong>$limit</strong> (<em>int</em>) – The LIMIT clause</li> -<li><strong>$offset</strong> (<em>int</em>) – The OFFSET clause</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_result instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_result</p> -</td> -</tr> -</tbody> -</table> -<p>Same as <code class="docutils literal"><span class="pre">get()</span></code>, but also allows the WHERE to be added directly.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::select"> -<code class="descname">select</code><span class="sig-paren">(</span><span class="optional">[</span><em>$select = '*'</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::select" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$select</strong> (<em>string</em>) – The SELECT portion of a query</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a SELECT clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::select_avg"> -<code class="descname">select_avg</code><span class="sig-paren">(</span><span class="optional">[</span><em>$select = ''</em><span class="optional">[</span>, <em>$alias = ''</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::select_avg" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$select</strong> (<em>string</em>) – Field to compute the average of</li> -<li><strong>$alias</strong> (<em>string</em>) – Alias for the resulting value name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a SELECT AVG(field) clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::select_max"> -<code class="descname">select_max</code><span class="sig-paren">(</span><span class="optional">[</span><em>$select = ''</em><span class="optional">[</span>, <em>$alias = ''</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::select_max" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$select</strong> (<em>string</em>) – Field to compute the maximum of</li> -<li><strong>$alias</strong> (<em>string</em>) – Alias for the resulting value name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a SELECT MAX(field) clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::select_min"> -<code class="descname">select_min</code><span class="sig-paren">(</span><span class="optional">[</span><em>$select = ''</em><span class="optional">[</span>, <em>$alias = ''</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::select_min" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$select</strong> (<em>string</em>) – Field to compute the minimum of</li> -<li><strong>$alias</strong> (<em>string</em>) – Alias for the resulting value name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a SELECT MIN(field) clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::select_sum"> -<code class="descname">select_sum</code><span class="sig-paren">(</span><span class="optional">[</span><em>$select = ''</em><span class="optional">[</span>, <em>$alias = ''</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::select_sum" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$select</strong> (<em>string</em>) – Field to compute the sum of</li> -<li><strong>$alias</strong> (<em>string</em>) – Alias for the resulting value name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a SELECT SUM(field) clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::distinct"> -<code class="descname">distinct</code><span class="sig-paren">(</span><span class="optional">[</span><em>$val = TRUE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::distinct" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$val</strong> (<em>bool</em>) – Desired value of the “distinct” flag</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Sets a flag which tells the query builder to add -a DISTINCT clause to the SELECT portion of the query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::from"> -<code class="descname">from</code><span class="sig-paren">(</span><em>$from</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::from" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$from</strong> (<em>mixed</em>) – Table name(s); string or array</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Specifies the FROM clause of a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::join"> -<code class="descname">join</code><span class="sig-paren">(</span><em>$table</em>, <em>$cond</em><span class="optional">[</span>, <em>$type = ''</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::join" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name to join</li> -<li><strong>$cond</strong> (<em>string</em>) – The JOIN ON condition</li> -<li><strong>$type</strong> (<em>string</em>) – The JOIN type</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a JOIN clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::where"> -<code class="descname">where</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::where" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Name of field to compare, or associative array</li> -<li><strong>$value</strong> (<em>mixed</em>) – If a single key, compared to this value</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">DB_query_builder instance</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object</p> -</td> -</tr> -</tbody> -</table> -<p>Generates the WHERE portion of the query. -Separates multiple calls with ‘AND’.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_where"> -<code class="descname">or_where</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_where" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Name of field to compare, or associative array</li> -<li><strong>$value</strong> (<em>mixed</em>) – If a single key, compared to this value</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">DB_query_builder instance</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object</p> -</td> -</tr> -</tbody> -</table> -<p>Generates the WHERE portion of the query. -Separates multiple calls with ‘OR’.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_where_in"> -<code class="descname">or_where_in</code><span class="sig-paren">(</span><span class="optional">[</span><em>$key = NULL</em><span class="optional">[</span>, <em>$values = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_where_in" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>string</em>) – The field to search</li> -<li><strong>$values</strong> (<em>array</em>) – The values searched on</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">DB_query_builder instance</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object</p> -</td> -</tr> -</tbody> -</table> -<p>Generates a WHERE field IN(‘item’, ‘item’) SQL query, -joined with ‘OR’ if appropriate.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_where_not_in"> -<code class="descname">or_where_not_in</code><span class="sig-paren">(</span><span class="optional">[</span><em>$key = NULL</em><span class="optional">[</span>, <em>$values = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_where_not_in" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>string</em>) – The field to search</li> -<li><strong>$values</strong> (<em>array</em>) – The values searched on</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">DB_query_builder instance</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object</p> -</td> -</tr> -</tbody> -</table> -<p>Generates a WHERE field NOT IN(‘item’, ‘item’) SQL query, -joined with ‘OR’ if appropriate.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::where_in"> -<code class="descname">where_in</code><span class="sig-paren">(</span><span class="optional">[</span><em>$key = NULL</em><span class="optional">[</span>, <em>$values = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::where_in" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>string</em>) – Name of field to examine</li> -<li><strong>$values</strong> (<em>array</em>) – Array of target values</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">DB_query_builder instance</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object</p> -</td> -</tr> -</tbody> -</table> -<p>Generates a WHERE field IN(‘item’, ‘item’) SQL query, -joined with ‘AND’ if appropriate.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::where_not_in"> -<code class="descname">where_not_in</code><span class="sig-paren">(</span><span class="optional">[</span><em>$key = NULL</em><span class="optional">[</span>, <em>$values = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::where_not_in" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>string</em>) – Name of field to examine</li> -<li><strong>$values</strong> (<em>array</em>) – Array of target values</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">DB_query_builder instance</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object</p> -</td> -</tr> -</tbody> -</table> -<p>Generates a WHERE field NOT IN(‘item’, ‘item’) SQL query, -joined with ‘AND’ if appropriate.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::group_start"> -<code class="descname">group_start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::group_start" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Starts a group expression, using ANDs for the conditions inside it.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_group_start"> -<code class="descname">or_group_start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_group_start" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Starts a group expression, using ORs for the conditions inside it.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::not_group_start"> -<code class="descname">not_group_start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::not_group_start" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Starts a group expression, using AND NOTs for the conditions inside it.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_not_group_start"> -<code class="descname">or_not_group_start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_not_group_start" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">CI_DB_query_builder instance (method chaining)</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CI_DB_query_builder</td> -</tr> -</tbody> -</table> -<p>Starts a group expression, using OR NOTs for the conditions inside it.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::group_end"> -<code class="descname">group_end</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::group_end" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">DB_query_builder instance</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">object</td> -</tr> -</tbody> -</table> -<p>Ends a group expression.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::like"> -<code class="descname">like</code><span class="sig-paren">(</span><em>$field</em><span class="optional">[</span>, <em>$match = ''</em><span class="optional">[</span>, <em>$side = 'both'</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::like" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$field</strong> (<em>string</em>) – Field name</li> -<li><strong>$match</strong> (<em>string</em>) – Text portion to match</li> -<li><strong>$side</strong> (<em>string</em>) – Which side of the expression to put the ‘%’ wildcard on</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a LIKE clause to a query, separating multiple calls with AND.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_like"> -<code class="descname">or_like</code><span class="sig-paren">(</span><em>$field</em><span class="optional">[</span>, <em>$match = ''</em><span class="optional">[</span>, <em>$side = 'both'</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_like" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$field</strong> (<em>string</em>) – Field name</li> -<li><strong>$match</strong> (<em>string</em>) – Text portion to match</li> -<li><strong>$side</strong> (<em>string</em>) – Which side of the expression to put the ‘%’ wildcard on</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a LIKE clause to a query, separating multiple class with OR.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::not_like"> -<code class="descname">not_like</code><span class="sig-paren">(</span><em>$field</em><span class="optional">[</span>, <em>$match = ''</em><span class="optional">[</span>, <em>$side = 'both'</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::not_like" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$field</strong> (<em>string</em>) – Field name</li> -<li><strong>$match</strong> (<em>string</em>) – Text portion to match</li> -<li><strong>$side</strong> (<em>string</em>) – Which side of the expression to put the ‘%’ wildcard on</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a NOT LIKE clause to a query, separating multiple calls with AND.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_not_like"> -<code class="descname">or_not_like</code><span class="sig-paren">(</span><em>$field</em><span class="optional">[</span>, <em>$match = ''</em><span class="optional">[</span>, <em>$side = 'both'</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_not_like" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$field</strong> (<em>string</em>) – Field name</li> -<li><strong>$match</strong> (<em>string</em>) – Text portion to match</li> -<li><strong>$side</strong> (<em>string</em>) – Which side of the expression to put the ‘%’ wildcard on</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a NOT LIKE clause to a query, separating multiple calls with OR.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::having"> -<code class="descname">having</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::having" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Identifier (string) or associative array of field/value pairs</li> -<li><strong>$value</strong> (<em>string</em>) – Value sought if $key is an identifier</li> -<li><strong>$escape</strong> (<em>string</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a HAVING clause to a query, separating multiple calls with AND.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::or_having"> -<code class="descname">or_having</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::or_having" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Identifier (string) or associative array of field/value pairs</li> -<li><strong>$value</strong> (<em>string</em>) – Value sought if $key is an identifier</li> -<li><strong>$escape</strong> (<em>string</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a HAVING clause to a query, separating multiple calls with OR.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::group_by"> -<code class="descname">group_by</code><span class="sig-paren">(</span><em>$by</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::group_by" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$by</strong> (<em>mixed</em>) – Field(s) to group by; string or array</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds a GROUP BY clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::order_by"> -<code class="descname">order_by</code><span class="sig-paren">(</span><em>$orderby</em><span class="optional">[</span>, <em>$direction = ''</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::order_by" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$orderby</strong> (<em>string</em>) – Field to order by</li> -<li><strong>$direction</strong> (<em>string</em>) – The order requested - ASC, DESC or random</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds an ORDER BY clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::limit"> -<code class="descname">limit</code><span class="sig-paren">(</span><em>$value</em><span class="optional">[</span>, <em>$offset = 0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::limit" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$value</strong> (<em>int</em>) – Number of rows to limit the results to</li> -<li><strong>$offset</strong> (<em>int</em>) – Number of rows to skip</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds LIMIT and OFFSET clauses to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::offset"> -<code class="descname">offset</code><span class="sig-paren">(</span><em>$offset</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::offset" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$offset</strong> (<em>int</em>) – Number of rows to skip</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds an OFFSET clause to a query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::set"> -<code class="descname">set</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = ''</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::set" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Field name, or an array of field/value pairs</li> -<li><strong>$value</strong> (<em>string</em>) – Field value, if $key is a single field</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds field/value pairs to be passed later to <code class="docutils literal"><span class="pre">insert()</span></code>, -<code class="docutils literal"><span class="pre">update()</span></code> or <code class="docutils literal"><span class="pre">replace()</span></code>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::insert"> -<code class="descname">insert</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$set = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::insert" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$set</strong> (<em>array</em>) – An associative array of field/value pairs</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles and executes an INSERT statement.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::insert_batch"> -<code class="descname">insert_batch</code><span class="sig-paren">(</span><em>$table</em><span class="optional">[</span>, <em>$set = NULL</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">[</span>, <em>$batch_size = 100</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::insert_batch" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$set</strong> (<em>array</em>) – Data to insert</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -<li><strong>$batch_size</strong> (<em>int</em>) – Count of rows to insert at once</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Number of rows inserted or FALSE on failure</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles and executes batch <code class="docutils literal"><span class="pre">INSERT</span></code> statements.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">When more than <code class="docutils literal"><span class="pre">$batch_size</span></code> rows are provided, multiple -<code class="docutils literal"><span class="pre">INSERT</span></code> queries will be executed, each trying to insert -up to <code class="docutils literal"><span class="pre">$batch_size</span></code> rows.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::set_insert_batch"> -<code class="descname">set_insert_batch</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = ''</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::set_insert_batch" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Field name or an array of field/value pairs</li> -<li><strong>$value</strong> (<em>string</em>) – Field value, if $key is a single field</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds field/value pairs to be inserted in a table later via <code class="docutils literal"><span class="pre">insert_batch()</span></code>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::update"> -<code class="descname">update</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$set = NULL</em><span class="optional">[</span>, <em>$where = NULL</em><span class="optional">[</span>, <em>$limit = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::update" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$set</strong> (<em>array</em>) – An associative array of field/value pairs</li> -<li><strong>$where</strong> (<em>string</em>) – The WHERE clause</li> -<li><strong>$limit</strong> (<em>int</em>) – The LIMIT clause</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles and executes an UPDATE statement.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::update_batch"> -<code class="descname">update_batch</code><span class="sig-paren">(</span><em>$table</em><span class="optional">[</span>, <em>$set = NULL</em><span class="optional">[</span>, <em>$value = NULL</em><span class="optional">[</span>, <em>$batch_size = 100</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::update_batch" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$set</strong> (<em>array</em>) – Field name, or an associative array of field/value pairs</li> -<li><strong>$value</strong> (<em>string</em>) – Field value, if $set is a single field</li> -<li><strong>$batch_size</strong> (<em>int</em>) – Count of conditions to group in a single query</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Number of rows updated or FALSE on failure</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles and executes batch <code class="docutils literal"><span class="pre">UPDATE</span></code> statements.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">When more than <code class="docutils literal"><span class="pre">$batch_size</span></code> field/value pairs are provided, -multiple queries will be executed, each handling up to -<code class="docutils literal"><span class="pre">$batch_size</span></code> field/value pairs.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::set_update_batch"> -<code class="descname">set_update_batch</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = ''</em><span class="optional">[</span>, <em>$escape = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::set_update_batch" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Field name or an array of field/value pairs</li> -<li><strong>$value</strong> (<em>string</em>) – Field value, if $key is a single field</li> -<li><strong>$escape</strong> (<em>bool</em>) – Whether to escape values and identifiers</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining)</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_DB_query_builder</p> -</td> -</tr> -</tbody> -</table> -<p>Adds field/value pairs to be updated in a table later via <code class="docutils literal"><span class="pre">update_batch()</span></code>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::replace"> -<code class="descname">replace</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$set = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::replace" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$set</strong> (<em>array</em>) – An associative array of field/value pairs</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles and executes a REPLACE statement.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::delete"> -<code class="descname">delete</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$where = ''</em><span class="optional">[</span>, <em>$limit = NULL</em><span class="optional">[</span>, <em>$reset_data = TRUE</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::delete" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>mixed</em>) – The table(s) to delete from; string or array</li> -<li><strong>$where</strong> (<em>string</em>) – The WHERE clause</li> -<li><strong>$limit</strong> (<em>int</em>) – The LIMIT clause</li> -<li><strong>$reset_data</strong> (<em>bool</em>) – TRUE to reset the query “write” clause</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_DB_query_builder instance (method chaining) or FALSE on failure</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles and executes a DELETE query.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::truncate"> -<code class="descname">truncate</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_query_builder::truncate" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Executes a TRUNCATE statement on a table.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">If the database platform in use doesn’t support TRUNCATE, -a DELETE statement will be used instead.</p> -</div> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::empty_table"> -<code class="descname">empty_table</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_query_builder::empty_table" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Deletes all records from a table via a DELETE statement.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::get_compiled_select"> -<code class="descname">get_compiled_select</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$reset = TRUE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::get_compiled_select" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$reset</strong> (<em>bool</em>) – Whether to reset the current QB values or not</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The compiled SQL statement as a string</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles a SELECT statement and returns it as a string.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::get_compiled_insert"> -<code class="descname">get_compiled_insert</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$reset = TRUE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::get_compiled_insert" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$reset</strong> (<em>bool</em>) – Whether to reset the current QB values or not</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The compiled SQL statement as a string</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles an INSERT statement and returns it as a string.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::get_compiled_update"> -<code class="descname">get_compiled_update</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$reset = TRUE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::get_compiled_update" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$reset</strong> (<em>bool</em>) – Whether to reset the current QB values or not</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The compiled SQL statement as a string</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles an UPDATE statement and returns it as a string.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_query_builder::get_compiled_delete"> -<code class="descname">get_compiled_delete</code><span class="sig-paren">(</span><span class="optional">[</span><em>$table = ''</em><span class="optional">[</span>, <em>$reset = TRUE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_query_builder::get_compiled_delete" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table</strong> (<em>string</em>) – Table name</li> -<li><strong>$reset</strong> (<em>bool</em>) – Whether to reset the current QB values or not</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The compiled SQL statement as a string</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Compiles a DELETE statement and returns it as a string.</p> -</dd></dl> - -</dd></dl> - -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="transactions.html" class="btn btn-neutral float-right" title="Transactions">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="helpers.html" class="btn btn-neutral" title="Query Helper Methods"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/results.html b/user_guide/database/results.html deleted file mode 100644 index 0a876c5a8..000000000 --- a/user_guide/database/results.html +++ /dev/null @@ -1,1231 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Generating Query Results — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Query Helper Methods" href="helpers.html"/> - <link rel="prev" title="Queries" href="queries.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Generating Query Results</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="generating-query-results"> -<h1>Generating Query Results<a class="headerlink" href="#generating-query-results" title="Permalink to this headline">¶</a></h1> -<p>There are several ways to generate query results:</p> -<div class="contents local topic" id="contents"> -<ul class="simple"> -<li><a class="reference internal" href="#result-arrays" id="id1">Result Arrays</a></li> -<li><a class="reference internal" href="#result-rows" id="id2">Result Rows</a></li> -<li><a class="reference internal" href="#custom-result-objects" id="id3">Custom Result Objects</a></li> -<li><a class="reference internal" href="#result-helper-methods" id="id4">Result Helper Methods</a></li> -<li><a class="reference internal" href="#class-reference" id="id5">Class Reference</a></li> -</ul> -</div> -<div class="section" id="result-arrays"> -<h2><a class="toc-backref" href="#id1">Result Arrays</a><a class="headerlink" href="#result-arrays" title="Permalink to this headline">¶</a></h2> -<p><strong>result()</strong></p> -<p>This method returns the query result as an array of <strong>objects</strong>, or -<strong>an empty array</strong> on failure. Typically you’ll use this in a foreach -loop, like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">title</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">body</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p>The above method is an alias of <code class="docutils literal"><span class="pre">result_object()</span></code>.</p> -<p>You can also pass a string to <code class="docutils literal"><span class="pre">result()</span></code> which represents a class to -instantiate for each result object (note: this class must be loaded)</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SELECT * FROM users;"</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result</span><span class="p">(</span><span class="s1">'User'</span><span class="p">)</span> <span class="k">as</span> <span class="nv">$user</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$user</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> <span class="c1">// access attributes</span> - <span class="k">echo</span> <span class="nv">$user</span><span class="o">-></span><span class="na">reverse_name</span><span class="p">();</span> <span class="c1">// or methods defined on the 'User' class</span> -<span class="p">}</span> -</pre></div> -</div> -<p><strong>result_array()</strong></p> -<p>This method returns the query result as a pure array, or an empty -array when no result is produced. Typically you’ll use this in a foreach -loop, like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result_array</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'title'</span><span class="p">];</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'name'</span><span class="p">];</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'body'</span><span class="p">];</span> -<span class="p">}</span> -</pre></div> -</div> -</div> -<div class="section" id="result-rows"> -<h2><a class="toc-backref" href="#id2">Result Rows</a><a class="headerlink" href="#result-rows" title="Permalink to this headline">¶</a></h2> -<p><strong>row()</strong></p> -<p>This method returns a single result row. If your query has more than -one row, it returns only the first row. The result is returned as an -<strong>object</strong>. Here’s a usage example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> - -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">row</span><span class="p">();</span> - -<span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$row</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">title</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">body</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p>If you want a specific row returned you can submit the row number as a -digit in the first parameter:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">row</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span> -</pre></div> -</div> -<p>You can also add a second String parameter, which is the name of a class -to instantiate the row with:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SELECT * FROM users LIMIT 1;"</span><span class="p">);</span> -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">row</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">'User'</span><span class="p">);</span> - -<span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> <span class="c1">// access attributes</span> -<span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">reverse_name</span><span class="p">();</span> <span class="c1">// or methods defined on the 'User' class</span> -</pre></div> -</div> -<p><strong>row_array()</strong></p> -<p>Identical to the above <code class="docutils literal"><span class="pre">row()</span></code> method, except it returns an array. -Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> - -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">row_array</span><span class="p">();</span> - -<span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$row</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'title'</span><span class="p">];</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'name'</span><span class="p">];</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="p">[</span><span class="s1">'body'</span><span class="p">];</span> -<span class="p">}</span> -</pre></div> -</div> -<p>If you want a specific row returned you can submit the row number as a -digit in the first parameter:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">row_array</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span> -</pre></div> -</div> -<p>In addition, you can walk forward/backwards/first/last through your -results using these variations:</p> -<blockquote> -<div><div class="line-block"> -<div class="line"><strong>$row = $query->first_row()</strong></div> -<div class="line"><strong>$row = $query->last_row()</strong></div> -<div class="line"><strong>$row = $query->next_row()</strong></div> -<div class="line"><strong>$row = $query->previous_row()</strong></div> -</div> -</div></blockquote> -<p>By default they return an object unless you put the word “array” in the -parameter:</p> -<blockquote> -<div><div class="line-block"> -<div class="line"><strong>$row = $query->first_row(‘array’)</strong></div> -<div class="line"><strong>$row = $query->last_row(‘array’)</strong></div> -<div class="line"><strong>$row = $query->next_row(‘array’)</strong></div> -<div class="line"><strong>$row = $query->previous_row(‘array’)</strong></div> -</div> -</div></blockquote> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">All the methods above will load the whole result into memory -(prefetching). Use <code class="docutils literal"><span class="pre">unbuffered_row()</span></code> for processing large -result sets.</p> -</div> -<p><strong>unbuffered_row()</strong></p> -<p>This method returns a single result row without prefetching the whole -result in memory as <code class="docutils literal"><span class="pre">row()</span></code> does. If your query has more than one row, -it returns the current row and moves the internal data pointer ahead.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> - -<span class="k">while</span> <span class="p">(</span><span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">unbuffered_row</span><span class="p">())</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">title</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">body</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<p>You can optionally pass ‘object’ (default) or ‘array’ in order to specify -the returned value’s type:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span><span class="o">-></span><span class="na">unbuffered_row</span><span class="p">();</span> <span class="c1">// object</span> -<span class="nv">$query</span><span class="o">-></span><span class="na">unbuffered_row</span><span class="p">(</span><span class="s1">'object'</span><span class="p">);</span> <span class="c1">// object</span> -<span class="nv">$query</span><span class="o">-></span><span class="na">unbuffered_row</span><span class="p">(</span><span class="s1">'array'</span><span class="p">);</span> <span class="c1">// associative array</span> -</pre></div> -</div> -</div> -<div class="section" id="custom-result-objects"> -<h2><a class="toc-backref" href="#id3">Custom Result Objects</a><a class="headerlink" href="#custom-result-objects" title="Permalink to this headline">¶</a></h2> -<p>You can have the results returned as an instance of a custom class instead -of a <code class="docutils literal"><span class="pre">stdClass</span></code> or array, as the <code class="docutils literal"><span class="pre">result()</span></code> and <code class="docutils literal"><span class="pre">result_array()</span></code> -methods allow. This requires that the class is already loaded into memory. -The object will have all values returned from the database set as properties. -If these have been declared and are non-public then you should provide a -<code class="docutils literal"><span class="pre">__set()</span></code> method to allow them to be set.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">User</span> <span class="p">{</span> - - <span class="k">public</span> <span class="nv">$id</span><span class="p">;</span> - <span class="k">public</span> <span class="nv">$email</span><span class="p">;</span> - <span class="k">public</span> <span class="nv">$username</span><span class="p">;</span> - - <span class="k">protected</span> <span class="nv">$last_login</span><span class="p">;</span> - - <span class="k">public</span> <span class="k">function</span> <span class="nf">last_login</span><span class="p">(</span><span class="nv">$format</span><span class="p">)</span> - <span class="p">{</span> - <span class="k">return</span> <span class="nv">$this</span><span class="o">-></span><span class="na">last_login</span><span class="o">-></span><span class="na">format</span><span class="p">(</span><span class="nv">$format</span><span class="p">);</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="k">function</span> <span class="nf">__set</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$value</span><span class="p">)</span> - <span class="p">{</span> - <span class="k">if</span> <span class="p">(</span><span class="nv">$name</span> <span class="o">===</span> <span class="s1">'last_login'</span><span class="p">)</span> - <span class="p">{</span> - <span class="nv">$this</span><span class="o">-></span><span class="na">last_login</span> <span class="o">=</span> <span class="nx">DateTime</span><span class="o">::</span><span class="na">createFromFormat</span><span class="p">(</span><span class="s1">'U'</span><span class="p">,</span> <span class="nv">$value</span><span class="p">);</span> - <span class="p">}</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="k">function</span> <span class="nf">__get</span><span class="p">(</span><span class="nv">$name</span><span class="p">)</span> - <span class="p">{</span> - <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$this</span><span class="o">-></span><span class="nv">$name</span><span class="p">))</span> - <span class="p">{</span> - <span class="k">return</span> <span class="nv">$this</span><span class="o">-></span><span class="nv">$name</span><span class="p">;</span> - <span class="p">}</span> - <span class="p">}</span> -<span class="p">}</span> -</pre></div> -</div> -<p>In addition to the two methods listed below, the following methods also can -take a class name to return the results as: <code class="docutils literal"><span class="pre">first_row()</span></code>, <code class="docutils literal"><span class="pre">last_row()</span></code>, -<code class="docutils literal"><span class="pre">next_row()</span></code>, and <code class="docutils literal"><span class="pre">previous_row()</span></code>.</p> -<p><strong>custom_result_object()</strong></p> -<p>Returns the entire result set as an array of instances of the class requested. -The only parameter is the name of the class to instantiate.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> - -<span class="nv">$rows</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">custom_result_object</span><span class="p">(</span><span class="s1">'User'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$rows</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">id</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">email</span><span class="p">;</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">last_login</span><span class="p">(</span><span class="s1">'Y-m-d'</span><span class="p">);</span> -<span class="p">}</span> -</pre></div> -</div> -<p><strong>custom_row_object()</strong></p> -<p>Returns a single row from your query results. The first parameter is the row -number of the results. The second parameter is the class name to instantiate.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"YOUR QUERY"</span><span class="p">);</span> - -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">custom_row_object</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">'User'</span><span class="p">);</span> - -<span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$row</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">email</span><span class="p">;</span> <span class="c1">// access attributes</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">last_login</span><span class="p">(</span><span class="s1">'Y-m-d'</span><span class="p">);</span> <span class="c1">// access class methods</span> -<span class="p">}</span> -</pre></div> -</div> -<p>You can also use the <code class="docutils literal"><span class="pre">row()</span></code> method in exactly the same way.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">custom_row_object</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">'User'</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="result-helper-methods"> -<h2><a class="toc-backref" href="#id4">Result Helper Methods</a><a class="headerlink" href="#result-helper-methods" title="Permalink to this headline">¶</a></h2> -<p><strong>num_rows()</strong></p> -<p>The number of rows returned by the query. Note: In this example, $query -is the variable that the query result object is assigned to:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT * FROM my_table'</span><span class="p">);</span> - -<span class="k">echo</span> <span class="nv">$query</span><span class="o">-></span><span class="na">num_rows</span><span class="p">();</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Not all database drivers have a native way of getting the total -number of rows for a result set. When this is the case, all of -the data is prefetched and <code class="docutils literal"><span class="pre">count()</span></code> is manually called on the -resulting array in order to achieve the same result.</p> -</div> -<p><strong>num_fields()</strong></p> -<p>The number of FIELDS (columns) returned by the query. Make sure to call -the method using your query result object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT * FROM my_table'</span><span class="p">);</span> - -<span class="k">echo</span> <span class="nv">$query</span><span class="o">-></span><span class="na">num_fields</span><span class="p">();</span> -</pre></div> -</div> -<p><strong>free_result()</strong></p> -<p>It frees the memory associated with the result and deletes the result -resource ID. Normally PHP frees its memory automatically at the end of -script execution. However, if you are running a lot of queries in a -particular script you might want to free the result after each query -result has been generated in order to cut down on memory consumption.</p> -<p>Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT title FROM my_table'</span><span class="p">);</span> - -<span class="k">foreach</span> <span class="p">(</span><span class="nv">$query</span><span class="o">-></span><span class="na">result</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$row</span><span class="p">)</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">title</span><span class="p">;</span> -<span class="p">}</span> - -<span class="nv">$query</span><span class="o">-></span><span class="na">free_result</span><span class="p">();</span> <span class="c1">// The $query result object will no longer be available</span> - -<span class="nv">$query2</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT name FROM some_table'</span><span class="p">);</span> - -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query2</span><span class="o">-></span><span class="na">row</span><span class="p">();</span> -<span class="k">echo</span> <span class="nv">$row</span><span class="o">-></span><span class="na">name</span><span class="p">;</span> -<span class="nv">$query2</span><span class="o">-></span><span class="na">free_result</span><span class="p">();</span> <span class="c1">// The $query2 result object will no longer be available</span> -</pre></div> -</div> -<p><strong>data_seek()</strong></p> -<p>This method sets the internal pointer for the next result row to be -fetched. It is only useful in combination with <code class="docutils literal"><span class="pre">unbuffered_row()</span></code>.</p> -<p>It accepts a positive integer value, which defaults to 0 and returns -TRUE on success or FALSE on failure.</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'SELECT `field_name` FROM `table_name`'</span><span class="p">);</span> -<span class="nv">$query</span><span class="o">-></span><span class="na">data_seek</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span> <span class="c1">// Skip the first 5 rows</span> -<span class="nv">$row</span> <span class="o">=</span> <span class="nv">$query</span><span class="o">-></span><span class="na">unbuffered_row</span><span class="p">();</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Not all database drivers support this feature and will return FALSE. -Most notably - you won’t be able to use it with PDO.</p> -</div> -</div> -<div class="section" id="class-reference"> -<h2><a class="toc-backref" href="#id5">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline">¶</a></h2> -<dl class="class"> -<dt id="CI_DB_result"> -<em class="property">class </em><code class="descname">CI_DB_result</code><a class="headerlink" href="#CI_DB_result" title="Permalink to this definition">¶</a></dt> -<dd><dl class="method"> -<dt id="CI_DB_result::result"> -<code class="descname">result</code><span class="sig-paren">(</span><span class="optional">[</span><em>$type = 'object'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::result" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$type</strong> (<em>string</em>) – Type of requested results - array, object, or class name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Array containing the fetched rows</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>A wrapper for the <code class="docutils literal"><span class="pre">result_array()</span></code>, <code class="docutils literal"><span class="pre">result_object()</span></code> -and <code class="docutils literal"><span class="pre">custom_result_object()</span></code> methods.</p> -<p>Usage: see <a class="reference internal" href="#result-arrays">Result Arrays</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::result_array"> -<code class="descname">result_array</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::result_array" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array containing the fetched rows</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td> -</tr> -</tbody> -</table> -<p>Returns the query results as an array of rows, where each -row is itself an associative array.</p> -<p>Usage: see <a class="reference internal" href="#result-arrays">Result Arrays</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::result_object"> -<code class="descname">result_object</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::result_object" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array containing the fetched rows</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td> -</tr> -</tbody> -</table> -<p>Returns the query results as an array of rows, where each -row is an object of type <code class="docutils literal"><span class="pre">stdClass</span></code>.</p> -<p>Usage: see <a class="reference internal" href="#result-arrays">Result Arrays</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::custom_result_object"> -<code class="descname">custom_result_object</code><span class="sig-paren">(</span><em>$class_name</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::custom_result_object" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$class_name</strong> (<em>string</em>) – Class name for the resulting rows</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Array containing the fetched rows</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the query results as an array of rows, where each -row is an instance of the specified class.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::row"> -<code class="descname">row</code><span class="sig-paren">(</span><span class="optional">[</span><em>$n = 0</em><span class="optional">[</span>, <em>$type = 'object'</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::row" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$n</strong> (<em>int</em>) – Index of the query results row to be returned</li> -<li><strong>$type</strong> (<em>string</em>) – Type of the requested result - array, object, or class name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The requested row or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>A wrapper for the <code class="docutils literal"><span class="pre">row_array()</span></code>, <code class="docutils literal"><span class="pre">row_object()</span> <span class="pre">and</span> -<span class="pre">``custom_row_object()</span></code> methods.</p> -<p>Usage: see <a class="reference internal" href="#result-rows">Result Rows</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::unbuffered_row"> -<code class="descname">unbuffered_row</code><span class="sig-paren">(</span><span class="optional">[</span><em>$type = 'object'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::unbuffered_row" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$type</strong> (<em>string</em>) – Type of the requested result - array, object, or class name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Next row from the result set or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Fetches the next result row and returns it in the -requested form.</p> -<p>Usage: see <a class="reference internal" href="#result-rows">Result Rows</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::row_array"> -<code class="descname">row_array</code><span class="sig-paren">(</span><span class="optional">[</span><em>$n = 0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::row_array" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$n</strong> (<em>int</em>) – Index of the query results row to be returned</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The requested row or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the requested result row as an associative array.</p> -<p>Usage: see <a class="reference internal" href="#result-rows">Result Rows</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::row_object"> -<code class="descname">row_object</code><span class="sig-paren">(</span><span class="optional">[</span><em>$n = 0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::row_object" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$n</strong> (<em>int</em>) – Index of the query results row to be returned</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The requested row or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">stdClass</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the requested result row as an object of type -<code class="docutils literal"><span class="pre">stdClass</span></code>.</p> -<p>Usage: see <a class="reference internal" href="#result-rows">Result Rows</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::custom_row_object"> -<code class="descname">custom_row_object</code><span class="sig-paren">(</span><em>$n</em>, <em>$type</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::custom_row_object" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$n</strong> (<em>int</em>) – Index of the results row to return</li> -<li><strong>$class_name</strong> (<em>string</em>) – Class name for the resulting row</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The requested row or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">$type</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the requested result row as an instance of the -requested class.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::data_seek"> -<code class="descname">data_seek</code><span class="sig-paren">(</span><span class="optional">[</span><em>$n = 0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::data_seek" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$n</strong> (<em>int</em>) – Index of the results row to be returned next</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Moves the internal results row pointer to the desired offset.</p> -<p>Usage: see <a class="reference internal" href="#result-helper-methods">Result Helper Methods</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::set_row"> -<code class="descname">set_row</code><span class="sig-paren">(</span><em>$key</em><span class="optional">[</span>, <em>$value = NULL</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::set_row" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$key</strong> (<em>mixed</em>) – Column name or array of key/value pairs</li> -<li><strong>$value</strong> (<em>mixed</em>) – Value to assign to the column, $key is a single field name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p> -</td> -</tr> -</tbody> -</table> -<p>Assigns a value to a particular column.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::next_row"> -<code class="descname">next_row</code><span class="sig-paren">(</span><span class="optional">[</span><em>$type = 'object'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::next_row" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$type</strong> (<em>string</em>) – Type of the requested result - array, object, or class name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Next row of result set, or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the next row from the result set.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::previous_row"> -<code class="descname">previous_row</code><span class="sig-paren">(</span><span class="optional">[</span><em>$type = 'object'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::previous_row" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$type</strong> (<em>string</em>) – Type of the requested result - array, object, or class name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Previous row of result set, or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the previous row from the result set.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::first_row"> -<code class="descname">first_row</code><span class="sig-paren">(</span><span class="optional">[</span><em>$type = 'object'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::first_row" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$type</strong> (<em>string</em>) – Type of the requested result - array, object, or class name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">First row of result set, or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the first row from the result set.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::last_row"> -<code class="descname">last_row</code><span class="sig-paren">(</span><span class="optional">[</span><em>$type = 'object'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::last_row" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$type</strong> (<em>string</em>) – Type of the requested result - array, object, or class name</li> -</ul> -</td> -</tr> -<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Last row of result set, or NULL if it doesn’t exist</p> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mixed</p> -</td> -</tr> -</tbody> -</table> -<p>Returns the last row from the result set.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::num_rows"> -<code class="descname">num_rows</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::num_rows" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Number of rows in the result set</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td> -</tr> -</tbody> -</table> -<p>Returns the number of rows in the result set.</p> -<p>Usage: see <a class="reference internal" href="#result-helper-methods">Result Helper Methods</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::num_fields"> -<code class="descname">num_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::num_fields" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Number of fields in the result set</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td> -</tr> -</tbody> -</table> -<p>Returns the number of fields in the result set.</p> -<p>Usage: see <a class="reference internal" href="#result-helper-methods">Result Helper Methods</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::field_data"> -<code class="descname">field_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::field_data" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array containing field meta-data</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td> -</tr> -</tbody> -</table> -<p>Generates an array of <code class="docutils literal"><span class="pre">stdClass</span></code> objects containing -field meta-data.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::free_result"> -<code class="descname">free_result</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::free_result" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">void</td> -</tr> -</tbody> -</table> -<p>Frees a result set.</p> -<p>Usage: see <a class="reference internal" href="#result-helper-methods">Result Helper Methods</a>.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_result::list_fields"> -<code class="descname">list_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_DB_result::list_fields" title="Permalink to this definition">¶</a></dt> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array of column names</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td> -</tr> -</tbody> -</table> -<p>Returns an array containing the field names in the -result set.</p> -</dd></dl> - -</dd></dl> - -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="helpers.html" class="btn btn-neutral float-right" title="Query Helper Methods">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="queries.html" class="btn btn-neutral" title="Queries"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/transactions.html b/user_guide/database/transactions.html deleted file mode 100644 index bb8fc401c..000000000 --- a/user_guide/database/transactions.html +++ /dev/null @@ -1,615 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Transactions — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="Database Metadata" href="metadata.html"/> - <link rel="prev" title="Query Builder Class" href="query_builder.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <img src="data:image/jpeg;base64,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" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2"><a class="reference internal" href="utilities.html">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Transactions</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="transactions"> -<h1>Transactions<a class="headerlink" href="#transactions" title="Permalink to this headline">¶</a></h1> -<p>CodeIgniter’s database abstraction allows you to use transactions with -databases that support transaction-safe table types. In MySQL, you’ll -need to be running InnoDB or BDB table types rather than the more common -MyISAM. Most other database platforms support transactions natively.</p> -<p>If you are not familiar with transactions we recommend you find a good -online resource to learn about them for your particular database. The -information below assumes you have a basic understanding of -transactions.</p> -<div class="section" id="codeigniter-s-approach-to-transactions"> -<h2>CodeIgniter’s Approach to Transactions<a class="headerlink" href="#codeigniter-s-approach-to-transactions" title="Permalink to this headline">¶</a></h2> -<p>CodeIgniter utilizes an approach to transactions that is very similar to -the process used by the popular database class ADODB. We’ve chosen that -approach because it greatly simplifies the process of running -transactions. In most cases all that is required are two lines of code.</p> -<p>Traditionally, transactions have required a fair amount of work to -implement since they demand that you keep track of your queries and -determine whether to commit or rollback based on the success or failure -of your queries. This is particularly cumbersome with nested queries. In -contrast, we’ve implemented a smart transaction system that does all -this for you automatically (you can also manage your transactions -manually if you choose to, but there’s really no benefit).</p> -</div> -<div class="section" id="running-transactions"> -<h2>Running Transactions<a class="headerlink" href="#running-transactions" title="Permalink to this headline">¶</a></h2> -<p>To run your queries using transactions you will use the -$this->db->trans_start() and $this->db->trans_complete() functions as -follows:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_start</span><span class="p">();</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'AN SQL QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'ANOTHER QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'AND YET ANOTHER QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_complete</span><span class="p">();</span> -</pre></div> -</div> -<p>You can run as many queries as you want between the start/complete -functions and they will all be committed or rolled back based on success -or failure of any given query.</p> -</div> -<div class="section" id="strict-mode"> -<h2>Strict Mode<a class="headerlink" href="#strict-mode" title="Permalink to this headline">¶</a></h2> -<p>By default CodeIgniter runs all transactions in Strict Mode. When strict -mode is enabled, if you are running multiple groups of transactions, if -one group fails all groups will be rolled back. If strict mode is -disabled, each group is treated independently, meaning a failure of one -group will not affect any others.</p> -<p>Strict Mode can be disabled as follows:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_strict</span><span class="p">(</span><span class="k">FALSE</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="managing-errors"> -<h2>Managing Errors<a class="headerlink" href="#managing-errors" title="Permalink to this headline">¶</a></h2> -<p>If you have error reporting enabled in your config/database.php file -you’ll see a standard error message if the commit was unsuccessful. If -debugging is turned off, you can manage your own errors like this:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_start</span><span class="p">();</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'AN SQL QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'ANOTHER QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_complete</span><span class="p">();</span> - -<span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_status</span><span class="p">()</span> <span class="o">===</span> <span class="k">FALSE</span><span class="p">)</span> -<span class="p">{</span> - <span class="c1">// generate an error... or use the log_message() function to log your error</span> -<span class="p">}</span> -</pre></div> -</div> -</div> -<div class="section" id="disabling-transactions"> -<h2>Disabling Transactions<a class="headerlink" href="#disabling-transactions" title="Permalink to this headline">¶</a></h2> -<p>If you would like to disable transactions you can do so using -<code class="docutils literal"><span class="pre">$this->db->trans_off()</span></code>:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_off</span><span class="p">();</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_start</span><span class="p">();</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'AN SQL QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_complete</span><span class="p">();</span> -</pre></div> -</div> -<p>When transactions are disabled, your queries will be auto-committed, just as -they are when running queries without transactions, practically ignoring -any calls to <code class="docutils literal"><span class="pre">trans_start()</span></code>, <code class="docutils literal"><span class="pre">trans_complete()</span></code>, etc.</p> -</div> -<div class="section" id="test-mode"> -<h2>Test Mode<a class="headerlink" href="#test-mode" title="Permalink to this headline">¶</a></h2> -<p>You can optionally put the transaction system into “test mode”, which -will cause your queries to be rolled back – even if the queries produce -a valid result. To use test mode simply set the first parameter in the -$this->db->trans_start() function to TRUE:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_start</span><span class="p">(</span><span class="k">TRUE</span><span class="p">);</span> <span class="c1">// Query will be rolled back</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'AN SQL QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_complete</span><span class="p">();</span> -</pre></div> -</div> -</div> -<div class="section" id="running-transactions-manually"> -<h2>Running Transactions Manually<a class="headerlink" href="#running-transactions-manually" title="Permalink to this headline">¶</a></h2> -<p>If you would like to run transactions manually you can do so as follows:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_begin</span><span class="p">();</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'AN SQL QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'ANOTHER QUERY...'</span><span class="p">);</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s1">'AND YET ANOTHER QUERY...'</span><span class="p">);</span> - -<span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_status</span><span class="p">()</span> <span class="o">===</span> <span class="k">FALSE</span><span class="p">)</span> -<span class="p">{</span> - <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_rollback</span><span class="p">();</span> -<span class="p">}</span> -<span class="k">else</span> -<span class="p">{</span> - <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">trans_commit</span><span class="p">();</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Make sure to use $this->db->trans_begin() when running manual -transactions, <strong>NOT</strong> $this->db->trans_start().</p> -</div> -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <a href="metadata.html" class="btn btn-neutral float-right" title="Database Metadata">Next <span class="fa fa-arrow-circle-right"></span></a> - - - <a href="query_builder.html" class="btn btn-neutral" title="Query Builder Class"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html deleted file mode 100644 index 9a26b0690..000000000 --- a/user_guide/database/utilities.html +++ /dev/null @@ -1,993 +0,0 @@ - - -<!DOCTYPE html> -<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - - <title>Database Utility Class — CodeIgniter 3.1.9 documentation</title> - - - - - <link rel="shortcut icon" href="../_static/ci-icon.ico"/> - - - - <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'> - - - - - - - - - - <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" /> - - - - <link rel="index" title="Index" - href="../genindex.html"/> - <link rel="search" title="Search" href="../search.html"/> - <link rel="top" title="CodeIgniter 3.1.9 documentation" href="../index.html"/> - <link rel="up" title="Database Reference" href="index.html"/> - <link rel="next" title="DB Driver Reference" href="db_driver_reference.html"/> - <link rel="prev" title="Database Forge Class" href="forge.html"/> - - - <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> - -</head> - -<body class="wy-body-for-nav" role="document"> - - <div id="nav"> - <div id="nav_inner"> - - - - <div id="pulldown-menu" class="ciNav"> - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - </div> - - - </div> -</div> -<div id="nav2"> - <a href="#" id="openToc"> - <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" /> - </a> -</div> - - <div class="wy-grid-for-nav"> - - - <nav data-toggle="wy-nav-shift" class="wy-nav-side"> - <div class="wy-side-nav-search"> - - <a href="../index.html" class="fa fa-home"> CodeIgniter</a> - - -<div role="search"> - <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> - <input type="text" name="q" placeholder="Search docs" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> - </div> - - <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> - - - - <ul> -<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li> -<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li> -<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li> -<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li> -<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li> -<li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li> -</ul> -</li> -</ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Database Reference</a><ul class="current"> -<li class="toctree-l2"><a class="reference internal" href="examples.html">Quick Start: Usage Examples</a></li> -<li class="toctree-l2"><a class="reference internal" href="configuration.html">Database Configuration</a></li> -<li class="toctree-l2"><a class="reference internal" href="connecting.html">Connecting to a Database</a></li> -<li class="toctree-l2"><a class="reference internal" href="queries.html">Running Queries</a></li> -<li class="toctree-l2"><a class="reference internal" href="results.html">Generating Query Results</a></li> -<li class="toctree-l2"><a class="reference internal" href="helpers.html">Query Helper Functions</a></li> -<li class="toctree-l2"><a class="reference internal" href="query_builder.html">Query Builder Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li> -<li class="toctree-l2"><a class="reference internal" href="metadata.html">Getting MetaData</a></li> -<li class="toctree-l2"><a class="reference internal" href="call_function.html">Custom Function Calls</a></li> -<li class="toctree-l2"><a class="reference internal" href="caching.html">Query Caching</a></li> -<li class="toctree-l2"><a class="reference internal" href="forge.html">Database Manipulation with Database Forge</a></li> -<li class="toctree-l2 current"><a class="current reference internal" href="#">Database Utilities Class</a></li> -<li class="toctree-l2"><a class="reference internal" href="db_driver_reference.html">Database Driver Reference</a></li> -</ul> -</li> -</ul> -<ul> -<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li> -<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li> -</ul> -</li> -</ul> - - - - </div> - - </nav> - - <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> - - - <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> - <i data-toggle="wy-nav-top" class="fa fa-bars"></i> - <a href="../index.html">CodeIgniter</a> - </nav> - - - - <div class="wy-nav-content"> - <div class="rst-content"> - <div role="navigation" aria-label="breadcrumbs navigation"> - <ul class="wy-breadcrumbs"> - <li><a href="../index.html">Docs</a> »</li> - - <li><a href="index.html">Database Reference</a> »</li> - - <li>Database Utility Class</li> - <li class="wy-breadcrumbs-aside"> - - </li> - <div style="float:right;margin-left:5px;" id="closeMe"> - <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> - </div> - </ul> - <hr/> -</div> - <div role="main" class="document"> - - <div class="section" id="database-utility-class"> -<h1>Database Utility Class<a class="headerlink" href="#database-utility-class" title="Permalink to this headline">¶</a></h1> -<p>The Database Utility Class contains methods that help you manage your -database.</p> -<div class="contents local topic" id="contents"> -<ul class="simple"> -<li><a class="reference internal" href="#initializing-the-utility-class" id="id1">Initializing the Utility Class</a></li> -<li><a class="reference internal" href="#using-the-database-utilities" id="id2">Using the Database Utilities</a><ul> -<li><a class="reference internal" href="#retrieve-list-of-database-names" id="id3">Retrieve list of database names</a></li> -<li><a class="reference internal" href="#determine-if-a-database-exists" id="id4">Determine If a Database Exists</a></li> -<li><a class="reference internal" href="#optimize-a-table" id="id5">Optimize a Table</a></li> -<li><a class="reference internal" href="#repair-a-table" id="id6">Repair a Table</a></li> -<li><a class="reference internal" href="#optimize-a-database" id="id7">Optimize a Database</a></li> -<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> -<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> -</ul> -</li> -<li><a class="reference internal" href="#backup-your-database" id="id10">Backup Your Database</a><ul> -<li><a class="reference internal" href="#database-backup-notes" id="id11">Database Backup Notes</a></li> -<li><a class="reference internal" href="#usage-example" id="id12">Usage Example</a></li> -<li><a class="reference internal" href="#setting-backup-preferences" id="id13">Setting Backup Preferences</a></li> -<li><a class="reference internal" href="#description-of-backup-preferences" id="id14">Description of Backup Preferences</a></li> -</ul> -</li> -<li><a class="reference internal" href="#class-reference" id="id15">Class Reference</a></li> -</ul> -</div> -<div class="section" id="initializing-the-utility-class"> -<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> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">In order to initialize the Utility class, your database -driver must already be running, since the utilities class relies on it.</p> -</div> -<p>Load the Utility Class as follows:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">dbutil</span><span class="p">();</span> -</pre></div> -</div> -<p>You can also pass another database object to the DB Utility loader, in case -the database you want to manage isn’t the default one:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">myutil</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">dbutil</span><span class="p">(</span><span class="nv">$this</span><span class="o">-></span><span class="na">other_db</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span> -</pre></div> -</div> -<p>In the above example, we’re passing a custom database object as the first -parameter and then tell it to return the dbutil object, instead of -assigning it directly to <code class="docutils literal"><span class="pre">$this->dbutil</span></code>.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Both of the parameters can be used individually, just pass an empty -value as the first one if you wish to skip it.</p> -</div> -<p>Once initialized you will access the methods using the <code class="docutils literal"><span class="pre">$this->dbutil</span></code> -object:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">some_method</span><span class="p">();</span> -</pre></div> -</div> -</div> -<div class="section" id="using-the-database-utilities"> -<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> -<div class="section" id="retrieve-list-of-database-names"> -<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> -<p>Returns an array of database names:</p> -<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">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">list_databases</span><span class="p">();</span> - -<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> -<span class="p">{</span> - <span class="k">echo</span> <span class="nv">$db</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -</div> -<div class="section" id="determine-if-a-database-exists"> -<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> -<p>Sometimes it’s helpful to know whether a particular database exists. -Returns a boolean TRUE/FALSE. Usage example:</p> -<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">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">database_exists</span><span class="p">(</span><span class="s1">'database_name'</span><span class="p">))</span> -<span class="p">{</span> - <span class="c1">// some code...</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Replace <em>database_name</em> with the name of the database you are -looking for. This method is case sensitive.</p> -</div> -</div> -<div class="section" id="optimize-a-table"> -<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> -<p>Permits you to optimize a table using the table name specified in the -first parameter. Returns TRUE/FALSE based on success or failure:</p> -<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">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">optimize_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="s1">'Success!'</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Not all database platforms support table optimization. It is -mostly for use with MySQL.</p> -</div> -</div> -<div class="section" id="repair-a-table"> -<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> -<p>Permits you to repair a table using the table name specified in the -first parameter. Returns TRUE/FALSE based on success or failure:</p> -<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">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">repair_table</span><span class="p">(</span><span class="s1">'table_name'</span><span class="p">))</span> -<span class="p">{</span> - <span class="k">echo</span> <span class="s1">'Success!'</span><span class="p">;</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Not all database platforms support table repairs.</p> -</div> -</div> -<div class="section" id="optimize-a-database"> -<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> -<p>Permits you to optimize the database your DB class is currently -connected to. Returns an array containing the DB status messages or -FALSE on failure.</p> -<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">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">optimize_database</span><span class="p">();</span> - -<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> -<span class="p">{</span> - <span class="nb">print_r</span><span class="p">(</span><span class="nv">$result</span><span class="p">);</span> -<span class="p">}</span> -</pre></div> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Not all database platforms support database optimization. It -it is mostly for use with MySQL.</p> -</div> -</div> -<div class="section" id="export-a-query-result-as-a-csv-file"> -<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> -<p>Permits you to generate a CSV file from a query result. The first -parameter of the method must contain the result object from your -query. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">dbutil</span><span class="p">();</span> - -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SELECT * FROM mytable"</span><span class="p">);</span> - -<span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">csv_from_result</span><span class="p">(</span><span class="nv">$query</span><span class="p">);</span> -</pre></div> -</div> -<p>The second, third, and fourth parameters allow you to set the delimiter -newline, and enclosure characters respectively. By default commas are -used as the delimiter, “n” is used as a new line, and a double-quote -is used as the enclosure. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$delimiter</span> <span class="o">=</span> <span class="s2">","</span><span class="p">;</span> -<span class="nv">$newline</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\r\n</span><span class="s2">"</span><span class="p">;</span> -<span class="nv">$enclosure</span> <span class="o">=</span> <span class="s1">'"'</span><span class="p">;</span> - -<span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">dbutil</span><span class="o">-></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> -</pre></div> -</div> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">This method will NOT write the CSV file for you. It -simply creates the CSV layout. If you need to write the file -use the <a class="reference internal" href="../helpers/file_helper.html"><span class="doc">File Helper</span></a>.</p> -</div> -</div> -<div class="section" id="export-a-query-result-as-an-xml-document"> -<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> -<p>Permits you to generate an XML file from a query result. The first -parameter expects a query result object, the second may contain an -optional array of config parameters. Example:</p> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">dbutil</span><span class="p">();</span> - -<span class="nv">$query</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">db</span><span class="o">-></span><span class="na">query</span><span class="p">(</span><span class="s2">"SELECT * FROM mytable"</span><span class="p">);</span> - -<span class="nv">$config</span> <span class="o">=</span> <span class="k">array</span> <span class="p">(</span> - <span class="s1">'root'</span> <span class="o">=></span> <span class="s1">'root'</span><span class="p">,</span> - <span class="s1">'element'</span> <span class="o">=></span> <span class="s1">'element'</span><span class="p">,</span> - <span class="s1">'newline'</span> <span class="o">=></span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> - <span class="s1">'tab'</span> <span class="o">=></span> <span class="s2">"</span><span class="se">\t</span><span class="s2">"</span> -<span class="p">);</span> - -<span class="k">echo</span> <span class="nv">$this</span><span class="o">-></span><span class="na">dbutil</span><span class="o">-></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> -</pre></div> -</div> -<div class="admonition important"> -<p class="first admonition-title">Important</p> -<p class="last">This method will NOT write the XML file for you. It -simply creates the XML layout. If you need to write the file -use the <a class="reference internal" href="../helpers/file_helper.html"><span class="doc">File Helper</span></a>.</p> -</div> -</div> -</div> -<div class="section" id="backup-your-database"> -<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> -<div class="section" id="database-backup-notes"> -<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> -<p>Permits you to backup your full database or individual tables. The -backup data can be compressed in either Zip or Gzip format.</p> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">This feature is only available for MySQL and Interbase/Firebird databases.</p> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p>For Interbase/Firebird databases, the backup file name is the only parameter.</p> -<p class="last">$this->dbutil->backup(‘db_backup_filename’);</p> -</div> -<div class="admonition note"> -<p class="first admonition-title">Note</p> -<p class="last">Due to the limited execution time and memory available to PHP, -backing up very large databases may not be possible. If your database is -very large you might need to backup directly from your SQL server via -the command line, or have your server admin do it for you if you do not -have root privileges.</p> -</div> -</div> -<div class="section" id="usage-example"> -<h3><a class="toc-backref" href="#id12">Usage Example</a><a class="headerlink" href="#usage-example" title="Permalink to this headline">¶</a></h3> -<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// Load the DB utility class</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">dbutil</span><span class="p">();</span> - -<span class="c1">// Backup your entire database and assign it to a variable</span> -<span class="nv">$backup</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">backup</span><span class="p">();</span> - -<span class="c1">// Load the file helper and write the file to your server</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">helper</span><span class="p">(</span><span class="s1">'file'</span><span class="p">);</span> -<span class="nx">write_file</span><span class="p">(</span><span class="s1">'/path/to/mybackup.gz'</span><span class="p">,</span> <span class="nv">$backup</span><span class="p">);</span> - -<span class="c1">// Load the download helper and send the file to your desktop</span> -<span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">helper</span><span class="p">(</span><span class="s1">'download'</span><span class="p">);</span> -<span class="nx">force_download</span><span class="p">(</span><span class="s1">'mybackup.gz'</span><span class="p">,</span> <span class="nv">$backup</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="setting-backup-preferences"> -<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> -<p>Backup preferences are set by submitting an array of values to the first -parameter of the <code class="docutils literal"><span class="pre">backup()</span></code> method. Example:</p> -<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> - <span class="s1">'tables'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(</span><span class="s1">'table1'</span><span class="p">,</span> <span class="s1">'table2'</span><span class="p">),</span> <span class="c1">// Array of tables to backup.</span> - <span class="s1">'ignore'</span> <span class="o">=></span> <span class="k">array</span><span class="p">(),</span> <span class="c1">// List of tables to omit from the backup</span> - <span class="s1">'format'</span> <span class="o">=></span> <span class="s1">'txt'</span><span class="p">,</span> <span class="c1">// gzip, zip, txt</span> - <span class="s1">'filename'</span> <span class="o">=></span> <span class="s1">'mybackup.sql'</span><span class="p">,</span> <span class="c1">// File name - NEEDED ONLY WITH ZIP FILES</span> - <span class="s1">'add_drop'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> <span class="c1">// Whether to add DROP TABLE statements to backup file</span> - <span class="s1">'add_insert'</span> <span class="o">=></span> <span class="k">TRUE</span><span class="p">,</span> <span class="c1">// Whether to add INSERT data to backup file</span> - <span class="s1">'newline'</span> <span class="o">=></span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="c1">// Newline character used in backup file</span> -<span class="p">);</span> - -<span class="nv">$this</span><span class="o">-></span><span class="na">dbutil</span><span class="o">-></span><span class="na">backup</span><span class="p">(</span><span class="nv">$prefs</span><span class="p">);</span> -</pre></div> -</div> -</div> -<div class="section" id="description-of-backup-preferences"> -<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> -<table border="1" class="docutils"> -<colgroup> -<col width="16%" /> -<col width="16%" /> -<col width="16%" /> -<col width="51%" /> -</colgroup> -<thead valign="bottom"> -<tr class="row-odd"><th class="head">Preference</th> -<th class="head">Default Value</th> -<th class="head">Options</th> -<th class="head">Description</th> -</tr> -</thead> -<tbody valign="top"> -<tr class="row-even"><td><strong>tables</strong></td> -<td>empty array</td> -<td>None</td> -<td>An array of tables you want backed up. If left blank all tables will be -exported.</td> -</tr> -<tr class="row-odd"><td><strong>ignore</strong></td> -<td>empty array</td> -<td>None</td> -<td>An array of tables you want the backup routine to ignore.</td> -</tr> -<tr class="row-even"><td><strong>format</strong></td> -<td>gzip</td> -<td>gzip, zip, txt</td> -<td>The file format of the export file.</td> -</tr> -<tr class="row-odd"><td><strong>filename</strong></td> -<td>the current date/time</td> -<td>None</td> -<td>The name of the backed-up file. The name is needed only if you are using -zip compression.</td> -</tr> -<tr class="row-even"><td><strong>add_drop</strong></td> -<td>TRUE</td> -<td>TRUE/FALSE</td> -<td>Whether to include DROP TABLE statements in your SQL export file.</td> -</tr> -<tr class="row-odd"><td><strong>add_insert</strong></td> -<td>TRUE</td> -<td>TRUE/FALSE</td> -<td>Whether to include INSERT statements in your SQL export file.</td> -</tr> -<tr class="row-even"><td><strong>newline</strong></td> -<td>“\n”</td> -<td>“\n”, “\r”, “\r\n”</td> -<td>Type of newline to use in your SQL export file.</td> -</tr> -<tr class="row-odd"><td><strong>foreign_key_checks</strong></td> -<td>TRUE</td> -<td>TRUE/FALSE</td> -<td>Whether output should keep foreign key checks enabled.</td> -</tr> -</tbody> -</table> -</div> -</div> -<div class="section" id="class-reference"> -<h2><a class="toc-backref" href="#id15">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline">¶</a></h2> -<dl class="class"> -<dt id="CI_DB_utility"> -<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> -<dd><dl class="method"> -<dt id="CI_DB_utility::backup"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$params</strong> (<em>array</em>) – An associative array of options</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Perform a database backup, per user preferences.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_utility::database_exists"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$database_name</strong> (<em>string</em>) – Database name</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p> -</td> -</tr> -</tbody> -</table> -<p>Check for the existence of a database.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_utility::list_databases"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array of database names found</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td> -</tr> -</tbody> -</table> -<p>Retrieve a list of all the database names.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_utility::optimize_database"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Array of optimization messages or FALSE on failure</td> -</tr> -<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td> -</tr> -</tbody> -</table> -<p>Optimizes the database.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_utility::optimize_table"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table_name</strong> (<em>string</em>) – Name of the table to optimize</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>Optimizes a database table.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_utility::repair_table"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$table_name</strong> (<em>string</em>) – Name of the table to repair</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p> -</td> -</tr> -</tbody> -</table> -<p>Repairs a database table.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_utility::csv_from_result"> -<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 = "n"</em><span class="optional">[</span>, <em>$enclosure = '"'</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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$query</strong> (<em>object</em>) – A database result object</li> -<li><strong>$delim</strong> (<em>string</em>) – The CSV field delimiter to use</li> -<li><strong>$newline</strong> (<em>string</em>) – The newline character to use</li> -<li><strong>$enclosure</strong> (<em>string</em>) – The enclosure delimiter to use</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Translates a database result object into a CSV document.</p> -</dd></dl> - -<dl class="method"> -<dt id="CI_DB_utility::xml_from_result"> -<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> -<dd><table class="docutils field-list" frame="void" rules="none"> -<col class="field-name" /> -<col class="field-body" /> -<tbody valign="top"> -<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> -<li><strong>$query</strong> (<em>object</em>) – A database result object</li> -<li><strong>$params</strong> (<em>array</em>) – An associative array of preferences</li> -</ul> -</td> -</tr> -<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> -</td> -</tr> -<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p> -</td> -</tr> -</tbody> -</table> -<p>Translates a database result object into an XML document.</p> -</dd></dl> - -</dd></dl> - -</div> -</div> - - - </div> - <footer> - - <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> - - <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> - - - <a href="forge.html" class="btn btn-neutral" title="Database Forge Class"><span class="fa fa-arrow-circle-left"></span> Previous</a> - - </div> - - - <hr/> - - <div role="contentinfo"> - <p> - © Copyright 2014 - 2018, British Columbia Institute of Technology. - Last updated on Jun 12, 2018. - </p> - </div> - - 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>. - -</footer> - </div> - </div> - - </section> - - </div> - - - - - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT:'../', - VERSION:'3.1.9', - COLLAPSE_INDEX:false, - FILE_SUFFIX:'.html', - HAS_SOURCE: false - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - - - - - - <script type="text/javascript" src="../_static/js/theme.js"></script> - - - - - <script type="text/javascript"> - jQuery(function () { - SphinxRtdTheme.StickyNav.enable(); - }); - </script> - - -</body> -</html>
\ No newline at end of file |