diff options
author | def <dennis@felsin9.de> | 2015-07-11 14:39:19 +0200 |
---|---|---|
committer | def <dennis@felsin9.de> | 2016-01-25 19:10:37 +0100 |
commit | c50b5b62ef5ae51467754f7c1db49c4cbeaee5f8 (patch) | |
tree | 3c40a179da95227dd7308d57965809f7e2dacb44 /examples/cross_todo/nim_backend | |
parent | 4246f660ea4ba7bab05811662eb53a87cc0cc049 (diff) | |
download | Nim-c50b5b62ef5ae51467754f7c1db49c4cbeaee5f8.tar.gz |
Fix a few deprecation warnings
Diffstat (limited to 'examples/cross_todo/nim_backend')
-rw-r--r-- | examples/cross_todo/nim_backend/backend.nim | 18 | ||||
-rw-r--r-- | examples/cross_todo/nim_backend/testbackend.nim | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/examples/cross_todo/nim_backend/backend.nim b/examples/cross_todo/nim_backend/backend.nim index 5b49bc4a9..6869665f8 100644 --- a/examples/cross_todo/nim_backend/backend.nim +++ b/examples/cross_todo/nim_backend/backend.nim @@ -1,6 +1,6 @@ # Backend for a simple todo program with sqlite persistence. # -# Most procs dealing with a TDbConn object may raise an EDb exception. +# Most procs dealing with a DbConn object may raise an EDb exception. import db_sqlite, parseutils, strutils, times @@ -42,7 +42,7 @@ proc initDefaults*(params: var TPagedParams) = params.showChecked = false -proc openDatabase*(path: string): TDbConn = +proc openDatabase*(path: string): DbConn = ## Creates or opens the sqlite3 database. ## ## Pass the path to the sqlite database, if the database doesn't exist it @@ -86,7 +86,7 @@ proc getModificationDate*(todo: TTodo): Time = return todo.modificationDate -proc update*(todo: var TTodo; conn: TDbConn): bool = +proc update*(todo: var TTodo; conn: DbConn): bool = ## Checks the database for the object and refreshes its variables. ## ## Use this method if you (or another entity) have modified the database and @@ -112,7 +112,7 @@ proc update*(todo: var TTodo; conn: TDbConn): bool = echo("Something went wrong selecting for id " & $todo.id) -proc save*(todo: var TTodo; conn: TDbConn): bool = +proc save*(todo: var TTodo; conn: DbConn): bool = ## Saves the current state of text, priority and isDone to the database. ## ## Returns true if the database object was updated (in which case the @@ -135,7 +135,7 @@ proc save*(todo: var TTodo; conn: TDbConn): bool = # - Procs dealing directly with the database # -proc addTodo*(conn: TDbConn; priority: int; text: string): TTodo = +proc addTodo*(conn: DbConn; priority: int; text: string): TTodo = ## Inserts a new todo into the database. ## ## Returns the generated todo object. If there is an error EDb will be raised. @@ -149,7 +149,7 @@ proc addTodo*(conn: TDbConn; priority: int; text: string): TTodo = result = initFromDB(todoId, text, priority, false, currentDate) -proc deleteTodo*(conn: TDbConn; todoId: int64): int64 {.discardable.} = +proc deleteTodo*(conn: DbConn; todoId: int64): int64 {.discardable.} = ## Deletes the specified todo identifier. ## ## Returns the number of rows which were affected (1 or 0) @@ -157,7 +157,7 @@ proc deleteTodo*(conn: TDbConn; todoId: int64): int64 {.discardable.} = result = conn.execAffectedRows(query, $todoId) -proc getNumEntries*(conn: TDbConn): int = +proc getNumEntries*(conn: DbConn): int = ## Returns the number of entries in the Todos table. ## ## If the function succeeds, returns the zero or positive value, if something @@ -171,7 +171,7 @@ proc getNumEntries*(conn: TDbConn): int = result = -1 -proc getPagedTodos*(conn: TDbConn; params: TPagedParams; +proc getPagedTodos*(conn: DbConn; params: TPagedParams; page = 0'i64): seq[TTodo] = ## Returns the todo entries for a specific page. ## @@ -210,7 +210,7 @@ proc getPagedTodos*(conn: TDbConn; params: TPagedParams; row[3].parseBool, Time(row[4].parseInt))) -proc getTodo*(conn: TDbConn; todoId: int64): ref TTodo = +proc getTodo*(conn: DbConn; todoId: int64): ref TTodo = ## Returns a reference to a TTodo or nil if the todo could not be found. var tempTodo: TTodo tempTodo.id = todoId diff --git a/examples/cross_todo/nim_backend/testbackend.nim b/examples/cross_todo/nim_backend/testbackend.nim index 131dda1cf..6754f013a 100644 --- a/examples/cross_todo/nim_backend/testbackend.nim +++ b/examples/cross_todo/nim_backend/testbackend.nim @@ -3,7 +3,7 @@ import backend, db_sqlite, strutils, times -proc showPagedResults(conn: TDbConn; params: TPagedParams) = +proc showPagedResults(conn: DbConn; params: TPagedParams) = ## Shows the contents of the database in pages of specified size. ## ## Hmm... I guess this is more of a debug proc which should be moved outside, |