slice type
Matt S Trout [Mon, 16 Apr 2012 07:11:08 +0000 (07:11 +0000)]
lib/Data/Query/Constants.pm
lib/Data/Query/Renderer/SQL/SQLite.pm [new file with mode: 0644]

index 2aa9100..eb5cd1b 100644 (file)
@@ -18,6 +18,7 @@ use constant +{
     DQ_UPDATE => 'Update',
     DQ_INSERT => 'Insert',
     DQ_GROUP => 'Group',
+    DQ_SLICE => 'Slice',
   ))
 };
 
diff --git a/lib/Data/Query/Renderer/SQL/SQLite.pm b/lib/Data/Query/Renderer/SQL/SQLite.pm
new file mode 100644 (file)
index 0000000..4dac236
--- /dev/null
@@ -0,0 +1,18 @@
+package Data::Query::Renderer::SQL::SQLite;
+
+use Moo;
+
+extends 'Data::Query::Renderer::SQL::Naive';
+
+sub _render_slice {
+  my ($self, $dq) = @_;
+  [ ($dq->{from} ? $self->_render($dq->{from}) : ()),
+    $self->_format_keyword('LIMIT'), $self->_render($dq->{limit}),
+    ($dq->{offset}
+      ? ($self->_format_keyword('OFFSET'), $self->_render($dq->{offset}))
+      : ()
+    ),
+  ];
+}
+
+1;