Class: Doctrine_Import_Pgsql

Source Location: /Doctrine/Import/Pgsql.php

Class Doctrine_Import_Pgsql

Class Overview

Located in /Doctrine/Import/Pgsql.php [line 33]

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

Properties

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_Import

Doctrine_Import::importSchema()
importSchema
Doctrine_Import::listDatabases()
lists all databases
Doctrine_Import::listFunctions()
lists all availible database functions
Doctrine_Import::listSequences()
lists all database sequences
Doctrine_Import::listTableColumns()
lists table constraints
Doctrine_Import::listTableConstraints()
lists table constraints
Doctrine_Import::listTableIndexes()
lists table constraints
Doctrine_Import::listTables()
lists tables
Doctrine_Import::listTableTriggers()
lists table triggers
Doctrine_Import::listTableViews()
lists table views
Doctrine_Import::listTriggers()
lists all database triggers
Doctrine_Import::listUsers()
lists database users
Doctrine_Import::listViews()
lists database views

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 ]
Property Summary
mixed   $sql  

[ Top ]
Method Summary
array   listTableColumns()   lists table constraints
array   listTableConstraints()   lists table constraints
array   listTableIndexes()   list all indexes in a table
array   listTables()   lists tables
array   listTableTriggers()   lists table triggers
array   listTableViews()   list the views in the database that reference a given table
array   listTriggers()   lists all database triggers

[ Top ]
Properties
mixed   $sql = array(
'listDatabases' => 'SELECT datname FROM pg_database',
'listFunctions' => "SELECT
proname
FROM
pg_proc pr,
pg_type tp
WHERE
tp.oid = pr.prorettype
AND pr.proisagg = FALSE
AND tp.typname <> 'trigger'
AND pr.pronamespace IN
(SELECT oid FROM pg_namespace
WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema'",
'listSequences' => "SELECT
relname
FROM
pg_class
WHERE relkind = 'S' AND relnamespace IN
(SELECT oid FROM pg_namespace
WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema')",
'listTables' => "SELECT
c.relname AS table_name
FROM pg_class c, pg_user u
WHERE c.relowner = u.usesysid
AND c.relkind = 'r'
AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname)
AND c.relname !~ '^(pg_|sql_)'
UNION
SELECT c.relname AS table_name
FROM pg_class c
WHERE c.relkind = 'r'
AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname)
AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner)
AND c.relname !~ '^pg_'",
'listViews' => 'SELECT viewname FROM pg_views',
'listUsers' => 'SELECT usename FROM pg_user',
'listTableConstraints' => "SELECT
relname
FROM
pg_class
WHERE oid IN (
SELECT indexrelid
FROM pg_index, pg_class
WHERE pg_class.relname = %s
AND pg_class.oid = pg_index.indrelid
AND (indisunique = 't' OR indisprimary = 't')
)",
'listTableIndexes' => "SELECT
relname
FROM
pg_class
WHERE oid IN (
SELECT indexrelid
FROM pg_index, pg_class
WHERE pg_class.relname = %s
AND pg_class.oid=pg_index.indrelid
AND indisunique != 't'
AND indisprimary != 't'
)",
'listTableColumns' => "SELECT
a.attnum,
a.attname AS field,
t.typname AS type,
format_type(a.atttypid, a.atttypmod) AS complete_type,
a.attnotnull AS isnotnull,
(SELECT 't'
FROM pg_index
WHERE c.oid = pg_index.indrelid
AND pg_index.indkey[0] = a.attnum
AND pg_index.indisprimary = 't'
) AS pri,
(SELECT pg_attrdef.adsrc
FROM pg_attrdef
WHERE c.oid = pg_attrdef.adrelid
AND pg_attrdef.adnum=a.attnum
) AS default
FROM pg_attribute a, pg_class c, pg_type t
WHERE c.relname = %s
AND a.attnum > 0
AND a.attrelid = c.oid
AND a.atttypid = t.oid
ORDER BY a.attnum",
)
[line 36]
API Tags:
Access:  protected


Redefinition of:
Doctrine_Import::$sql

[ Top ]
Methods
listTableColumns  [line 149]

  array listTableColumns( string $table  )

lists table constraints

Parameters:
string   $table:  database table name

API Tags:
Access:  public


Redefinition of:
Doctrine_Import::listTableColumns()
lists table constraints

[ Top ]
listTableConstraints  [line 136]

  array listTableConstraints( string $table  )

lists table constraints

Parameters:
string   $table:  database table name

API Tags:
Access:  public


Redefinition of:
Doctrine_Import::listTableConstraints()
lists table constraints

[ Top ]
listTableIndexes  [line 189]

  array listTableIndexes( string $table  )

list all indexes in a table

Parameters:
string   $table:  database table name

API Tags:
Access:  public


Redefinition of:
Doctrine_Import::listTableIndexes()
lists table constraints

[ Top ]
listTables  [line 202]

  array listTables( [string|null $database = null]  )

lists tables

Parameters:
string|null   $database: 

API Tags:
Access:  public


Redefinition of:
Doctrine_Import::listTables()
lists tables

[ Top ]
listTableTriggers  [line 212]

  array listTableTriggers( string $table  )

lists table triggers

Parameters:
string   $table:  database table name

API Tags:
Access:  public


Redefinition of:
Doctrine_Import::listTableTriggers()
lists table triggers

[ Top ]
listTableViews  [line 230]

  array listTableViews( string $table  )

list the views in the database that reference a given table

Parameters:
string   $table:  database table name

API Tags:
Access:  public


Redefinition of:
Doctrine_Import::listTableViews()
lists table views

[ Top ]
listTriggers  [line 126]

  array listTriggers( [string|null $database = null]  )

lists all database triggers

Parameters:
string|null   $database: 

API Tags:
Access:  public


Redefinition of:
Doctrine_Import::listTriggers()
lists all database triggers

[ Top ]