New database commands

Dec 26, 2009
12
2
Uranus
#1
Tried the new database commands in TCC 23. This example is given in the TCC Help file:

echo Testing file write and read
echo %@unqopen[rwc,test.db]
echo %@unqkvf[test.db,"aaa",ansi.cmd]
echo %@unqreadf[test.db,"aaa",newansi.cmd]
echo %@unqclose[test.db]


When I run this, exactly as written in the Help File, line 3 produces an error message:

The system cannot find the file specified.
ansi.cmd
 
#2
That example shows @UNQREADF being used with 3 parameters.
Code:
echo %@unqreadf[test.db,"aaa",newansi.cmd]
The help seems to show it requiring at least 4 parameters.
Code:
@UNQREADF[[u,]filename, "key", outputname, length]
Also ... apparently, ansi.cmd MUST exist because it's ENTIRE CONTENTS will be paired with "aaa" in the database. Is that really what's desired/intended? It seems a bit strange to me.
 

rconn

Administrator
Staff member
May 14, 2008
10,532
94
#3
That example shows @UNQREADF being used with 3 parameters.
Code:
echo %@unqreadf[test.db,"aaa",newansi.cmd]
The help seems to show it requiring at least 4 parameters.
Code:
@UNQREADF[[u,]filename, "key", outputname, length]
The length is optional; if it's not specified the entire file is read.
 

rconn

Administrator
Staff member
May 14, 2008
10,532
94
#4
Tried the new database commands in TCC 23. This example is given in the TCC Help file:

echo Testing file write and read
echo %@unqopen[rwc,test.db]
echo %@unqkvf[test.db,"aaa",ansi.cmd]
echo %@unqreadf[test.db,"aaa",newansi.cmd]
echo %@unqclose[test.db]


When I run this, exactly as written in the Help File, line 3 produces an error message:

The system cannot find the file specified.
ansi.cmd
ANSI.CMD is a dummy file name for the purpose of the example; it must exist in your working directory.
 

rconn

Administrator
Staff member
May 14, 2008
10,532
94
#5
Also ... apparently, ansi.cmd MUST exist because it's ENTIRE CONTENTS will be paired with "aaa" in the database. Is that really what's desired/intended? It seems a bit strange to me.
Yes, it must exist, and the entire contents will only be paired with "aaa" if you don't specify a length. Why is that strange?
 
#6
Yes, it must exist, and the entire contents will only be paired with "aaa" if you don't specify a length. Why is that strange?
What seems strange is that a copy of the entire file winds up inside the database. Are there situations in which databases actually work that way? Since the file must exist locally, so it would seem more efficient to pair "aaa" with the (fq) name of the file.