本文整理汇总了Python中sqlite3.version方法的典型用法代码示例。如果您正苦于以下问题:Python sqlite3.version方法的具体用法?Python sqlite3.version怎么用?Python sqlite3.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlite3
的用法示例。
在下文中一共展示了sqlite3.version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: analyze_db
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def analyze_db():
conn = sqlite3.connect('WhatsappDB/msgstore.db')
cursor = conn.cursor()
rows=list()
print 'Module Version ',sqlite3.version
print 'Library Version ',sqlite3.sqlite_version
print ""
for row in cursor.execute('SELECT * FROM messages where edit_version=7 and key_from_me = 1 ORDER BY _id'):
row_date=str(row[7])
if len(row_date)>10:
row_date = row_date[:len(row_date)-3]
row_date=datetime.datetime.fromtimestamp(int(row_date)).strftime('%Y-%m-%d %H:%M:%S')
text = "Numero de telefono de whatsapp borrado [>] "+ str(str(row[1]).split("@")[0]) + "\nTimestamp [>] "+row_date
print text
rows.append(text)
cursor.close()
conn.close()
return rows
示例2: check7_sqlite3
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def check7_sqlite3(self):
'''sqlite3
#TODO need to add to required section readme
https://stackoverflow.com/a/1546162
'''
self.append_text("\n")
# Start check
#SQLITE_MIN_VERSION = (0, 0, 0)
try:
import sqlite3
# sqlite3.version - pysqlite version
sqlite3_py_version_str = sqlite3.version
# sqlite3.sqlite_version - sqlite version
sqlite3_version_str = sqlite3.sqlite_version
except ImportError:
sqlite3_version_str = 'not found'
sqlite3_py_version_str = 'not found'
result = ("* SQLite Database library (sqlite3: " +
sqlite3_version_str + ") (Python-sqlite3: " +
sqlite3_py_version_str + ")")
# End check
self.append_text(result)
示例3: check13_pyicu
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def check13_pyicu(self):
'''PyICU'''
self.append_text("\n")
# Start check
try:
import PyICU
try:
pyicu_str = PyICU.VERSION
icu_str = PyICU.ICU_VERSION
except Exception: # any failure to 'get' the version
pyicu_str = 'unknown version'
icu_str = 'unknown version'
except ImportError:
pyicu_str = 'not found'
icu_str = 'not found'
result = "* PyICU " + pyicu_str + "(ICU " + icu_str + ")"
# End check
self.append_text(result)
示例4: _create_db
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def _create_db(self):
"""Create a db file that doesn't exist yet.
Initializes the schema and certain metadata.
"""
if self._debug.should('dataio'):
self._debug.write("Creating data file {!r}".format(self._filename))
self._dbs[get_thread_id()] = db = SqliteDb(self._filename, self._debug)
with db:
db.executescript(SCHEMA)
db.execute("insert into coverage_schema (version) values (?)", (SCHEMA_VERSION,))
db.executemany(
"insert into meta (key, value) values (?, ?)",
[
('sys_argv', str(getattr(sys, 'argv', None))),
('version', __version__),
('when', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')),
]
)
示例5: _read_db
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def _read_db(self):
"""Read the metadata from a database so that we are ready to use it."""
with self._dbs[get_thread_id()] as db:
try:
schema_version, = db.execute_one("select version from coverage_schema")
except Exception as exc:
raise CoverageException(
"Data file {!r} doesn't seem to be a coverage data file: {}".format(
self._filename, exc
)
)
else:
if schema_version != SCHEMA_VERSION:
raise CoverageException(
"Couldn't use data file {!r}: wrong schema: {} instead of {}".format(
self._filename, schema_version, SCHEMA_VERSION
)
)
for row in db.execute("select value from meta where key = 'has_arcs'"):
self._has_arcs = bool(int(row[0]))
self._has_lines = not self._has_arcs
for path, file_id in db.execute("select path, id from file"):
self._file_map[path] = file_id
示例6: dumps
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def dumps(self):
"""Serialize the current data to a byte string.
The format of the serialized data is not documented. It is only
suitable for use with :meth:`loads` in the same version of
coverage.py.
Returns:
A byte string of serialized data.
.. versionadded:: 5.0
"""
if self._debug.should('dataio'):
self._debug.write("Dumping data from data file {!r}".format(self._filename))
with self._connect() as con:
return b'z' + zlib.compress(to_bytes(con.dump()))
示例7: sys_info
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def sys_info(cls):
"""Our information for `Coverage.sys_info`.
Returns a list of (key, value) pairs.
"""
with SqliteDb(":memory:", debug=NoDebugging()) as db:
temp_store = [row[0] for row in db.execute("pragma temp_store")]
compile_options = [row[0] for row in db.execute("pragma compile_options")]
return [
('sqlite3_version', sqlite3.version),
('sqlite3_sqlite_version', sqlite3.sqlite_version),
('sqlite3_temp_store', temp_store),
('sqlite3_compile_options', compile_options),
]
示例8: connect_to_db
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def connect_to_db(dbname, verbose=False):
"""
Connect to the database
:param dbname: the database file name
:param verbose: print addtional output
:return: the database connection
"""
try:
conn = sqlite3.connect(dbname)
except sqlite3.Error as e:
print(e)
sys.exit(-1)
if verbose:
sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))
return conn
示例9: connect_to_db
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def connect_to_db(dbname, verbose=False):
"""
Connect to the database
:param dbname: the database file name
:param verbose: print addtional output
:return: the database connection
"""
try:
if verbose:
sys.stderr.write("Connecting to {}\n".format(os.path.join(defaultdir, dbname)))
conn = sqlite3.connect(os.path.join(defaultdir, dbname))
except sqlite3.Error as e:
sys.stderr.write("ERROR Creating database: {}\n".format(os.path.join(defaultdir, dbname)))
sys.stderr.write(e)
sys.exit(-1)
if verbose:
sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))
return conn
示例10: connect_to_db
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def connect_to_db(dbname, verbose=False):
"""
Connect to the database
:param dbname: the database file name
:param verbose: print addtional output
:return: the database connection
"""
global conn
if conn:
return conn
try:
conn = sqlite3.connect(dbname)
except sqlite3.Error as e:
print(e)
sys.exit(-1)
if verbose:
sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))
return conn
示例11: createdb
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def createdb(db, verbose=False):
"""
Create the database connection
:param db:
:return:
"""
try:
conn = sqlite3.connect(db)
except sqlite3.Error as e:
sys.stderr.write("ERROR Creating database: {}\n".format(db))
sys.stderr.write(e)
sys.exit(-1)
if verbose:
sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))
return conn
示例12: get_summary
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def get_summary(cls):
"""
Return a dictionary of information about this database backend.
"""
summary = {
"DB-API version": "2.0",
"Database SQL type": cls.__name__,
"Database SQL module": "sqlite3",
"Database SQL Python module version": sqlite3.version,
"Database SQL module version": sqlite3.sqlite_version,
"Database SQL module location": sqlite3.__file__,
}
return summary
示例13: check1_python
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def check1_python(self):
'''Check python version Gramps is currently running with against min
version required
#TODO - does not handle an older version of Gramps using python 2 on
that a system that has python 3 installed (same for each of the other
test)
'''
# Start check
MIN_PYTHON_VERSION = (3, 3, 0)
min_py_str = verstr(MIN_PYTHON_VERSION)
# version to check against
# Gramps running version of python
py_str = '%d.%d.%d' % sys.version_info[:3]
check1 = "* Python "
if not sys.version_info >= MIN_PYTHON_VERSION:
#print("Failed")
messagefailed1 = " (Requires version "
messagefailed3 = " or greater installed.)\n"
messagefailed = messagefailed1 + min_py_str + messagefailed3
result = check1 + py_str + messagefailed
else:
#print("Success")
messagesuccess1 = " (Success version "
messagesuccess3 = " or greater installed.)\n"
messagesuccess = messagesuccess1 + min_py_str + messagesuccess3
result = check1 + py_str + messagesuccess
# End check
self.append_text(result)
示例14: check11_osmgpsmap
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def check11_osmgpsmap(self):
'''osmgpsmap'''
# Start check
OSMGPSMAP_MIN_VERSION = (1, 0)
OSMGPSMAP_FOUND = False
try:
from gi import Repository
repository = Repository.get_default()
if repository.enumerate_versions("OsmGpsMap"):
gi.require_version('OsmGpsMap', '1.0')
from gi.repository import OsmGpsMap as osmgpsmap
try:
osmgpsmap_str = osmgpsmap._version
OSMGPSMAP_FOUND = True
except Exception: # any failure to 'get' the version
osmgpsmap_str = 'unknown version'
else:
osmgpsmap_str = 'not found'
except ImportError:
osmgpsmap_str = 'not found'
if OSMGPSMAP_FOUND:
result = ("* osmgpsmap " + osmgpsmap_str + " (Success version " +
verstr(OSMGPSMAP_MIN_VERSION) +
" or greater installed.)")
else:
result = ("* osmgpsmap " + osmgpsmap_str + " (Requires version " +
verstr(OSMGPSMAP_MIN_VERSION) + " or greater)")
# End check
self.append_text(result)
示例15: check12_graphviz
# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import version [as 别名]
def check12_graphviz(self):
'''Graphviz
Needs the liblasi library with utf-8 support to create ps/ps2 output
GRAPHVIZ_MIN_VER = (2, 28)
https://github.com/Alexpux/MINGW-packages/issues/737#issuecomment-147185667
# bpisoj commented that Gramps needs a version of Graphviz that :
[needs additional]...library be added to msys2-mingw stack as
libann, libgts and liblasi?
I am interested in last one as only that support utf-8 characters
in ps/ps2 output.
'''
#self.append_text("\n")
# Start check
try:
dotversion_str = Popen(['dot', '-V'],
stderr=PIPE).communicate(input=None)[1]
if isinstance(dotversion_str, bytes) and sys.stdin.encoding:
dotversion_str = dotversion_str.decode(sys.stdin.encoding)
if dotversion_str:
dotversion_str = dotversion_str.replace('\n', '')[23:27]
except Exception:
dotversion_str = 'Graphviz not in system PATH'
result = "Graphviz " + dotversion_str
# End check
self.append_text(result)