git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@30 b6239004-a887-0f4b-9937-50029ccdca16
81 lines
2.6 KiB
HTML
81 lines
2.6 KiB
HTML
<html>
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="..\styles.css">
|
|
</head>
|
|
<body>
|
|
<img src="..\..\da.png" alt="" align="right">
|
|
|
|
<!-------------------------------------------------------------------------->
|
|
|
|
<p class="h1">
|
|
<span>Dynamic SQL</span>
|
|
</p>
|
|
|
|
|
|
<h2>Purpose</h2>
|
|
<p>
|
|
This demo shows how to retrieve schema and/or data via SQL generated at
|
|
runtime.
|
|
</p>
|
|
<p>
|
|
When you compile and run the server, you will see it contains a memo displaying
|
|
"<i>SQL details generated for Update will be displayed here</i>".
|
|
The
|
|
demo does not actually attempt to update server data but merely display
|
|
the fields
|
|
that would be updated by processing the delta. See the <b>TDynSQLService.UpdateData</b>
|
|
code in <b>DynSQLService_Impl</b> to see how the delta is being processed.
|
|
</p>
|
|
<p>
|
|
Having next <b>compiled and run the client</b>, the first thing to try
|
|
is clicking
|
|
on the <b>Retrieve Schema and Data</b> button and you should then see the
|
|
<b>Customers
|
|
data displayed in the grid</b>. Changing the text in the memo, e.g. to
|
|
<b>Select
|
|
* from "Order Details"</b> and clicking the button again results
|
|
in the
|
|
display of a different dataset with a totally different schema. Any of
|
|
the datasets
|
|
in the database (Northwind, by default) may be accessed in this manner.
|
|
</p>
|
|
<p>
|
|
Other points of interest:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
As their names suggest, the <b>Retrieve Schema</b> and <b>Retrieve Data</b>
|
|
buttons
|
|
achieve the same as the <b>Retrieve Schema and Data</b> button. You might
|
|
want
|
|
to use them separately if the data has the same layout as the schema already
|
|
retrieved.
|
|
For example, having retrieved all the records (<b>Max Records = -1</b>),
|
|
you can
|
|
change the number of records required and select <b>Retrieve Data</b> because
|
|
the schema is correct. If you change the actual SQL though, you will need
|
|
to reload
|
|
the schema.
|
|
</li>
|
|
<li>
|
|
<b>Save</b> and <b>Load</b> buttons. <b>Save</b> stores the schema and
|
|
data in
|
|
<b>Data.dat</b> in the sample folder. If you only want to save the schema,
|
|
set
|
|
Max Records = 0 and retrieve schema and data (otherwise Save cannot work
|
|
because
|
|
the dataset is not open). <b>Load</b> restores the schema and any records
|
|
saved
|
|
no matter what data is currently open. Thus you can think of retrieve and
|
|
load
|
|
as similar operations but with remote and local data respectively.
|
|
</li>
|
|
<li>
|
|
The <b>Update</b> button simulates updating the dataset. You can see the
|
|
result
|
|
in the memo contained in the server form.
|
|
</li>
|
|
</ul>
|
|
|
|
</body>
|
|
</html> |