API15

API15:JDatabase/ construct

From Joomla! Documentation

Revision as of 22:14, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Database object constructor <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowik...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Database object constructor

[Edit Descripton]

Template:Description:JDatabase/ construct

Syntax

__construct($options)
Parameter Name Default Value Description
$options List of options used to configure the connection

Defined in

libraries/joomla/database/database.php

Importing

jimport( 'joomla.database.database' );

Source Body

function __construct( $options )
{
        $prefix         = array_key_exists('prefix', $options)  ? $options['prefix']    : 'jos_';

        // Determine utf-8 support
        $this->_utf = $this->hasUTF();

        //Set charactersets (needed for MySQL 4.1.2+)
        if ($this->_utf){
                $this->setUTF();
        }

        $this->_table_prefix    = $prefix;
        $this->_ticker                  = 0;
        $this->_errorNum                = 0;
        $this->_log                             = array();
        $this->_quoted                  = array();
        $this->_hasQuoted               = false;

        // Register faked "destructor" in PHP4 to close all connections we might have made
        if (version_compare(PHP_VERSION, '5') == -1) {
                register_shutdown_function(array(&$this, '__destruct'));
        }
}

[Edit See Also] Template:SeeAlso:JDatabase/ construct

Examples

<CodeExamplesForm />