MySQL Documentation Appendix D (Porting mSQL applications to MySQL)

Documentation Version: 0.95
MySQL Version: 3.20.29
Porting mSQL applications to MySQL should be relatively easy.

First, Run the shell script msql2mysql over your source. This needs the binary program replace, which is distributed with MySQL. This will translate mSQL function names to MySQL. It will NOT fix parameter types or change the number of parameters in MySQL functions that need additional parameters.

Other Hints:

MySQL comes with ported versions of the mSQL test programs insert_test.c and select_test.c. It's a good idea to compare these with their mSQL equivalents. This should give you a good start on understanding what you will need to do to port a mSQL application to MySQL. It will also give you some hints on what you need to do to write a MySQL application.

How does the MySQL client/server protocol differ from mSQL?

There are significant differences. Amongst them are...

Differences between msql 2.0b7 and MySQL

- CREATE TABLE:
  MySQL: Has the following field option types:
         UNSIGNED, ZEROFILL,
         Has DEFAULT on not null fields.
  mSQL:


- To create indexes:
  MySQL:  All indexes have to be given at CREATE TABLE.
  mSQL:   Indexes must be created by a separate CREATE INDEX clause.
          (Does mSQL use a new key file for each index?)
          Indexes may be dropped with DROP INDEX

- To get a unique identifier at insert:
  MySQL: Use 'auto_increment' as a column type specifier.
         The used index may be retrieved after update by the API
         function mysql_insert_id().
  mSQL:  Create a SEQUENCE on a table and use the __seq function
         to get a unique index.

- Group functions:
  MySQL: count(), avg(), min(), max() and sum().  min() and max() may
         take string arguments. count(*) is optimized to return directly
         if no other column is used.
  mSQL:  none

- searching case-independent:
  MySQL: LIKE is always case independent. If possible MySQL uses indexes
         if the like argument doesn't start with a wild-card.
  mSQL:  Use CLIKE.

- searching with regular expressions.
  MySQL: Use REGEXP or RLIKE
  mSQL:  Use RLIKE.

- What is the difference in the WHERE statement:
  MySQL has braces, Soon it will have full function support in the WHERE.
  (This is scheduled for version 3.21.X)

- Qualifying column names:
  MySQL: If a column name is unique you don't have to use the full qualifier.
  mSQL:  When using more than one table in a select you must use full
         table qualifiers.

- Aliasing
  MySQL: Has table and column aliasing.
  mSQL:  Has table aliasing.

- Insert/update with calculations.
  MySQL: Full calculation support. In an insert you may use values of preceding
         fields.
  mSQL:  Only insert and update with constants.

- Which formulas may be used in the select statement.
  MySQL: To many to print here. Check the manual.
  mSQL:  none

- HAVING
  MySQL: Supported, but can only use calculation on the selected fields.
         To select on a calculated value one must use a column alias.
         Ex: SELECT COUNT(*) AS id_count,id FROM groups GROUP BY id HAVING
             id_count > 10
  mSQL:  Not supported

- Importing and Exporting data
  MySQL: MySQL has functionality built into the server for the import 
         of data by way of LOAD DATA INFILE.  Having this built into the
         server makes data loads significantly faster.
  mSQL:  External program.