kodus/sql-split 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kodus/sql-split

最新稳定版本:2.1.0

Composer 安装命令:

composer require kodus/sql-split

包简介

A simple facility to split SQL files into individual queries - supports MySQL and PostgreSQL

README 文档

README

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

PHP Version Build Status

Install via Composer

composer require kodus/sql-split

Features

I designed this for use with PDO and MySQL/PostgreSQL statements.

It uses a very simple recursive descent parser to minimally tokenize valid SQL - this approach ensures there is no ambiguity between quoted strings, keywords, comments, etc. but makes no attempt to validate SQL command structure or validity of the extracted statements.

It supports the following SQL/DDL features:

  • SQL and DDL Queries
  • Stored procedures, functions, views, triggers, etc.
  • PostgreSQL dollar-tags ($$ and $mytag$ delimiters)
  • The MySQL DELIMITER command

Usage

Just this:

$statements = Splitter::split(file_get_contents(...));

This will split to individual SQL statements and (by default) strip comments.

Then just loop over your $statements and run them via PDO.

That's all.

统计信息

  • 总下载量: 234.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-08