This repository has been archived by the owner on May 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix, and performance improvments
- Loading branch information
Showing
8 changed files
with
386 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
/composer.phar | ||
/test.py | ||
/__pycache__ | ||
/src/__pycache__ | ||
/src/__pycache__ | ||
/test_AMPPHP.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# JDBI Client (PHP) | ||
Front-end to take request to JDB Core | ||
|
||
## Requirements: | ||
- **PHP > 7.4** | ||
- **PHP Memcache** | ||
- **JDB Core Running** | ||
- **Memcached Server Running** | ||
|
||
## Introduction | ||
For first initialize the **JDB Sock Connection** to **Memcached Server** | ||
``` php | ||
use laky64\database\JDBI; | ||
include 'vendor/autoload.php'; | ||
$JDBI = new JDBI('ip_memcached_server', 'port_memcached_server'); //Start Connection | ||
... | ||
$JDBI -> close(); //Close connection | ||
``` | ||
#### Show Processlist | ||
Show processlist, return array on success and null on failure | ||
``` php | ||
... | ||
$JDBI->query('SHOW PROCESSLIST;'); | ||
... | ||
``` | ||
#### Make Database | ||
For make database, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('CREATE DATABASE `database_name` PASSWORD `database_password`;'); | ||
... | ||
``` | ||
#### Drop Database | ||
For drop database, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('DROP DATABASE `database_name`;'); | ||
... | ||
``` | ||
#### Connect to Database | ||
For connect to database, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI -> connect('database_name','database_password'); | ||
... | ||
``` | ||
#### Make Table | ||
For make table **(Need connection to database)**, return true on success and false on failure | ||
##### With Auto-Increment primary key | ||
``` php | ||
... | ||
$JDBI->query('CREATE TABLE `table_name` (`column1`, `column2`, `column3`) AS PRIMARY `column1` TYPE `AUTO_INCREMENT`;'); | ||
... | ||
``` | ||
##### With Defined primary key | ||
``` php | ||
... | ||
$JDBI->query('CREATE TABLE `table_name` (`column1`, `column2`, `column3`) AS PRIMARY `column1` TYPE `DEFINED`;'); | ||
... | ||
``` | ||
#### Drop Table | ||
For drop table **(Need connection to database)**, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('DROP TABLE `table_name`;'); | ||
... | ||
``` | ||
#### Show all Table | ||
Show all tables **(Need connection to database)**, return array on success and null on failure | ||
``` php | ||
... | ||
$JDBI->query('SHOW TABLES;'); | ||
... | ||
``` | ||
#### Dump Table | ||
Dump Row **(Need connection to database)**, return array on success and null on failure | ||
``` php | ||
... | ||
$JDBI->query('SELECT * FROM `table_name`;'); | ||
... | ||
``` | ||
#### Add Column | ||
Add Column **(Need connection to database)**, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('ALTER TABLE `table_name` ADD COLUMN (`column1`, `column2`);'); | ||
... | ||
``` | ||
#### Drop Column | ||
Add Column **(Need connection to database)**, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('ALTER TABLE `table_name` DROP COLUMN (`column1`, `column2`);'); | ||
... | ||
``` | ||
#### Insert Row | ||
Insert Row **(Need connection to database)**, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('INSERT INTO `table_name` (`column1`, `column2`, `column3`) VALUES (`value1`, `value2`, `value3`);'); | ||
... | ||
``` | ||
#### Update Row | ||
Insert Row **(Need connection to database)**, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('UPDATE `table_name` SET (`column1`, `column2`) VALUES (`value1`, `value2`) WHERE `column` IS `value`;'); | ||
... | ||
``` | ||
#### Delete Row | ||
Delete Row **(Need connection to database)**, return true on success and false on failure | ||
``` php | ||
... | ||
$JDBI->query('DELETE FROM `table_name` WHERE `column` IS `value`;'); | ||
... | ||
``` | ||
#### Dump Row | ||
Dump Row **(Need connection to database)**, return array on success and null on failure | ||
``` php | ||
... | ||
$JDBI->query('SELECT * FROM `table_name` WHERE `column` IS `value`;'); | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# JDBI Client (Python) | ||
Front-end to take request to JDB Core | ||
|
||
## Requirements: | ||
- **PHP > 7.4** | ||
- **PHP Memcache** | ||
- **Python > 3.9** | ||
- **JDB Core Running** | ||
- **Memcached Server Running** | ||
|
||
## Introduction | ||
For first initialize the **JDB Sock Connection** to **Memcached Server** | ||
``` python | ||
from vendor.laky64.jdb.src.JDBI import JDBI | ||
JDBI_CLASS = JDBI('ip_memcached_server', 'port_memcached_server') | ||
``` | ||
#### Show Processlist | ||
Show processlist, return array on success and None on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('SHOW PROCESSLIST;') | ||
... | ||
``` | ||
#### Make Database | ||
For make database, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('CREATE DATABASE `database_name` PASSWORD `database_password`;') | ||
... | ||
``` | ||
#### Drop Database | ||
For drop database, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('DROP DATABASE `database_name`;') | ||
... | ||
``` | ||
#### Connect to Database | ||
For connect to database, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.connect('database_name','database_password') | ||
... | ||
``` | ||
#### Make Table | ||
For make table **(Need connection to database)**, return true on success and false on failure | ||
##### With Auto-Increment primary key | ||
``` python | ||
... | ||
JDBI_CLASS.query('CREATE TABLE `table_name` (`column1`, `column2`, `column3`) AS PRIMARY `column1` TYPE `AUTO_INCREMENT`;') | ||
... | ||
``` | ||
##### With Defined primary key | ||
``` python | ||
... | ||
JDBI_CLASS.query('CREATE TABLE `table_name` (`column1`, `column2`, `column3`) AS PRIMARY `column1` TYPE `DEFINED`;') | ||
... | ||
``` | ||
#### Drop Table | ||
For drop table **(Need connection to database)**, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('DROP TABLE `table_name`;') | ||
... | ||
``` | ||
#### Show all Table | ||
Show all tables **(Need connection to database)**, return array on success and None on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('SHOW TABLES;') | ||
... | ||
``` | ||
#### Dump Table | ||
Dump Row **(Need connection to database)**, return array on success and None on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('SELECT * FROM `table_name`;') | ||
... | ||
``` | ||
#### Add Column | ||
Add Column **(Need connection to database)**, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('ALTER TABLE `table_name` ADD COLUMN (`column1`, `column2`);') | ||
... | ||
``` | ||
#### Drop Column | ||
Add Column **(Need connection to database)**, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('ALTER TABLE `table_name` DROP COLUMN (`column1`, `column2`);') | ||
... | ||
``` | ||
#### Insert Row | ||
Insert Row **(Need connection to database)**, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('INSERT INTO `table_name` (`column1`, `column2`, `column3`) VALUES (`value1`, `value2`, `value3`);') | ||
... | ||
``` | ||
#### Update Row | ||
Insert Row **(Need connection to database)**, return true on success and false on failure | ||
``` python | ||
... | ||
$JDBI->query('UPDATE `table_name` SET (`column1`, `column2`) VALUES (`value1`, `value2`) WHERE `column` IS `value`;'); | ||
... | ||
``` | ||
#### Delete Row | ||
Delete Row **(Need connection to database)**, return true on success and false on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('DELETE FROM `table_name` WHERE `column` IS `value`;') | ||
... | ||
``` | ||
#### Dump Row | ||
Dump Row **(Need connection to database)**, return array on success and None on failure | ||
``` python | ||
... | ||
JDBI_CLASS.query('SELECT * FROM `table_name` WHERE `column` IS `value`;') | ||
... | ||
``` |
Oops, something went wrong.