Can you use a field named End with Class TDataBase ? yes!

Can you use a field named End with Class TDataBase ? yes!

Postby wartiaga » Tue Feb 15, 2022 12:56 pm

Hi all,

Is there an error in database.prg in fwh1811? Check the images below. In the previous version these errors do not occur. Thanks.

Image

prg line:
oArqBol:BAIRRO := oArqAsoc:BAIRRO

Image

prg line:
REDEFINE GET oGet06 VAR oArqAsoc:END ID 104 of oFolder:aDialogs[1] picture '@!' COLOR Frente,Fundo update
wartiaga
 
Posts: 210
Joined: Wed May 25, 2016 1:04 am

Re: Error in database.prg?

Postby carlos vargas » Tue Feb 15, 2022 3:53 pm

oArqBol:BAIRRO := oArqAsoc:BAIRRO

para descartar, haria lo siguiente:
Code: Select all  Expand view

?oArqBol:cAlias, select(oArqBol:cAlias)
?oArqAsoc:cAlias, select(oArqAsoc:cAlias)
 
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1719
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Error in database.prg?

Postby Antonio Linares » Tue Feb 15, 2022 3:57 pm

Please copy here the error.log thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error in database.prg?

Postby wartiaga » Tue Feb 15, 2022 4:55 pm

Antonio Linares wrote:Please copy here the error.log thanks


Application
===========
Path and name: D:\SISTEMAS\SINDF\sind.exe (32 bits)
Size: 9,486,848 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20181011)
FiveWin version: FWH 18.11
C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 7 secs
Error occurred at: 15/02/2022, 13:56:09
Error description: Warning BASE/2001 Alias nÆo existe: TDATABASE:_FIELDPUT
Args:
[ 1] = N 7
[ 2] = C

