-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fabian Externbrink
committed
Jul 5, 2017
1 parent
fcb6be0
commit a2c0ffe
Showing
3 changed files
with
33 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# OrcID_ | ||
# ORC-Schlange |
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,18 @@ | ||
from sqlite3 import connect | ||
|
||
class DB: | ||
def __init__(self,path="example/people.db"): | ||
self.conn = connect(path) | ||
self.c = self.conn.cursor() | ||
|
||
def getList(self): | ||
self.c.execute('SELECT * FROM people') | ||
return self.c.fetchall() | ||
|
||
def close(self): | ||
self.conn.close() | ||
|
||
if __name__ == "__main__": | ||
db = DB() | ||
print(db.getList()) | ||
db.close() |
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,14 @@ | ||
import sqlite3 | ||
|
||
conn = sqlite3.connect('example/people.db') | ||
c = conn.cursor() | ||
|
||
c.execute("DROP TABLE people") | ||
c.execute("CREATE TABLE people (orcid CHARACTER(16), start DATE, end DATE)") | ||
c.execute("INSERT INTO people VALUES ('0000000219094153','1900-01-01','2016-12-31')") | ||
c.execute("INSERT INTO people VALUES ('000000020183570X','1900-01-01','2016-12-31')") | ||
c.execute("INSERT INTO people VALUES ('0000000303977442','1900-01-01','2016-12-31')") | ||
|
||
conn.commit() | ||
|
||
conn.close() |