1.5deprecatedAdvanced Symphony Database Connector (ASDC)
Efficient database library
Clone URLhttps://github.com/symphonycms/asdc.git
Add as a submodulegit submodule add https://github.com/symphonycms/asdc.git extensions/asdc --recursive
Compatibility
2.x.x | 2.1.x | 2.2.x | 2.3.x | 2.4.x | 2.5.x | 2.6.x | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.7.4 | 2.7.5 | 2.7.6 | 2.7.7 | 2.7.8 | 2.7.9 | 2.7.10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1.2 | 1.4 | 1.4 | 1.5 | No | No | No | No | No | No | No | No | No | No | No | No | No | No |
Readme
Advanced Symphony Database Connector (ASDC)
- Version: 1.5
- Author: Alistair Kearney ([email protected])
- Build Date: 19th September 2012
- Requirements: Symphony 2.3 or above
A more efficient database library that can be used by developers as an alternative to the built in MySQL database connector. Note, this does not replace the existing driver used throughout Symphony, but is used in tandem to it.
ASDCLoader::instance()
will auto-discover the existing Database object and use its connection resource. It is possible to also use this library outside of Symphony, or establish a new database connection (See example 3)
INSTALLATION
** Note: The latest version can always be grabbed with git clone git://github.com/symphonycms/asdc.git
**
Upload the
asdc
folder in to your Symphony/extensions
folder.Enable it by selecting the "Advanced Symphony Database Connector (ASDC)", choose Enable from the with-selected menu, then click Apply.
USAGE
Example 1 - no profiling:
require_once(EXTENSIONS . '/asdc/lib/class.asdc.php');
try{
$db = ASDCLoader::instance();
$result = $db->query("SELECT * FROM `sym_pages` LIMIT 1");
print_r($result->current());
}
catch(Exception $e){
vprintf('%d: %s on query "%s"', $db->lastError());
}
Example 2 - profiling:
require_once(EXTENSIONS . '/asdc/lib/class.asdc.php');
try{
$db = ASDCLoader::instance(true); ## TURN ON PROFILING HERE!
$result = $db->query("SELECT * FROM `sym_pages` LIMIT 1");
print_r($result->current());
print_r($db->log());
}
catch(Exception $e){
vprintf('%d: %s on query "%s"', $db->lastError());
}
Example 3 - Connection without the loader:
require_once(EXTENSIONS . '/asdc/lib/class.asdc.php');
$db = new ASDCMySQL;
### Optional ###
$db->character_encoding = 'utf8';
$db->character_set = 'utf8';
$db->prefix = 'eh_';
$db->force_query_caching = true;
###
try{
$db->connect('mysql://username:password@host:3306/my_table/);
print 'SUCCESS!';
}
catch(Exception $e){
print $e->getMessage();
}
Version history
Symphony 2.3 to 2.3.x
- Updated to work with Symphony 2.3.x. Dropped support for lower versions. Please use v 1.4.
Symphony 2.0.6 to 2.2.x
- Few tweaks to prevent the Log filling up with warnings
Symphony 2.0.6 to 2.2.x
- Fixed some problems with passing around the DB resource under Symphony 2.0.7
Symphony 2.0 to 2.0.6
- Added a truncate function
Symphony 2.0 to 2.0.6
ASDCLoader::instance()
will correctly determine if currently operating from the Front end or Admin.