diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index 26b7515bab12..86155dea0803 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -29,13 +29,13 @@ prototype: The name of the class property is the connection name, and can be used while connecting to specify a group name. -.. note:: The default location of the SQLite3 database is in the **writable** folder. - If you want to change the location, you must set the full path to the new folder. +.. note:: The default location of the SQLite3 database is the **writable** folder. + If you want to change the location, you must set the full path to the new folder (e.g., 'database' => WRITEPATH . 'db/database_name.db'). DSN --- -Some database drivers (such as Postgre, OCI8) requires a full DSN string to connect. +Some database drivers (such as Postgre, OCI8) requires a full DSN (Data Source Name) string to connect. But 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. @@ -48,7 +48,7 @@ you're using the driver's underlying native PHP extension, like this: DSN in Universal Manner ^^^^^^^^^^^^^^^^^^^^^^^ -You can also set a Data Source Name in universal manner (URL like). In that case DSNs must have this prototype: +You can also set a DSN in universal manner (URL like). In that case DSNs must have this prototype: .. literalinclude:: configuration/003.php :lines: 11-14 @@ -113,7 +113,7 @@ Configuring with .env File You can also save your configuration values within a **.env** file with the current server's database settings. You only need to enter the values that change from what is in the -default group's configuration settings. The values should be name following this format, where +default group's configuration settings. The values should follow this format, where ``default`` is the group name:: database.default.username = 'root'; @@ -137,11 +137,11 @@ and decode it in the constructor in the Config class: .. _database-config-explanation-of-values: ********************* -Explanation of Values +Description of Values ********************* ================ =========================================================================================================== - Name Config Description + Config Name Description ================ =========================================================================================================== **DSN** The DSN connect string (an all-in-one configuration sequence). **hostname** The hostname of your database server. Often this is 'localhost'. @@ -154,31 +154,31 @@ Explanation of Values **DBDriver** The database driver name. The case must match the driver name. You can set a fully qualified classname to use your custom driver. Supported drivers: ``MySQLi``, ``Postgre``, ``SQLite3``, ``SQLSRV``, and ``OCI8``. -**DBPrefix** An optional table prefix which will added to the table name when running +**DBPrefix** An optional table prefix which will be added to the table name when running :doc:`Query Builder ` queries. This permits multiple CodeIgniter installations to share one database. **pConnect** true/false (boolean) - Whether to use a persistent connection. -**DBDebug** true/false (boolean) - Whether to throw exceptions or not when database errors occur. +**DBDebug** true/false (boolean) - Whether to throw exceptions when database errors occur. **charset** The character set used in communicating with the database. **DBCollat** (``MySQLi`` only) The character collation used in communicating with the database. **swapPre** 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. **schema** (``Postgre`` and ``SQLSRV`` only) The database schema, default value varies by driver. -**encrypt** (``MySQLi`` and ``SQLSRV`` only) Whether or not to use an encrypted connection. +**encrypt** (``MySQLi`` and ``SQLSRV`` only) Whether to use an encrypted connection. See :ref:`MySQLi encrypt ` for ``MySQLi`` settings. ``SQLSRV`` driver accepts true/false. -**compress** (``MySQLi`` only) Whether or not to use client compression. +**compress** (``MySQLi`` only) Whether to use client compression. **strictOn** (``MySQLi`` only) true/false (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application. **port** The database port number - Empty string ``''`` for default port (or dynamic port with ``SQLSRV``). -**foreignKeys** (``SQLite3`` only) true/false (boolean) - Whether or not to enable Foreign Key constraint. +**foreignKeys** (``SQLite3`` only) true/false (boolean) - Whether to enable Foreign Key constraint. .. important:: SQLite3 Foreign Key constraint is disabled by default. See `SQLite documentation `_. To enforce Foreign Key constraint, set this config item to true. **busyTimeout** (``SQLite3`` only) milliseconds (int) - Sleeps for a specified amount of time when a table is locked. -**numberNative** (``MySQLi`` only) true/false (boolean) - Whether or not to enable MYSQLI_OPT_INT_AND_FLOAT_NATIVE. +**numberNative** (``MySQLi`` only) true/false (boolean) - Whether to enable MYSQLI_OPT_INT_AND_FLOAT_NATIVE. **dateFormat** The default date/time formats as PHP's `DateTime format`_. * ``date`` - date format * ``datetime`` - date and time format @@ -225,4 +225,4 @@ MySQLi driver accepts an array with the following options: * ``ssl_ca`` - Path to the certificate authority file * ``ssl_capath`` - Path to a directory containing trusted CA certificates in PEM format * ``ssl_cipher`` - List of *allowed* ciphers to be used for the encryption, separated by colons (``:``) -* ``ssl_verify`` - true/false; Whether to verify the server certificate or not +* ``ssl_verify`` - true/false (boolean) - Whether to verify the server certificate or not diff --git a/user_guide_src/source/database/helpers.rst b/user_guide_src/source/database/helpers.rst index 0d640f6422e1..0542057379b1 100644 --- a/user_guide_src/source/database/helpers.rst +++ b/user_guide_src/source/database/helpers.rst @@ -42,7 +42,6 @@ $db->countAll() Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. This is part of Query Builder. -Example: .. literalinclude:: helpers/001.php @@ -51,7 +50,6 @@ $db->countAllResults() Permits you to determine the number of rows in a particular result set. Submit the table name in the first parameter. This is part of Query Builder. -Example: .. literalinclude:: helpers/002.php diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst index 0862ec0f4125..29920f0c9756 100644 --- a/user_guide_src/source/database/index.rst +++ b/user_guide_src/source/database/index.rst @@ -14,7 +14,7 @@ patterns. The database functions offer clear, simple syntax. Connecting to a Database Running Queries Generating Query Results - Query Helper Functions + Query Helper Methods Query Builder Class Transactions Getting MetaData diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 5dac7926f7a8..171c354d1120 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -88,7 +88,7 @@ $query, which can be used to show the results: .. literalinclude:: query_builder/004.php -Please visit the :doc:`getResult*() method ` page for a full +Please visit the :ref:`getResult() ` method for a full discussion regarding result generation. $builder->getCompiledSelect() @@ -101,14 +101,14 @@ Example: .. literalinclude:: query_builder/005.php -The first 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 ``$builder->get()``): +The parameter (false) in the first query below enables you to set whether or not the query builder +will be reset (because the default value of the parameter is true, ``getCompiledSelect(bool $reset = true)``, by default it will be reset just like when using ``$builder->get()``): .. literalinclude:: query_builder/006.php The key thing to notice in the above example is that the second query did not utilize ``limit(10, 20)`` but the generated SQL query has ``LIMIT 20, 10``. -The reason for this outcome is because the first parameter is set to ``false``. +The reason for this outcome is because the parameter in the first query is set to ``false``, ``limit(10, 20)`` remained in the second query. $builder->getWhere() -------------------- @@ -169,7 +169,7 @@ $builder->selectMin() --------------------- Writes a **SELECT MIN(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. literalinclude:: query_builder/011.php @@ -178,7 +178,7 @@ $builder->selectAvg() --------------------- Writes a **SELECT AVG(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. literalinclude:: query_builder/012.php @@ -187,7 +187,7 @@ $builder->selectSum() --------------------- Writes a **SELECT SUM(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. literalinclude:: query_builder/013.php @@ -196,7 +196,7 @@ $builder->selectCount() ----------------------- Writes a **SELECT COUNT(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. note:: This method is particularly helpful when used with ``groupBy()``. For diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index a5d490a81a20..85e57c3be70e 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -12,6 +12,8 @@ There are several ways to generate query results: Result Arrays ************* +.. _getresult: + getResult() =========== @@ -93,7 +95,7 @@ digit in the first parameter: .. literalinclude:: results/009.php -In addition, you can walk forward/backwards/first/last through your +In addition, you can walk forward/backward/first/last through your results using these variations: | ``$row = $query->getFirstRow()``