Skip to content
This repository was archived by the owner on May 5, 2019. It is now read-only.

choval/builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QueryBuilder

Generates SQL queries for MySQL and SQLite.

This library helps creating safe SQL queries to use in different plugins.

Requirements

  • PHP 7.4+
  • libqlite 3.14+

Installation

composer require choval/builder

Usage

use choval\builder;

$builder = new builder;
$db = new SQLite3('my.db');
$db->query('CREATE TABLE user ( id INT PRIMARY KEY AUTO_INCREMENT, name TEXT )');

$userId = 1;
$user = $db->querySingle( $builder->get('user', $userId) );

$user['name'] = 'John';
$db->querySingle( $builder->save('user', $user) );

TODO

  • loadStructure method to load the database structure from a JSON.
  • fields method for selecting the fields to retrieve. Allow functions as well.
  • orderBy method for adding an order/sort.
  • groupBy method to add grouping.
  • having method to filter after grouping.

About

Generates SQL queries for MySQL and SQLite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors