summaryrefslogtreecommitdiff
path: root/demos/sqlmap
diff options
context:
space:
mode:
Diffstat (limited to 'demos/sqlmap')
-rw-r--r--demos/sqlmap/protected/App_Data/person.xml29
-rw-r--r--demos/sqlmap/protected/App_Data/personHelper.xml42
-rw-r--r--demos/sqlmap/protected/App_Data/test.dbbin5120 -> 3072 bytes
-rw-r--r--demos/sqlmap/protected/pages/Sample/Home.page7
-rw-r--r--demos/sqlmap/protected/pages/Sample/ProductList.page9
-rw-r--r--demos/sqlmap/protected/pages/Sample/ProductList.php18
-rw-r--r--demos/sqlmap/protected/pages/Sample/crud1.php6
-rw-r--r--demos/sqlmap/protected/pages/Sample/crud2.php9
8 files changed, 36 insertions, 84 deletions
diff --git a/demos/sqlmap/protected/App_Data/person.xml b/demos/sqlmap/protected/App_Data/person.xml
index 4ffe44d9..b5b94175 100644
--- a/demos/sqlmap/protected/App_Data/person.xml
+++ b/demos/sqlmap/protected/App_Data/person.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap>
+
+<sqlMapConfig>
<select id="SelectAll" resultClass="Person">
SELECT
@@ -9,8 +10,30 @@
per_birth_date as BirthDate,
per_weight_kg as WeightInKilograms,
per_height_m as HeightInMeters
- FROM
+ FROM
person
</select>
-</sqlMap> \ No newline at end of file
+ <insert id="Insert" parameterClass="Person">
+ insert into PERSON
+ (PER_FIRST_NAME, PER_LAST_NAME, PER_BIRTH_DATE, PER_WEIGHT_KG, PER_HEIGHT_M)
+ values
+ (#FirstName#, #LastName#, #BirthDate#, #WeightInKilograms#, #HeightInMeters#)
+ </insert>
+
+ <update id="Update" parameterClass="Person">
+ update PERSON set
+ PER_FIRST_NAME = #FirstName#,
+ PER_LAST_NAME = #LastName#,
+ PER_BIRTH_DATE = #BirthDate#,
+ PER_WEIGHT_KG = #WeightInKilograms#,
+ PER_HEIGHT_M = #HeightInMeters#
+ where PER_ID = #ID#
+ </update>
+
+ <delete id="Delete" parameterClass="int">
+ delete from PERSON
+ where PER_ID = #value#
+ </delete>
+
+</sqlMapConfig>
diff --git a/demos/sqlmap/protected/App_Data/personHelper.xml b/demos/sqlmap/protected/App_Data/personHelper.xml
deleted file mode 100644
index ea2d4302..00000000
--- a/demos/sqlmap/protected/App_Data/personHelper.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<sqlMap Name="PersonHelper">
-
- <select id="Select" parameterClass="int" resultClass="Person">
- select
- PER_ID as ID,
- PER_FIRST_NAME as FirstName,
- PER_LAST_NAME as LastName,
- PER_BIRTH_DATE as BirthDate,
- PER_WEIGHT_KG as WeightInKilograms,
- PER_HEIGHT_M as HeightInMeters
- from PERSON
- WHERE
- PER_ID = #value#
- </select>
-
- <insert id="Insert" parameterClass="Person">
- insert into PERSON
- (PER_ID, PER_FIRST_NAME, PER_LAST_NAME,
- PER_BIRTH_DATE, PER_WEIGHT_KG, PER_HEIGHT_M)
- values
- (#ID#, #FirstName#, #LastName#,
- #BirthDate#, #WeightInKilograms#, #HeightInMeters#)
- </insert>
-
- <update id="Update" parameterClass="Person">
- update PERSON set
- PER_FIRST_NAME = #FirstName#,
- PER_LAST_NAME = #LastName#,
- PER_BIRTH_DATE = #BirthDate#,
- PER_WEIGHT_KG = #WeightInKilograms#,
- PER_HEIGHT_M = #HeightInMeters#
- where PER_ID = #ID#
- </update>
-
- <delete id="Delete" parameterClass="int">
- delete from PERSON
- where PER_ID = #value#
- </delete>
-
-</sqlMap>
diff --git a/demos/sqlmap/protected/App_Data/test.db b/demos/sqlmap/protected/App_Data/test.db
index a40c91fe..8778160a 100644
--- a/demos/sqlmap/protected/App_Data/test.db
+++ b/demos/sqlmap/protected/App_Data/test.db
Binary files differ
diff --git a/demos/sqlmap/protected/pages/Sample/Home.page b/demos/sqlmap/protected/pages/Sample/Home.page
index 6d059c7e..37e59b42 100644
--- a/demos/sqlmap/protected/pages/Sample/Home.page
+++ b/demos/sqlmap/protected/pages/Sample/Home.page
@@ -1,5 +1,4 @@
<ul>
- <li><a href="index.php?page=crud1">Tutorial 1</a></li>
- <li><a href="index.php?page=crud2">Tutorial 2</a></li>
- <li><a href="index.php?page=ProductList">Product List</a></li>
-</ul> \ No newline at end of file
+ <li><a href="index.php?page=Sample.crud1">Tutorial 1</a></li>
+ <li><a href="index.php?page=Sample.crud2">Tutorial 2</a></li>
+</ul> \ No newline at end of file
diff --git a/demos/sqlmap/protected/pages/Sample/ProductList.page b/demos/sqlmap/protected/pages/Sample/ProductList.page
deleted file mode 100644
index 904d411d..00000000
--- a/demos/sqlmap/protected/pages/Sample/ProductList.page
+++ /dev/null
@@ -1,9 +0,0 @@
-<h1>Database Examples</h1>
-<com:TRepeater id="productList">
- <prop:ItemTemplate>
- <div>
- Code: <%# $this->DataItem['productid'] %>
- Category: <%# $this->DataItem['category'] %>
- </div>
- </prop:ItemTemplate>
-</com:TRepeater> \ No newline at end of file
diff --git a/demos/sqlmap/protected/pages/Sample/ProductList.php b/demos/sqlmap/protected/pages/Sample/ProductList.php
deleted file mode 100644
index a35c40ea..00000000
--- a/demos/sqlmap/protected/pages/Sample/ProductList.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-class ProductList extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $sqlmap = $this->Application->Modules['petshop-sqlmap'];
- $products = $sqlmap->queryForList('SelectAllProducts');
- $this->productList->setDataSource($products);
- $this->productList->dataBind();
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/demos/sqlmap/protected/pages/Sample/crud1.php b/demos/sqlmap/protected/pages/Sample/crud1.php
index 40733dc9..9ea6e05e 100644
--- a/demos/sqlmap/protected/pages/Sample/crud1.php
+++ b/demos/sqlmap/protected/pages/Sample/crud1.php
@@ -6,13 +6,13 @@ class crud1 extends TPage
{
private function loadData()
{
- $sqlmap = $this->Application->Modules['person-sample'];
+ $sqlmap = $this->Application->Modules['person-sample']->Client;
$this->personList->DataSource = $sqlmap->queryForList('SelectAll');
- $this->personList->dataBind();
+ $this->personList->dataBind();
}
public function onLoad($param)
- {
+ {
if(!$this->IsPostBack)
$this->loadData();
}
diff --git a/demos/sqlmap/protected/pages/Sample/crud2.php b/demos/sqlmap/protected/pages/Sample/crud2.php
index 46fe3893..3d2087bb 100644
--- a/demos/sqlmap/protected/pages/Sample/crud2.php
+++ b/demos/sqlmap/protected/pages/Sample/crud2.php
@@ -6,18 +6,17 @@ class crud2 extends TPage
{
private function sqlmap()
{
- return $this->Application->Modules['person-sample'];
+ return $this->Application->Modules['person-sample']->Client;
}
private function loadData()
{
- $this->personList->DataSource =
- $this->sqlmap()->queryForList('SelectAll');
+ $this->personList->DataSource = $this->sqlmap()->queryForList('SelectAll');
$this->personList->dataBind();
}
public function onLoad($param)
- {
+ {
if(!$this->IsPostBack)
$this->loadData();
}
@@ -44,7 +43,7 @@ class crud2 extends TPage
$person->HeightInMeters = $this->getText($param, 2);
$person->WeightInKilograms = $this->getText($param, 3);
$person->ID = $this->getKey($sender, $param);
-
+
$this->sqlmap()->update("Update", $person);
$this->refreshList($sender, $param);
}