 |
Iliev Newbie
Joined: 20 Jun 2011 Posts: 8
|
Posted: Mon Jun 20, 2011 9:27 pm
%querry issues, 3.34 |
I have a db, it's loaded. I have a field, called level, type is 'number'. There are several rows, with values set for the level field.
Let's say they're 1 for row 0, 2 for 1, 3 for 2. The db is called eq.
If I type #show %query(&level=1), it shows me all records 0eq|1eq|2eq. Same with &level>0
If I type #show %query(&level=2), it shows me nothing, blank line.
So what is wrong with the query ? |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 21, 2011 10:52 pm |
The %query function (any many other functions) takes a STRING argument so you should be putting " quotes around your query, like this:
Code: |
#SHOW %query("&level=1") |
Otherwise CMUD tries to parse and evaluate the expression at compile time instead of at run time. Haven't testing this directly, but it should work. |
|
|
 |
Iliev Newbie
Joined: 20 Jun 2011 Posts: 8
|
Posted: Wed Jun 22, 2011 11:08 am |
I found that on forums, but it didn't work either :( first time I do it there's access violation error, second time there is no message at all, but the database gets kind of buggy :P can't close it, can't 'exit' it, need to close-reopen cmud.
Cmud is in c:\Program Files\, the sessions are in d:\cmud sessions.
I made a loop with dbfirst then dbnext until empty, not sure if it works fast enough but it can search the db with expressions, can't make query (# and %) work. :P |
|
|
 |
Iliev Newbie
Joined: 20 Jun 2011 Posts: 8
|
Posted: Wed Jun 22, 2011 1:05 pm |
dbfirst/next is kind of slow :P like a second for 15 items display
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 22, 2011 4:18 pm |
Looks like %query broke somewhere along the way. I just tried a simple %query with my test database and I also got the access violation. And yes, after an access violation you need to exit CMUD...don't try to keep using the database.
I'll add this to the bug list. I'm not going to put a lot of work into the existing database module because it needs to be completely rewritten from scratch. But hopefully this is an easy bug to fix since it used to work in older versions of CMUD as far as I know. |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 22, 2011 4:20 pm |
Also, regarding the speed, yes the database module is extremely slow. It really isn't a database at all, which is why it needs to be re-written to use a real SQL database driver. The current database module is a straight port from zMUD and uses flat files.
|
|
|
 |
|
|