All Projects → marcocesarato → PHP-Light-SQL-Parser

marcocesarato / PHP-Light-SQL-Parser

Licence: GPL-3.0 License
This class can parse SQL to get query type, tables, field values, etc.. It takes an string with a SQL statements and parses it to extract its different components. Currently the class can extract the SQL query method, the names of the tables involved in the query and the field values that are passed as parameters. This parser is pretty light re…

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to PHP-Light-SQL-Parser

go-tc
traffic control in pure go - it allows to read and alter queues, filters and classes
Stars: ✭ 245 (+965.22%)
Mutual labels:  class
sql-ddl-to-json-schema
SQL DDL to JSON Schema Converter
Stars: ✭ 138 (+500%)
Mutual labels:  sql-parser
LMPHP
Multi-language management and support on the site.
Stars: ✭ 19 (-17.39%)
Mutual labels:  class
see-you-again
😊 因为爱很重,我却不想懂,害怕被感动,只往反方向走,背对湿润瞳孔,你们请放纵,寻觅各自天空,如果输了,累了,记得转身回头 See You Again My Class~
Stars: ✭ 106 (+360.87%)
Mutual labels:  class
sqlfun
Modern SQL parser using Bison (Yacc) and Flex
Stars: ✭ 63 (+173.91%)
Mutual labels:  sql-parser
python-autoclass
A python 3 library providing functions and decorators to automatically generate class code, such as constructor body or properties getters/setters along with optional support of validation contracts on the generated setters. Its objective is to reduce the amount of copy/paste code in your classes - and hence to help reducing human mistakes :).
Stars: ✭ 30 (+30.43%)
Mutual labels:  class
dexdeps
查看dex中class, field, method内部与外部依赖
Stars: ✭ 23 (+0%)
Mutual labels:  class
toxic-decorators
Library of Javascript decorators
Stars: ✭ 26 (+13.04%)
Mutual labels:  class
ProType
A new kind of object oriented front-end JS framework.
Stars: ✭ 80 (+247.83%)
Mutual labels:  class
babel-plugin-private-underscores
Make _classMembers 'private' using symbols
Stars: ✭ 39 (+69.57%)
Mutual labels:  class
dotdoodl-kid-classes
Teaching materials for an intro to CSS animations for kids series.
Stars: ✭ 26 (+13.04%)
Mutual labels:  class
pre-class-accessors
No description or website provided.
Stars: ✭ 12 (-47.83%)
Mutual labels:  class
reducer-class
Boilerplate free class-based reducer creator. Built with TypeScript. Works with Redux and NGRX. Has integration with immer.
Stars: ✭ 25 (+8.7%)
Mutual labels:  class
core
An advanced and highly optimized Java library to build frameworks: it's useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more...
Stars: ✭ 100 (+334.78%)
Mutual labels:  class
PsNetTools
PsNetTools is a cross platform PowerShell module to test network features on Windows, Linux and Mac.
Stars: ✭ 13 (-43.48%)
Mutual labels:  class
yolov5-deepsort-tensorrt
A c++ implementation of yolov5 and deepsort
Stars: ✭ 207 (+800%)
Mutual labels:  class
JavaResolver
Java class file inspection library for .NET.
Stars: ✭ 39 (+69.57%)
Mutual labels:  class
BashClass
BashClass is an Object Oriented Programming language that compiles to BASH 4.4
Stars: ✭ 40 (+73.91%)
Mutual labels:  class
simplevk
SimpleVK это PHP библиотека для быстрой разработки ботов для VK | vk api php class bot sdk library client framework longpoll callback streaming auth
Stars: ✭ 84 (+265.22%)
Mutual labels:  class
Overview
Overview and map of the organization, for the UCSD course COGS108: Data Science in Practice.
Stars: ✭ 111 (+382.61%)
Mutual labels:  class

PHP Light SQL Parser Class

Version: 0.2.105 beta

Github: https://github.com/marcocesarato/PHP-Light-SQL-Parser-Class

Author: Marco Cesarato

Description

This class can parse SQL to get query type, tables, field values, etc..

It takes an string with a SQL statements and parses it to extract its different components.

Currently the class can extract the SQL query method, the names of the tables involved in the query and the field values that are passed as parameters. This parser is pretty light respect phpsqlparser or others php sql parser.

Requirements

  • php 4+

Install

Composer

  1. Install composer
  2. Type composer require marcocesarato/sqlparser
  3. Enjoy

Usage

$parser = new LightSQLParser("UPDATE Customers AS alias SET ContactName = 'Marco Cesarato', City = 'Milan' WHERE ID = 1;");

OR

$parser = new LightSQLParser();
$parser->setQuery("UPDATE Customers AS alias SET ContactName = 'Marco Cesarato', City = 'Milan' WHERE ID = 1;");

Method

How to retrieve the query's method:

$parser->getMethod();

Output

string(6) "UPDATE"

Tables

How to retrieve the main the query's table:

$parser->getTable();

Output

string(9) "Customers"

How to retrieve the query's tables:

$parser->getAllTables();

Output

array(1) {
  [0]=>
  string(9) "Customers"
}

Fields

How to retrieve the query's fields:

$parser->getFields();

Output

array(2) {
  [0]=>
  string(11) "ContactName"
  [1]=>
  string(4) "City"
}

Methods

LightSQLParser

Method Parameters Description
__construct Constructor
setQuery Set SQL Query string
getQuery return array Get SQL Query string
getAllQuery return string Get SQL All Query string
getMethod param $query
return string
Get SQL Query method
getFields param $query
return array
Get Query fields (at the moment only SELECTINSERTUPDATE)
getTable param $query
return string
Get SQL Query First Table
getTables return array Get SQL Query Tables
getJoinTables return array Get SQL Query Join Tables
hasJoin return bool Return if has join tables
getSubQueries return array Get all SELECT subqueries
hasSubQueries return bool Return if has subqueries
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].