Read from MySQL: Difference between revisions

From XdmfWeb
Jump to navigationJump to search
(New page: == '''Accessing a MySQL DataBase''' == Partial support for reading data from a MySQL database is available. MySQL is treated as another HeavyData format like HDF5. Currently database acce...)
 
No edit summary
Line 16: Line 16:
                 </DataItem>
                 </DataItem>
             </Attribute>
             </Attribute>
A Valid SQL statement is placed in the CDATA of the DataItem. When the XdmfDataItem is
updated, an atomic query is made and the result is placed in the XdmfArray of the DataItem.
Putting a "<" (less than) in the CDATA will cause an error in the XML parser. The XML example
above shows how to do this correctly.
The Server, User, and DataBase attributes tell Xdmf how to access MySQL. There is also
a Password attribute. Currently this is just clear text which is a really bad idea. This
will change.

Revision as of 10:44, 23 May 2008

Accessing a MySQL DataBase

Partial support for reading data from a MySQL database is available. MySQL is treated as another HeavyData format like HDF5. Currently database access is ReadOnly and is accessed by setting the Format of the DataItem in XML equal to MySQL

           <Attribute Name="Cell Centered Values" Center="Cell">
               <DataItem Format="MySQL"
                   Server="localhost"
                   User="root"
                   DataBase="MnmiFromout"
                   Dimensions="3"
                   NumberType="Float">
                   <![CDATA[SELECT X FROM Locations WHERE Time < 0.21]]>
               </DataItem>
           </Attribute>

A Valid SQL statement is placed in the CDATA of the DataItem. When the XdmfDataItem is updated, an atomic query is made and the result is placed in the XdmfArray of the DataItem. Putting a "<" (less than) in the CDATA will cause an error in the XML parser. The XML example above shows how to do this correctly.

The Server, User, and DataBase attributes tell Xdmf how to access MySQL. There is also a Password attribute. Currently this is just clear text which is a really bad idea. This will change.