Database Events returns empty lists when databases are queried

The script below targets an app’s database files. The result is empty. Why?
Furthermore, the store type property produces stop in every case. What causes that?

set ABSupportFol_path to (((path to application support folder from user domain) as text) & "AddressBook")
# set ABSupportFol_path to (path to desktop) as text
set ABSupportFol_alias to ABSupportFol_path as alias
set ABSupportFol_posix to POSIX path of ABSupportFol_alias

tell application "Finder"
	set _Databases_alias to (every document file of alias ABSupportFol_path whose name contains "aclcddb" or name contains "abcddb") as alias list
	# set _Databases_alias to (every document file of alias ABSupportFol_path whose name contains "dbev") as alias list
	set _Databases_posix to {}
	repeat with aDB in every item of _Databases_alias
		set end of _Databases_posix to POSIX path of aDB
	end repeat
end tell

tell application "Database Events"
	set quit delay to 0
	set DB_records to {}
	repeat with aDB in _Databases_posix
		tell database aDB
			open
			set end of DB_records to records
		end tell
	end repeat
	set DBCount to count every database
	log "Database Events Running 1" & (log (running is true))
	set _Database_types to store type of every database
	
	
	return {DB_records, _Database_types, DBCount}
end tell

Model: MacBook Pro 9,1 (mid-2012 15") Core i7 2.3 GHz, 16 GB RAM, 1TB SSD
AppleScript: 2.7
Browser: Safari 605.1.15
Operating System: macOS 10.14

I don’t think DataBase events works the way you want it to.

The app was designed to give AppleScript access to a set of database tools.

I don’t think it works with any database it didn’t create, and databases created by it don’t work with any other system.

Unfortunately, there’s not a lot of database options for AppleScript.

If the file format for the data you’re looking at is compatible with SQL Lite, I recommend Shane’s SQLite Lib2

https://latenightsw.com/freeware/

Freeware | Late Night Software
SQLite Lib 1.0.0 and SQLite Lib2 1.1.0

I think that database events creates standard sqlite databases. They can be manipulated with other tools (e.g. db browser for sqlite). As well, there’s no reason that it wouldn’t provide access to a standard db produced by another application.

Of note, you need to ‘launch’ database events. Telling only is insufficient.

tell application "Database Events"
       launch
end tell

There is an old primer that was published by MacTech many moons ago. It might be worth a read.

Introduction to Database Events
https://preserve.mactech.com/articles/mactech/Vol.22/22.02/IntrotoDatabaseEvents/index.html

You would think so, and I thought so too, but no.

I started using Database Events when it was first available, and had a significant number of different databases created using it.

When Shane came out with SQLLiteLib, I tried opening some of those databases with SQLLite and that failed, then I tried opening SQLLite databases in database events and that failed. (They opened but the result was random noise).

I had to write a script that would call every record in Database Events and then add them to SQLite (luckily SQLLite Lib has a batch update command).

If I remember right Shane was saying that while Database Events uses the SQLLite engine, it adds wrappers and other cruft that keep it from being compatible with SQLLite apps or any other database.

But we should confirm with Shane. (Or Ben Waldie, who wrote the article you linked to, which I used when I first started using DB Events)

http://preserve.mactech.com/articles/mactech/Vol.22/22.02/IntrotoDatabaseEvents/index.html

More or less. Database Events stores both the data and the structure of the DB, and you need to reverse-engineer how the structure is stored to be able to do anything meaningful with it.

For what it’s worth, this seems to open the dbs in question:

use script "SQLite Lib2" version "1.1.2"
use scripting additions

set ABSupportFol_path to (((path to application support folder from user domain) as text) & "AddressBook")
# set ABSupportFol_path to (path to desktop) as text
set ABSupportFol_alias to ABSupportFol_path as alias
set ABSupportFol_posix to POSIX path of ABSupportFol_alias

tell application "Finder"
	set _Databases_alias to (every document file of alias ABSupportFol_path whose name contains "aclcddb" or name contains "abcddb") as alias list
	# set _Databases_alias to (every document file of alias ABSupportFol_path whose name contains "dbev") as alias list
	set _Databases_posix to {}
	repeat with aDB in every item of _Databases_alias
		reveal aDB
		set end of _Databases_posix to POSIX path of aDB
	end repeat
end tell


set DB_records to {}
repeat with aDB in _Databases_posix
	set result_Any to open db in file aDB ¬
		can write false ¬
		can create false ¬
		without load into memory
	
end repeat


return {DB_records, _Database_types, DBCount}