Class: Doctrine_Formatter

Source Location: /Doctrine/Formatter.php

Class Doctrine_Formatter

Class Overview

Doctrine_Formatter

Located in /Doctrine/Formatter.php [line 33]

Doctrine_Connection_Module
   |
   --Doctrine_Formatter
Author(s): Information Tags:
Version:  $Revision$
Link:  www.phpdoctrine.com
Since:  1.0
License:  LGPL

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Doctrine_Connection_Module

Doctrine_Connection_Module::$conn
Doctrine_Connection_Module::$moduleName

Inherited From Doctrine_Connection_Module

Doctrine_Connection_Module::__construct()
Doctrine_Connection_Module::getConnection()
getConnection returns the connection object this module uses
Doctrine_Connection_Module::getModuleName()
getModuleName returns the name of this module

[ Top ]
Method Summary
void   convertBooleans()   convertBooleans some drivers need the boolean values to be converted into integers when using DQL API
string   escapePattern()   Quotes pattern (% and _) characters in a string)
string   fixIndexName()   Removes any formatting in an index name using the 'idxname_format' option
string   fixSequenceName()   Removes any formatting in an sequence name using the 'seqname_format' option
string   getIndexName()   adds index name formatting to a index name
string   getSequenceName()   adds sequence name formatting to a sequence name
mixed   quote()   quote quotes given input parameter
string   quoteIdentifier()   Quote a string so it can be safely used as a table or column name

[ Top ]
Properties
Methods
convertBooleans  [line 72]

  void convertBooleans( array $item  )

convertBooleans some drivers need the boolean values to be converted into integers when using DQL API

This method takes care of that conversion

Parameters:
array   $item: 

API Tags:
Access:  public


[ Top ]
escapePattern  [line 47]

  string escapePattern( string $text  )

Quotes pattern (% and _) characters in a string)

EXPERIMENTAL

WARNING: this function is experimental and may change signature at any time until labelled as non-experimental

Parameters:
string   $text:  the input string to quote

API Tags:
Return:  quoted string
Access:  public


[ Top ]
fixIndexName  [line 190]

  string fixIndexName( string $idx  )

Removes any formatting in an index name using the 'idxname_format' option

Parameters:
string   $idx:  string that containts name of anl index

API Tags:
Return:  name of the index with possible formatting removed
Access:  public


[ Top ]
fixSequenceName  [line 174]

  string fixSequenceName( string $sqn  )

Removes any formatting in an sequence name using the 'seqname_format' option

Parameters:
string   $sqn:  string that containts name of a potential sequence

API Tags:
Return:  name of the sequence with possible formatting removed
Access:  public


[ Top ]
getIndexName  [line 216]

  string getIndexName( string $idx  )

adds index name formatting to a index name

Parameters:
string   $idx:  name of the index

API Tags:
Return:  formatted index name
Access:  public


[ Top ]
getSequenceName  [line 205]

  string getSequenceName( string $sqn  )

adds sequence name formatting to a sequence name

Parameters:
string   $sqn:  name of the sequence

API Tags:
Return:  formatted sequence name
Access:  public


[ Top ]
quote  [line 139]

  mixed quote( mixed $input, [string $type = null]  )

quote quotes given input parameter

Parameters:
mixed   $input:  parameter to be quoted
string   $type: 

API Tags:
Access:  public


[ Top ]
quoteIdentifier  [line 119]

  string quoteIdentifier( string $str, [bool $checkOption = true]  )

Quote a string so it can be safely used as a table or column name

Delimiting style depends on which database driver is being used.

NOTE: just because you CAN use delimited identifiers doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve.

Portability is broken by using the following characters inside delimited identifiers:

  • backtick (`) -- due to MySQL
  • double quote (") -- due to Oracle
  • brackets ([ or ]) -- due to Access
Delimited identifiers are known to generally work correctly under the following drivers:
  • mssql
  • mysql
  • mysqli
  • oci8
  • pgsql
  • sqlite
InterBase doesn't seem to be able to use delimited identifiers via PHP 4. They work fine under PHP 5.

Parameters:
string   $str:  identifier name to be quoted
bool   $checkOption:  check the 'quote_identifier' option

API Tags:
Return:  quoted identifier string
Access:  public


[ Top ]