Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry-packages
spicey
Commits
a21ef4a6
Commit
a21ef4a6
authored
Jan 08, 2018
by
Michael Hanus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generation of ER model slightly improved
parent
67ddf019
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
13 deletions
+17
-13
README.md
README.md
+5
-1
docs/manual.tex
docs/manual.tex
+3
-0
resource_files/README.txt
resource_files/README.txt
+2
-3
src/Spicey/Scaffolding.curry
src/Spicey/Scaffolding.curry
+6
-8
src/Spicey/SpiceUp.curry
src/Spicey/SpiceUp.curry
+1
-1
No files found.
README.md
View file @
a21ef4a6
...
...
@@ -28,7 +28,11 @@ To generate an application, follow the steps below.
file is "
<ERD>
.db" where
<ERD>
is the name of the specified ER model.
Since this file name will be used in the _generated_ cgi programs,
a relative file name will be relative to the place where
the cgi programs are stored.
the cgi programs are stored. In order to avoid confusion due to
relative file names, it might be better to specify
an absolute path name for the database file.
This path could also be set in the definition of the constant
`sqliteDBFile`
in the generated Curry program
`Model/<ERD>.curry`
.
4.
Change into the generated directory containing all sources as a
Curry package, e.g., by
`cd Blog`
.
...
...
docs/manual.tex
View file @
a21ef4a6
...
...
@@ -79,6 +79,9 @@ a relative database file name will be relative to the place where
the web programs are stored.
In order to avoid such confusion, it might be better to specify
an absolute path name for the database file.
This path could also be set in the definition of the constant
\code
{
sqliteDBFile
}
in the generated Curry program
\code
{
Model/
$
ERD
$
.curry
}
.
Spicey generates the web application as a Curry package in a new
directory. Thus, change into this directory (e.g.,
\code
{
cd
$
ERD
$}
)
...
...
resource_files/README.txt
View file @
a21ef4a6
...
...
@@ -28,9 +28,8 @@ src/Model/
it contains the Curry module <MODEL>.curry implementing the access
to the database which are generated from the ER description.
In addition to the Curry program, this directory also contains
the term files of the original and transformed ER description
(files `<MODEL>_ERD.term` and `<MODEL>_ERDT.term`),
Curry file of the original ER description (file `<MODEL>_ERD.curry`),
the Curry file of the original ER description (file `<MODEL>_ERD.curry`),
the term files of the transformed ER description (`<MODEL>_ERDT.term`),
and the info file `<MODEL>_SQLCode.info` which is used by
the Curry preprocessor when SQL queries are embedded in the source
code.
...
...
src/Spicey/Scaffolding.curry
View file @
a21ef4a6
...
...
@@ -8,6 +8,7 @@ import AbstractCurry.Types
import AbstractCurry.Build
import AbstractCurry.Pretty hiding(showCProg)
import Database.ERD
import Directory
import FilePath ( (</>) )
import IO
import System(system)
...
...
@@ -83,20 +84,17 @@ createHtmlHelpers _ (ERD name entities relationship) path _ =
hPutStr fileh (showCProg (generateToHtml erdname allEntities relationships))
hClose fileh
--
u
ses Curry's ertools for ERD to Curry transformation
--
U
ses Curry's
`
ertools
`
for ERD to Curry transformation
createModels :: String -> ERD -> String -> String -> IO ()
createModels term_path erd path db_path = do
let erdname = erdName erd
dbfile = if null db_path then erdname ++ ".db"
else db_path
aterm_path <- getAbsolutePath term_path
curdir <- getCurrentDirectory
setCurrentDirectory path
erd2cdbiWithDBandERD dbfile term_path
let orgerdfile = erdname ++ "_ERD.term"
transerdfile = erdname ++ "_ERDT.term"
curryfile = erdname ++ ".curry"
infofile = erdname ++ "_SQLCode.info"
system $ unwords ["mv", transerdfile, curryfile, infofile, path]
system $ unwords ["cp", term_path, path </> orgerdfile]
done
setCurrentDirectory curdir
createRoutes :: String -> ERD -> String -> String -> IO ()
createRoutes _ erd path _ = do
...
...
src/Spicey/SpiceUp.curry
View file @
a21ef4a6
...
...
@@ -16,7 +16,7 @@ import Spicey.Scaffolding
systemBanner :: String
systemBanner =
let bannerText = "Spicey Web Framework (Version " ++ packageVersion ++
" of 0
5
/01/18)"
" of 0
8
/01/18)"
bannerLine = take (length bannerText) (repeat '-')
in bannerLine ++ "\n" ++ bannerText ++ "\n" ++ bannerLine
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment