PHP Classes
elePHPant
Icontem

PHP DB Query to JSON: Run SQL in multiple database and get JSON results

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-04-20 (4 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 81 All time: 9,134 This week: 503Up
Version License PHP version Categories
db_connector 1.0.1Custom (specified...7PHP 5, Databases
Description Author

This package can connect to different databases and execute queries.

It provides a base class that has functions to connect to a database server, execute SQL queries and return query result values.

The sub-classes need to extend the base class so they can implement the support to different SQL database servers like MySQL, Microsoft SQL Server, PostgreSQL and SQLite.

The base class can also compose queries based on joins of tables and fields passed as parameters, as well return the results of a query as a string in JSON format.

  Performance   Level  
Name: Simone Gosetto <contact>
Classes: 1 package by
Country: Italy Italy

Details
I've thought to realize a set of classes ?connector? for the varius DB, starting from a one abstract class, in order that the classes have almost the same functions.

The additional functional character consists in doing a JOIN between query of different connectors
(the example is on the relevant page), so that you can have a complete array on output with the merge of that one we have outlined on the configuration of the CROSS QUERY.

Configuration:

Into the file ?config.inc.ini? you have to configurate the credentials of the varius DB, in which you want to enter on. The credentials will be used by the relatives classes.

I HAVE DONE ALL MY TESTS WITH PC WWINDOWS 7/10 WITH XAMPP AND PHP 7.2.3

###################### SQL SERVER (MSSQL) ######################

Extensions: 
    "extension=sqlsrv_72_ts_x86"
    "extension=sqlsrv_72_ts_x64"

Useful Links for the download and the configurarion of the library srvsql for PHP 7:
 - https://www.microsoft.com/en-us/download/confirmation.aspx?id=56567 
 - https://www.microsoft.com/en-us/download/confirmation.aspx?id=56729
 
############################ SQLITE ############################

Extension: "extension=php_sqlite3.dll"
  
Files utili:
 - SQLite_db_test.db -> esempio di db
  
############################# MYSQL #############################

MySql is based on the library "mysqli" standard for PHP 5+

########################## POSTGRESSQL ##########################

Extension: "extension=php_pgsql.dll"

Tested with PostgresSQL 10

#################################################################

EXAMPLES:
  Into the file ?example.php? you find all the examples of code of the varius DB
  
  Files folder image Files  
File Role Description
Accessible without login Plain text file config.inc.ini Conf. config
Accessible without login Plain text file example.php Example example script
Accessible without login Plain text file LICENSE Lic. license
Accessible without login Plain text file readme_EN.md Doc. en documentation
Accessible without login Plain text file readme_IT.md Doc. it documentation
Plain text file SG_DB.php Class db master class
Plain text file SG_MsSQL.php Class sql server class
Plain text file SG_Mysql.php Class mysql class
Plain text file SG_PostgreSQL.php Class postgresql class
Plain text file SG_SQLite.php Class sqlite class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:81
This week:0
All time:9,134
This week:503Up