Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get an Item's time modified in a qml file
I am in need to find the time modified information of qm-items in a .qml file. I have written the following macro to get column names. I failed to locate the time modified info. Any advice is much appreciated.

Function QML_Columns
Select All      Help
str sPath="K:\QM Backup\18.4847_180429073652_Porto-Res.qml"
str s s0 s1

Sqlite x.Open(sPath 1)
SqliteStatement t g
t.Prepare(x "SELECT text,rowid FROM texts")
g.Prepare(x "SELECT * FROM items WHERE rowid=?1")

int m=g.GetColumnCount
int i rowid
g.BindInt(1 rowid)
for i 0 m
,out F"{i} {s0} : {s}"
I understand that  table texts has a column named "date". Is it likely to be the time modified of this item? If this is the case, how can one convert these string to a valid date/time string.

Thank you for any advice.
Macro get QM item properties from a QM file
Select All      Help
str sPath="Q:\My QM\backup\System.DA667CE0.47ED2B42.qml"

Sqlite x.Open(sPath 1)
SqliteStatement g t
g.Prepare(x "SELECT rowid,name,flags FROM items")
t.Prepare(x "SELECT date,text FROM texts WHERE rowid=?1")
,;get item properties from 'items' table
,if(!g.FetchRow) break
,int rowid=g.GetInt(0)
,str name=g.GetText(1)
,int flags=g.GetInt(2)
,int itemType=flags&0xff
,int isFolder=itemType=6
,lpstr st=0; sel(itemType) case 1 st="Macro"; case 2 st="Function"; case 3 st="Menu"; case 4 st="Toolbar"; case 5 st="Autotext"; case 6: st="Folder"; case 7 st="Member f."; case 8 st="File link"
,;get item properties from 'texts' table
,t.BindInt(1 rowid)
,;get date
,str date
,if isFolder
,,DateTime* p=t.GetBlob(0 _i)
,,if(p.t) DateTime d=sub.Reverse64(p.t); date=d.ToStr; else date="unknown"
,;get text. Maybe you don't need it, it's just an example. If don't need, remove ",text" from SELECT.
,str text=t.GetText(1)
,text.LimitLen(100); text.escape(1) ;;to display in single line
,out F"<>{name%%-30s}  <c 0xff0000>{st%%-12s}</c>  <c 0x8000>{date%%-20s}</c>  <_>{text}</_>"

#sub Reverse64
function'long long'x

long r
byte* a(&x) b(&r)
int i
for i 0 8
ret r
It is perfect! Many thanks indeed!

Forum Jump:

Users browsing this thread: 1 Guest(s)