MSSQL implementation of -dt_get
Arthur Axel 'fREW' Schmidt [Sun, 30 Jan 2011 16:42:57 +0000 (10:42 -0600)]
lib/DBIx/Class/SQLMaker/MSSQL.pm

index f64d972..55ebdcf 100644 (file)
@@ -10,4 +10,16 @@ sub _rno_default_order {
   return \ '(SELECT(1))';
 }
 
+{
+  my %part_map = (
+     month        => 'mm',
+     day_of_month => 'dd',
+     year         => 'yyyy',
+  );
+
+  sub _datetime_sql { "DATEPART('$part_map{$_[1]}', $_[2])" }
+  sub _datetime_diff_sql { "DATEDIFF('$part_map{$_[1]}', $_[2], $_[3])" }
+}
+
+
 1;