SQLFunctions
SQLFunctions
()
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
Adds an user to the table dbeasy_user
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
Connects to the Database specified in the file config_user.php
void
autoConnectToDB
()
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
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
()
Creates a table which name and fields are given in the argument of the function
string
createTable
(string $table_name, stringarray $fields)
-
string
$table_name: Name of table
-
stringarray
$fields: Name of all fields of table
Deletes the row in a table which satisfies the given condition
If all rows shall be deleted, fill in "" as $condition
recordSet
deleteRow
(string $table_name, string $condition)
-
string
$table_name: Name of table
-
string
$condition: Condition
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
Deletes a table from the database
void
dropTable
(string $table_name)
-
string
$table_name: Name of table
Executes the SQL-Statement given as an argument of the function
resultSet
executeSQL
(string $sql_statement)
-
string
$sql_statement: SQL-Statement
void
existsItem
(mixed $table_name, mixed $key, mixed $key_value)
Generates the Date, dependent on the databasetype
date
generateDate
()
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
Returns all fields of the specified table in an array
stringarray
getFields
(string $table_name)
-
string
$table_name: Name of table
Returns the name of primary key, if there is only one primary key and primary key is of type integer, else false
string
getIntPrimaryKey
(string $table, stringarray $array_possible_primary_key)
-
string
$table: Name of table
-
stringarray
$array_possible_primary_key: Name of possible primary keys
Returns the maximal number of datarecords, which are in the table
int
getMax
(string $table_name, string $field)
-
string
$table_name: Name of table
-
string
$field: Name of field
Returns the Result Message
void
getResultMsg
()
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
Adds the tablename to the dbeasy_log_systables, needed for uninstallation
void
LogTable
(string $table_name)
-
string
$table_name: Name of table
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
recordSet
selectAll
(string $table_name, string $condition)
-
string
$table_name: Name of table
-
string
$condition: Condition, "" if no condition is specified
Shows all tables, which are contained in the database to which the programm is connected
stringarray
showTables
()
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
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