Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Tue Mar 11, 2008 10:22 am   

Loading databases
 
Perhaps someone can tell me if I have to manually set the active db in spite of the fact that the documentation for #DBLOAD indicates that using this command is the way to activate a particular db. If I have more than one db that I want to access, am I supposed to affix the db id (22ac, for instance) to each operation I do on the db? If so, what is the point of #DBLOAD then? I start my script with #DBLOAD xx, where xx is the particular db I want to operate on, but this only has worked for me, so far, if there is only one db. If I use #DBCLOSE xx, it also closes all other dbs. I am sure that my way is wrong, but the documentation and a lack (IMO) of a #DBOPEN to match the #DBCLOSE, is making me have a hard time with this. From what I am understanding, #DBLOAD just does an internal load, it does not make the named db, the default db, which is what needs to happen.
_________________
Sic itur ad astra.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Mar 12, 2008 1:04 am   
 
If I recall correctly you can only have one DB active at anytime, so what you're probably seeing is when you #DBLOAD AAdb, then do a subsequent #DBLOAD BBdb the second one is now the active one.

I'm not sure what you mean by 'DBCLOSE closes all other DBs'.
_________________
Asati di tempari!
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Wed Mar 12, 2008 11:02 pm   
 
After a #DBCLOSE one must select DB from the toolbar and fetch a new db.
_________________
Sic itur ad astra.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sun Mar 16, 2008 11:04 pm   
 
Under Programming the Database - Accessing Database Records I read the following:
Quote:

To access a database record other than the current record, you specify the record number, appended to the database name. If you leave the database name out, the current database will be used. For example, to display record 20 in the current database, you can do

#SHOWDB 20

To show record 20 from the Equipment Name (name is eq), you would use

#SHOWDB 20eq

(bold italics are mine)

The implication from the above is that one can script multiple databases cuncurrently. However, when I try to use this scheme, I find that only the current database can be accessed. Scripts that attempt to use the recnum|dbid, where the dbid is not that of the current database, fail.
_________________
Sic itur ad astra.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Tue Mar 18, 2008 12:38 am   
 
Here is an update on this problem. While looking at it, it occured to me that I had seen this problem before in another form. Namely, while tyring to use #EXECWIN. The problem with that command was that it expected a raw command stream and not a variable containing the commands. This seems to be also what is happening with something like:
Code:

$rec = find(@data, View|dbid, ColumnID)

I was attempting to parametrize the dbid by using View|@MasterDB. However, the View|dbid is a raw command stream and therefore, because of zscript's lack of this type of variable, it will get a type mismatch and not process the variable properly.
When I substituted the actual dbid for @MasterDB, the script worked. It also seems that this is the one time where autotype seems to be the only correct datatype to use. I believe that an autotyped variable can be used in this situation, mainly becuase I think that this will cause zscript to convert it to whatever it needs. This requires further testing.
_________________
Sic itur ad astra.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net