Screenshot
Additional features
Add-ins
Community
Reporting Bugs
Developer Questions
Download Center
Invoice Templates
External links
Microsoft Visual Basic .
Microsoft Visual Basic .
Category:Discontinued Microsoft software
Category:Microsoft Office-related software
Category:Visual Basic softwareQ:
Table SQLite
I need to save a table to sqlite database so I do this:
data = {
'__id__': serialize.dumps(obj),
'text': obj.text,
'date': obj.date
}
cursor.executemany('create table mytable (__id__ text primary key, text text, date date)')
This works ok but I don't want to create the table everytime I create a new instance of my class.
I need some way of "defining" the table in the class and then "saving" it in the function.
How can I do this?
Thanks
A:
You can create the table in the class like:
class MyClass:
def __init__(self, name):
self.name = name
def __init_db(self):
self.db = sqlite3.connect('mytable.db')
def __init__(self, name):
self.name = name
self.db.execute('create table mytable (__id__ text primary key, text text, date date)')
self.mytable = self.db.execute('select * from mytable')
With the rapid development of Internet technology, the users have access to a lot of Internet contents. People may easily obtain various kinds of Internet contents via Internet. People may select a favorite Internet content from a number of Internet contents and store the favorite Internet content in a memory.
The favorite Internet content may be an Internet news, a website, a service providing server, an enterprise server, and the like. When the favorite Internet content is stored in the memory, a user may find the favorite Internet content and read the favorite Internet content easily by using the Internet browsing function of the mobile phone.
Generally, a be359ba680
Related links:
Comments