File: max-row.hs

package info (click to toggle)
haskelldb 0.9.cvs.601-13
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 680 kB
  • ctags: 33
  • sloc: haskell: 4,392; sh: 1,900; makefile: 130
file content (21 lines) | stat: -rw-r--r-- 420 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Gets the activity from the row with the highest id.

import Database.HaskellDB

import TestConnect

import Dp037.D3proj_time_reports

q = do
    t <- table d3proj_time_reports
    t' <- table d3proj_time_reports
    r <- project (xid << _max (t'!xid))
    restrict (t!xid .==. r!xid)
    project (activity << t!activity)

test db = do
	  print $ showSql q
	  rs <- query db q
	  mapM_ print rs

main = argConnect test