Skip to content

Instantly share code, notes, and snippets.

@tfaris
Created October 18, 2017 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfaris/734f6169485828aaa1ec1cf49515964b to your computer and use it in GitHub Desktop.
Save tfaris/734f6169485828aaa1ec1cf49515964b to your computer and use it in GitHub Desktop.
[ArmedXpert] One method for running an arbitrary SQL SELECT query using the ArmedXpert plugin editor.
editor.ClearLog()
import clr
clr.AddReference('System.Data.SQLite')
from nichevision.forensics.armedxpert.dnada.datalayer import Database
from System.Data.SQLite import SQLiteCommand
cmd = SQLiteCommand("select * from AlleleCombination", Database.SharedDatasource.Connection)
reader = cmd.ExecuteReader()
try:
while reader.Read():
v = list(reader.GetValues())
output = ','.join(['%s = %s%s' % (
name,
str(reader[name])[:50],
'...' if len(str(reader[name])) > 50 else '')
for name in v])
print output
finally:
reader.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment