gpsa/sql-dump-parser

There is no license information available for the latest version (dev-master) of this package.

SQL Dump Parser

dev-master 2018-11-17 04:18 UTC

This package is auto-updated.

Last update: 2024-09-17 17:57:30 UTC


README

Build Status

Introduction

This project aims to help on parsing SQL Dump Files.

Installation

You need Composer:

composer require gpsa/sql-dump-parser

Usage

  • Load String:

    $parser = new MySQL();
    $parser->loadString($sql, $startLine);
    
  • Load File:

     $parser = new MySQL();
     $parser->loadFile($sql, $startLine); 
    
    $startLine is optional and tells which line of file/string to start iterating
  • Iterating Queries:

     	# After loading the file/string we can Iterate and get all files
     	foreach ($parser->getNext() as $item) {
     		echo "{$item->getLine()} - {$item->getSql()}";
     	}
    

For more detailed examples, I suggest see tests folder.