symfony API

sfDatabase Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.4 API OpenSearch

Packages

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

sfDatabase is a base abstraction class that allows you to setup any type of

Method Summary

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

Method Details

  • connect () Browse code

    Connects to the database.

    throws sfDatabaseException If a connection could not be created

  • (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

  • (string) getParameter ($name, $default) Browse code

    $name The key name
    $default The default value

    Gets the parameter associated with the given key.


    This is a shortcut for:

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

    returns The value associated with the key

  • (sfParameterHolder) getParameterHolder () Browse code

    Gets the parameter holder for this object.

    returns A sfParameterHolder instance

  • (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

  • (boolean) hasParameter ($name) Browse code

    $name The key name

    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

  • (bool) initialize ($parameters) 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

  • setParameter ($name, $value) Browse code

    $name The key name
    $value The value

    Sets the value for the given key.


    This is a shortcut for:

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

  • (void) shutdown () Browse code

    Executes the shutdown procedure.

    throws sfDatabaseException If an error occurs while shutting down this database

  • __construct () Browse code

    Class constructor.