Skip to content

an be used to check a sql query is correct in syntax before actually executing a query. Can be used to verify a query should be executed at all (Secure SQL queries by checking the table name) Create SQL queries at runtime (Under Development)

Notifications You must be signed in to change notification settings

abin-andrews/Easy-PHP-Sql-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Easy-PHP-Sql-Parser

A codeigniter library for handling php-sql-parser (Note. Only for handling MySQL database queries)

Uses

Can be used to check a sql query is correct in syntax before actually executing a query. Can be used to verify a query should be executed at all (Secure SQL queries by checking the table name) Create SQL queries at runtime (Under Development)

How to Use in CodeIgniter ==================-

  1. First copy the contents into /application/libraries folder

Use the following in a controller 2. $this->load->library('sqlparser') to load the library

  1. $this->sqlparser->sql = 'Enter your query here'; if($this->sqlparser->parse()) {

       		$tableName = $this->sqlparser->getTableName();
       		
       }
    
4. $tablename will return array of tables present in the queries.

5. To get a tablename $tableName[0] (First table) name

Methods Available

getTableName()

Will return table names irrespective of what type of query is passed.

Thanks, orginal php-sql-parser library https://code.google.com/p/php-sql-parser/

MIT License 2014

About

an be used to check a sql query is correct in syntax before actually executing a query. Can be used to verify a query should be executed at all (Secure SQL queries by checking the table name) Create SQL queries at runtime (Under Development)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages