Is it necessary to encode() for file names in sqlar format?
Peng Yu <[email protected]>
| Newsgroups | gmane.comp.db.sqlite.general |
|---|---|
| Message-ID | <CABrM6wmHXKhb=s6=PFi_uQUpk=3b1=kQXOX0nRUbkp5GdqFngQ@mail.gmail.com> |
I use the following python3 code to create sqlar file. Is it necessary
to sys.argv[2].encode('utf-8') in the line of execute()? In other
word, does the native sqlar tools inteprete the name column as an
encoded value or a non-encode value? Thanks.
import sqlite3
conn=sqlite3.connect(sys.argv[1])
c=conn.cursor()
c.execute('''
CREATE TABLE IF NOT EXISTS sqlar(
name TEXT PRIMARY KEY
, mode INT
, mtime INT
, sz INT
, data BLOB)
''')
import zlib
data = sys.stdin.buffer.read()
c.execute('REPLACE INTO sqlar VALUES(?, ?, ?, ?, ?)', [sys.argv[2], 0,
0, len(data), zlib.compress(data)])
conn.commit()
--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users