[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.schema_proc.inc.php (sommaire)

(pas de description)

Poids: 1263 lignes (42 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

schema_proc:: (32 méthodes):
  schema_proc()
  _in_index()
  CreateTable()
  DropAllTables()
  DropTable()
  DropColumn()
  RenameTable()
  _PostgresHasOldSequence()
  _PostgresTestDropOldSequence()
  AlterColumn()
  RenameColumn()
  AddColumn()
  CreateIndex()
  DropIndex()
  UpdateSequence()
  RefreshTable()
  GenerateScripts()
  ExecuteScripts()
  f()
  num_rows()
  next_record()
  query()
  insert()
  ExecuteSqlArray()
  _index_name()
  error()
  fatal()
  debug_message()
  _egw2adodb_columndef()
  TranslateType()
  GetTableDefinition()
  _GetColumns()


Classe: schema_proc  - X-Ref

eGW's ADOdb based schema-processor

schema_proc($dbms=False)   X-Ref
Constructor of schema-processor

param: string $dbms type of the database: 'mysql','pgsql','mssql','sapdb'

_in_index($columns,$indexs)   X-Ref
Check if the given $columns exist as index in the index array $indexes

param: string/array $columns column-name as string or array of column-names plus optional options key
param: array $indexs array of indexes (column-name as string or array of column-names plus optional options key)
return: boolean true if index over $columns exist in the $indexes array

CreateTable($sTableName, $aTableDef, $preserveSequence=False)   X-Ref
Created a table named $sTableName as defined in $aTableDef

param: string $sTableName
param: array $aTableDef
param: bool $preserveSequence
return: int 2: no error, 1: errors, but continued, 0: errors aborted

DropAllTables($aTables, $bOutputHTML=False)   X-Ref
Drops all tables in $aTables

param: array $aTables array of eGW table-definitions
param: boolean $bOutputHTML should we give diagnostics, default False
return: boolean True if no error, else False

DropTable($sTableName)   X-Ref
Drops the table $sTableName

param: string $sTableName
return: int 2: no error, 1: errors, but continued, 0: errors aborted

DropColumn($sTableName, $aTableDef, $sColumnName, $bCopyData = true)   X-Ref
Drops column $sColumnName from table $sTableName

param: string $sTableName table-name
param: array $aTableDef eGW table-defintion
param: string $sColumnName column-name
param: boolean $bCopyData ???
return: int 2: no error, 1: errors, but continued, 0: errors aborted

RenameTable($sOldTableName, $sNewTableName)   X-Ref
Renames table $sOldTableName to $sNewTableName

param: string $sOldTableName old (existing) table-name
param: string $sNewTableName new table-name
return: int 2: no error, 1: errors, but continued, 0: errors aborted

_PostgresHasOldSequence($sTableName,$preserveValue=False)   X-Ref
Check if we have an old, not automaticaly droped sequence

param: string $sTableName
param: bool $preserveValue
return: boolean/string sequence-name or false

_PostgresTestDropOldSequence($sTableName,$preserveValue=False)   X-Ref
Check if we have an old, not automaticaly droped sequence and drop it

param: $sTableName
param: bool $preserveValue

AlterColumn($sTableName, $sColumnName, $aColumnDef, $bCopyData=True)   X-Ref
Changes one (exiting) column in a table

param: string $sTableName table-name
param: string $sColumnName column-name
param: array $aColumnDef new column-definition
param: boolean $bCopyData ???
return: int 2: no error, 1: errors, but continued, 0: errors aborted

RenameColumn($sTableName, $sOldColumnName, $sNewColumnName, $bCopyData=True)   X-Ref
Renames column $sOldColumnName to $sNewColumnName in table $sTableName

param: string $sTableName table-name
param: string $sOldColumnName old (existing) column-name
param: string $sNewColumnName new column-name
param: boolean $bCopyData ???
return: int 2: no error, 1: errors, but continued, 0: errors aborted

AddColumn($sTableName, $sColumnName, $aColumnDef)   X-Ref
Add one (new) column to a table

param: string $sTableName table-name
param: string $sColumnName column-name
param: array $aColumnDef column-definition
return: int 2: no error, 1: errors, but continued, 0: errors aborted

CreateIndex($sTableName,$aColumnNames,$bUnique=false,$options='',$sIdxName='')   X-Ref
Create an (unique) Index over one or more columns

param: string $sTablename table-name
param: array $aColumnNames columns for the index
param: boolean $bUnique=false true for a unique index, default false
param: array/string $options='' db-sepecific options, default '' = none
param: string $sIdxName='' name of the index, if not given (default) its created automaticaly
return: int 2: no error, 1: errors, but continued, 0: errors aborted

DropIndex($sTableName,$aColumnNames)   X-Ref
Drop an Index

param: string $sTablename table-name
param: array/string $aColumnNames columns of the index or the name of the index
return: int 2: no error, 1: errors, but continued, 0: errors aborted

UpdateSequence($sTableName,$sColumnName)   X-Ref
Updating the sequence-value, after eg. copying data via RefreshTable

param: string $sTableName table-name
param: string $sColumnName column-name, which default is set to nextval()

RefreshTable($sTableName, $aTableDef, $aDefaults=False)   X-Ref
This function manually re-created the table incl. primary key and all other indices

It is meant to use if the primary key, existing indices or column-order changes or
columns are not longer used or new columns need to be created (with there default value or NULL)
Beside the default-value in the schema, one can give extra defaults via $aDefaults to eg. use an
other colum or function to set the value of a new or changed column

param: string $sTableName table-name
param: array $aTableDef eGW table-defintion
param: array/boolean $aDefaults array with default for the colums during copying, values are either (old) column-names or quoted string-literals

GenerateScripts($aTables, $bOutputHTML=False)   X-Ref
depricated Function does nothing any more


ExecuteScripts($aTables, $bOutputHTML=False)   X-Ref
Creates all tables for one application

param: array $aTables array of eGW table-definitions
param: boolean $bOutputHTML=false should we give diagnostics, default False
return: boolean True on success, False if an (fatal) error occured

f($value,$strip_slashes=False)   X-Ref
Return the value of a column

param: string/integer $Name name of field or positional index starting from 0
param: bool $strip_slashes string escape chars from field(optional), default false
return: string the field value

num_rows()   X-Ref
Number of rows in current result set

return: int number of rows

next_record()   X-Ref
Move to the next row in the results set

return: bool was another row found?

query($sQuery, $line='', $file='')   X-Ref
Execute a query

param: string $Query_String the query to be executed
param: mixed $line the line method was called from - use __LINE__
param: string $file the file method was called from - use __FILE__
param: int $offset row to start from
param: int $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
return: ADORecordSet or false, if the query fails

insert($table,$data,$where,$line,$file,$app=False,$use_prepared_statement=false)   X-Ref
Insert a row of data into a table or updates it if $where is given, all data is quoted according to it's type

param: string $table name of the table
param: array $data with column-name / value pairs
param: mixed $where string with where clause or array with column-name / values pairs to check if a row with that keys already exists, or false for an unconditional insert
param: int $line line-number to pass to query
param: string $file file-name to pass to query
param: string $app=false string with name of app, this need to be set in setup anyway!!!
return: ADORecordSet or false, if the query fails

ExecuteSqlArray($aSql,$debug_level,$debug)   X-Ref
Execute the Sql statements in an array and give diagnostics, if any error occures

param: $aSql array of SQL strings to execute
param: $debug_level int for which debug_level (and higher) should the diagnostics always been printed
param: $debug string variable number of arguments for the debug_message functions in case of an error
return: int 2: no error, 1: errors, but continued, 0: errors aborted

_index_name($sTableName,$aColumnNames)   X-Ref
Created a (unique) name for an index

As the length of the index name is limited on some databases, we use two algorithms:
a) we use just the first column-name with and added _2, _3, ... if more indexes uses that column
b) we use the table-names plus all column-names and remove dublicate parts

