Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Linux Planet
Linux Today
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article
Related Items

•  Apples and Oranges: A Linux DBMS Comparison


   LinuxPlanet / Tutorials



Apples and Oranges, Part II: A Linux DBMS Comparison
Bringing the Client to Life on mSQL

Matthias Warkus
Thursday, November 18, 1999 01:25:46 PM

The differences between mSQL's and MySQL's C API are very, very small. Thus, there is even an automatic converter. The principal differences are:

  • mSQL does not store a connection data block, only a number (int bookstore)
  • some mSQL functions don't take the connection as an argument
  • mSQL function names are Pascalish (they use StudlyCaps instead of underscores)

The handy MONEY data type is a fixed-precision decimal fraction type with two decimals. To make mSQL correctly store integer numbers of cents in MONEY columns, I needed to convert them, casting them into floats, dividing them and formatting them in the sprintf statement of the add_new_book() function.

This is list_books(), ported to mSQL:

void
list_books(void)
{
  int count;
  m_result *result;

  msqlQuery(bookstore, "SELECT ARTICLE_NO, AUTHOR_FIRST_NAMES,\
AUTHOR_LAST_NAMES, TITLE, ISBN, WHOLESALE_PRICE, RETAIL_PRICE,\
COPIES_AVAILABLE FROM BOOK");
  result = msqlStoreResult();

  for(count = msqlNumRows(result); count > 0; count--)
	{
	  m_row record;
	  record = msqlFetchRow(result);

	  printf("\nArticle no. %s\n", record[0]);
	  printf("%s, %s:\n", record[2], record[1]);
	  printf("    %s (%s)\n", record[3], record[4]);
	  printf("Bought at %s; selling at %s; %s copies available\n\n",
			 record[5], record[6], record[7]);
	};

  msqlFreeResult(result);
}

Documentation for mSQL's C API can be found in the mSQL manual that ships with mSQL as PostScript and as a large HTML file.

Next: Some Early Conclusions »

Skip Ahead

1 The Database Design
2 Adapting the Design to PostgreSQL
3 Adapting the Design to MySQL
4 Adapting the Design to mSQL
5 Implementing the Test Client
6 Bringing the Client to Life on PostgreSQL
7 Bringing the Client to Life on MySQL
8 Bringing the Client to Life on mSQL
9 Some Early Conclusions





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers