Small problem with QBase

Anything QL Software or Programming Related.
afx
Trump Card
Posts: 198
Joined: Tue Dec 28, 2010 10:23 pm

Small problem with QBase

Post by afx »

I've started using Qbase (a front end for DBAS files), and I really like this program for its simplicity and ease of use. The program's author is Daniel Baum, and the latest version I found on Dilwyn's website is version 1.01 from 2017.

The problem is that I see a small error in the "Select" option; the '=' and '<>' operators seem to be swapped. Also, the '<' and '>' operators. Luckily, the sources are available, and I've tried to correct the error on lines 5300 to 5330, to the best of my ability. With these small corrections, I can run the SuperBASIC program with lrun and everything works fine.

My problem is that I don't know how to compile a program with QLiberator when there are libraries or when the program is designed for PE.

The questions are:

Does anyone know how to compile this SuperBASIC program under PE? Or does anyone know if there's a newer version with this minor fix? Or would anyone know how to contact Daniel Baum to see if there's a newer version?


Derek_Stewart
Font of All Knowledge
Posts: 4650
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Small problem with QBase

Post by Derek_Stewart »

Hi,

Daniel, is a member on the Forum, there is a new version of Qbase, see : viewtopic.php?p=29094&hilit=qbase#p29094


Regards,

Derek
User avatar
NormanDunbar
Forum Moderator
Posts: 2450
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: Small problem with QBase

Post by NormanDunbar »

afx wrote: Sun Mar 16, 2025 7:32 pm The problem is that I see a small error in the "Select" option; the '=' and '<>' operators seem to be swapped. Also, the '<' and '>' operators.
There's actually a bug in DBAS on the select function, I think. The docs say to do one thing, but the C68 library does the opposite. This reverses the result so the records you want to select are not, but the ones you didn't want, are! It is also intermittently working if you use the internal comparison routines. I had to write a user compare function when I converted the Quanta Library to use DBAS, because select was pants.

I'm doing a bit of DBAS in Assembly ATM, and I'm seeing the same intermittently there too with the internal compare functions.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
BSJR
Trump Card
Posts: 219
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: Small problem with QBase

Post by BSJR »

NormanDunbar wrote: Mon Mar 17, 2025 6:01 am
afx wrote: Sun Mar 16, 2025 7:32 pm The problem is that I see a small error in the "Select" option; the '=' and '<>' operators seem to be swapped. Also, the '<' and '>' operators.
There's actually a bug in DBAS on the select function, I think. The docs say to do one thing, but the C68 library does the opposite. This reverses the result so the records you want to select are not, but the ones you didn't want, are! It is also intermittently working if you use the internal comparison routines. I had to write a user compare function when I converted the Quanta Library to use DBAS, because select was pants.

I'm doing a bit of DBAS in Assembly ATM, and I'm seeing the same intermittently there too with the internal compare functions.

Cheers,
Norm.
Can you be more specific?
There is no SELECT keyword in DBas so I assume you mean EXCLUDE, INCLUDE or SEARCH. I have not found any of these problems there while working on and with SuQcess for 25 years.
Could it be that the problem is in the C68 part (not used in SuQcess) and not in DBAS?

There is another DBAS problem once you create over 200 fields. In theory the limit is 255 but it seems to loose track of them well before that.

BSJR


User avatar
NormanDunbar
Forum Moderator
Posts: 2450
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: Small problem with QBase

Post by NormanDunbar »

I can indeed be specific.

When I wrote the Quanta LibGuide using DBAS way back min 1992, on DBAS version 1.x, I had to write a user selection function to allow the "select" function to be used. This was because the C68 function fsd_incld() didn't work. In order to include the records I wanted, I had to fsd_excld() the ones I didn't want using a user function, C68 library doesn't let the internal comparaison function be used---see later.

I have this comment in the libselect.C file:

Code: Select all

/*------------------------------------------------------*
    * Very strange, I have to EXCLUDE records I don't want *
    * as INCLUDING those I do want, doesn't work !         *
    *							   *
    * If any records are selected, position at the first,  *
    * otherwise perform an automatic reset.		   *
    *------------------------------------------------------*/
The c68 function mentioned use the underlying assembly functions fsd.sel function with a parameter list as follows:

Code: Select all

Byte 0: Bit 7 clear = use internal compare, set = use user supplied compare.
        Bit 6 clear = exclude selected records, set = include selected records.
        Bits 5-0 = unused.
Byte 1: How many parameters follow.

then, each parameter:

0.W = Field number.
2.B: 0 = field greater than; 1 = field equals; 2 = field less than.
3.B = Unused.
4.L = Offset of comparison data from start of parameter list.
8.W: 0 = no more parameters; 4 = OR this parameter with next; 8 = AND this parameter with next; $C = XOR this parameter wit next.
There can be up to 4 conditions.


This piece of assembly code, running against the Quanta libguide database is not working:

Code: Select all

selectInclude  equ  64 ; Bit 6 is set, should include records.

...

gg01Select
    dc.b    selectInclude   ; Include records which match.
    dc.b    1               ; One parameter.

    dc.w    1               ; Field = Disc Name.
    dc.b    1               ; Must be equal.
    dc.b    0               ; Unused.
    dc.l    gg01Data-gg01Select  ; Offset to data.
    dc.w    0               ; No more parameters.

