Database - 17.07 - Problems

Re: Database - 17.07 - Problems

Postby James Bott » Fri Aug 25, 2017 2:22 pm

Diego,

Thanks for contributing. It seems I need to look at xBrowse.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Database - 17.07 - Problems

Postby Diego Decandia » Fri Aug 25, 2017 2:36 pm

James,
I have an application where the problem occurs, but when I try to extract an example that presents the problem, the problem is not there. As soon as possible, i will place a test.
Diego Decandia
 
Posts: 40
Joined: Fri Aug 22, 2014 6:21 am

Re: Database - 17.07 - Problems

Postby Diego Decandia » Fri Aug 25, 2017 4:41 pm

Ok, this is the example to test.
Dialog 1 has a TDatabase object in the browse, dialogue 2 uses a DBF directly, but the essential thing is the btmbmp with oDBF:Gotop() and oDBF:Gobottom().
Without the action of the Btnbmp (which contain oDBF:GoTop() or oDBF:GoBottom()) Everything is ok even with fwh 17.07

Code: Select all  Expand view  RUN
// ---------------------------------------------//
function TEST
    local oDlg

    DEFINE DIALOG oDlg PIXEL SIZE 200,200 TITLE "Test"

    @ 10, 10 BUTTON "DIALOG 1" OF oDlg PIXEL SIZE 35,15 ACTION DLG1()
    @ 40, 10 BUTTON "DIALOG 2" OF oDlg PIXEL SIZE 35,15 ACTION DLG2()

    ACTIVATE DIALOG oDlg CENTERED
return nil

