Class SQLFunctions

Description

Contains all functions which handle with SQL

Located in /SQLFunctions.php (line 20)


	
			
Direct descendents
Class Description
SQLInstallFunctions SQLInstallFunctions contains special functions for DBeasy installation concerning database issues.
Variable Summary
mixed $connection
mixed $db_address
mixed $db_dsn
mixed $db_name
mixed $db_password
mixed $db_path
mixed $db_type
mixed $db_username
mixed $debug
Method Summary
SQLFunctions SQLFunctions ()
void addField (string $table_name, stringarray $fields)
string addUser (string $login, string $password, int $user_group, string $firstname, string $lastname)
void autoConnectToDB ()
void connectToDB (string $db_type, string $db_address, string $db_username, string $db_password, string $db_name, string $db_path, string $db_dsn)
void connectToDBODBM ()
string createTable (string $table_name, stringarray $fields)
recordSet deleteRow (string $table_name, string $condition)
void dropColumn (string $table_name, string $column_name)
void dropTable (string $table_name)
resultSet executeSQL (string $sql_statement)
void existsItem (mixed $table_name, mixed $key, mixed $key_value)
date generateDate ()
void generateID (string $seq_name, [int $start_value = "1"], int 2)
stringarray getFields (string $table_name)
string getIntPrimaryKey (string $table, stringarray $array_possible_primary_key)
int getMax (string $table_name, string $field)
void getResultMsg ()
void insertData (string $table_name, stringarray $values_array)
void LogTable (string $table_name)
recordSet selectAll (string $table_name, string $condition)
stringarray showTables ()
void tableExists (string $table_name, boolean 1)
void updateRow (string $table_name, string $key, string $key_value, stringarray $fields_array)
Variables
mixed $connection (line 23)
mixed $current_result = "empty" (line 32)
mixed $db_address (line 25)
mixed $db_dsn (line 30)
mixed $db_name (line 28)
mixed $db_password (line 27)
mixed $db_path (line 29)
mixed $db_type (line 24)
mixed $db_username (line 26)
mixed $debug (line 22)
Methods
Constructor SQLFunctions (line 34)
SQLFunctions SQLFunctions ()
addField (line 518)

Adds an field to the table mentioned in the arguments

void addField (string $table_name, stringarray $fields)
  • string $table_name: Name of table
  • stringarray $fields: Name and type of fields
addUser (line 263)

Adds an user to the table dbeasy_user

  • return: Result Message
string addUser (string $login, string $password, int $user_group, string $firstname, string $lastname)
  • string $login: Login name
  • string $password: Password
  • int $user_group: User group : for group sysadmin 1, for group formadmin 2
  • string $firstname: First name
  • string $lastname: Last name
autoConnectToDB (line 120)

Connects to the Database specified in the file config_user.php

  • see: config_user.php
void autoConnectToDB ()
connectToDB (line 60)

Connects to the Database specified in the arguments of the function

Not all parameters are necessary, that is dependent on the database type

void connectToDB (string $db_type, string $db_address, string $db_username, string $db_password, string $db_name, string $db_path, string $db_dsn)
  • string $db_type: Database-Type
  • string $db_address: Database-Address
  • string $db_username: Username for connect to database
  • string $db_password: Password for connect to database
  • string $db_name: Name of database
  • string $db_path: Path of database
  • string $db_dsn: DSN of database
connectToDBODBM (line 191)

Abbrevation: connectToDataBaseOverDataBaseMapping

This function includes: 1) a connection establishment to the DBEasy's configuration database 2) query for access data (dbeasy_user_db_mapping) for selected user and selected database 3) a connection establishment to the selected database with access data of point 2)

void connectToDBODBM ()
createTable (line 211)

Creates a table which name and fields are given in the argument of the function

  • return: Result Message
string createTable (string $table_name, stringarray $fields)
  • string $table_name: Name of table
  • stringarray $fields: Name of all fields of table
deleteRow (line 466)

Deletes the row in a table which satisfies the given condition

If all rows shall be deleted, fill in "" as $condition

  • return: Result
recordSet deleteRow (string $table_name, string $condition)
  • string $table_name: Name of table
  • string $condition: Condition
dropColumn (line 622)

Deletes the specified Column from the Table

void dropColumn (string $table_name, string $column_name)
  • string $table_name: Name of table
  • string $column_name: Name of Column
dropTable (line 742)

Deletes a table from the database

void dropTable (string $table_name)
  • string $table_name: Name of table
executeSQL (line 237)

Executes the SQL-Statement given as an argument of the function

  • return: ResultSet
resultSet executeSQL (string $sql_statement)
  • string $sql_statement: SQL-Statement
existsItem (line 811)
void existsItem (mixed $table_name, mixed $key, mixed $key_value)
generateDate (line 341)

Generates the Date, dependent on the databasetype

  • return: Date
date generateDate ()
generateID (line 864)

Generates an unique ID

void generateID (string $seq_name, [int $start_value = "1"], int 2)
  • int 2: Unique ID
  • string $seq_name: Name of sequence
  • int $start_value: Start value, by default set to 1
getFields (line 791)

Returns all fields of the specified table in an array

  • return: Name of all fields
stringarray getFields (string $table_name)
  • string $table_name: Name of table
getIntPrimaryKey (line 827)

Returns the name of primary key, if there is only one primary key and primary key is of type integer, else false

  • return: Name of primary key
string getIntPrimaryKey (string $table, stringarray $array_possible_primary_key)
  • string $table: Name of table
  • stringarray $array_possible_primary_key: Name of possible primary keys
getMax (line 491)

Returns the maximal number of datarecords, which are in the table

  • return: Maximal number of datarecords
int getMax (string $table_name, string $field)
  • string $table_name: Name of table
  • string $field: Name of field
getResultMsg (line 42)

Returns the Result Message

void getResultMsg ()
insertData (line 417)

Inserts an Datarecord into a table. $value_array is an array which contains the new values.

The values need to have the same order in the array and in the database.

void insertData (string $table_name, stringarray $values_array)
  • string $table_name: Name of table
  • stringarray $values_array: All values which shall be inserted
LogTable (line 755)

Adds the tablename to the dbeasy_log_systables, needed for uninstallation

void LogTable (string $table_name)
  • string $table_name: Name of table
selectAll (line 381)

Returns all Datarecords of a table, which satisfy the given condition in an array.

If there is no condition, fill in "" as the $condition argument

  • return: All Datarecords selected
recordSet selectAll (string $table_name, string $condition)
  • string $table_name: Name of table
  • string $condition: Condition, "" if no condition is specified
showTables (line 505)

Shows all tables, which are contained in the database to which the programm is connected

  • return: Name of all tables in database
stringarray showTables ()
tableExists (line 770)

Checks if the specified table exists in the database

void tableExists (string $table_name, boolean 1)
  • boolean 1: True or False
  • string $table_name: Name of table
updateRow (line 291)

Updates an existing row, with the values in the variable $fields_array

void updateRow (string $table_name, string $key, string $key_value, stringarray $fields_array)
  • string $table_name: Name of table
  • string $key: Key
  • string $key_value: Key value
  • stringarray $fields_array: Name of fields

Documentation generated on Thu, 15 Jul 2004 08:23:57 +0200 by phpDocumentor 1.3.0RC3