Stack Calls
===========
Called from: source\rtl\tobject.prg => TDATABASE:ERROR( 0 )
Called from: DATABASE.PRG => TDATABASE:FIELDPUT( 982 )
Called from: DATABASE.PRG => TDATABASE:_END( 1366 )
Called from: PROG08.PRG => (b)NOVO( 389 )
Called from: TGET.PRG => TGET:REDEFINE( 721 )
Called from: PROG08.PRG => NOVO( 389 )
Called from: PROG08.PRG => (b)PROG08( 177 )
Called from: .\source\classes\BUTTON.PRG => TBUTTONBMP:CLICK( 179 )
Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1755 )
Called from: .\source\classes\BUTTONB.PRG => TBUTTONBMP:HANDLEEVENT( 261 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3513 )
Called from: => SENDMESSAGE( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 433 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 1136 )
Called from: => DIALOGBOX( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
Called from: PROG08.PRG => PROG08( 185 )
Called from: SIND32.PRG => HABIL( 1780 )
Called from: SIND32.PRG => (b)ASSOC( 359 )
Called from: .\source\classes\MENU.PRG => TMENU:ACTIVATE( 1595 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 966 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1960 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3513 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1065 )
Called from: SIND32.PRG => MAIN( 274 )

System
======
CPU type: Intel(R) Core(TM) i5-8300H CPU @ 2.30GHz 2304 Mhz
Hardware memory: 16259 megs

Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %

Windows total applications running: 4
1 ,
2 , C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22000.120_none_e541a94
3 Alternância de Tarefas, D:\SISTEMAS\SINDF\sind.exe
4 GDI+ Window (sind.exe), C:\WINDOWS\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.22000.434_none_1630a2eb2777c45

Variables in use
================
Procedure Type Value
==========================
TDATABASE:ERROR
Param 1: C "Alias nÆo existe"
Param 2: C "TDATABASE"
Param 3: C "_FIELDPUT"
Param 4: N 2001
Param 5: A Len: 2
Local 1: O Class: TDATABASE
Local 2: N 13
TDATABASE:FIELDPUT
Param 1: N 7
Param 2: C " "
Local 1: O Class: TDATABASE
Local 2: L .F.
Local 3: N 0
Local 4: U
TDATABASE:_END
Param 1: O Class: TDATABASE
Local 1: A Len: 1
Local 2: C "_END"
Local 3: N 1005
Local 4: N 7
Local 5: C "END"
Local 6: L .T.
Local 7: C " "
Local 8: U
Local 9: U
Local 10: C " "
(b)NOVO
Param 1: C " "
TGET:REDEFINE
Param 1: N 104
Param 2: B {|| ... }
Param 3: O Class: TDIALOG
Param 4: U
Param 5: C "@!"
Param 6: U
Param 7: N 16711680
Param 8: N 13041663
Param 9: U
Param 10: U
Param 11: U
Param 12: L .T.
Param 13: U
Param 14: U
Param 15: L .F.
Param 16: L .F.
Param 17: U
Param 18: U
Param 19: U
Param 20: U
Param 21: U
Param 22: U
Param 23: C "oArqAsoc:END"
Param 24: U
Param 25: U
Param 26: U
Param 27: U
Param 28: U
Param 29: L .F.
Param 30: U
Local 1: O Class: TGET
Local 2: U
Local 3: U
Local 4: U
Local 5: L .F.
NOVO
(b)PROG08
Param 1: O Class: TBUTTONBMP
TBUTTONBMP:CLICK
Local 1: O Class: TBUTTONBMP
TBUTTON:HANDLEEVENT
Param 1: N 2048
Param 2: N 0
Param 3: N 0
Local 1: O Class: TBUTTONBMP
Local 2: U
TBUTTONBMP:HANDLEEVENT
Param 1: N 2048
Param 2: N 0
Param 3: N 0
Local 1: O Class: TBUTTONBMP
Local 2: U
_FWH
Param 1: N 0
Param 2: N 2048
Param 3: N 0
Param 4: N 0
Param 5: N 21
Local 1: O Class: TBUTTONBMP
SENDMESSAGE
Param 1: N 3933528
Param 2: N 2048
Param 3: N 0
Param 4: N 0
TDIALOG:COMMAND
Param 1: N 4001
Param 2: N 3933528
Local 1: O Class: TDIALOG
Local 2: O Class: TBUTTONBMP
Local 3: N 0
Local 4: N 4001
Local 5: N 3933528
Local 6: U
TWINDOW:HANDLEEVENT
Param 1: N 273
Param 2: N 4001
Param 3: N 3933528
TDIALOG:HANDLEEVENT
Param 1: N 273
Param 2: N 4001
Param 3: N 3933528
Local 1: O Class: TDIALOG
DIALOGBOX
Param 1: N 4194304
Param 2: C "BROWASOC"
Param 3: N 1707284
Param 4: O Class: TDIALOG
TDIALOG:ACTIVATE
Param 1: U
Param 2: U
Param 3: U
Param 4: L .T.
Param 5: U
Param 6: L .T.
Param 7: B {|| ... }
Param 8: U
Param 9: U
Param 10: U
Param 11: U
Param 12: L .F.
Param 13: O Class: TDIALOG
Param 14: U
Local 1: O Class: TDIALOG
Local 2: N 1707284
Local 3: U
Local 4: U
Local 5: U
Local 6: O Class: TDIALOG
PROG08
HABIL
Param 1: C "08"
Param 2: O Class: TMENUITEM
Local 1: U
Local 2: O Class: TMENUITEM
(b)ASSOC
Param 1: O Class: TMENUITEM
TMENU:ACTIVATE
Param 1: N 61
Param 2: N 103
Param 3: O Class: TBAR
Param 4: L .F.
Local 1: N 0
Local 2: O Class: TMENU
Local 3: A Len: 2
TBTNBMP:LBUTTONUP
Param 1: N 37
Param 2: N 98
Param 3: O Class: TBTNBMP
Local 1: O Class: TBAR
Local 2: L .T.
Local 3: N 0
TCONTROL:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 2424930
Local 1: O Class: TBTNBMP
Local 2: U
TBTNBMP:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 2424930
Local 1: O Class: TBTNBMP
_FWH
Param 1: N 2424930
Param 2: N 514
Param 3: N 0
Param 4: N 2424930
Param 5: N 4
Local 1: O Class: TBTNBMP
WINRUN
Param 1: N 1707284
TWINDOW:ACTIVATE
Param 1: C "MAXIMIZED"
Param 2: U
Param 3: U
Param 4: U
Param 5: U
Param 6: U
Param 7: U
Param 8: B {|| ... }
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Param 15: U
Param 16: U
Param 17: U
Param 18: U
Param 19: U
Param 20: L .F.
Local 1: O Class: TWINDOW
Local 2: U
Local 3: U
MAIN
Local 1: U

Linked RDDs
===========
DBF
DBFFPT
DBFBLOB
DBFCDX
DBFNTX

DataBases in use
================

1: ARQRAM RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
6 5 .F. .T.

Indexes in use TagName
=> DESCRICAO DESCRICAO

Relations in use

2: CONFCTE RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 1 .F. .F.

Indexes in use TagName

Relations in use

3: ARQULT RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
1 1 .F. .F.

Indexes in use TagName

Relations in use

4: ARQMEN RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
6 5 .F. .T.

Indexes in use TagName
=> CODIGO CODIGO
DESCRICAO DESCRICAO

Relations in use

5: ARQCON RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
6 6 .F. .F.

Indexes in use TagName
=> CODIGO CODIGO
DESCRICAO DESCRICAO

Relations in use

7: ARQASOC1 RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
684 10753 .F. .F.

Indexes in use TagName
=> CODIGO CODIGO
FANTASIA FANTASIA
SOCIAL SOCIAL
STATUS STATUS
CPFCNPJ CPFCNPJ
SUBSTR(CPFCNPJ,1,12) CNPJP
CIDADE CIDADE

Relations in use

8: => ARQBOL RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
60993 200472 .F. .F.

Indexes in use TagName
=> BOLETO BOLETO
CGCCLI+BOLETO CGCCLI
NRBANCO NRBANCO
DTOS(BAIXA)+NOME BAIXA
NOME NOME
DTOS(EMISSAO)+NOME EMISSAO
DTOS(BAIXA)+TIPO+CGCCLI BAIXATIPO
CBARRAS CBARRAS
DTOS(VENCTO) VENCIMENTO
BANCO+REMESSA REMESSA

Relations in use

Classes in use:
===============
1 ERROR
2 HASHENTRY
3 HBCLASS
4 HBOBJECT
5 TWINDOW
6 TCONTROL
7 TGET
8 TDATABASE
9 TFONT
10 TBRUSH
11 TICON
12 TREG32
13 TBAR
14 TRECT
15 TBTNBMP
16 TMENU
17 TMENUITEM
18 TIMAGELIST
19 TBITMAP
20 TMSGBAR
21 TDIALOG
22 TSAY
23 TXBROWSE
24 TXBRWCOLUMN
25 GET
26 TCLIPGET
27 TBUTTON
28 TBUTTONBMP
29 TSCROLLBAR
30 TCLIPBOARD
31 TMSGITEM
32 TTIMER
33 TFOLDER
34 TSTRUCT

Memory Analysis
===============
2467 Static variables

Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes

wartiaga
 
Posts: 210
Joined: Wed May 25, 2016 1:04 am

Re: Error in database.prg?

Postby wartiaga » Tue Feb 15, 2022 4:58 pm

carlos vargas wrote:
oArqBol:BAIRRO := oArqAsoc:BAIRRO

para descartar, haria lo siguiente:
Code: Select all  Expand view

?oArqBol:cAlias, select(oArqBol:cAlias)
?oArqAsoc:cAlias, select(oArqAsoc:cAlias)
 


Carlos this is so strange because in older fivewin works great. The line before this error I do the same thing oArqBol:END := oArqAsoc:END.
wartiaga
 
Posts: 210
Joined: Wed May 25, 2016 1:04 am

Re: Error in database.prg?

Postby Antonio Linares » Wed Feb 16, 2022 12:19 pm

Do you have a field named "end" in your DBFs ?

Try to use a different field name
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error in database.prg?

Postby wartiaga » Wed Feb 16, 2022 5:25 pm

Antonio Linares wrote:Do you have a field named "end" in your DBFs ?

Try to use a different field name


Yes Antonio, in 10 dbfs.
Database is ending the object with End and not End()? Any other solutions to not have to change the dbfs and prgs?
Thank you!
wartiaga
 
Posts: 210
Joined: Wed May 25, 2016 1:04 am

Re: Error in database.prg?

Postby Antonio Linares » Wed Feb 16, 2022 10:37 pm

> End and not End()

Inside Harbour there is no difference for them

You can not have a data and a method with the same name, "()" does not matter, it is just a message to the object
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error in database.prg?

Postby Antonio Linares » Wed Feb 16, 2022 10:39 pm

A workaround would be to remove this method from Class TDataBase:

// METHOD End() INLINE ::Close()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error in database.prg?

Postby nageswaragunupudi » Thu Feb 17, 2022 1:14 pm

It is clear that we can not use oDBf:End to access value of field named "END" or assign new values to oDbf:End.
Sameway you can not have field names that conflict with any methods of datas of TDatabase/

In such cases, we can rename the field temporarily inside the TDatabase object and use the temporary new name to access/assign values.

For example
Code: Select all  Expand view

oDbf:MapCol( "END", "ENDX" )
? oDbf:EndX
oDbf:EndX := <val>
 

You can safely use oDbf:Endx and it is internally mapped to the field "END"
You can use any name you like.

Note:
Please change the caption "Error in database.prg".
There is NO ERROR in FWH Database.prg.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Error in database.prg?

Postby wartiaga » Thu Feb 17, 2022 2:36 pm

nageswaragunupudi wrote:It is clear that we can not use oDBf:End to access value of field named "END" or assign new values to oDbf:End.
Sameway you can not have field names that conflict with any methods of datas of TDatabase/

In such cases, we can rename the field temporarily inside the TDatabase object and use the temporary new name to access/assign values.

For example
Code: Select all  Expand view

oDbf:MapCol( "END", "ENDX" )
? oDbf:EndX
oDbf:EndX := <val>
 

You can safely use oDbf:Endx and it is internally mapped to the field "END"
You can use any name you like.

Note:
Please change the caption "Error in database.prg".
There is NO ERROR in FWH Database.prg.


Thanks for the explanation. I called it an "error" because in older versions of fivewin this problem doesn't occur. What changed in database.prg for this to happen?
wartiaga
 
Posts: 210
Joined: Wed May 25, 2016 1:04 am

Re: Error in database.prg?

Postby wartiaga » Thu Feb 17, 2022 2:38 pm

Antonio Linares wrote:A workaround would be to remove this method from Class TDataBase:

// METHOD End() INLINE ::Close()


Great! Thank you Antonio!
wartiaga
 
Posts: 210
Joined: Wed May 25, 2016 1:04 am

Re: Can you use a field named End with Class TDataBase ? yes!

Postby nageswaragunupudi » Thu Feb 17, 2022 4:45 pm

Thanks for the explanation. I called it an "error" because in older versions of fivewin this problem doesn't occur. What changed in database.prg for this to happen?

New method End() which is a synonym for Close() was added.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Can you use a field named End with Class TDataBase ? yes!

Postby wartiaga » Thu Feb 17, 2022 5:38 pm

nageswaragunupudi wrote:
Thanks for the explanation. I called it an "error" because in older versions of fivewin this problem doesn't occur. What changed in database.prg for this to happen?

New method End() which is a synonym for Close() was added.


Ok, thank you Mr. Nages!
wartiaga
 
Posts: 210
Joined: Wed May 25, 2016 1:04 am

Re: Can you use a field named End with Class TDataBase ? yes!

Postby James Bott » Fri Feb 18, 2022 10:29 pm

Thanks for the explanation. I called it an "error" because in older versions of fivewin this problem doesn't occur. What changed in database.prg for this to happen?


Actually, it was a change that I suggested. Prior to that, all of FW's objects could be "destroyed" by calling the End() method--except the TDatabase class which used a Close() method, which is the old DBase command to close a file. However, when using objects it helps to use the same method names for similar processes, thus changing the method Close() to End() made data objects consistent with all the other types of objects--just like the New() method is used to create all new objects.

Thus it is not a good idea to try to use any method name as a fieldname in your code.
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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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