Hi Christopher,

I actually had to rewrite this response a couple of times.

>From what I understand from the implementation, all arbitrary sized strings 
>should be using the VARCHAR datatype. The concept was implementation of a MAX 
>or field lenth value for VARCHAR is not part of JDB but instead part of the 
>front end or the client application. That is unless you can convince Chris or 
>Oleg of the validity/advantage of putting in the field length ...

For me, I've always used JDB (a bastardized version of it) as a local DB for 
MS-SQL server (I added in extensions/variables so that JDB would retain the 
MS-SQL datatype for the purpose of creating SQL statements for DML commands) 
and not having to worry about the character lengths. Of course there were 
instances where the generated SQL statement failed when updating MS-SQL because 
the concatenated fields were longer than the actual storage field but I treat 
this as an EXCEPTION and not the rule. :)

In short, my advice is not worry about the length of the characters and instead 
concentrate on the solution. Problems like these should be treated as 
exceptions ...

r/Alex


________________________________________
From: programming-boun...@jsoftware.com [programming-boun...@jsoftware.com] On 
Behalf Of Sherlock, Ric [r.g.sherl...@massey.ac.nz]
Sent: Wednesday, December 16, 2009 9:35 AM
To: Programming forum
Subject: Re: [Jprogramming] Newbie JDB problem: inserting chars in      a       
1       column char table gives 'assertion failure'

Sorry ignore my previous post. Having read your post more carefully I see that 
you probably want to know how to do specify the max length of the field. (As I 
said, I haven't used JDB before & assumed that c1 was more than just the field 
name).

Perhaps you checking out the demo databases that ship with the Addon will help.

   open 'data/jdb/sed'


> From: Sherlock, Ric
>
> I've not used JDB before but it's not clear from your post what exactly
> you are trying to do.
...
>   b) or that the field will dynamically change its specification to now
> allow several characters
...
> If b), then I suspect that you will need to change the initial
> definition of the field to be the maximum number of characters that you
> want to be able to insert in it.
>
> > From: christopher collins
> >
> > Does JDB have a way to declare the length of the char column?
> >
> > I've gone through the JDB doc and sample code carefully and can't
> find
> > any indication of how to declare the length of the char column.
> >
> > I've run a few experiments and can't get a JDB database table which
> > consists of only one char column to accept anything but a single
> > character in each insert.
> >
> > Here's the code:
> >
> > NB. Create a table with only a single char column
> > Create__db 'tblA';0 : 0
> > c1 char
> > )
> > NB. Insert a single character
> > Insert__db 'tblA';'a'
> > Insert__db 'tblA';'b'
> > Insert__db 'tblA';'c'
> > NB. works fine, no problem
> >
> > NB. Define another table with a single char column
> > Create__db 'tblB';0 : 0
> > c1 char
> > )
> > NB. Insert a string of characters
> > Insert__db 'tblB';'aaaaaaa'
> >
> > |assertion failure: validate
> > |   1=#~.(#@".)&>'active';Tcolmap
> >
> >
> > To summarize: I can't find any doc that outlines how to construct a
> > table with a single char column  that  accepts multiple characters.
> > Nor can I find any code samples. Various small experiments have
> failed.
> >
> > Thanks in advance for any help.
> > --chris--
> > ---------------------------------------------------------------------
> -
> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to