Recommend this page to a friend! |
Download |
Info | Screenshots | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 339 | All time: 7,080 This week: 455 |
Version | License | PHP version | Categories | |||
db-manager-logger 2.2.3 | GNU General Publi... | 5.4 | PHP 5, Databases, Logging |
Description | Author | ||||||||
This package can compose and execute MySQL queries using PDO. |
|
<p>This class provides a safe connection with database (yeah, it does use transaction) and log all actions performed daily into a single file/day.</p> <p>You can audit all queries was performed into database, with values, datetime and totally debugged by viewing the files created into ./log/ folder.</p>
<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</p>
Execute the sql file located in `
./src/`
Install [apache/log4php] using [composer].
To install, add `
apache/log4php`
to your `
composer.json`
file.
{
"require" : {
"apache/log4php": "2.3.0"
},
}
From there, use the `
composer install`
or `
composer update`
commands to install.
<?php
define('DB_HOST', 'my-host'); // define the host of mysql server
define('DB_PORT', 3306); // define the port of mysql server
define('DB_USER', 'my-user'); // define the user of mysql server
define('DB_PASS', 'my-pass'); // define the password of mysql server
define('DB_NAME', 'my-db'); // define the database name
define('DB_ENCODING', 'utf8'); // define the encoding of statements
// Assuming you installed from Composer:
require "vendor/autoload.php";
// Get the instance of DBManager:
$pdo = DBManager::getInstance();
###### INSERT STATEMENT ######
// Array with key->val pairs (columns that will be created)
$paramIns = array(
'cn1' => 'cv1',
'cn2' => 'cv2',
'cnN' => 'cvN',
);
// Creates the sql
$insert = $pdo->createInsert('tableName', $paramIns);
/*
Output: INSERT INTO tableName(cn1,cn2,cnN) VALUES (:cn1,:cn2,:cnN);
*/
$resultInsert = $pdo->query($insert);
###### UPDATE STATEMENT ######
// Array with key->val pairs (columns that will be updated)
$paramUpd = array(
'cn1' => 'cv1',
'cn2' => 'cv2'
);
// Array with columnKey => val (columns that will be used on WHERE clause)
// If null or empty, the result sql will be "UPDATE tableName SET col1 = :val1, col2 = :va2, ... colN = :valN ;"
$paramCond = array(
// The first parameter of array data is the where clause (like, equal, less, etc... [see the main class constants]])
// The second parameter of second array is the operand type (and|or) to concat with next column. Use null if the last param
'ck1' => array(DBManager::COL_EQUAL => array('cv1' => 'and')),
'ck2' => array(DBManager::COL_EQUAL => array('cv2' => null))
);
// Creates the sql
$update = $pdo->createUpdate('tableName', $paramUpd, $paramCond);
/*
Output: UPDATE tableName SET `cn1` = :cn1, `cn2` = :cn2 WHERE `ck1` = :ck1 and `ck2` = :ck2 ;
*/
$resultUpdate = $pdo->query($update);
###### DELETE STATEMENT ######
// Array with key->val pairs to where clause to delete
// If null or empty, the result sql will be "DELETE FROM tableName;"
$paramDel = array(
// The first parameter of array data is the where clause (like, equal, less, etc... [see the main class constants]])
// The second parameter of second array is the operand type (and|or) to concat with next column. Use null if the last param
'ck1' => array(DBManager::COL_EQUAL => array('cv1' => null))
);
$delete = $pdo->createDelete('tableName', $paramDel);
/*
Output: DELETE FROM table WHERE `key1` = :key1;
*/
$resultDelete = $pdo->query($delete);
###### SELECT STATEMENT ######
// Array with columns to retrieve
$paramSelect = array('cn1', 'cnN');
// Array with columnKey => value to where clause to select
// If null or empty, the result sql will be "SELECT col1, col2,... colN FROM tableName ORDER BY col1,col2,...colN;"
$paramWhere = array(
// The first parameter of array data is the where clause (like, equal, less, etc... [see the main class constants]])
// The second parameter of second array is the operand type (and|or) to concat with next column. Use null if the last param
'cn1' => array(DBManager::COL_EQUAL => array('cv1' => 'and')),
'cn2' => array(DBManager::COL_LIKE => array('cv2' => null))
);
// Array with columnKey -> value to order clause to select
// If null or empty, the result sql will be "SELECT col1, col2,... colN FROM tableName;"
$paramOrder = array(
// Fields used in order
'fields' => array('cn1', 'cn2'),
// Order type (asc|desc)
'order' => 'ASC'
);
// Creates the sql
$select = $pdo->createSelect('tableName', $paramSelect, $paramWhere, $paramOrder);
/*
Output: SELECT `cn1`, `cnN` FROM table WHERE `cn1` = :cn1 and `cn2` LIKE :cn2 ORDER BY cn1,cn2 ASC;
*/
$resultSelect = $pdo->select($select);
unset($pdo);
?>
[apache/log4php]:http://logging.apache.org/log4php/download.html [composer]:http://getcomposer.org/
Screenshots (1) | ||
Files (84) |
File | Role | Description | ||
---|---|---|---|---|
phpdoc (2 files, 9 directories) | ||||
src (2 files, 4 directories) | ||||
vendor (1 file, 2 directories) | ||||
views (2 files) | ||||
composer.json | Conf. | Composer dependencies | ||
composer.lock | Data | Auxiliary data | ||
config.xml | Data | Config for the logger | ||
index.php | Example | Index page of testing class | ||
LICENSE | Lic. | Auxiliary data | ||
README.md | Doc. | Auxiliary data |
Files (84) | / | phpdoc |
Files (84) | / | phpdoc | / | classes |
File | Role | Description |
---|---|---|
Accounts.html | Doc. | Documentation |
AccountsLogger.html | Doc. | Documentation |
DatabaseException.html | Doc. | Documentation |
DBManager.html | Doc. | Documentation |
DBManagerLogger.html | Doc. | Documentation |
Files (84) | / | phpdoc | / | css |
File | Role | Description | ||
---|---|---|---|---|
phpdocumentor-clean-icons (2 files) | ||||
bootstrap-combined.no-icons.min.css | Data | Auxiliary data | ||
font-awesome.min.css | Data | Auxiliary data | ||
jquery.iviewer.css | Data | Auxiliary data | ||
prism.css | Data | Auxiliary data | ||
template.css | Data | Auxiliary data |
Files (84) | / | phpdoc | / | css | / | phpdocumentor-clean-icons |
File | Role | Description |
---|---|---|
lte-ie7.js | Data | Auxiliary data |
style.css | Data | Auxiliary data |
Files (84) | / | phpdoc | / | files |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
index.php.txt | Doc. | Documentation |
src.Accounts.class.html | Doc. | Documentation |
src.Accounts.logger.html | Doc. | Documentation |
src.Database.class.html | Doc. | Documentation |
src.Database.exception.html | Doc. | Documentation |
Files (84) | / | phpdoc | / | images |
File | Role | Description | ||
---|---|---|---|---|
iviewer (8 files) | ||||
apple-touch-icon-114x114.png | Icon | Icon image | ||
apple-touch-icon-72x72.png | Icon | Icon image | ||
apple-touch-icon.png | Icon | Icon image | ||
custom-icons.svg | Data | Auxiliary data | ||
favicon.ico | Data | Auxiliary data | ||
hierarchy-item.png | Icon | Icon image | ||
icon-class-13x13.png | Icon | Icon image | ||
icon-class.svg | Data | Auxiliary data | ||
icon-interface-13x13.png | Icon | Icon image | ||
icon-interface.svg | Data | Auxiliary data | ||
icon-trait-13x13.png | Icon | Icon image | ||
icon-trait.svg | Data | Auxiliary data |
Files (84) | / | phpdoc | / | images | / | iviewer |
File | Role | Description |
---|---|---|
grab.cur | Data | Auxiliary data |
hand.cur | Data | Auxiliary data |
iviewer.rotate_left.png | Icon | Icon image |
iviewer.rotate_right.png | Icon | Icon image |
iviewer.zoom_fit.png | Icon | Icon image |
iviewer.zoom_in.png | Icon | Icon image |
iviewer.zoom_out.png | Icon | Icon image |
iviewer.zoom_zero.png | Icon | Icon image |
Files (84) | / | phpdoc | / | js |
File | Role | Description |
---|---|---|
bootstrap.min.js | Data | Auxiliary data |
html5.js | Data | Auxiliary data |
jquery-1.11.0.min.js | Data | Auxiliary data |
jquery.dotdotdot-1.5.9.js | Data | Auxiliary data |
jquery.dotdotdot-1.5.9.min.js | Data | Auxiliary data |
jquery.iviewer.js | Data | Auxiliary data |
jquery.iviewer.min.js | Data | Auxiliary data |
jquery.mousewheel.js | Data | Auxiliary data |
jquery.smooth-scroll.js | Data | Auxiliary data |
prism.min.js | Data | Auxiliary data |
Files (84) | / | phpdoc | / | reports |
File | Role | Description |
---|---|---|
deprecated.html | Doc. | Documentation |
errors.html | Doc. | Documentation |
markers.html | Doc. | Documentation |
Files (84) | / | src |
File | Role | Description | ||
---|---|---|---|---|
interfaces (1 file) | ||||
loggers (1 file) | ||||
main (3 files) | ||||
models (1 file) | ||||
Database.class.php | Class | Main class source | ||
Database.exception.php | Class | Class exception helper |
Files (84) | / | src | / | main |
File | Role | Description |
---|---|---|
DBLogger.class.php | Class | Class source |
DBManager.class.php | Class | Class source |
DBManager.exception.php | Class | Class source |
Files (84) | / | vendor |
File | Role | Description | ||
---|---|---|---|---|
bin (2 files) | ||||
composer (8 files) | ||||
autoload.php | Aux. | Auxiliary script |
Files (84) | / | vendor | / | bin |
File | Role | Description |
---|---|---|
phpunit | Data | Auxiliary data |
phpunit.bat | Data | Auxiliary data |
Files (84) | / | vendor | / | composer |
File | Role | Description |
---|---|---|
autoload_classmap.php | Aux. | Auxiliary script |
autoload_files.php | Aux. | Auxiliary script |
autoload_namespaces.php | Aux. | Auxiliary script |
autoload_psr4.php | Aux. | Auxiliary script |
autoload_real.php | Aux. | Auxiliary script |
ClassLoader.php | Class | Class source |
include_paths.php | Aux. | Auxiliary script |
installed.json | Data | Auxiliary data |
Files (84) | / | views |
File | Role | Description |
---|---|---|
screenshot.png | Data | Auxiliary data |
screenshot2.png | Data | Auxiliary data |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
db-manager-logger-2015-02-25.zip 538KB | |
db-manager-logger-2015-02-25.tar.gz 501KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
96% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.