Class PhraseBook

Description

Manages associations of keyed labels to SQL queries.

This class is used to abstract the SQL languange away from the use in PHP source code. The normal usage is to load a specified phrasebook from a file at the start of a script and then to call out the phrases as needed, providing needed variable bindings as required.

The phrasebook file uses SQL style comments to allow it to be syntaxed highlighted in SQL by most editors.

  • todo: Write a SQLDoc documentation generator

Located in /include/classes/phrasebook/PhraseBook.inc (line 25)


	
			
Variable Summary
 array $phrases
Method Summary
 PhraseBook PhraseBook ([string $fileName = ""])
 mixed getQuery (string $label, [array $args = ""])
 void loadDictFile (string $filename)
 void loadDictString (string $str)
Variables
array $phrases (line 30)

a hashed association of keys/phrase pairs

Methods
Constructor PhraseBook (line 36)

PhraseBook Constructor.

PhraseBook PhraseBook ([string $fileName = ""])
  • string $fileName: if not null, attempts to load indicated phrase file
getQuery (line 90)

Retrieve an existing phrase from the phrasebok, by name

Given a key, this function returns the associated phrase or FALSE if no such phrase

  • return: the requested phrase or FALSE is not found
mixed getQuery (string $label, [array $args = ""])
  • string $label: they key to look up
  • array $args: associative array of variable replacements
loadDictFile (line 77)

Populated the PhraseBook from a file

This is the most common way to populate a phrase book.

  • todo: test for file existence
void loadDictFile (string $filename)
  • string $filename: the file to parse into the phrasebook
loadDictString (line 49)

Populates the PhraseBook from a string

This function provides all the parsing needed to load a phrase book. In normal usage, the phrase book is alwasy loaded from a file, but in rare (and testing) cases, its useful to load "raw" strings.

void loadDictString (string $str)
  • string $str: the string containing the to-be-parsed data

Documentation generated on Tue, 25 Apr 2006 13:07:43 -0400 by phpDocumentor 1.3.0RC3