function DLG1
    local oDlg, oBrw, oDBF

    USE C:\FWH\SAMPLES\CUSTOMER NEW
    INDEX ON FIELD->FIRST TAG FIRST
    INDEX ON FIELD->LAST TAG LAST
    CLOSE CUSTOMER

    oDBF := TDATABASE():Open( nil,"C:\FWH\SAMPLES\CUSTOMER", "DBFCDX" )
    oDBF:SetOrder( "FIRST" )

    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG1"

   @ 0,0 XBROWSE oBrw SIZE -50,-2 PIXEL OF oDlg ;
    ALIAS ( oDBF:cALIAS ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

   @ 10, 250 BtnBmp of oDlg RESOURCE "CLOSE16" ;
    PIXEL TOP NOBORDER 2007 SIZE 35,25 ;
    PROMPT "&E n d" ACTION oDlg:End()

    @ 45, 250 BTNBMP OF oDlg PROMPT "First" ;
        SIZE 35,25 RESOURCE "GOTOP16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOTOP(), oBrw:Refresh(), oBrw:SetFocus() )

    @ 80, 250 BTNBMP OF oDlg PROMPT "Last" ;
        SIZE 35,25 RESOURCE "GOBOT16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOBOTTOM(), oBrw:Refresh(), oBrw:SetFocus() )

    ACTIVATE DIALOG oDlg CENTER

    oDBF:End()

return nil

function DLG2
    local oDlg, oBrw

    USE C:\FWH\SAMPLES\CLIENTS NEW
    INDEX ON FIELD->NAME TAG NAME
    INDEX ON FIELD->ADRESS TAG ADRESS
    SET TAG TO NAME
    GO TOP

    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG2"

   @ 0,0 XBROWSE oBrw SIZE -5,-2 PIXEL OF oDlg ;
    ALIAS ( "CLIENTS" ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

    ACTIVATE DIALOG oDlg CENTER

    CLOSE CLIENTS

return nil
 
Diego Decandia
 
Posts: 40
Joined: Fri Aug 22, 2014 6:21 am

Re: Database - 17.07 - Problems

Postby norberto » Fri Aug 25, 2017 4:51 pm

Hi,

Error happens in Twbrowse too.

thanks
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Re: Database - 17.07 - Problems

Postby James Bott » Fri Aug 25, 2017 5:18 pm

Diego,

You forgot to set the default RDD:

REQUEST DBFCDX
rddsetdefault( "DBFCDX" )

If you add those lines it works fine.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Database - 17.07 - Problems

Postby Diego Decandia » Fri Aug 25, 2017 5:32 pm

Hmmm, I have tested into another my application where those set are present...
Diego Decandia
 
Posts: 40
Joined: Fri Aug 22, 2014 6:21 am

Re: Database - 17.07 - Problems

Postby Diego Decandia » Fri Aug 25, 2017 5:41 pm

I confirm that, even by performing the only TEST function with the sets indicated by James, the problem arises. You must open dialog 1, close it, open dialog 2 and, when closed, here is the error.
Diego Decandia
 
Posts: 40
Joined: Fri Aug 22, 2014 6:21 am

Re: Database - 17.07 - Problems

Postby James Bott » Fri Aug 25, 2017 5:44 pm

Diego,

I had to make a few changes to get your sample working (commented lines were erroring out). It was also set to use TDatabase() not TData() which I changed.

I am not seeing any errors using this code.

James

Code: Select all  Expand view  RUN
/*
Language : Fivewin/xHarbour
Updated  :
Notes    : Code provided by Diego Decandia
viewtopic.php?f=3&t=34468&p=204989#p204985

*/


#include "fivewin.ch"

Function Main()
   REQUEST DBFCDX
   rddsetdefault( "DBFCDX" )
   
   Test()

Return nil

// ---------------------------------------------//
function TEST
    local oDlg

    DEFINE DIALOG oDlg PIXEL SIZE 200,200 TITLE "Test"

    @ 10, 10 BUTTON "DIALOG 1" OF oDlg PIXEL SIZE 35,15 ACTION DLG1()
    @ 40, 10 BUTTON "DIALOG 2" OF oDlg PIXEL SIZE 35,15 ACTION DLG2()

    ACTIVATE DIALOG oDlg CENTERED
return nil

function DLG1
    local oDlg, oBrw, oDBF

    USE C:\FWH\SAMPLES\CUSTOMER NEW
    INDEX ON FIELD->FIRST TAG FIRST
    INDEX ON FIELD->LAST TAG LAST
    CLOSE CUSTOMER
   
    oDBF := TDATA():New( nil,"C:\FWH\SAMPLES\CUSTOMER", "DBFCDX" )
    oDBF:use()
       
    msgInfo(if(oDBF:used(),"Customer.dbf is open","Customer.dbf is not open"))
   
    //oDBF:SetOrder( "FIRST" )
   
    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG1"

   @ 0,0 XBROWSE oBrw SIZE -50,-2 PIXEL OF oDlg ;
    ALIAS ( oDBF:cALIAS ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

   @ 10, 250 BtnBmp of oDlg RESOURCE "CLOSE16" ;
    PIXEL TOP NOBORDER 2007 SIZE 35,25 ;
    PROMPT "&E n d" ACTION oDlg:End()

    @ 45, 250 BTNBMP OF oDlg PROMPT "First" ;
        SIZE 35,25 RESOURCE "GOTOP16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOTOP(), oBrw:Refresh(), oBrw:SetFocus() )

    @ 80, 250 BTNBMP OF oDlg PROMPT "Last" ;
        SIZE 35,25 RESOURCE "GOBOT16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOBOTTOM(), oBrw:Refresh(), oBrw:SetFocus() )

    ACTIVATE DIALOG oDlg CENTER

    oDBF:End()

return nil

function DLG2
    local oDlg, oBrw

    USE C:\FWH\SAMPLES\CLIENTS NEW
    INDEX ON FIELD->NAME TAG NAME
    INDEX ON FIELD->ADRESS TAG ADRESS
    //SET TAG TO NAME
    GO TOP

    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG2"

   @ 0,0 XBROWSE oBrw SIZE -5,-2 PIXEL OF oDlg ;
    ALIAS ( "CLIENTS" ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

    ACTIVATE DIALOG oDlg CENTER

    //CLOSE CLIENTS
    use

return nil
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Database - 17.07 - Problems

Postby James Bott » Fri Aug 25, 2017 5:47 pm

Diego,

You must open dialog 1, close it, open dialog 2 and, when closed, here is the error.


Apparently, the syntax:

CLOSE CLIENTS is not valid. If you change it to just USE then it works fine. Try the test code in my previous message.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Database - 17.07 - Problems

Postby Diego Decandia » Fri Aug 25, 2017 5:55 pm

It is true, even putting close all, no error. So it is not good to use <close ' Alias '>.??
Diego Decandia
 
Posts: 40
Joined: Fri Aug 22, 2014 6:21 am

Re: Database - 17.07 - Problems

Postby Diego Decandia » Fri Aug 25, 2017 6:21 pm

In any way, if I use DLG2 first, close clients works.

If I use DLG1 and then DLG2, close clients does not work.
Diego Decandia
 
Posts: 40
Joined: Fri Aug 22, 2014 6:21 am

Re: Database - 17.07 - Problems

Postby Enrico Maria Giordano » Fri Aug 25, 2017 8:32 pm

James Bott wrote:CLOSE CLIENTS is not valid.


CLOSE <alias> is perfectly valid. The problem has to be elsewhere.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Database - 17.07 - Problems

Postby James Bott » Fri Aug 25, 2017 9:30 pm

Enrico,

Thanks for the clarification--I should have looked it up. I had never used that syntax before. And when I changed it to USE it started working fine.

It is rather irrelevant in this situation because we are trying to track down an error occurring with TDatabase/TData so using standard database syntax clouds the issue.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Database - 17.07 - Problems

Postby Diego Decandia » Fri Aug 25, 2017 9:38 pm

If in dialog 2, before close clients, you put
MsgInfo (Alias ())
You see that the DBF file is already closed.
Who closed it?
Diego Decandia
 
Posts: 40
Joined: Fri Aug 22, 2014 6:21 am

Re: Database - 17.07 - Problems

Postby James Bott » Fri Aug 25, 2017 9:58 pm

Diego,

I am not seeing that but I am using FWH 16.02 with TDatabase from 17.07 and xHarbour

I assume you are using 17.07? If so, then there must be a problem that is not in the TDatabase class. It could even be a xHarbour or Harbour issue.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 35 guests