Get Sqlite file Modified Date and Time

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Get Sqlite file Modified Date and Time

Post by jalz » Thu Aug 10, 2017 2:12 pm

Hey Guys,

Need a little bit of help please. I'm trying to get the modified Date and Time of a sqlite file. Initially, after doing some research and reading the dictionary I thought I could somehow use the read from file command combined with the it variable to obtain this data somehow (wasn't sure how but thought I could parse through the data somehow). However after running my script, the it variable is always empty. I know the read from file command works with ascii and binary files, is sqlite a binary file (I thought all files on a computer were in binary format)

The code I am using is similar to the one below (I know the pathname is correct as I can read and write to my database fine with the same pathname I use)

Code: Select all

read from file specialFolderPath("desktop") & "/myDb.sqlite" until EOF
put it into field "Test"
Is there another command I should be looking for?

Thanks
Jalz
Last edited by jalz on Thu Aug 10, 2017 4:24 pm, edited 1 time in total.

Klaus
Posts: 11313
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Get Sqlite file Modified Date and Time

Post by Klaus » Thu Aug 10, 2017 3:08 pm

Hi Jalz,

do something like this (out of my head):

Code: Select all

...
put the folder into tOldDir
put urlencode("myDb.sqlite") into tFile
set the folder to specialfoderpath("desktop")
put the long files into tLF
put lineoffset(tFile,tLF) into tFound
put item 5 of line tFound of tLF into tModData
convert tModDate from seconds to date and long time
answer "DB File last modified at:" && tModDate
...
Check "files" in the dictionary for more fun with "long files".


Best

Klaus

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Get Sqlite file Modified Date and Time

Post by jalz » Thu Aug 10, 2017 7:11 pm

Awesome Klaus,

Your code works a treat :)- Thankyou

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”