Download the PHP package marcocesarato/cpdo without Composer

On this page you can find all versions of the php package marcocesarato/cpdo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cpdo

CPDO - Cache PDO Query Class

Version: 0.2.3.47 beta

Github: https://github.com/marcocesarato/PHP-CPDO

Author: Marco Cesarato

Description

This package can retrieve PDO query results from cache variables.

It extends the base PDO class and override some functions to handle database query execution and store the query results in variables.

The class can also return query results for cached queries for previously executed queries to retrieve the results faster for repeated queries.

It permit to have cached SELECT/SHOW/DESCRIBE queries on Memory (RAM). Then after the execution the cache will be deleted.

Cache is cleaned on INSERT/UPDATE/DELETE/TRUNCATE... only for the single table.

What problem this solves

When we call the same query (for example on ORM based system) we retrieve from the database the same data doing the same operation and some time we overload the database server (for example retrieving big data multiple times).

This class prevent to do the same query on the database, retrieving the data from memory without overload the database server in some cases.

Requirements

Databases supported (CPDO::connect)

Install

Composer

  1. Install composer
  2. Type composer require marcocesarato/cpdo
  3. Enjoy

Usage

You have to use this class as PDO.

CPDO introduced these new methods:

Method connect

This feature is a DSN autogeneration and you have to use it instead of the constructor.

Usage of connect

Method getTables

Return the names of all database tables as array

Method backup

You can backup Data (At the moment no TRIGGERS, VIEWS and EVENTS if you need it you can request it to the developer). You can choose if you want the tables you want backup through an array.

Usage of backup

Cache

You can disable/enable the cache using the following methods (default is disabled):

or

Methods available:

Debugger

You can enable/disable the debugger using the following methods (default is enabled):

or

Methods available:

Example of complete logs getLogs()

(Not recommended) Persistent cache

PS: this usage is not recommended!!!

If you want a persitent you can use the method CPDOCache::populate for populate the cache and CPDOCache::retrieve for retrieve the cache.

Thanks these methods you could implement a persistent cache system saving the data encoded (with json or serialization) and after restore the cache.

Pro:

Cons:

Example of usage

Methods

CPDO

Same methods of PDO in additions the following:

Methods Parameters Description
connect param $database_type
param null $database_name
param null $database_host
param null $database_user
param null $database_pswd
param null $database_charset
return bool|static
Autogeneration of the DSN
enableDebug Enable debug
disableDebug Disable debug
enableCache Enable cache
disableCache Disable cache
getTables return array|bool Get list of database tables
backup param string $tables Backup database tables or just a table
escape param string $value Escape variable

CPDOLogger

Methods Parameters Description
enable Enable logs
disable Disable logs
isEnabled return bool Return if logs are enabled
addLog param $query
param $time
param $cache
Add new log
getLogs return array Get Logs
getCounter return int Get Counter
getQueries return array Get Counter
cleanLogs Clean Logs

CPDOCache

Methods Parameters Description
disable Disable cache
isEnabled return bool Return if cache is enabled
populate param $mixed
return bool
Populate cache
retrieve return array Retrieve Cache
getExceptions return array Get all excluded tables
addException param $exclude Add exception
addExceptions param $exclude Add exceptions
setcache param $query
param $value
param null $arg
Set Cache
getcache param $query
param null $arg
return null
Get Cache
deletecache param $query Delete Cache

All versions of cpdo with dependencies

PHP Build Version
Package Version
Requires php Version >=5.1.2
ext-pdo Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package marcocesarato/cpdo contains the following files

Loading the files please wait ....