Skip to content

MyDB is a relational database based on JSON and Open Source, written 100% in PHP and from absolute zero, aims to guarantee speed and simplicity in its execution, with some SQL expressions changed.

License

Notifications You must be signed in to change notification settings

FernandoTheDev/mydb-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyDB

Logo MyDB is a relational database based on JSON and Open Source, written 100% in PHP and from absolute zero, aims to guarantee speed and simplicity in its execution, with some SQL expressions changed.

Usage - SQL

SELECT

SELECT * FROM db.table
SELECT column1 FROM db.table
SELECT column1, column2 FROM db.table

-- Support WHERE 
SELECT * FROM db.table WHERE name = Fernando 

CREATE

-- Typing and other things removed
CREATE DATABASE name

CREATE TABLE name.table (column)

CREATE TABLE name.table (
    column1,
    column2
)

INSERT

INSERT INTO database.table VALUES (bla)

INSERT INTO database.table VALUES (
    bla,
    blabla
)

UPDATE

UPDATE database.table SET column1 = value1 WHERE column2 = value2
-- Complete as far as I could do
UPDATE database.table SET column1 = value1, column4 = value4 WHERE column2 = value2 AND column3 = value3

DELETE

-- We still cannot delete specific data in the table
DELETE DATABASE name
DELETE TABLE name.table

Usage - PHP

Namespace

use Fernando\MyDB\MyDB;

Basic

use Fernando\MyDB\MyDB;

require_once __DIR__ . '/../vendor/autoload.php';

$mydb = new MyDB();
// If it exists, if not, create and add this line of code after executing the query
$mydb->setDatabase("fernando");

$mydb->prepare("SELECT * FROM users WHERE name = Mateus");
$mydb->execute();

print_r($mydb->getData());

Use in terminal, just run the parameterless ./mydb.php file without parameters.

./mydb

Tests

Open the tests folder, you will see 3 tests that I did where I create Database and tables among other things.

Additional Information

Because it is an interpreter, it executes line by line, and you can prepare several queries before finally executing, as I demonstrated in tests/three.php.

Authors:

Suport

If you want specific improvements in optimization, security and others, contact the Authors

Installation

Composer

composer require fernandothedev/mydb-php

About

MyDB is a relational database based on JSON and Open Source, written 100% in PHP and from absolute zero, aims to guarantee speed and simplicity in its execution, with some SQL expressions changed.

Resources

License

Stars

Watchers

Forks

Languages