PHP Classes

File: dbAccess.xml

Recommend this page to a friend!
  Classes of Claudius Tiberiu Iacob   DbProxy   dbAccess.xml   Download  
File: dbAccess.xml
Role: Auxiliary data
Content type: text/plain
Description: See "HowToInstall.txt" for info
Class: DbProxy
Execute MySQL queries from SQL defined in XML
Author: By
Last change:
Date: 13 years ago
Size: 2,142 bytes


Class file image Download
<config for="DbProxyDemo"> <!-- Connection data for class DbProxyDemo --> <param> <name>connection</name> <type>array</type> <value> <item key="dbName" type="string">DbProxyDemo</item> <item key="dbHost" type="string">localhost</item> <item key="dbUser" type="string">test</item> <item key="dbPassword" type="string">1234</item> </value> </param> <!-- Create the 'employees' demo table: --> <param> <name>createDemoTable</name> <type>array</type> <value> <item key="queryParams" type="string"> MALE, FEMALE </item> <item key="queryTemplate"> <![CDATA[ create table if not exists `employees` ( `uid` int not null auto_increment, `firstName` varchar(255) not null, `middleName` varchar(255) default null, `lastName` varchar(255) not null, `age` int not null, `sex` enum('%MALE%','%FEMALE%') not null, `job` varchar(255) not null, `salary` int not null, primary key (`uid`) ); ]]> </item> <item key="queryResultType" type="string">null</item> </value> </param> <!-- List all entries: --> <param> <name>getEmployees</name> <type>array</type> <value> <item key="queryParams" type="null" /> <item key="queryTemplate"> <![CDATA[ select * from `employees`; ]]> </item> <item key="queryResultType" type="string">array</item> </value> </param> <!-- Add a new entry: --> <param> <name>addEmployee</name> <type>array</type> <value> <item key="queryParams" type="string"> FIRST_NAME, MIDDLE_NAME, LAST_NAME, AGE, SEX, JOB, SALARY </item> <item key="queryTemplate"> <![CDATA[ insert into `employees` ( `firstName`, `middleName`, `lastName`, `age`, `sex`, `job`, `salary` ) values ( "%FIRST_NAME%", "%MIDDLE_NAME%", "%LAST_NAME%", %AGE%, "%SEX%", "%JOB%", %SALARY% ); ]]> </item> <item key="queryResultType" type="string">null</item> </value> </param> </config>