mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 04:00:18 +03:00
Merge branch 'master' into asyncio
This commit is contained in:
commit
aa80f92807
|
@ -173,16 +173,8 @@ class SQLiteSession(MemorySession):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _create_table(c, *definitions):
|
def _create_table(c, *definitions):
|
||||||
"""
|
|
||||||
Creates a table given its definition 'name (columns).
|
|
||||||
If the sqlite version is >= 3.8.2, it will use "without rowid".
|
|
||||||
See http://www.sqlite.org/releaselog/3_8_2.html.
|
|
||||||
"""
|
|
||||||
required = (3, 8, 2)
|
|
||||||
sqlite_v = tuple(int(x) for x in sqlite3.sqlite_version.split('.'))
|
|
||||||
extra = ' without rowid' if sqlite_v >= required else ''
|
|
||||||
for definition in definitions:
|
for definition in definitions:
|
||||||
c.execute('create table {}{}'.format(definition, extra))
|
c.execute('create table {}'.format(definition))
|
||||||
|
|
||||||
# Data from sessions should be kept as properties
|
# Data from sessions should be kept as properties
|
||||||
# not to fetch the database every time we need it
|
# not to fetch the database every time we need it
|
||||||
|
|
Loading…
Reference in New Issue
Block a user