After a period of time, SPL has made some modifications and supported the MySQL database since its last version 3.1.0.5.3.2.0.4, Dll: Here. Only need in the project, overwrite the original dll can, if has not downloaded SPL earlier versions of friends, please first browse: http://tintown.cnblogs.com/archive/2005/04/11/135582.html.
The SPL has been updated since the last release of 3.1.0.5:
1. Support for BIT data types in ms SQL Server
The Type mapped to classmap is Boolean, for example:
< Attribute Name = "Isover" Column = "Isover" Type = "Boolean" />
The corresponding object class type is bool, for example:
Private Bool M_isover;
Public Bool Isover
{
Get
{
Return This. M_isover;
}
Set
{
This. M_isover=Value;
}
}
You can use condition to compare and judge the query results:
Codition c = ....
C. addequalto ("isover", false); // This will generate a query condition for isover = '0 '.
2. The provider type of the data source can be determined, which facilitates the manual assembly of different SQL statements by different database providers.
Use setting. instance (). getdatabasevendor (dbname) to obtain the data source provider based on the dbname data source, and then compare it with the databasevendor Enumeration type.
For example, the access date is different from that of SQL SERVER: one uses the # sign and the other uses the 'sign
If (Setting. instance (). getdatabasevendor (dbname) = Databasevendor. msaccess)
{
Builder. append ( " And specialpriced2.fromdate <= # " + Itemdate. Day. tostring () + " - " + Itemdate. Month. tostring () + " - " + Itemdate. year. tostring () + " # " );
Builder. append ( " And specialpriced2.todate> = # " + Itemdate. Day. tostring () + " - " + Itemdate. Month. tostring () + " - " + Itemdate. year. tostring () + " # " );
}
If (Setting. instance (). getdatabasevendor (dbname) = Databasevendor. MSSQLServer)
{
Builder. append ( " And specialpriced2.fromdate <=' " + Itemdate. Day. tostring () + " - " + Itemdate. Month. tostring () + " - " + Itemdate. year. tostring () + " ' " );
Builder. append ( " And specialpriced2.todate> =' " + Itemdate. Day. tostring () + " - " + Itemdate. Month. tostring () + " - " + Itemdate. year. tostring () + " ' " );
}
This function provides the best flexibility for the system to support multiple databases. Although the "entity" and "standard" of SPL can distinguish different data source providers, however, where you need to write SQL, you also need to provide different statements for execution based on different data source providers.
3. modified the compatibility of all reserved words
Currently, the delimiters are added to all SPL operations. Oracle uses the "" number, Ms uses the "[]" number, and MySQL uses the "'" number, all tests passed
4. added the null value query function in condition.
This method is only valid for addequalto () and addnotequalto:
C. addequalto ( " Field name " , System. dbnull. value );
C. addnotequalto ( " Field name " , System. dbnull. value );
5. Added support for the MySQL database.
SPL uses the dedicated connection provided by MySQL to access MySQL. net connector, the driver should be said to be currently. net is the best choice for connecting to MySQL. When using SPL to access MySQL, you only need to install this driver. For download and introduction, see the official address:
Http://dev.mysql.com/downloads/connector/net/1.0.html
You only need to set the databasemap type to "MySQL" when using it, as shown below:
< Database Name = "Mysqldb" Type = "MySQL" >
< Parameter Name = "User ID" Value = "Root" />
< Parameter Name = "Data Source" Value = "Localhost" />
< Parameter Name = "Database" Value = "MySQL" />
< Parameter Name = "Password" Value = "" />
< Classmapfile Path = "Classmap. xml" />
</ Database >
After configuration, SPL is exactly the same as others in a specific application. Test conditions:
Entity test ---> pass
Retrievecriteira, updatecriteria, and deletecriteria test ---> pass
Transaction test ---> pass
Auto-increment primary key test ---> pass
Top function test ---> pass
6. The datetime null value is processed (supported at the beginning of 3.2.0.1)
To assign a null value to a field of the datetime type, you only need to use datetime. minvalue:
Aentity. createdate = datetime. minvalue;
In the SPL, it will determine if datetime. minvalue is automatically saved to the database as system. dbnull. value. dbnull. value.
7. Errors Caused by inconsistent attribute names and field names in updatecriteria (revision started at 3.2.0.2)
In the past, when updatecriteira did not convert the attribute to the field name, the field cannot be found if the attribute name is different from the field name.
(Thank you very much for the suggestions provided by iamsunrise. Please download spl3.2 again)
(Thanks to the bug reported by Zi Yang)
8. The MySQL type of databasetype has been fixed in 3.2.0.4.
For more information about SPL visit: http://tintown.cnblogs.com/category/12787.html