alex Mon Aug 20 14:08:52 2001 EDT
Added files:
/r2/binarycloud/user/mod/query_example QueryExample.php schema.sql
schema.xml
Log:
Andreas' Query Mod.
Index: r2/binarycloud/user/mod/query_example/QueryExample.php
+++ r2/binarycloud/user/mod/query_example/QueryExample.php
<?php
// Header {{{
/*
* -File $Id: QueryExample.php,v 1.1 2001/08/20 21:08:52 alex Exp $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2001, Entity
* -Author Andreas Aderhold, a.a...@th...
*/
// {{{ class QueryExample
/**
* This is the QueryExample class
*
*/
class QueryExample {
// {{{ method QueryExample($_params)
/**
* This method
*
* @access public
*/
function QueryExample($_params) {
$this->params = $_params;
global $QueryManager;
// doing a simple custom SELECT query
$query = array(
'QUERY' => 'SELECT newsId, news FROM news',
'ARGTYPES' => array('integer','text'),
);
$this->result = $QueryManager->DoCustomQuery($query, null, true);
return true;
}
// }}}
// {{{ method Output()
/**
* This method is responsible for output.
* Uhhrg, thats only a quick hack to demonstrate QueryManager.
*
* @access public
*/
function Output() {
echo "<table>";
echo "<th>NewsId</th>";
echo "<th>News</th>";
for ($row = 0; $row < count($this->result); $row++) {
printf("<tr valign=\"top\"><td>%s</td><td>%s</td></tr>",
$this->result[$row]['newsId'],
$this->result[$row]['news']
);
}
echo "</table>";
}
// }}}
// {{{ Vars
var $params;
// }}}
}
// }}}
?>
Index: r2/binarycloud/user/mod/query_example/schema.sql
+++ r2/binarycloud/user/mod/query_example/schema.sql
-- You have to insert these in database test
--
-- Table structure for table `news`
--
CREATE TABLE news (
newsId int(11) default NULL,
news text
) TYPE=MyISAM;
--
-- Dumping data for table `news`
--
INSERT INTO news (newsId, news) VALUES ( '1', 'Hey, Congratualtions. Querymanager is working. You are reading a database record from the query_example. See user.mod.query_example for details.');
Index: r2/binarycloud/user/mod/query_example/schema.xml
+++ r2/binarycloud/user/mod/query_example/schema.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<database>
<name>test</name>
<create>0</create>
<table>
<name>news</name>
<declaration>
<field>
<name>newsId</name>
<type>integer</type>
</field>
<field>
<name>news</name>
<type>text</type>
</field>
</declaration>
<initialization>
<insert>
<field>
<name>newsId</name>
<value>1</value>
</field>
<field>
<name>news</name>
<value>Hey, Congratualtions. Querymanager is working. You are reading a database record from the query_example. See user.mod.query_example for details..</value>
</field>
</insert>
</initialization>
</table>
</database>
|