The SPL has been upgraded to 3.2 and fully supports the MySQL database (updated )!

Source: Internet
Author: User
Tags spl

After a period of time, SPL has made some modifications and supported the MySQL database since its last version, Dll: Here. Only need in the project, overwrite the original dll can, if has not downloaded SPL earlier versions of friends, please first browse:

The SPL has been updated since the last release of
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
Return This. M_isover;
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:
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
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
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

For more information about SPL visit:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.