Problem solved. Using Create__ rather than InsertCols__ to create the whole
table with columns in one go does work, as below. Still not sure why
InsertCols__ method gets stuck though.

load 'data/jdb'

ffd         =: Open_jdb_ jpath , '~temp'     NB. folder for the databases
footballdb     =: Create__ffd 'football'    NB. create a database called
football

matchdatetb =: Create__footballdb 'matchdate';0 : 0
value varchar;
)

teamnametb =: Create__footballdb 'teamname';0 : 0
value varchar;
)

matchtb =: Create__footballdb 'match';0 : 0
matchdate matchdate
hometeam teamname
awayteam teamname;
)

ftagtb =: Create__footballdb 'ftag';0 : 0
match match;
value int
)

ShowCols__footballdb &.> Tables__footballdb

On Sat, Dec 20, 2008 at 10:52 AM, Matthew Brand <[email protected]>wrote:

> The error occurs without any data being inserted into the database. It
> occurs after the command to define what the columns are in the ftag table:
> InsertCols__fdb 'ftag'; 0 : 0
>     match match;
>     value int
> )
>
> When that command is executed it seems to never stop, executing jbreak
> stops it and the error message is output:
>
> |attention interrupt: dbsortdir
> |       dbsortdir''
>
> To explain in more detail what the code is doing. I am create four tables:
>
> "matchedate" which will store every date that a match occurred on (i.e. it
> is a list of unique varchar).
>
> "teamname" which will store the name of every team that ever played a match
> (i.e. it is a list of unique varchar).
>
> "match" which stores a matchdate, hometeam and awayteam record for each
> match that occurred. Note that there can be more than one match on the same
> day but not between the same pair of teams. This table is a list of unique
> triplet matchdate, hometeam, awayteam.
>
> Finally to store the results of the game I try to define a table "ftag" for
> the Full time Away Goals with "match" as the key and a value field to store
> the result of the game.
>
> I intend to make other tables for Half Time Away Goals and other data
> concerning the results. The reason I do not just append ftag, fthg, etc as
> extra columns on the "match" table is that some matches have more results
> data items than other. E.g., some games have got the Half Time Away Goals
> recorded but others have not. These columns do not have the same length as
> the columns in the "match" table so I ut them in a different table.
>
> Is anybody able to reproduce the error? To do it, create an empty
> directory '~user/projects/football/data/jdb'.
>
> Then execute the following J:
>
> load 'data/jdb'
> NB. You must create the empty directory '~user/projects/football/data/jdb'
>
> ffd =: Open_jdb_ jpath , '~user/projects/football/data/jdb' NB. football
> folder
> fdb =: Create__ffd 'football'  NB. football database
> matchdatetable =: Create__fdb 'matchdate' NB. stores the match dates
> teamnametable =: Create__fdb 'teamname' NB. stores the team names
> matchtable =: Create__fdb 'match' NB. stores the matches that have occurred
> ftagtable =: Create__fdb 'ftag' NB. stores the Full Time Away Goals
>
> InsertCols__fdb 'matchdate';'matchdate varchar;'
> InsertCols__fdb 'teamname' ;'teamname  varchar;'
> InsertCols__fdb 'match'; 0 : 0
> hometeam teamname
> awayteam teamname
> matchdate matchdate;
> )
>
> NB. This should not cause any problems so far.
>
> NB. but the following causes a problem:
> InsertCols__fdb 'ftag'; 0 : 0
>     match match;
>     value int
> )
>
>
> Thanks,
> Matthew.
>
> On Sat, Dec 20, 2008 at 3:04 AM, Devon McCormick <[email protected]>wrote:
>
>> How much data do you have (number of records)?  Can you provide a small
>> sample of data from which one may re-produce the error?
>>
>> On Fri, Dec 19, 2008 at 3:26 PM, Matthew Brand <[email protected]
>> >wrote:
>>
>> > Dear All,
>> >
>> > I am trying out JDB by creating a database of football (Soccer) scores.
>> >
>> > I create the following tables and everything runs smoothly:
>> >
>> > load 'data/jdb'
>> > NB. You must create the empty directory
>> '~user/projects/football/data/jdb'
>> >
>> > ffd =: Open_jdb_ jpath , '~user/projects/football/data/jdb' NB. football
>> > folder
>> > fdb =: Create__ffd 'football'  NB. football database
>> > matchdatetable =: Create__fdb 'matchdate' NB. stores the match dates
>> > teamnametable =: Create__fdb 'teamname' NB. stores the team names
>> > matchtable =: Create__fdb 'match' NB. stores the matches that have
>> occurred
>> > ftagtable =: Create__fdb 'ftag' NB. stores the Full Time Away Goals
>> >
>> > InsertCols__fdb 'matchdate';'matchdate varchar;'
>> > InsertCols__fdb 'teamname' ;'teamname  varchar;'
>> > InsertCols__fdb 'match'; 0 : 0
>> > hometeam teamname
>> > awayteam teamname
>> > matchdate matchdate;
>> > )
>> >
>> > This all occurs without issues. Then when I try to insert the columns
>> for
>> > the results table (say the full time away goals):
>> > InsertCols__fdb 'ftag'; 0 : 0
>> >    match match;
>> >    value int
>> > )
>> >
>> > , no error is generated but the system uses all of the processor for at
>> > least 10 minutes. When I use jbreak to stop it from running I get:
>> >
>> > |attention interrupt: dbsortdir
>> > |       dbsortdir''
>> >
>> > Any thoughts?
>> >
>> > Thanks,
>> > Matthew.
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>>
>>
>>
>> --
>> Devon McCormick, CFA
>> ^me^ at acm.
>> org is my
>> preferred e-mail
>> ----------------------------------------------------------------------
>> 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