dbTalk Databases Forums  

Extended Get operation - Odd behavior

comp.databases.btrieve comp.databases.btrieve


Discuss Extended Get operation - Odd behavior in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Extended Get operation - Odd behavior - 08-04-2006 , 08:51 PM






Basically I have a problem with extended get. If I say "Give me all
the records in the db that have a date after mm/dd/yyyy", it works
fine. If I say, "show me all the records that have a date BEFORE
mm/dd/yyyy", it never shows me any records. Now, admittedly, your
ability to help may be frustrated by the fact that I am using a layer
on top of raw Btrieve but perhaps you can think up a question or a test
to make the solution visible. Right now it LOOKS LIKE Btrieve has a
problem doing a less-than compare on dates although it does
greater-than compares fine. I DO NOT BELIEVE that. However it behaves
AS IF that were the cause.

What you should notice is there are 2 nearly identical "frames"
(FIRST_FRAME and SECOND_FRAME). FIRST_FRAME always works. SECOND_FRAME
always fails.
At A, I am grabbing the date I'm comparing to from a control.
At B, I change it to the format shown at X below:
At C, I make it another filter clause. (DSQL_DATE = 3, DSQL_GORE = 5,
DSQL_LORE = 6)

What is strange (and consistent) is that frame FIRST_FRAME always works
perfectly.and SECOND_FRAME never works.
So, for example, if I set the FIRST_FRAME date to January 1, 2005, I
correctly get everything at and after January 1, 2005 (provided I leave
SECOND_FRAME empty).
If I put January 1, 2005 in FIRST_FRAME and February 2, 2005 in
SECOND_FRAME, I get absolutely nothing despite the fact that there are
matching records throughout January 2005.
If I put March 30th, 2005 in SECOND_FRAME and leave FIRST_FRAME empty,
I still get zero hits.
---------------------
So, one way of saying it, is: No matter what I put in SECOND_FRAME,
none of my records are less than that value - as if second frame is
always 00-00-0000 no matter what I put in it.



FIRST_FRAME:
if (IsDlgButtonChecked(hLWnd, DISPLAY_TD_FILTERING))
{
A SendMessage(GetDlgItem(hLWnd,DISPLAY_TD_START), HEM_GETDATA, 0,
(LPARAM)(LPVOID) &DosDate);
if (DosDate.year != 0)
{
B DosDateToBnDate(&DosDate, &tempdate);
C MakeTerm(&ext.lpSQLFilter->Term[ext.lpSQLFilter->NumTerms++],
DSQL_DATE,
sizeof(Bn_Date), offsetof(struct TRANS_REC, tdate),
DSQL_GORE, DSQL_ANDTERM, (LPVOID)&tempdate) ;
}

SECOND_FRAME:
SendMessage(GetDlgItem(hLWnd,DISPLAY_TD_END), HEM_GETDATA, 0,
(LPARAM)(LPVOID) &DosDate);
if (DosDate.year != 0)
{
DosDateToBnDate(&DosDate, &tempdate);
MakeTerm(&ext.lpSQLFilter->Term[ext.lpSQLFilter->NumTerms++],
DSQL_DATE,
sizeof(Bn_Date), offsetof(struct TRANS_REC, tdate),
DSQL_LORE, DSQL_ANDTERM, (LPVOID)&tempdate) ;
}
}


X typedef struct tagBn_Date
{
unsigned char Day;
unsigned char Month;
unsigned int Year;
} Bn_Date,
far *LPBNDATE;


void MakeTerm(LPSQLTERM lpTerm, char Type, UINT Length, UINT uOffset,
char Relate, char AndOr, LPVOID Value)
{
lpTerm->Type = Type ;
lpTerm->Length = Length ;
lpTerm->Offset = uOffset ;
lpTerm->Relate = Relate ;
lpTerm->AndOr = AndOr ;
lpTerm->Value = Value ;
return ;
}


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.