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
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to