-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcf0c1c
commit d13eaca
Showing
5 changed files
with
128 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
``` | ||
newnote(dsn, job_id, username, note) | ||
``` | ||
Create a new note in the `notes` table. A note is associated with a particular | ||
job and therefore a `job_id` is required, along with a `username` to indicate | ||
who wrote the note. | ||
""" | ||
function newnote(dsn, job_id, username, note) | ||
ODBC.execute!(dsn, """ | ||
INSERT INTO notes (job_id, username, dt, note) VALUES | ||
($job_id, '$username', '$(now())', '$note'); | ||
""") | ||
end | ||
|
||
""" | ||
``` | ||
listnotes(dsn; job_id=0, username="") | ||
``` | ||
If keyword arguments `job_id` and/or `username` are provided, list the notes | ||
in the `notes` table that are at the intersection of those conditions. | ||
Otherwise, list all notes in the `notes` table. | ||
""" | ||
function listnotes(dsn; job_id=0, username="") | ||
if job_id != 0 && username != "" | ||
wherestr = "WHERE " | ||
if job_id != 0 | ||
wherestr *= "job_id = $job_id" | ||
end | ||
if username != "" | ||
wherestr *= ", username = '$username'" | ||
end | ||
else | ||
wherestr = "" | ||
end | ||
|
||
ODBC.query(dsn, """ | ||
SELECT job_id, username, dt, note FROM notes $wherestr; | ||
""") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters