List:Commits« Previous MessageNext Message »
From:plavin Date:August 10 2007 2:45am
Subject:svn commit - mysqldoc@docsrva: r7409 - trunk/userguide
View as plain text  
Author: plavin
Date: 2007-08-10 02:45:36 +0200 (Fri, 10 Aug 2007)
New Revision: 7409

Log:
Work on final section


Modified:
   trunk/userguide/php-pdo.xml


Modified: trunk/userguide/php-pdo.xml
===================================================================
--- trunk/userguide/php-pdo.xml	2007-08-09 22:33:33 UTC (rev 7408)
+++ trunk/userguide/php-pdo.xml	2007-08-10 00:45:36 UTC (rev 7409)
Changed blocks: 10, Lines Added: 80, Lines Deleted: 53; 9702 bytes

@@ -22,8 +22,8 @@
       regardless of the MySQL version. This does away with the need for
       using the standard MySQL extension with older versions of MySQL
       and using the MySQLi extension for later versions. An additional
-      advantage is the ability to use object-oriented code regardless
-      of the version of MySQL.
+      advantage is the ability to use object-oriented code regardless of
+      the version of MySQL.
     </para>
 
     <para>

@@ -57,6 +57,12 @@
       regardless of your operating system.
     </para>
 
+    <para>
+      The PDO extension is entirely object-oriented, there is no
+      procedural version of this extension, so some knowledge of
+      object-oriented programming is assumed.
+    </para>
+
   </section>
 
   <section id="project-outline">

@@ -64,12 +70,6 @@
     <title>Project Outline</title>
 
     <para>
-      The PDO extension is entirely object-oriented, there is no
-      procedural version of this extension, so some knowledge of
-      object-oriented programming is assumed.
-    </para>
-
-    <para>
       The project examined in this article uses PDO to select from and
       insert into a database of PHP classes. XML representations of PHP
       classes, both internal and user-defined, are transformed into SQL

@@ -77,10 +77,14 @@
     </para>
 
     <para>
-      Even if your XML skills are weak, you'll find the SimpleXMLElement
-      easy to understand and use. blah blah
+      Even if your grasp of XML skills is shaky, you'll find the
+      SimpleXMLElement easy to understand and use.
     </para>
 
+    <para>
+      All the compressed files included and dir structure
+    </para>
+
   </section>
 
   <section id="xml-document-format">

@@ -88,11 +92,11 @@
     <title>The XML Document Format</title>
 
     <para>
-      Using PHP's reflection classes you can automate building an XML
-      file of a PHP class. We won't concern ourselves here with the
-      details of how to do this; we'll review an example file in this
-      section and include other examples in the appendix at the end of
-      this article. However, our treatment is constrained by the
+      Using PHP's reflection classes you can automate the process of
+      converting a PHP class to XML We won't concern ourselves here with
+      the details of how to do this; we'll review an example file in
+      this section and include other examples in the appendix at the end
+      of this article. However, our treatment is constrained by the
       capabilities of the reflection classes. For example, Javadoc style
       comments can be captured for user-defined classes, methods, and
       data members but not for constants.

@@ -152,9 +156,10 @@
 </programlisting>
 
     <para>
-      Not all methods or data members are included but there's enough
-      detail to form an idea of what any XML representation of a PHP
-      class might look like.
+      Not all methods or data members of the
+      <literal>mysqli_sql_exception</literal> class are included but
+      there's enough detail here to form an idea of what any XML
+      representation of a PHP class might look like.
     </para>
 
     <para>

@@ -404,13 +409,17 @@
     </para>
 
     <para>
-      The names of existing XML class files are copied from a directory
-      into an array. This is done using a user-defined class,
-      <literal>DirectoryItems</literal>, that copies the names of files
-      in a specified directory (<filename>xml</filename> in this
-      particular case) into an array. This array is compared to the
-      classes already contained in the database to create a drop-down
-      list of classes that aren't yet included.
+      Existing XML class files are found in a directory named
+      <literal>xml</literal>. The XML file name (excluding the
+      <literal>xml</literal> extension) matches the corresponding PHP
+      class name. These names are copied from the <filename>xml
+      </filename> directory into an array. This is done using a
+      user-defined class, <literal>DirectoryItems</literal>, that copies
+      the names of files in a specified directory
+      (<filename>xml</filename> in this particular case) into an array.
+      This array is compared to the classes already contained in the
+      database to create a drop-down list of classes that aren't yet
+      included. The code follows.
     </para>
 
 <programlisting>

