示例#1
0
def create_book(cursor, row):
    _row = sqlite3.Row(cursor, row)

    book = Book()
    book.id = _row["book_id"]
    book.author = _row["author"]
    book.isbn_number = _row["isbn_number"]
    book.title = _row["title"]
    book.year_published = _row["year_published"]

    librarian = Librarian()
    librarian.id = _row["librarian_id"]
    librarian.first_name = _row["first_name"]
    librarian.last_name = _row["last_name"]

    library = Library()
    library.id = _row["library_id"]
    library.title = _row["library_name"]

    book.librarian = librarian
    book.location = library

    return book
示例#2
0
def create_book(cursor, row):
    _row = sqlite3.Row(cursor, row)

    book = Book()
    book.id = _row["book_id"]
    book.Author = _row["Author"]
    book.ISBNNumber = _row["ISBNNumber"]
    book.bookTitle = _row["bookTitle"]
    book.YearPublished = _row["YearPublished"]

    librarian = Librarian()
    librarian.id = _row["librarian_id"]
    librarian.first_name = _row["first_name"]
    librarian.last_name = _row["last_name"]

    library = Library()
    library.id = _row["library_id"]
    library.title = _row["library_name"]

    book.librarian = librarian
    book.location = library

    return book
示例#3
0
def create_library(cursor, row):
    _row = sqlite3.Row(cursor, row)

    library = Library()
    library.id = _row["id"]
    library.title = _row["title"]
    library.address = _row["address"]

    # Note: You are adding a blank books list to the library object
    # This list will be populated later (see below)
    library.books = []

    book = Book()
    book.id = _row["book_id"]
    book.title = _row["book_title"]
    book.author = _row["author"]
    book.isbn = _row["isbn"]
    book.published_year = _row["published_year"]

    # Return a tuple containing the library and the
    # book built from the data in the current row of
    # the data set
    return (library, book,)
示例#4
0
def create_book(cursor, row):
    _row = sqlite3.Row(cursor, row)
    
    book = Book()
    book.id = _row['book_id']
    book.author = _row['author']
    book.isbn = _row['isbn']
    book.title = _row['title']
    book.year_published = _row['year_published']
    
    librarian = Librarian()
    librarian.id = _row['librarian_id']
    librarian.first_name = _row['first_name']
    librarian.last_name = _row['last_name']

    library = Library()
    library.id = _row['library_id']
    library.title = _row['library_name']

    book.librarian = librarian
    book.location = library

    return book