diff options
author | john haque <j.eh@mchsi.com> | 2012-05-02 08:05:43 -0500 |
---|---|---|
committer | john haque <j.eh@mchsi.com> | 2012-05-02 08:05:43 -0500 |
commit | 3a8c139d1a28651bf222b05cb0895bf5066bb9f9 (patch) | |
tree | cbe9b6c918bef7439f6c321925c30066e6103771 /extension/testdbarray.awk | |
parent | 50c2afd6433f1c4407b04d2f75e536da7c94fe74 (diff) | |
download | egawk-3a8c139d1a28651bf222b05cb0895bf5066bb9f9.tar.gz egawk-3a8c139d1a28651bf222b05cb0895bf5066bb9f9.tar.bz2 egawk-3a8c139d1a28651bf222b05cb0895bf5066bb9f9.zip |
Fix memory corruption in copying an array, add another array extension.
Diffstat (limited to 'extension/testdbarray.awk')
-rw-r--r-- | extension/testdbarray.awk | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/extension/testdbarray.awk b/extension/testdbarray.awk new file mode 100644 index 00000000..fd7fd595 --- /dev/null +++ b/extension/testdbarray.awk @@ -0,0 +1,21 @@ +@include "dbarray.awk" + +# $ ../gawk -f testdbarray.awk +# $ ../gawk -f testdbarray.awk +# ... +# $ ../gawk -vINIT=1 -f testdbarray.awk + + +BEGIN { + # bind array 'A' to the table 'table_A' in sqlite3 database 'testdb' + db_bind(A, "testdb", "table_A") + + if (INIT) # detele table and start over + delete A + + lenA = length(A) + A[++lenA] = strftime() + PROCINFO["sorted_in"] = "@ind_num_asc" + for (item in A) + print item, ":", A[item] +} |