SQL_Parser
[ class tree: SQL_Parser ] [ index: SQL_Parser ] [ all elements ]

Class: SQL_Parser

Source Location: /SQL_Parser-0.6.0/SQL/Parser.php

Class Overview


A sql parser


Author(s):

Version:

  • Devel: 0.5

Copyright:

  • 2002-2004 Brent Cook 2005 Erich Enke

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 62]
A sql parser


[ Top ]


Class Variables

$comments = array()

[line 122]

  • Access: public

Type:   array


[ Top ]

$dialects = array(
        'ANSI',
        'MySQL',
    )

[line 134]


Type:   array


[ Top ]

$functions = array()

[line 80]


Type:   array


[ Top ]

$lexer =

[line 68]


Type:   SQL_Parser_Lexer


[ Top ]

$lexeropts = array()

[line 110]


Type:   array


[ Top ]

$notes = array()

[line 139]

  • Access: public

Type:   mixed


[ Top ]

$operators = array()

[line 98]


Type:   array


[ Top ]

$parseropts = array()

[line 116]


Type:   array


[ Top ]

$quotes = array()

[line 128]

  • Access: public

Type:   array


[ Top ]

$symbols = array()

[line 92]


Type:   array


[ Top ]

$synonyms = array()

[line 104]


Type:   array


[ Top ]

$token =

[line 74]


Type:   string


[ Top ]

$types = array()

[line 86]


Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 165]

SQL_Parser __construct( [string $string = null], [string $dialect = 'ANSI'])

Constructor

Parameters:

string   $string   —  the SQL query to parse
string   $dialect   —  the SQL dialect

[ Top ]

getParams   [line 249]

mixed getParams( array &$values, array &$types, [integer $i = 0])

extracts parameters from a function call

this function should be called if an opening brace is found, so the first call to $this->getTok() will return first param or the closing )


Parameters:

array   &$values   —  to set it
array   &$types   —  to set it
integer   $i   —  position

[ Top ]

getTok   [line 417]

void getTok( )

retrieves next token

[ Top ]

initLexer   [line 175]

void initLexer( $string)


Parameters:

   $string   — 

[ Top ]

isCommand   [line 374]

boolean isCommand( )

Returns true if current token is a command, otherwise false
  • Return: true if current token is a command
  • Access: public
  • Uses: SQL_Parser::$token - R
  • Uses: SQL_Parser::$commands - R

[ Top ]

isFunc   [line 360]

boolean isFunc( )

Returns true if current token is a function, otherwise false

[ Top ]

isOperator   [line 402]

boolean isOperator( )

Returns true if current token is an operator, otherwise false

[ Top ]

isReserved   [line 388]

boolean isReserved( )

Returns true if current token is a reserved word, otherwise false

[ Top ]

isType   [line 330]

boolean isType( )

Returns true if current token is a variable type name, otherwise false

[ Top ]

isVal   [line 343]

boolean isVal( )

Returns true if current token is a value, otherwise false

[ Top ]

parse   [line 1778]

void parse( [ $string = null])

  • Access: public

Parameters:

   $string   — 

[ Top ]

parseCondition   [line 647]


parseCreate   [line 1066]

mixed parseCreate( )


[ Top ]

parseDelete   [line 1342]

mixed parseDelete( )

DELETE FROM tablename WHERE searchclause

[ Top ]

parseDrop   [line 1377]

mixed parseDrop( )


[ Top ]

parseFieldList   [line 874]

mixed parseFieldList( )

  • Return: array parsed field list on success, otherwise Error
  • Access: public

[ Top ]

parseFieldOptions   [line 440]

array parseFieldOptions( )

Parses field/column options, usually for an CREATE or ALTER TABLE statement

[ Top ]

parseFrom   [line 1326]

void parseFrom( )

  • Access: public

[ Top ]

parseFunctionOpts   [line 1042]

mixed parseFunctionOpts( )

Parses parameters in a function call

[ Top ]

parseIdentifier   [line 1417]

void parseIdentifier( [ $type = 'column'])

[[db.].table].column [[AS] alias]
  • Access: public

Parameters:

   $type   — 

[ Top ]

parseInsert   [line 1110]

mixed parseInsert( )


[ Top ]

parseLock   [line 1619]

void parseLock( )

tbl_name [[AS] alias] lock_type[, ...]
  • Access: public

[ Top ]

parseLockType   [line 1652]

void parseLockType( )

READ [LOCAL] | [LOW_PRIORITY] WRITE
  • Access: public

[ Top ]

parseQuery   [line 1701]


parseSelect   [line 1476]

mixed parseSelect( [ $subSelect = false])


Parameters:

   $subSelect   — 

[ Top ]

parseSelectExpression   [line 758]

void parseSelectExpression( )

  • Access: public

[ Top ]

parseTableFactor   [line 1227]

void parseTableFactor( )

  • Access: public

[ Top ]

parseTableReference   [line 1242]

void parseTableReference( )

  • Access: public

[ Top ]

parseUpdate   [line 1181]

mixed parseUpdate( )

UPDATE tablename SET (colname = (value|colname) (,|WHERE searchclause))+
  • Return: array parsed update on success, otherwise Error
  • Todo: This is incorrect. multiple where clauses would parse
  • Access: public
  • Usedby: SQL_Parser::parseQuery()

[ Top ]

raiseError   [line 299]

Error raiseError( string $message)


Parameters:

string   $message   —  error message

[ Top ]

setDialect   [line 202]

mixed setDialect( string $dialect)

loads SQL dialect specific data

Parameters:

string   $dialect   —  the SQL dialect to use

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:48 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.