@UNQKVF[[u,]filename,"key","value"[,length]] : Add a key / file value pair to a UnQlite database.
u | Optional flag that the key and value are Unicode (UTF16) |
filename | Database opened with @UNQOPEN |
key | Key to add or replace |
filename | Store the contents of the file filename in the value |
length | Optional length (in bytes) to write (if -1 or nor specified, write the entire file) |
The maximum file size is dependent on the amount of RAM and disk space available.
Returns 0 if successful, or the error text if not.
Example:
This example opens a database named "test.db", writes a key/file to the database, and then reads it back, saving it in a new file.
echo Testing file write and read
echo This is a test file > testfile.txt
echo %@unqopen[rwc,test.db]
echo %@unqkvf[test.db,"aaa",testfile.txt]
echo %@unqreadf[test.db,"aaa",newtestfile.txt]
echo %@unqclose[test.db]
See also: @UNQOPEN, @UNQCLOSE, @UNQKVFA.