承接 marcocesarato/sqlparser 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

marcocesarato/sqlparser

Composer 安装命令:

composer require marcocesarato/sqlparser

包简介

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 pas

README 文档

README

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

统计信息

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

GitHub 信息

  • Stars: 31
  • Watchers: 1
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2019-05-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固