Detailed Description
Class provides connection creation routine.
- Author
- Dodonov A.A.
Definition at line 26 of file db_config_set.php.
Constructor & Destructor Documentation
Constructor.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 78 of file db_config_set.php.
{
try
{
$this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
}
catch( Exception $e )
{
}
}
Member Function Documentation
Function connects to database.
- Parameters
-
| $DBAdapter | - Database API adapter. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 241 of file db_config_set.php.
{
try
{
if( $this->Config == false )
{
throw( new Exception( 'Config was not loaded' ) );
}
foreach( $this->Config as $i => $ConfigLine )
{
if( $Connection !== false )
{
return( $Connection );
}
}
throw( new Exception( "Unable to connect to the database" ) );
}
catch( Exception $e )
{
}
}
| get_connection_for_config_line |
( |
|
$DBAdapter, |
|
|
|
$i, |
|
|
|
$ConfigLine |
|
) |
| |
Function processes config line.
- Parameters
-
| $DBAdapter | - Database adapter. |
| $i | - Line cursor. |
| $ConfigLine | - Config line. |
- Returns
- Connection object.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 202 of file db_config_set.php.
{
try
{
if( $ConfigLine != '' )
{
$DBAdapter->connect( $ConfigLine );
return( $DBAdapter->get_connection() );
}
return( false );
}
catch( Exception $e )
{
return( false );
}
}
| load_config |
( |
|
$ConfigPath | ) |
|
Function loads config.
- Parameters
-
| $ConfigPath | - Path to the loading conig. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 108 of file db_config_set.php.
{
try
{
$this->Config = $this->CachedMultyFS->file_get_contents(
$ConfigPath );
$this->Config = str_replace( "\r" , "\n" , $this->Config );
$this->Config = str_replace( "\n\n" , "\n" , $this->Config );
$this->Config = explode( "\n" , $this->Config );
}
catch( Exception $e )
{
}
}
| optimize_config_file |
( |
|
$i, |
|
|
|
$ConfigLine |
|
) |
| |
Config optimization.
- Parameters
-
| $i | - Line cursor. |
| $DBAdapter | - Config line. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 148 of file db_config_set.php.
{
try
{
if( $i != 0 )
{
$Content = $ConfigLine."\r\n";
foreach( $this->Config as $j => $ConfigLine2 )
{
if( $i != $j && $ConfigLine2 != '' )
{
$Content .= $ConfigLine2."\r\n";
}
}
$this->Config = $this->CachedMultyFS->file_put_contents( $this->ConfigPath , $Content );
}
}
catch( Exception $e )
{
}
}
Field Documentation
Object provides access to the FS.
- Author
- Dodonov A.A.
Definition at line 62 of file db_config_set.php.
The documentation for this class was generated from the following file: