Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

kodus/sql-splitter

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Statement Splitter

A simple parser to split SQL (and/or DDL) files into individual SQL queries.

This is an unofficial PHP port of SQL-Statement-Parser by TeamSQL.

PHP Version Build Status

Install via Composer

composer require kodus/sql-splitter

Features

Supported SQL File Formats:

  • MySQL
  • PostgreSQL
  • Microsoft SQL Server

Specifically with support for the following SQL/DDL features:

  • SQL and DDL Queries
  • Stored procedures, functions, views, etc.
  • PostgreSQL's dollar-tags (e.g. $$ and $mytag$, etc.)
  • MySQL's DELIMITER

Usage

Pick one of the platform-specific methods:

$statements = SQLSplitter::splitMySQL(file_get_contents(...));
$statements = SQLSplitter::splitMSSQL(file_get_contents(...));
$statements = SQLSplitter::splitPostgreSQL(file_get_contents(...));

Or dynamically pick one based on the PDO driver-name:

$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);

$statements = SQLSplitter::split($driver, file_get_contents(...));

Driver-names are also available as SQLSplitter class-constants, e.g. DB_MYSQL, DB_MSSQL and DB_PGSQL.

About

(unmaintained) A simple facility to split SQL files into individual queries - supports MySQL, PostgreSQL and Microsoft SQL Server

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.