Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

UNQLITE and :mem:

Aug
1,914
68
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  27.00.21 x64   Windows 10 [Version 10.0.19042.867]

In the help for UNQLITE, it says;
If filename is ":mem:", then a private in-memory database is created. The in-memory database will be discarded when the database is closed.

When I run the following;
Code:
@setlocal
@echo off

::set thedb=jlc.db
set thedb=:mem:
echo Datebase: %thedb

echo Opening database for read/write/create
unqlite /db:"%thedb" /rwc

echo Name of current database: %_unq_db

unqlite /db:"%thedb" /kvs "keyone" "This is a string value assigned to keyone"

unqlite /db:"%thedb" /r "keyone"

echo Closing the database
unqlite /c

echo Name of current database: %_unq_db

endlocal
quit

It gives an I/O error;
Code:
e:\utils>testun
Datebase: :mem:
Opening database for read/write/create
Name of current database: E:\Utils\:mem:
IO error while opening the target database file: E:\Utils\:mem:

IO error while opening the target database file: E:\Utils\:mem:
IO error while opening the target database file: E:\Utils\:mem:

Closing the database
Name of current database: E:\Utils\:mem:

Also, %_unq_db says that the :mem: database is in the directory from which I opened the :mem: database.

I have checked, and there is no physical E:\Utils\:mem: database created, nor should there be.

Why am I getting these I/O errors?

Joe
 
Hey @jpavel,
Does this code work okay for you?

I just tested the code again, and it still works as it should.
Code:
e:\utils>testun.btm
Datebase: :mem:
Opening database for read/write/create
Name of current database: :mem:
This is a string value assigned to keyone
Closing the database
Name of current database: :mem:

I am using;
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  28.02.18 x64   Windows 10 [Version 10.0.19043.1526]

This is in response to your recent question.

Joe
 
I thought there was a recent thread about the @UNQ* functions and :mem" but I couldn't find it. I put this at line 17 in your (@Joe Caverly ) script.

Code:
Echo Trying to open with @UNQOPEN (should get 0)
echo @UNQOPEN returned %@unqopen[rwc,%thedb]

echo Trying @UNQREADS
echo The string in keyone is %@unqreads[%thedb,keyone]

And got this.

Code:
Datebase: :mem:
Opening database for read/write/create
Name of current database: :mem:
This is a string value assigned to keyone
Trying to open with @UNQOPEN (should get 0)
@UNQOPEN returned 0
Trying @UNQREADS
IO error while opening the target database file: V:\:mem:

The string in keyone is 2
Closing the database
Name of current database: :mem:

Are the @UNQ* functions supposed to work with :mem:?
 
Can you make subkey/value pairs inside a key? If so, what's the syntax?
 
Has anyone got UNQLITE /KVF to work? I get this.

Code:
v:\> type v:\hello.txt
Hello world.

v:\> unqlite /db:"txt.db" /rwc

v:\> echo %_unq_db
V:\txt.db

v:\> unqlite /db:"txt.db" /KVF "hello" v:\hello.txt -1
Usage : UNQLITE [/RWC [/RO [/MM] /RW /TEMP /MM]] [/DB:"database"] [/C] [/D key] [/R key] [/KVS "key" "value"] [/KVSA "key" "string"] [/KVB "key" handle length] [/KVBA "key" handle length] [/KVF "key" filename length] [/KVFA "key" filename length]
 
The corresponding @UNQ* functions seem to work.

Code:
v:\> echo %@unqopen[rwc,"txt.db"]
0

v:\> echo %@unqkvf["txt.db","hello",v:\hello.txt]
0

v:\> echo %@unqreadf["txt.db","hello",hello2.txt]
0

v:\> echo %@unqclose["txt.db"]
0

v:\> type v:\hello2.txt
Hello world.
 
Back
Top