tiny/sql

SQL parsing library

dev-master 2017-10-29 20:24 UTC

This package is auto-updated.

Last update: 2024-05-16 21:29:44 UTC


README

About

Currently package has single useful component with functionality to split string with multiple SQL statements into array of separate statements. Being developed mostly as helper for Tiny/DbUnit project.

Example

$inputString = 'CREATE TABLE tbl (col TEXT); INSERT INTO tbl (col) VALUES ("one;");';
$splitter = Tiny\Sql\Parsers\StatementsSplitter::make();
$statements = $splitter->parse($inputString);
foreach($statements as $statement){
    print $statement."\n";
}
// CREATE TABLE tbl (col TEXT ) ;
// INSERT INTO tbl ( col ) VALUES ( "one;" ) ;

Installing

composer require tiny/sql