Jelix 1.8.13

DatabaseHelpers
in package

Trait for installer/configurator classes.

Tags
since
1.7

Table of Contents

$dbProfile  : string
$globalSetup  : GlobalSetup
global setup.
$_dbConn  : jDbConnection
__construct()  : mixed
createTableFromDao()  : mixed
dbConnection()  : jDbConnection
dbTool()  : jDbTools
execSQLScript()  : mixed
execute a sql script with the current profile.
getDbProfile()  : mixed
getDbType()  : string
insertDaoData()  : int
Insert data into a database, from a json file, using a DAO mapping.
useDbProfile()  : mixed
use the given database profile. check if this is an alias and use the real db profile if this is the case.

Properties

$dbProfile

protected string $dbProfile = ''

the jDb profile for the component

Tags

Methods

createTableFromDao()

public createTableFromDao( $selectorStr) : mixed
Parameters
$selectorStr :
Tags
Return values
mixed

execSQLScript()

execute a sql script with the current profile.

public execSQLScript(string $name[, string $module = null ][, bool $inTransaction = true ]) : mixed

The name of the script should be store in install/$name.databasetype.sql in the directory of the component. (replace databasetype by mysql, pgsql etc.) You can however provide a script compatible with all databases, but then you should indicate the full name of the script, with a .sql extension.

Parameters
$name : string

the name of the script

$module : string = null

the module from which we should take the sql file. null for the current module

$inTransaction : bool = true

indicate if queries should be executed inside a transaction

Tags
throws
Exception
Return values
mixed

getDbProfile()

public getDbProfile() : mixed
Tags
Return values
mixed

getDbType()

public getDbType([string $profile = null ]) : string
Parameters
$profile : string = null

the db profile

Tags
Return values
string

the name of the type of database

insertDaoData()

Insert data into a database, from a json file, using a DAO mapping.

public insertDaoData(string $relativeSourcePath, int $option[, null|mixed $module = null ]) : int
Parameters
$relativeSourcePath : string

name of the json file into the install directory

$option : int

one of jDbTools::IBD_* const

$module : null|mixed = null
Tags
throws
Exception
Return values
int

number of records inserted/updated

useDbProfile()

use the given database profile. check if this is an alias and use the real db profile if this is the case.

public useDbProfile(string $dbProfile) : mixed
Parameters
$dbProfile : string

the profile name

Tags
Return values
mixed

Search results