param: $sTableName string name of the table
param: $aColumnNames array of column-names or string with a single column-name
return: string the index-name

error($str)   X-Ref
Giving a non-fatal error-message


fatal($str)   X-Ref
Giving a fatal error-message and exiting


debug_message($msg,$backtrace=True)   X-Ref
Gives out a debug-message with certain parameters

All permanent debug-messages in the calendar should be done by this function !!!
(In future they may be logged or sent as xmlrpc-faults back.)

Permanent debug-message need to make sure NOT to give secret information like passwords !!!

This function do NOT honor the setting of the debug variable, you may use it like
if ($this->debug > N) $this->debug_message('Error ;-)');

The parameters get formated depending on their type.

param: $msg string message with parameters/variables like lang(), eg. '%1'
param: $backtrace include a function-backtrace, default True=On
param: $param mixed a variable number of parameters, to be inserted in $msg

_egw2adodb_columndef($aTableDef)   X-Ref
Converts an eGW table-definition array into an ADOdb column-definition string

param: array $aTableDef eGW table-defintion
return: string ADOdb column-definition string (comma separated)

TranslateType($egw_type)   X-Ref
Translates an eGW type into the DB's native type

param: string $egw_type eGW name of type
param: string/boolean DB's name of the type or false if the type could not be identified (should not happen)

GetTableDefinition($sTableName)   X-Ref
Read the table-definition direct from the database

The definition might not be as accurate, depending on the DB!

param: string $sTableName table-name
return: array/boolean table-defition, like $phpgw_baseline[$sTableName] after including tables_current, or false on error

_GetColumns($oProc,$sTableName,&$sColumns)   X-Ref
Get actual columnnames as a comma-separated string in $sColumns and set indices as class-vars pk,fk,ix,uc

old translator function, use GetTableDefition() instead



Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7