@@ -467,22 +476,19 @@
       PDO::ERRMODE_EXCEPTION);</literal> ensures the creation of
       exceptions rather than errors . In order to set the error mode you
       need to create a connection object first. Consequently, failure to
-      create a connection cannot itself throw an exception.
-    </para>
-
-    <para>
-      The <literal>setAttribute</literal> method performs a number of
+      create a connection cannot itself throw an exception. (The
+      <literal>setAttribute</literal> method performs a number of
       functions besides setting the error type. it can be used to force
       column names to upper or lower case and also to set
       database-specific capabilities such as
-      <literal>MYSQL_ATTR_USE_BUFFERED_QUERY</literal>.
+      <literal>MYSQL_ATTR_USE_BUFFERED_QUERY</literal>.)
     </para>
 
     <para>
-      In this case the requirements are fairly simple; use the
-      <literal>query</literal> method of a PDO connection to retrieve
-      the name field of all the classes currently stored in the
-      database.
+      The database operation that needs to be carried out here is fairly
+      simple; use the <literal>query</literal> method of a PDO
+      connection to retrieve the name field of all the classes currently
+      stored in the database.
     </para>
 
     <para>

@@ -499,17 +505,17 @@
       <literal>array-diff</literal>, for determining elements that are
       in one array but not another, capturing the result set as an array
       seems the better solution. Our query only retrieves one field so
-      we can create a one dimensional array by using the
-      <literal>fetchAll</literal> method, specifying the mode as
-      <literal>PDO::FETCH_COLUMN</literal> and the target column as the
-      first and only column, <literal>0</literal>.
+      we can create a one dimensional array of all the records returned
+      by using the <literal>fetchAll</literal> method, specifying the
+      mode as <literal>PDO::FETCH_COLUMN</literal> and the target column
+      as the first and only column, <literal>0</literal>.
     </para>
 
     <para>
       Using the appropriate method to fetch query results makes it easy
       to populate a drop-down list box with XML files that are not yet
       included in the database. The next section looks at inserting data
-      into a database.
+      from these XML files into a database.
     </para>
 
   </section>

@@ -519,37 +525,58 @@
     <title>Moving XML Data into a Database</title>
 
     <para>
-      The <literal>action</literal> attribute of the form in the the
-      previous section is <filename>add_record.php</filename>. This is
-      the file that inserts records into the tables.
+      The form discussed in the previous section invokes the
+      <filename>add_record.php</filename> script. This script contains
+      the code that inserts records into the database tables. You might
+      want to have a quick look at this page to get an overview of what
+      it does. We won't discuss every line of code, we'll concentrate on
+      the PDO code and only on methods that haven't yet been discussed.
     </para>
 
     <para>
-      Converting an XML document of a PHP class into a database format
-      is done using the XMLFormatToSQL class. This class creates a
-      SimpleXMLElement object and uses its methods to generate the SQL
+      This page makes use an ad hoc class, XMLFormatToSQL . This class
+      uses a SimpleXMLElement object and its methods to generate the SQL
       necessary to insert records into the <literal>phpclasses</literal>
-      database.
+      database. The SimpleXML extension is enabled by default so it
+      should be available unless you've compiled from source and
+      deliberately disabled it.
     </para>
 
     <para>
-      Simply put, this class first creates a record in the
+      Simply put, the XMLFormatToSQL class first creates a record in the
       <literal>tblclasses</literal> table, retrieves the id number of
       this record and then, if necessary, creates the related entries in
       the other tables in the database. To examine the details of this
       class see the <filename>XMLFormatToSQL.php</filename> file.
-      (Extending the <literal>SimpleXMLElement</literal> class might be
-      a simpler option but its constructor is final so can't be
-      overridden.)
     </para>
 
     <para>
-      Cover the methods that we haven't yet covered
+      The first unfamiliar method used by the
<filename>add_record.php</filename> script
+      is the <literal>beginTransaction</literal> method. By using
transactions we
+      can ensure that all tables related to a specific class are ...
+      
     </para>
+    
+    <para>
+      should an exception be thrown 
+      rollBack
+    </para>
 
     <para>
-      create SimpleXMLElement
+      
+      are dependent on the id created for the class in the tblclasses table
+      
+      <literal>lastInsertId</literal> method 
     </para>
+    
+    <para>
+      the <literal>createInterfacesSQL</literal> method of the 
+    </para>
+    
+    <para>
+      the <literal>createMethodsSQL</literal> returns an array of individual
+      
+    </para>
 
   </section>
 


Thread
svn commit - mysqldoc@docsrva: r7409 - trunk/userguideplavin10 Aug