Index: sql_parser.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sql_parser/sql_parser.info,v
retrieving revision 1.5
diff -u -p -r1.5 sql_parser.info
--- sql_parser.info	24 Aug 2010 22:22:33 -0000	1.5
+++ sql_parser.info	1 Sep 2010 17:24:32 -0000
@@ -1,6 +1,7 @@
 ; $Id: sql_parser.info,v 1.5 2010/08/24 22:22:33 duellj Exp $
 name = SQL Parser
 description = Parser SQL strings into Drupal database objects.
+package = Development
 core = 7.x
 
 files[] = sql_parser.module
Index: sql_parser.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sql_parser/sql_parser.module,v
retrieving revision 1.5
diff -u -p -r1.5 sql_parser.module
--- sql_parser.module	24 Aug 2010 22:22:33 -0000	1.5
+++ sql_parser.module	1 Sep 2010 17:24:32 -0000
@@ -10,8 +10,9 @@
  * Implements hook_menu().
  */
 function sql_parser_menu() {
-  $items['sql-parser'] = array(
+  $items['admin/config/development/sql-parser'] = array(
     'title' => 'SQL Parser',
+    'description' => 'Parse SQL strings and convert to Drupal DBTNG objects.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('sql_parser_parser_form'),
     'access arguments' => array('access content'),
@@ -24,23 +25,31 @@ function sql_parser_menu() {
  * Page Callback.
  */
 function sql_parser_parser_form($form, &$form_state) {
-  if ($form_state['input']['sql']) {
+  if (isset($form_state['input']['sql'])) {
     $parsed_sql = sql_parser_parse($form_state['input']['sql']);
     $query_string = sql_parser_convert($parsed_sql);
   }
   $form['sql'] = array(
-    '#title' => 'Original SQL String',
+    '#title' => 'Original SQL string',
     '#type' => 'textarea',
-    '#default_value' => $form_state['post']['sql'],
+    '#default_value' => isset($form_state['input']['sql']) ? $form_state['input']['sql'] : '',
+  );
+  $form['parsed_sql'] = array(
+    '#title' => 'Parsed SQL string',
+    '#type' => 'textarea',
+    '#attributes' => array(
+      'readonly' => 'readonly',
+    ),
+    '#value' => isset($parsed_sql) ? $parsed_sql : '',
   );
   $form['output'] = array(
-    '#title' => 'Database Object',
+    '#title' => 'Database object syntax',
     '#type' => 'textarea',
     '#rows' => 10,
     '#attributes' => array(
       'readonly' => 'readonly',
     ),
-    '#value' => $query_string,
+    '#value' => isset($query_string) ? $query_string : '',
   );
   $form['submit'] = array(
     '#type' => 'button',
Index: includes/sql_dialect.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sql_parser/includes/sql_dialect.inc,v
retrieving revision 1.9
diff -u -p -r1.9 sql_dialect.inc
--- includes/sql_dialect.inc	24 Aug 2010 22:22:33 -0000	1.9
+++ includes/sql_dialect.inc	1 Sep 2010 17:24:32 -0000
@@ -83,7 +83,7 @@ class SqlDialect {
     'currval'
   );
 
-  var $reserved = array('absolute', 'action', 'add', 'all', 'allocate', 'and', 'any', 'are', 'asc', 'ascending', 'assertion', 'at', 'authorization', 'begin', 'bit_length', 'both', 'cascade', 'cascaded', 'case', 'cast', 'catalog', 'char_length', 'character_length', 'check', 'close', 'coalesce', 'collate', 'collation', 'column', 'commit', 'connect', 'connection', 'constraint', 'constraints', 'continue', 'convert', 'corresponding', 'cross', 'current', 'current_date', 'current_time', 'current_timestamp', 'current_user', 'cursor', 'day', 'deallocate', 'declare', 'default', 'deferrable', 'deferred', 'desc', 'descending', 'describe', 'descriptor', 'diagnostics', 'disconnect', 'distinct', 'domain', 'else', 'end', 'end-exec', 'escape', 'except', 'exception', 'exec', 'execute', 'exists', 'external', 'extract', 'false', 'fetch', 'first', 'for', 'foreign', 'found', 'full', 'get', 'global', 'go', 'goto', 'grant', 'group', 'having', 'hour', 'identity', 'immediate', 'indicator', 'initially', 'inner', 'input', 'insensitive', 'intersect', 'isolation', 'join', 'key', 'language', 'last', 'leading', 'left', 'level', 'limit', 'local', 'lower', 'match', 'minute', 'module', 'month', 'names', 'national', 'natural', 'next', 'no', 'null', 'nullif', 'octet_length', 'of', 'only', 'open', 'option', 'or', 'order', 'outer', 'output', 'overlaps', 'pad', 'partial', 'position', 'precision', 'prepare', 'preserve', 'primary', 'prior', 'privileges', 'procedure', 'public', 'read', 'references', 'relative', 'restrict', 'revoke', 'right', 'rollback', 'rows', 'schema', 'scroll', 'second', 'section', 'session', 'session_user', 'size', 'some', 'space', 'sql', 'sqlcode', 'sqlerror', 'sqlstate', 'substring', 'system_user', 'table', 'temporary', 'then', 'timezone_hour', 'timezone_minute', 'to', 'trailing', 'transaction', 'translate', 'translation', 'trim', 'true', 'union', 'unique', 'unknown', 'upper', 'usage', 'user', 'using', 'value', 'values', 'varying', 'view', 'when', 'whenever', 'work', 'write', 'year', 'zone', 'eoc');
+  var $reserved = array('absolute', 'action', 'add', 'all', 'allocate', 'and', 'any', 'are', 'asc', 'ascending', 'assertion', 'at', 'authorization', 'begin', 'bit_length', 'both', 'cascade', 'cascaded', 'case', 'cast', 'catalog', 'char_length', 'character_length', 'check', 'close', 'coalesce', 'collate', 'collation', 'column', 'commit', 'connect', 'connection', 'constraint', 'constraints', 'continue', 'convert', 'corresponding', 'cross', 'current', 'current_date', 'current_time', 'current_timestamp', 'current_user', 'cursor', 'day', 'deallocate', 'declare', 'default', 'deferrable', 'deferred', 'desc', 'descending', 'describe', 'descriptor', 'diagnostics', 'disconnect', 'distinct', 'domain', 'else', 'end', 'end-exec', 'escape', 'except', 'exception', 'exec', 'execute', 'exists', 'external', 'extract', 'false', 'fetch', 'first', 'for', 'foreign', 'found', 'full', 'get', 'global', 'go', 'goto', 'grant', 'group', 'having', 'hour', 'identity', 'immediate', 'indicator', 'initially', 'inner', 'input', 'insensitive', 'intersect', 'isolation', 'join', 'key', 'language', 'last', 'leading', 'left', 'level', 'limit', 'local', 'lower', 'match', 'minute', 'module', 'month', 'names', 'national', 'natural', 'next', 'no', 'null', 'nullif', 'octet_length', 'of', 'offset', 'only', 'open', 'option', 'or', 'order', 'outer', 'output', 'overlaps', 'pad', 'partial', 'position', 'precision', 'prepare', 'preserve', 'primary', 'prior', 'privileges', 'procedure', 'public', 'read', 'references', 'relative', 'restrict', 'revoke', 'right', 'rollback', 'rows', 'schema', 'scroll', 'second', 'section', 'session', 'session_user', 'size', 'some', 'space', 'sql', 'sqlcode', 'sqlerror', 'sqlstate', 'substring', 'system_user', 'table', 'temporary', 'then', 'timezone_hour', 'timezone_minute', 'to', 'trailing', 'transaction', 'translate', 'translation', 'trim', 'true', 'union', 'unique', 'unknown', 'upper', 'usage', 'user', 'using', 'value', 'values', 'varying', 'view', 'when', 'whenever', 'work', 'write', 'year', 'zone', 'eoc');
 
   var $synonyms = array('decimal' => 'numeric', 'dec' => 'numeric', 'numeric' => 'numeric', 'float' => 'float', 'real' => 'real', 'double' => 'real', 'int' => 'int', 'integer' => 'int', 'interval' => 'interval', 'smallint' => 'smallint', 'timestamp' => 'timestamp', 'bool' => 'bool', 'boolean' => 'bool', 'set' => 'set', 'enum' => 'enum', 'text' => 'text', 'char' => 'char', 'character' => 'char', 'varchar' => 'varchar', 'ascending' => 'asc', 'asc' => 'asc', 'descending' => 'desc', 'desc' => 'desc', 'date' => 'date', 'time' => 'time');
 
Index: includes/sql_parser.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sql_parser/includes/sql_parser.inc,v
retrieving revision 1.13
diff -u -p -r1.13 sql_parser.inc
--- includes/sql_parser.inc	24 Aug 2010 22:22:33 -0000	1.13
+++ includes/sql_parser.inc	1 Sep 2010 17:24:33 -0000
@@ -165,6 +165,10 @@ class SqlParser {
           $this->parseLimit($sql_object);
           break;
 
+        case 'offset':
+//           $this->parseLimit($sql_object);
+          break;
+
         case 'group':
           $group_by = &$sql_object->addGroupBy();
           $this->getToken();
@@ -1307,6 +1311,14 @@ class SqlParser {
       $row_count = $this->lexer->tokenText;
       $this->getToken();
     }
+    elseif ($this->token == 'offset') {
+      $this->getToken();
+      if ($this->token != 'int_val' && $this->token != 'placeholder') {
+        return $this->raiseError('Expected an integer value');
+      }
+      $offset = $this->lexer->tokenText;
+      $this->getToken();
+    }
     $sql_object->addLimit($row_count, $offset);
   }
 }
