symfony API

sfDatabase Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.0 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

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

Inheritence

sfPDODatabase, sfMySQLDatabase, sfPostgreSQLDatabase  <  sfDatabase

Method Summary

  • connect()
    Connects to the database.
  • mixed getConnection()
    Retrieves the database connection associated with this sfDatabase implementation.
  • string getParameter(, , )
    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(, )
    Returns true if the given key exists in the parameter holder.
  • bool initialize()
    Initializes this sfDatabase object.
  • setParameter(, , )
    Sets the value for the given key.
  • void shutdown()
    Executes the shutdown procedure.

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 (, , ) Browse code

    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 (, ) Browse code

    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 () Browse code

    Initializes this sfDatabase object.

    returns true, if initialization completes successfully, otherwise false

    throws sfInitializationException If an error occurs while initializing this sfDatabase object

  • setParameter (, , ) Browse code

    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