problem with TDBNavigator with mySQL
Publicado: Jue Dic 08, 2011 4:23 am
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!
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!