Commit 64883de4 authored by Michael Hanus 's avatar Michael Hanus
Browse files

SQL translator adapted to recent cdbi changes

parent 17affbe8
import Uni_CDBI
import Uni
import Database.CDBI.ER
import Database.CDBI.Connection
import Time
......@@ -6,15 +6,15 @@ import Time
createTestData :: IO ()
createTestData = do
conn <- connectSQLite sqliteDBFile
result <- ((insertEntries studentList student_CDBI_Description) >+
(insertEntries lectureList lecture_CDBI_Description) >+
(insertEntries lecturerList lecturer_CDBI_Description) >+
(insertEntries placeList place_CDBI_Description) >+
(insertEntries timeList time_CDBI_Description) >+
(insertEntries examList exam_CDBI_Description) >+
(insertEntries resultList result_CDBI_Description) >+
(insertEntries participList participation_CDBI_Description) >+
(insertEntryCombined sse1 sseDescription)
result <- (insertEntries student_CDBI_Description studentList >+
insertEntries lecture_CDBI_Description lectureList >+
insertEntries lecturer_CDBI_Description lecturerList >+
insertEntries place_CDBI_Description placeList >+
insertEntries time_CDBI_Description timeList >+
insertEntries exam_CDBI_Description examList >+
insertEntries result_CDBI_Description resultList >+
insertEntries participation_CDBI_Description participList >+
insertEntryCombined sseDescription sse1
) conn
disconnect conn
case result of
......
......@@ -5,7 +5,7 @@
import Database.CDBI.ER as C
import Time
import Uni_CDBI
import Uni
-- "Scanner" errors
-- unsupported character '&'
......
......@@ -5,7 +5,7 @@
import Database.CDBI.ER
import Time
import Uni_CDBI
import Uni
-- Selecting key Values
testKey1 :: IO( SQLResult [(StudentID,String)])
......
......@@ -4,7 +4,7 @@
--- Testing also insert/update/delete operations
import Database.CDBI.ER
import Uni_CDBI
import Uni
-- control functions
showStudents :: IO (SQLResult [Student])
......
......@@ -5,7 +5,7 @@
import Database.CDBI.Connection
import Database.CDBI.ER
import Time
import Uni_CDBI
import Uni
import Test.Prop
......
......@@ -3,7 +3,6 @@
# Root location of the Curry System specified by variable CURRYROOT
CURRYROOT=`$CURRYBIN :set v0 :set -time :add Distribution :eval "putStrLn installDir" :quit`
CURRYBINDIR=$CURRYROOT/bin
if [ -x "$CURRYBINDIR/pakcs" ] ; then
......@@ -40,7 +39,7 @@ export PATH
cleandir () {
$CURRYBINDIR/cleancurry
/bin/rm -f $LOGFILE *_PUBLIC.curry TEST*.curry
/bin/rm -f Uni.erdterm Uni_ERDT.term Uni_SQLCode.info Uni_CDBI.curry Uni.db
/bin/rm -f Uni.erdterm Uni_ERDT.term Uni_SQLCode.info Uni.curry Uni.db
$CURRYBINDIR/cleancurry
}
......
......@@ -72,15 +72,15 @@ transStatement p mModel (Update tab assigns cond) =
(transUpdate p mModel assigns cond)
transStatement _ mModel (UpdateEntity tab val) =
liftPM (\table -> applyF (mCDBI, "updateEntry")
[(transValue mModel val False), table])
[table, transValue mModel val False])
(transTableName mModel tab)
transStatement p mModel (Delete tab cond) = transDelete p mModel tab cond
transStatement _ mModel (Insert tab cols valss) =
combinePMs (\func args -> applyF func args)
(getInsertfunction valss)
(getInsertFunction valss)
(combinePMs (\d t -> [d,t])
(transInsertData mModel tab cols valss)
(transTableName mModel tab))
(transTableName mModel tab)
(transInsertData mModel tab cols valss) )
transStatement p mModel (InTransaction sts) = transTransaction p mModel sts
transStatement _ _ Transaction =
cleanPM (CLambda [cpvar "c"]
......@@ -642,8 +642,8 @@ transMaybeCond p mModel cond =
-- Depending on the number of given lists of values
-- there are different CDBI functions to apply.
getInsertfunction :: [[Value]] -> PM (String, String)
getInsertfunction valss =
getInsertFunction :: [[Value]] -> PM (String, String)
getInsertFunction valss =
if length valss > 1
then cleanPM (mCDBI, "insertEntries")
else cleanPM (mCDBI, "insertEntry")
......
......@@ -28,7 +28,7 @@ import TransContracts (transContracts)
cppBanner :: String
cppBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText = "Curry Preprocessor (version of 24/07/2017)"
bannerText = "Curry Preprocessor (version of 05/01/2018)"
bannerLine = take (length bannerText) (repeat '=')
--- Preprocessor targets, i.e., kind of entities to be preprocessed:
......
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