Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Convert SQL query to Drupal Database abstraction layer code.
Dependencies:
INSTALL:
- Download and install Libraries API module
- Download PHP-SQL-Parser (version from 2013-11-30) library and unzip it to "sites/all/libraries" folder. Full path must be "sites/all/libraries/PHP-SQL-Parser/php-sql-parser.php"
- Download and install "Query coder" module
- Go to admin/config/development/query_coder
How To Use
Nice tutorial for this module on webwash.net:
Convert SQL Query Into Dynamic Query Using Query Coder Module
Known issues:
- INSERT queries must be specified in form "INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)"
- Not support "->expression()" conditions for UPDATE queries.
- All tables and fields in SELECT query must be specified with aliases, in other (UPDATE, INSERT, DELETE) queries without aliases
Example:
RIGHT: "SELECT * FROM users u"
NOT RIGHT: "SELECT * FROM users" - All combining conditions in SELECT queries must be specified with aliases.
Example:
RIGHT: "SELECT COUNT(*) AS user_count FROM users u"
NOT RIGHT: "SELECT COUNT(*) FROM users u".
Supporting organizations:
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Developer Tools
- 190 sites report using this module
- Created by denisz on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
7.x-1.0
released 19 March 2013
Works with Drupal: 7.x
✓ Recommended by the project’s maintainer.
Development version: 7.x-1.x-dev updated 12 May 2014 at 13:33 UTC