Wherefore static queries?

Events happening in the community are now at Drupal community events on www.drupal.org.
brian.travis's picture

The TNG database layer has the concept of static and dynamic queries. Insert, update, delete, and merge queries must be dynamic, which is great because it provides an abstraction from writing SQL statements, allowing the layer to create the proper SQL that goes to the database engine. However, the database abstraction layer for Drupal 7 allows select statements to be dynamic or static.

I'm writing a book on Drupal 7 for Windows developers, and I see a potential problem with allowing people to write static queries. That is, they may not be transportable across different engines.

For example, a simple query to select the first ten records is:

MySQL: SELECT title FROM table LIMIT 10
SQL Server: SELECT TOP 10 title FROM table

Each will break if the other's query is encountered. Doesn't this make a cross-database abstraction layer useless? The dynamic query, on the other hand, abstracts this using the range or limit methods.

Can someone provide some background info so I can tell my SQL server readers it's safe to move to Drupal?

Database

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: