Download the PHP package mfn/cakephp2-postgres-no-meta without Composer

On this page you can find all versions of the php package mfn/cakephp2-postgres-no-meta. 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 cakephp2-postgres-no-meta

CakePHP2 - Postgres driver with custom adaptions

This driver was changed in the following ways:

1) The default CakePHP 2.x Postgres driver uses getColumnMeta to infer column types from the server. Although the PHP part has been optimized in recent years [1], it still incurs an overhead to hit the Postgres database on every call with a query like SELECT RELNAME FROM PG_CLASS WHERE OID=... [2]

Thus, this implementation is born which foregoes any use of the meta data and simply uses PDO::FETCH_ASSOC.

2) There's a problem with special crafted SQL statements which contain the \ character [3] which actually isn't CakePHP specific but a problem of the underlying PDO/PgSQL driver [4].

The method \Postgres::value() was overriden to apply the special C-style escape operation to strings [5].

3) The default PHP/PDO lastInsertId always returns a string. This driver is adapted to return an integer if is_numeric returns true on it. This allows easier integration with codebases using strict_types=1.

Requirements and Installation

  1. You need at least CakePHP 2.10.12
    For CakePHP >= 2.0 and < 2.10.12 , you can use version 0.0.2 of this package
  2. Add the line "mfn/cakephp2-postgres-no-meta": "^0.0.6" to your app/composer.json
  3. Run php composer.phar require mfn/cakephp2-postgres-no-meta
  4. Load the plugin in app/Config/bootstrap.php with the line

  5. Use the driver in your app/Config/database.php: PostgresNoMeta.Database/PostgresNoMeta (instead of Database/Postgres)
  6. Profit!

Rational

During the switch of a big application from MySQL to Postgres it was discovered that much overhead was lost on Postgres and it was finally discovered that these meta queries incur a measurable overhead.

The individual queries are very fast but, depending on your queries, they may add up until a measurable point.

In our case there were performance improvement of up to 50% without any additional changes except activating this class. YMMV.

A little bit later also found problems with the generated SQL statements, which in special cases were translated from:

to

before sent to the server, causing various problems.

Further reference


All versions of cakephp2-postgres-no-meta with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
composer/installers 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 mfn/cakephp2-postgres-no-meta contains the following files

Loading the files please wait ....