Download the PHP package aleksey.nemiro/nemiro.data.php without Composer
On this page you can find all versions of the php package aleksey.nemiro/nemiro.data.php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aleksey.nemiro/nemiro.data.php
More information about aleksey.nemiro/nemiro.data.php
Files in aleksey.nemiro/nemiro.data.php
Package nemiro.data.php
Short Description The small helper classes for working with databases MySql and PostgreSQL.
License Apache License 2.0
Homepage https://github.com/alekseynemiro/Nemiro.Data.PHP
Informations about the package nemiro.data.php
Nemiro.Data.PHP

Nemiro.Data.PHP is a small set of utility classes for working with databases MySql and PostgreSQL.
To work with the databases used five simple methods: ExecuteNonQuery, ExecuteScalar, GetData, GetTable and GetRow.
The classes allow you to use parameterized queries, which makes working with databases secure.
Nemiro.Data.PHP is licensed under the Apache License Version 2.0.
Features
- Client for MySql;
- Client for PostgreSQL;
- A single interface to work with different data providers;
- Automatic control of database connections;
- Parameterized queries.
System Requirements
- PHP 5 >= 5.3;
- MySQL >= 5.6;
- PostgreSQL >= 7.4.
NOTE: Working with the earlier versions just has not been tested.
Supports
Further support and development of the project is not planned. Welcome to .NET ;-)
How to use the project?
The files of the project are made in Visual Studio 2013 with the extension PHP Tools for Visual Studio.
To use the classes in your own projects, it is recommended to put all the solution files in a folder \Nemiro\Data (corresponds to the namespace).
How to use the classes?
Configuration
By default, classes use the database connection settings of the following constants:
The DB_MODE may be one of the following:
- 0 - manual;
- 1 - auto - open and close for each request;
- 2 - smart (recomended).
You can use individual connection settings, which must be specified when you create an instance of a database client.
Including files
To use the database clients, you must include the following files:
or
Importing namespaces
For convenience, you can import the necessary classes in your code:
Examples of use
The following example creates a simple query to select all records from the table [messages].
Records obtained by the GetTable method, which returns an array of rows.
The following example creates a parameterized query to add records to the table [users].
The query is executed by the ExecuteScalar method, which returns the ID of added record.
The following example creates multiple queries and executed by the GetData method, which returns an array of tables.