gg01Data
    dc.w    5
    dc.b    "UG 04"
Here I'm asking for all the records with disc name "UG 04" to be included. I get zero records. If I change "selectInclude" from 64 to zero, I get records selected. However, I I try with another disc name instead of "CG 04" I get a whole lot more records, the vast majority are not for the disc I'm "selecting" for inclusion.

The C68 functions are in the file "fsdsel.s" which looks like this:

Code: Select all

.text
.even
.globl fsd_excld
.globl _fsd_excld
.globl fsd_incld
.globl _fsd_incld

; C library modules - Database handler

fsd.sel equ     $40

; Routine to perform include/exclude from a database
; short fsd_excld(long dbid, char routine, void application)
; short fsd_incld(long dbid, char routine, void application)
; routine = 0 for all
; return recnum / -1
fsd_excld:
_fsd_excld:
         moveq    #0,d0             ; do exclude (byte 0, bit 6 clear)
         bra      fsd_sel
fsd_incld:
_fsd_incld:
         move.w   #$4000,d0         ; do include (byte 0, bit 6 set)
fsd_sel:
         link     a6,#0
         movem.l  d1/d7/a0-a2,-(a7)
         move.l   8(a6),a0          ; get database ID
         move.l   __database,a2     ; get database VBR
; Call the database package
         lea      __fsd_sel,a1      ; parameter block
         move.w   d0,(a1)           ; store ex/include flag & no params
         move.l   12(a6),d7         ; routine ptr / 0
         beq      call              ; do all if ptr 0
         bset     #7,(a1)           ; signal user routine
;
call:
         jsr      fsd.sel(a2)
         move.l   d0,_dberr
         move.l   d0,_oserr        ; set error
         beq      ok
         moveq    #-1,d0
         bra      fin
ok:
         move.w   d1,d0
fin:
         movem.l  (a7)+,d1/d7/a0-a2
         unlk     a6
         rts
The parameter bit 6 settings match the docs. If the user function passed is zero, all records are selected or unselected depending on the function called. The user function has to do the compare as it doesn't appear that the internal compare function can be used.

I'm currently using DBAS version 2.13 if that makes any difference?


I am in the process of attempting to get a minimal working program so that I can test this out further.


HTH

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
afx
Trump Card
Posts: 198
Joined: Tue Dec 28, 2010 10:23 pm

Re: Small problem with QBase

Post by afx »

Derek_Stewart wrote: Sun Mar 16, 2025 8:27 pm Daniel, is a member on the Forum, there is a new version of Qbase, see : viewtopic.php?p=29094&hilit=qbase#p29094
Thanks Derek, for the links. I've tried version 1.02, but the problem is the same.
NormanDunbar wrote: Mon Mar 17, 2025 6:01 am There's actually a bug in DBAS on the select function, I think. The docs say to do one thing, but the C68 library does the opposite. This reverses the result so the records you want to select are not, but the ones you didn't want, are!
Hi Norman, that's exactly what I get with QBase's "Select" option.


User avatar
BSJR
Trump Card
Posts: 219
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: Small problem with QBase

Post by BSJR »

NormanDunbar wrote: Mon Mar 17, 2025 3:41 pm I can indeed be specific.

(...very specific...)

I'm currently using DBAS version 2.13 if that makes any difference?

I am in the process of attempting to get a minimal working program so that I can test this out further.

HTH
Cheers,
Norm.
Thanks Norman.
As I indicated, for SuQcess we only use the Basic keywords and no reversing of compare type is needed.
All 4 terms can be used with AND, OR, XOR & NOT and have been used on the Quanta Lib database as well.
(See the image on the site): https://home.hccnet.nl/b.spelten/ql/suqcess2.html

I am not familiar with C68 so this needs more study.

The DBAS as supplied with SuQcess is version 2.13md2. The "md2" stands for mod-2, a minor name change to make sure its RESET command does not reset SMSQe but only the record selection. The keyword is DBRST now.

BSJR


User avatar
NormanDunbar
Forum Moderator
Posts: 2450
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: Small problem with QBase

Post by NormanDunbar »

Does anyone have the source code for DBAS versions 2.12 or 2.13 please? I don;t have time to disassemble it to work out what the hell is going on in the fsd.sel function. There's a serious bug in there as it is definitely not working according to the docs, and even worse, is returning complete garbage for many of the selections, but correct results for other stuff.

I'm going bonkers here trying to figure it out and I need the code to check what is happening.


Thanks.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
dilwyn
Mr QL
Posts: 3050
Joined: Wed Dec 01, 2010 10:39 pm

Re: Small problem with QBase

Post by dilwyn »

The original sources were on Quanta Library disc SP08, but were a couple of versions older than you have.

DBAS 2.11 on The Library disc SP62, 2.12 and 2.13 were on The Library disks P64 and P85. Don't know if they included sources, sorry.

Edit: sorry about the fat fingered typing on my phone first time round.


Derek_Stewart
Font of All Knowledge
Posts: 4650
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Small problem with QBase

Post by Derek_Stewart »

Hi,


The problem with DBAS, was the source code was not supplied. I am sure, I may of disassembled DBAS, I used to disassemble everything to learn how to program in assembler.

I will look at my backup files.


Regards,

Derek
Post Reply