symfony API

sfDatabase Class

« Back to API menu

1.0 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:

sfDatabase is a base abstraction class that allows you to setup any type of database connection via a configuration file.

Inheritence

sfMySQLDatabase, sfPDODatabase, sfPostgreSQLDatabase  <  sfDatabase

Method Summary

  • shutdown()
    Executes the shutdown procedure.
  • boolean hasParameter($name, $ns = null)
    Returns true if the given key exists in the parameter holder.
  • string getParameter($name, $default = null, $ns = null)
    Gets the parameter associated with the given key.
  • connect()
    Connects to the database.
  • bool initialize($parameters = array())
    Initializes this sfDatabase object.
  • mixed getResource()
    Retrieves a raw database resource associated with this sfDatabase implementation.
  • getParameterHolder()
    Gets the parameter holder for this object.
  • mixed getConnection()
    Retrieves the database connection associated with this sfDatabase implementation.
  • setParameter($name, $value, $ns = null)
    Sets the value for the given key.

Method Details

  • shutdown () Browse code

    Executes the shutdown procedure.

    throws sfDatabaseException If an error occurs while shutting down this database

  • (boolean) hasParameter ($name, $ns = null) Browse code

    $name The key name
    $ns The namespace to use

    Returns true if the given key exists in the parameter holder.

    This is a shortcut for:

    $this->getParameterHolder()->has()

    returns true if the given key exists, false otherwise

  • (string) getParameter ($name, $default = null, $ns = null) Browse code

    $name The key name
    $default The default value
    $ns The namespace to use

    Gets the parameter associated with the given key.

    This is a shortcut for:

    $this->getParameterHolder()->get()

    returns The value associated with the key

  • connect () Browse code

    Connects to the database.

    throws sfDatabaseException If a connection could not be created

  • (bool) initialize ($parameters = array()) Browse code

    $parameters An associative array of initialization parameters

    Initializes this sfDatabase object.

    returns true, if initialization completes successfully, otherwise false

    throws sfInitializationException If an error occurs while initializing this sfDatabase object

  • (mixed) getResource () Browse code

    Retrieves a raw database resource associated with this sfDatabase implementation.

    returns A database resource

    throws sfDatabaseException If a resource could not be retrieved

  • getParameterHolder () Browse code

    Gets the parameter holder for this object.

    returns A sfParameterHolder instance

  • (mixed) getConnection () Browse code

    Retrieves the database connection associated with this sfDatabase implementation.

    When this is executed on a Database implementation that isn't an abstraction layer, a copy of the resource will be returned.

    returns A database connection

    throws sfDatabaseException If a connection could not be retrieved

  • setParameter ($name, $value, $ns = null) Browse code

    $name The key name
    $value The value
    $ns The namespace to use

    Sets the value for the given key.

    This is a shortcut for:

    $this->getParameterHolder()->set()

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.