Implements the Phrasebook pattern for SQL statements
Inherited Variables
Inherited Methods
Class Details
[line 134]
Implements the Phrasebook pattern
This class implements the phrasebook pattern, as documented by Yonat Sharon and Rani Pinchuk in their paper, The Phrasebook Pattern available at http://jerry.cs.uiuc.edu/~plop/plop2k/proceedings/Pinchuk/Pinchuk.pdf. It uses similar calls and XML document format to Rani Pinchuk's Class::Phrasebook module for Perl. The following documentation detailing the XML format is from the Class::Phrasebook module. (No reason to rewrite it)
<snip>
This class implements the Phrasebook pattern. It lets us create dictionaries of phrases. Each phrase can be accessed by a unique key. Each phrase may have placeholders. Group of phrases are kept in a dictionary. ... The phrases are kept in an XML document.
<?xml version="1.0"?>
<!DOCTYPE phrasebook [
<!ELEMENT phrasebook (dictionary)*>
<!ELEMENT dictionary (phrase)*>
<!ATTLIST dictionary name CDATA #REQUIRED>
<!ELEMENT phrase (#PCDATA)>
<!ATTLIST phrase name CDATA #REQUIRED>
]>
<phrasebook>
<dictionary name="EN">
<phrase name="HELLO_WORLD">
Hello World!!!
</phrase>
<phrase name="THE_HOUR">
The time now is $hour.
</phrase>
<phrase name="ADDITION">
add $a and $b and you get $c
</phrase>
<!-- my name is the same in English Dutch and French. -->
<phrase name="THE_AUTHOR">
Rani Pinchuk
</phrase>
</dictionary>
<dictionary name="FR">
<phrase name="HELLO_WORLD">
Bonjour le Monde!!!
</phrase>
<phrase name="THE_HOUR">
Il est maintenant $hour.
</phrase>
<phrase name="ADDITION">
$a + $b = $c
</phrase>
</dictionary>
<dictionary name="NL">
<phrase name="HELLO_WORLD">
Hallo Werld!!!
</phrase>
<phrase name="THE_HOUR">
Het is nu $hour.
</phrase>
<phrase name="ADDITION">
$a + $b = $c
</phrase>
</dictionary>
</phrasebook>
Each phrase should have a unique name. Within the phrase text we can place placeholders. When get method is called, those placeholders will be replaced by their value.