Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perplexing Behavior from Metakit

4 views
Skip to first unread message

Andrew Mangogna

unread,
Jun 24, 2007, 8:42:38 PM6/24/07
to
Recently, I have stumbled upon a behavior of Metakit of which I was neither
aware nor do I understand. The circumstances arose when storing some data
in a view for which one of the columns was named "Date" (as in the date
when the data was stored). This worked perfectly well until I packaged the
application into a starpack. Then, when retrieving the view that contained
the "Date" column name, the "mk::get" command began to return "Date"
as "date" (much to the grief of my application).

The difference was due to the use of the interpreter embedded in the
starpack. The following shows the differences:

tclsh ================================

$ tclsh
% package require Mk4tcl
2.4.9.6
% mk::file open db foo.mk
db
% mk::view layout db.A {Date Comment}
db.A
% mk::view layout db.A
Date Comment
% mk::row append db.A {Date 3/3/33 Comment {This is a comment}}
db.A!0
% mk::get db.A!0
Date 3/3/33 Comment {This is a comment}
% puts $tcl_version
8.5
% puts $tcl_patchLevel
8.5a5
%

and now using a tclkit

tclkit-linux-x86 =============================

$ tclkit-linux-x86
% package require Mk4tcl
2.4.9.5
% mk::file open db foo.mk
db
% mk::view layout db.A {Date Comment}
db.A
% mk::view layout db.A
Date Comment
% mk::row append db.A {Date 3/3/33 Comment {This is a comment}}
db.A!0
% mk::get db.A!0
date 3/3/33 Comment {This is a comment}
%

===============================

My guess was that somehow the use of Metakit in the virtual file system of
the starpack was coming into play. While groping through the metakit VFS
code I found the view layout for file system storage:

mk::view layout $db.dirs \
{name:S parent:I {files {name:S size:I date:I contents:M}}}

As it turns out, all the column names (name, parent, files, size, date and
contents) are turned in lower case form even if a view has been defined
with a layout that has upper case versions, as in:

============================
$ tclkit-linux-x86
% package require Mk4tcl
2.4.9.5
% mk::file open db foo.mk
db
% mk::view layout db.A {NAME SIZE DATE FILES}
db.A
% mk::view layout db.A
NAME SIZE DATE FILES
% mk::row append db.A {NAME John SIZE 22 DATE 3/3/33 FILES {a.out foo.c}}
db.A!0
% mk::get db.A!0
name John size 22 date 3/3/33 files {a.out foo.c}
%

===========================

I don't pretend to have any knowledge of Metakit internals, but it would
seem that column names are somehow cached on a case insensitive basis.

I'm curious if anyone else has run into this. I did look to see if there
were any posted reports of this and didn't find any in what was admittedly
a rather cursory search. In the end I can just code around the issue by
forcing the column names to be "unique" (or at least lower the probability
of a conflict).

--
Andrew Mangogna

0 new messages