Página 1 de 1

problem with TDBNavigator with mySQL

Publicado: Jue Dic 08, 2011 4:23 am
por Roberto
I have a huge system that is working fine with version 1.9.9.
I'm moving to 2.5 and I found the following isues:
1. Query, now, need to be opened.
before:
QClient := oTMySQLDataSource:Query("SELECT Name, Id FROM Client")
outdebug(QClient:Name)
now:
QClient := oTMySQLDataSource:Query("SELECT Name, Id FROM Client")
QClient:Open()
outdebug(QClient:Name)

It's ok, just a few work to review the code and open the query, no problem... but net next is complicated!
2. TDBNavigator loose its oDataSet object if I need to close and reopen the query. I could not be able to reproduce this behavior.
Where is the code that is working on 1.9.9:
PROCEDURE vwQuery_Refresh(p, txt)
LOCAL lFlag
LOCAL s := p:cSelect
LOCAL i := at("WHERE", s) + 6
LOCAL j := at("ORDER BY", s) - i - 1
LOCAL w := substr(s, i, j)
LOCAL m, o
LOCAL lc := p:aLinkedControls
WITH OBJECT p
lFlag := Len(lc) > 0 // to know if the query is linked with some datacontros
:lOpen := .F. // close it (I cound't find another way to update de query
// recreate the select statement
IF w[1] = "("
j := 1
m := 0
DO WHILE (j <= Len(w)) .AND. (iif(w[j] = "(", m++, iif(w[j] = ")", m--, Nil))) > 0
j++
ENDDO
ENDIF
:cSelect := stuff(s, i, j, txt)
:lOpen := .T. // reopen it
// here I search for something wrong with linked controls!
FOR EACH o iN :aLinkedControls
IF o:oDataField = NIL .and. lFlag
messagebox(p:cname + CRLF + o:ClassName())
o:oDataSet := p // so, I have to "update" the dataset! It does not happen with 1.9.9
ENDIF
NEXT
END
RETURN
I tried to use the sqlparams, but I got the same error.
It's taking so much time to discover this king of errors!

problem with TDBNavigator with mySQL

Publicado: Jue Dic 08, 2011 5:06 am
por Roberto
Sir,
It's a realy complex problem! I still can be wrong, but I think the real problem is that lAllowProcessMessages is True. So, when a query is being executed the program continues and
can't find the expedted oDataField that the query will return! I turned it off (false) and tested all again... seems to work know, but I'm not sure. Does it make any sense?

problem with TDBNavigator with mySQL

Publicado: Vie Dic 09, 2011 1:44 pm
por jfgimenez
Roberto,
> It's a realy complex problem! I still can be wrong, but I
> think the real problem is that lAllowProcessMessages is
> True. So, when a query is being executed the program
> continues and can't find the expedted oDataField that the query will
> return! I turned it off (false) and tested all again...
> seems to work know, but I'm not sure. Does it make any
> sense?
Yes, it fully makes sense. When ProcessMessages() is used, the program
doesn't continue from that point, but it does process every pending
event and windows messages, so it can execute other code where the
dataset is closed, just before continuing the execution at that point.
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info