WS only. Shorten all lines to 78 chars or less.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@191132 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Matthew Peters 2005-07-21 13:05:46 +00:00
parent 662aaa33aa
commit 82603ac05f
5 changed files with 575 additions and 305 deletions

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.SDO-DAS-Relational-applyChanges">
<refnamediv>
<refname>SDO_DAS_Relational::applyChanges</refname>
@ -26,8 +26,11 @@
&warn.experimental.func;
<para>
Given a PDO database handle and the special root object of a data graph, examine the change summary in the datagraph and applies the changes to the database.
The changes that it can apply can be creations of data objects, deletes of data objects, and modifications to properties of data objects.
Given a PDO database handle and the special root object of a data graph,
examine the change summary in the datagraph and applies the changes
to the database.
The changes that it can apply can be creations of data objects,
deletes of data objects, and modifications to properties of data objects.
</para>
</refsect1>
@ -39,7 +42,8 @@
<term>PDO_database_handle</term>
<listitem>
<para>
Constructed using the PDO extension. A typical line to construct a PDO database handle might look like this:
Constructed using the PDO extension.
A typical line to construct a PDO database handle might look like this:
<programlisting role="php" id="sdo.das.rel.ac.examples.pdo">
<![CDATA[
$dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PASSWORD);
@ -65,9 +69,16 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
<para>
None.
Note however that the datagraph that was passed is still intact and usable.
Furthermore, if data objects were created and written back to a table with autogenerated primary keys, then those primary keys will now be set in the data objects.
If the changes were successfully written, then the change summary associated with the datagraph will have been cleared, so that it is possible to now make further changes to the data graph and apply those changes in turn.
In this way it is possible to work with the same data graph and apply changes repeatedly.
Furthermore, if data objects were created and written back to a
table with autogenerated primary keys,
then those primary keys will now be set in the data objects.
If the changes were successfully written,
then the change summary associated with the datagraph will
have been cleared,
so that it is possible to now make further changes to the
data graph and apply those changes in turn.
In this way it is possible to work with the same data graph
and apply changes repeatedly.
</para>
</refsect1>
@ -77,19 +88,30 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
&reftitle.exceptions;
<para>
<function>SDO_DAS_Relational::applyChanges</function>
can throw an SDO_DAS_Relational_Exception if it is unable to apply all the changes correctly.
can throw an SDO_DAS_Relational_Exception if it is
unable to apply all the changes correctly.
</para>
<para>
The Relational DAS starts a database transaction before beginning to apply the changes and will commit the transaction only if they are all successful.
The Relational DAS generates qualified update and delete statements which contain a where clause that specifies that the row to be updated or deleted must contain the same values that it did when the data was first retrieved.
The Relational DAS starts a database transaction before
beginning to apply the changes and will commit
the transaction only if they are all successful.
The Relational DAS generates qualified update and delete statements
which contain a where clause that specifies that the row to be
updated or deleted must contain the same values that it did
when the data was first retrieved.
This is how the the optimistic concurrency is implemented.
If any of the qualified update or delete statements fails to update or delete their target row, it may be because the data has been altered in the database in the meantime.
In any event, if any update fails for any reason, the transaction is rolled back and an exception thrown.
If any of the qualified update or delete statements fails to update or
delete their target row, it may be because the data has been altered
in the database in the meantime.
In any event, if any update fails for any reason,
the transaction is rolled back and an exception thrown.
The exception will contain the generated SQL statement that failed.
</para>
<para>
The Relational DAS also catches any PDO exceptions and obtains PDO diagnostic information which it includes in an SDO_DAS_Relational_Exception which it then throws.
The Relational DAS also catches any PDO exceptions and obtains PDO
diagnostic information which it includes in an
SDO_DAS_Relational_Exception which it then throws.
</para>
</refsect1>
@ -102,7 +124,8 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
for many examples of calling this method.
Please see also the section on
<link linkend='sdo.das.rel.tracing'>Tracing</link>
to see how you can see what SQL statements are generated by the Relational DAS.
to see how you can see what SQL statements are
generated by the Relational DAS.
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry id="function.SDO-DAS-Relational-construct">
<refnamediv>
<refname>SDO_DAS_Relational::__construct</refname>
@ -30,7 +30,8 @@
&warn.experimental.func;
<para>
Constructs an instance of a Relational Data Access Service from the passed metadata.
Constructs an instance of a Relational Data Access Service
from the passed metadata.
</para>
</refsect1>
@ -42,7 +43,8 @@
<term>database_metadata</term>
<listitem>
<para>
An array containing one or more table definitions, each of which is an associative array containing the keys
An array containing one or more table definitions,
each of which is an associative array containing the keys
<varname>name</varname>
,
<varname>columns</varname>
@ -61,9 +63,13 @@
<term>application_root_type</term>
<listitem>
<para>
The root of each data graph is an object of a special root type and the application data objects come below that.
Of the various application types in the SDO model, one has to be the the application type immediately below the root of the data graph.
If there is only one table in the database metadata, so the application root type can be inferred, this argument can be omitted.
The root of each data graph is an object of a special root type and
the application data objects come below that.
Of the various application types in the SDO model,
one has to be the the application type immediately
below the root of the data graph.
If there is only one table in the database metadata,
so the application root type can be inferred, this argument can be omitted.
</para>
</listitem>
</varlistentry>
@ -71,14 +77,19 @@
<term>SDO_containment_references_metadata</term>
<listitem>
<para>
An array containing one or more definitions of a containment relation, each of which is an associative array containing the keys
An array containing one or more definitions of a containment relation,
each of which is an associative array containing the keys
<varname>parent</varname>
and
<varname>child</varname>
.
The containment relations describe how the types in the model are connected to form a tree.
The type specified as the application root type must be present as one of the parent types in the containment references.
If the application only needs to work with one table at a time, and there are no containment relations in the model, this argument can be omitted.
The containment relations describe how the types in the model
are connected to form a tree.
The type specified as the application root type must be present
as one of the parent types in the containment references.
If the application only needs to work with one table at a time,
and there are no containment relations in the model,
this argument can be omitted.
For a full discussion of the metadata, see the
<link linkend='sdo.das.rel.metadata'>metadata</link>
section in the general information about the Relational DAS.
@ -100,7 +111,8 @@
&reftitle.exceptions;
<para>
<function>SDO_DAS_Relational::construct</function>
throws a SDO_DAS_Relational_Exception if any problems are found in the metadata.
throws a SDO_DAS_Relational_Exception if
any problems are found in the metadata.
</para>
</refsect1>

View file

@ -1,10 +1,11 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.SDO-DAS-Relational-createRootDataObject">
<refnamediv>
<refname>SDO_DAS_Relational::createRootDataObject</refname>
<refpurpose>
Returns the special root object in an otherwise empty data graph. Used when creating a data graph from scratch.
Returns the special root object in an otherwise
empty data graph. Used when creating a data graph from scratch.
</refpurpose>
</refnamediv>
@ -15,17 +16,22 @@
<methodname>SDO_DAS_Relational::createRootDataObject</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
&warn.experimental.func;
<para>
Returns the special root object at the top of an otherwise empty data graph.
This call is used when the application wants to create a data graph from scratch, without having called
Returns the special root object at the top of an otherwise
empty data graph.
This call is used when the application wants to create a
data graph from scratch, without having called
<function>executeQuery</function>
to create a data graph.
</para>
<para>
The special root object has one multi-valued containment property, with a name of the application root type that was passed when the Relational DAS was constructed.
The special root object has one multi-valued containment property,
with a name of the application root type that was passed when
the Relational DAS was constructed.
The property can take values of only that type.
The only thing that the application can usefully do with the root type is to call
The only thing that the application can usefully do with the root
type is to call
<function>createDataObject</function>
on it, passing the name of the application root type,
in order to create a data object of their own application type.

View file

@ -1,10 +1,11 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.SDO-DAS-Relational-executeQuery">
<refnamediv>
<refname>SDO_DAS_Relational::executeQuery</refname>
<refpurpose>
Executes a given SQL query against a relational database and returns the results as a normalised data graph.
Executes a given SQL query against a relational database
and returns the results as a normalised data graph.
</refpurpose>
</refnamediv>
@ -30,8 +31,10 @@
&warn.experimental.func;
<para>
Executes a given query against the relational database, using the supplied PDO database handle.
Uses the model that it built from the the metadata to interpret the result set.
Executes a given query against the relational database,
using the supplied PDO database handle.
Uses the model that it built from the the metadata
to interpret the result set.
Returns a data graph.
</para>
</refsect1>
@ -44,7 +47,9 @@
<term>PDO_database_handle</term>
<listitem>
<para>
Constructed using the PDO extension. A typical line to construct a PDO database handle might look like this:
Constructed using the PDO extension.
A typical line to construct a PDO database handle might look
like this:
<programlisting role="php" id="sdo.das.rel.eq.examples.pdo">
<![CDATA[
$dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PASSWORD);
@ -65,9 +70,13 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
<term>column_specifier</term>
<listitem>
<para>
The Relational DAS needs to examine the result set and for every column, know which table and which column of that table it came from.
In some circumstances it can find this information for itself, but sometimes it cannot.
In these cases a column specifier is needed, which is an array that identifies the columns.
The Relational DAS needs to examine the result set and
for every column, know which table and which column of
that table it came from.
In some circumstances it can find this information for itself,
but sometimes it cannot.
In these cases a column specifier is needed,
which is an array that identifies the columns.
Each entry in the array is simply a string in the form
<varname>table-name.column_name</varname>
.
@ -75,18 +84,26 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
<para>
The column specifier is needed when there are duplicate column names in the database metadata,
For example, in the database used within the examples, all the tables have both a
The column specifier is needed when there are duplicate
column names in the database metadata,
For example, in the database used within the examples,
all the tables have both a
<varname>id</varname>
and a
<varname>name</varname>
column.
When the Relational DAS fetches the result set from PDO it can do so with the PDO_FETCH_ASSOC attribute, which will cause the columns in the results set to be labelled with the column name, but will not distinguish duplicates.
So this will only work when there are no duplicates possible in the results set.
When the Relational DAS fetches the result set from PDO
it can do so with the PDO_FETCH_ASSOC attribute,
which will cause the columns in the results set
to be labelled with the column name, but will not distinguish
duplicates.
So this will only work when there are no duplicates
possible in the results set.
</para>
<para>
To summarise, specify a column specifier array whenever there is any uncertainty about which column could be from which table and
To summarise, specify a column specifier array whenever there
is any uncertainty about which column could be from which table and
only omit it when every column name in the database metadata is unique.
</para>
@ -96,7 +113,10 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
use a column specifier.
There is one example in the
<filename>Scenarios</filename>
directory of the installation that does not: that which works with just the employee table, and because it works with just one table, there can not exist duplicate column names.
directory of the installation that does not:
that which works with just the employee table,
and because it works with just one table,
there can not exist duplicate column names.
</para>
</listitem>
</varlistentry>
@ -107,13 +127,19 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a data graph. Specifically, it returns a root object of a special type.
Returns a data graph.
Specifically, it returns a root object of a special type.
Under this root object will be the data from the result set.
The root object will have a multi-valued containment property with the same name as the application root type specified on the constructor,
and that property will contain one or more data objects of the application root type.
The root object will have a multi-valued containment property
with the same name as the application root type
specified on the constructor,
and that property will contain one or more data objects
of the application root type.
</para>
<para>
In the event that the query returns no data, the special root object will still be returned but the containment property for the application root type will be empty.
In the event that the query returns no data,
the special root object will still be returned but
the containment property for the application root type will be empty.
</para>
</refsect1>
@ -121,9 +147,14 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
&reftitle.exceptions;
<para>
<function>SDO_DAS_Relational::executeQuery</function>
can throw an SDO_DAS_Relational_Exception if it is unable to construct the data graph correctly.
This can occur for a number of reasons: for example if it finds that it does not have primary keys in the result set for all the objects.
It also catches any PDO exceptions and obtains PDO diagnostic information which it includes in an SDO_DAS_Relational_Exception which it then throws.
can throw an SDO_DAS_Relational_Exception if it is unable
to construct the data graph correctly.
This can occur for a number of reasons:
for example if it finds that it does not have primary keys
in the result set for all the objects.
It also catches any PDO exceptions and obtains PDO
diagnostic information which it includes in an
SDO_DAS_Relational_Exception which it then throws.
</para>
</refsect1>
@ -132,7 +163,8 @@ $dbh = new PDO("mysql:dbname=COMPANYDB;host=localhost",DATABASE_USER,DATABASE_PA
<para>
Please see the
<link linkend='sdo.das.rel.examples'>Examples</link>
section in the general information about the Relational DAS for many examples of calling this method.
section in the general information about the
Relational DAS for many examples of calling this method.
</para>
</refsect1>
</refentry>

File diff suppressed because it is too large Load diff