Commit 8bdcd430 authored by Bas Lijnse's avatar Bas Lijnse

Added extra SQL helper function

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2398 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 68fd78da
......@@ -31,6 +31,7 @@ sqlExecute :: SQLDatabase (A.*cur: *cur -> *(MaybeErrorString a,*cur) | SQLCurso
//Common helper functions for sqlExecute
execSelect :: SQLStatement [SQLValue] *cur -> *(MaybeErrorString [SQLRow],*cur) | SQLCursor cur
execInsert :: SQLStatement [SQLValue] *cur -> *(MaybeErrorString Int,*cur) | SQLCursor cur
execDelete :: SQLStatement [SQLValue] *cur -> *(MaybeErrorString Void,*cur) | SQLCursor cur
/**
* Run a single query and fetch all results
......
......@@ -56,6 +56,12 @@ execInsert query values cur
| isJust err = (Error (toString (fromJust err)),cur)
= (Ok id,cur)
execDelete :: SQLStatement [SQLValue] *cur -> *(MaybeErrorString Void,*cur) | SQLCursor cur
execDelete query values cur
# (err,cur) = execute query values cur
| isJust err = (Error (toString (fromJust err)),cur)
= (Ok Void,cur)
sqlExecuteSelect :: SQLDatabase SQLStatement ![SQLValue] -> Task [SQLRow]
sqlExecuteSelect db query values = sqlExecute db (execSelect query values)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment