Thanks to all for your help, especially Mr. Lam.
Your response, Mr. Lam,  was very instructive.
I used your input to explore a bit more, with a couple of questions arising.

See the questions embedded below:

*****************************
load 'data/jdb'

ffd =: Open_jdb_ jpath , '~temp'

Drop__ffd 'testdb'
db =: Create__ffd 'testdb'

ht=: Create__db 'tblChar';0 : 0
c1 char
)

NB. JDB doc says a 'char' column is stored as a character matrix
NB. The next sentence works, even though it inserts a scalar, 'a'
NB. QUESTION: Is this contrary to the JDB doc?
Insert__db 'tblChar';'a'
]shape =. $'a'
NB. Inserts a list of shape 1
Insert__db 'tblChar';,'b'
]shape =. $ ,'b'
NB. Inserts a list of shape 3 1
Insert__db 'tblChar';,.'def'
]shape =. $ ,.'def'
NB. Inserts a list of shape 1 4
Insert__db 'tblChar';,:'ghih'
]shape =. $ ,:'ghih'
Insert__db 'tblChar';3 5 $'123457'
Insert__db 'tblChar';,:'012345678901234567890'
]shape=.$ ,:'012345678901234567890'
NB. A JDB 'char' column allows chars of varying lengths to be inserted
Insert__db 'tblChar';2 100$'1234567890'
Reads__db 'from tblChar'

NB. The insert below causes a failure
NB. After this the table can no longer be read.
NB. QUESTION: Is that behavior intended?
NB. If so, JDB seems a little fragile for the rough, unskilled hands
of newbies like me
NB. This insert, where '01' is a list of shape 2, fails even though an
insert of 'b', a list of shape 1 worked above.
NB. QUESTION: Is this behavior consistent in a way that I am not understanding?
Insert__db 'tblChar';'01'
Reads__db 'from tblChar'

Thanks again for the high quality help & instruction.
--chris--
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to