Debugging SQL Code

Your Flash Remoting application may depend on calls made to a database, as the searchProducts.fla example does. If you have a database server such as Microsoft SQL Server, you will have all the tools at your disposal to properly test and debug SQL code. This means that you should have a workable copy of the database and database-programming environment available to you. It is unwise to debug database queries using a live server, so all debugging and optimization should be done locally or on a staging server before deploying your application.

Database Errors

Database errors can be difficult to track down from within Flash, so it is a good idea to try to track them down at the source: from within the database environment. Frequently, the error can be found in the syntax at the source, eliminating the guesswork when you execute the database code from Flash.

If the query runs successfully in the database environment, the next logical place to look for errors is in your server-side service. A successfully worded query can fail if you use a datatype that is not consistent. Frequent errors include forgetting the single quotes around character data or putting single quotes around numeric data improperly.

Another frequent error to watch out for is the improper use of NULL versus using an empty field. Often, a query result can be returned incorrectly if you are doing a search like this:

SELECT * FROM Customers WHERE Region = ''

You might be looking for Customers that don’t ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.