Docs For Class SqlToArray

## SqlToArray

Description

SqlToArray class for parsing a file of somewhat structured SQL statements into an array

There are a number of limitations for this class, and it is expected that the SQL files are constructed specifically to work within these limitations:

1) A statement is terminated by a semi-colon followed by whitespace.

2) A comment is a line starting with whitespace followed by two hyphens

3) If a line contains $somestring$ then rules (1) and (2) are suspended until the next line after a line containing a matching $somestring$. Where the 'somestring' can be any sequence of letters, numbers and underscores, including the empty string.

Notable deficiency:

Any SQL quoting using ' or " is ignored. Consequently a semi-colon followed by whitespace, a $somestring$ delimiter or a comment line will be processed in the same way regardless of whether they are inside an SQL quoted string.

- author: karora

Located in /htdocs/SqlToArray.php (line 25)

Method Summary
static string removeComment (string $line)
SqlToArray __construct ( $filename)
void doNormalLine (unknown_type $s)
array getStatements ()
Methods
static removeComment (line 66)

Return the empty string if this line is an SQL comment

Limitations: Does not recognize trailing comments.

string removeComment (string $line)

- string $line

Constructor __construct (line 31)
SqlToArray __construct ( $filename)

- $filename

doNormalLine (line 81)

Add this line onto the current statement, detecting the end of the statement.

Limitations: Doesn't handle quoting very well at all, other than $delimiter$ for quoting function bodies.

void doNormalLine (unknown_type $s)

- unknown_type $s

getStatements (line 102)

Accessor for the array of parsed statements.

- return: of string

array getStatements ()

Documentation generated on Sun, 08 Jul 2012 12:53:51 +0000 by phpDocumentor 1.4.3