Jdm My Sql Ex 7 1 Bundle
Last published: December 3, 2003 by 'skrish'
Defines 21 Classes
Extends 25 Classes
The Original MySQL Interface is built for VisualWorks 3.0 and published as JDMMySQLInterface parcel. Subsequently the parcels have been ported to VisualWorks 7.1 by Sudhakar Krishnamachari in 2003 and for MySQL 3.23.49. The port done by Jordan has been tried but this interface has been used for about a year consistently and debugged for a Distributed DBMS package built on top of MySQL with data tables of > 100MB.
This Interface follows the same system as built for other interfaces by creating a connection socket, pair of read and write streams to communicate with the MySQL DB server through the TCP-IP protocol. The JdmStatement object sends the "executeQuery: sqlString" method on the connection created and obtains the JdmResult object which can be read as a JdmResultSet if a table is returned consisting of rows and columns.
This ResultSet contains the returned data in case of any data query being sent and fetched and in the typical "next" method call can retrieve each individual row of data.
The interface encapsulates the protocol for MySQL communication for hashing the password, the command parameters, error codes and string returned, the socketAccessor, read and write stream objects all appropriately subclassed for the interface purpose.
To use the interface simply follow the procedure detailed below:
connection := JdmConnection on: ((JdmConnectionSpec new initialize)
host: host value;
statement := connection createStatement.
result := statement executeQuery: theQueryStr.
Iterating over this result as "result value next" will give the next row of data containing the column values as an ordered collection. Access to these can be either directly from the accessors provided in the JdmResultSet class.
The JdmFieldConvertor takes care of the type conversion between MySQL datatypes and their representation in Smalltalk including integers, strings, date-time, binary or text blobs etc...