SQL - mwicat/personal GitHub Wiki
python mysql
sudo apt-get install python-mysql.connector
import mysql.connector
cnx = mysql.connector.connect(user='root', database='download')
cursor = cnx.cursor()
query = "SELECT * from download"
cursor.execute(query)
for row in cursor:
print row
get columns
print ', '.join(r[0] for r in cursor.description)
sqlite
Update datetime rows
update messages set timestamp=datetime(timestamp, '-20 seconds');
update messages set timestamp=datetime(timestamp, '-20 seconds') where time(timestamp) > '10:37:00';
update messages set timestamp=strftime("%Y-%m-%d %H:%M:%f", timestamp, '-20 seconds') where time(timestamp) > '10:37:00';
sccpsoftkeyevent
Select datetime rows
select number from messages where time(timestamp) > '10:37:00';
SELECT strftime("%Y-%m-%d %H:%M:%f",timestamp) FROM messages;
Select binary
sqlite3 packets.db 'select quote(data) from messages where number in (50,51,62)'