FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Posible bug en xbrowse
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Posible bug en xbrowse
Posted: Fri Oct 02, 2009 04:26 PM
Al presionar el boton izquierdo del mouse en una linea del xbrowse, lanza un error:
Application
===========
   Path and name: V:\nicotina\nicotina.exe (32 bits)
   Size: 2,057,728 bytes
   Time from start: 0 hours 0 mins 11 secs 
   Error occurred at: 02-10-2009, 11:20:30
   Error description: Error DBCMD/2001  Workarea not in use: DBSKIP
   Args:

Stack Calls
===========
   Called from:  => DBSKIP(0)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSEW:MOUSEMOVE(3192)
   Called from:  => TWINDOW:HANDLEEVENT(0)


La posible soluci贸n encontrada es:
METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TXBrowse

.......
.......

         if ::cAlias == "ARRAY"
            ::nArrayAt-= ( ::RowCount() - ::nRowSel )
         else
            if ( ::nLen - ::RowCount() + ::nRowSel + 1)  <= ::KeyNo()
               ::Skip( -1 )   // Correci贸n wmormar
            endif
         endif


Saludos, espero ayude
William, Morales

Saludos



m茅xico.sureste
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Posible bug en xbrowse
Posted: Sun Oct 11, 2009 07:24 PM

WIlliam,

Puedes reproducir el error en FWH\samples\TestXBrw.prg ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Posible bug en xbrowse
Posted: Mon Oct 12, 2009 05:56 PM

Antonio,

Checo y comento.

William, Morales

Saludos



m茅xico.sureste
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Posible bug en xbrowse
Posted: Tue Oct 13, 2009 06:32 AM
Antonio,

He checado el testxbrw.prg y no da ningun problema con el bug mencionado.

Las pruebas que he hecho son con tMySql y el problema viene, porque en la xbrowse se valida Array y DBF.

Est茅 c贸digo lo demuestra.

Code (fw): Select all Collapse
         if ::cAlias == "ARRAY"
            ::nArrayAt-= ( ::RowCount() - ::nRowSel )
         else
            if ( ::nLen - ::RowCount() + ::nRowSel + 1)  <= ::KeyNo()
               ::Skip( -1 )   // Correci贸n wmormar
            endif
         endif


o es array u otro.

espero me haya explicado.

saludos
William, Morales

Saludos



m茅xico.sureste
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Posible bug en xbrowse
Posted: Tue Oct 13, 2009 08:43 AM

William,

Entiendo. Luego esa modificaci贸n solo deber铆amos aplicarla si se usa TMySQL.

Como podriamos detectar en el c贸digo que se est谩 usando TMySQL ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Posible bug en xbrowse
Posted: Tue Oct 13, 2009 02:07 PM
Antonio Linares wrote:William,

Entiendo. Luego esa modificaci贸n solo deber铆amos aplicarla si se usa TMySQL.

Como podriamos detectar en el c贸digo que se est谩 usando TMySQL ?


Antonio,

Podriamos detectar si es tmysql, colocando algo como ::classname(), Aunque pudiese darse el error con ADO de igual manera.

He colocado lo siguiente en mi definici贸n. Bien podr铆a ser la forma de detectar que es tmysql.

DATA nDataType; // Data type to be used: 0->rdd, 1->array, ... (more to come)
AS NUMERIC // If navigation codeblocks are not specified then get automatically
// initialiated when adjusting the browse depending on this DATA value
// 7777 -> TMySQL

::nDataType := 7777

Saludos
William, Morales

Saludos



m茅xico.sureste
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 05:15 AM
William,

Nuestra propuesta es a帽adir este nuevo define a include\xbrowse.ch:
Code (fw): Select all Collapse
#define DATATYPE_MYSQL        64

Los valores que tenemos ahora en include\xbrowse quedan asi:
Code (fw): Select all Collapse
#define DATATYPE_RDD           1
#define DATATYPE_ARRAY         2
#define DATATYPE_ADO           4
#define DATATYPE_ODBF         16
#define DATATYPE_TREE         32
#define DATATYPE_MYSQL        64

Podrias adaptar tu c贸digo a este define y publicar los cambios necesarios ? gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 05:17 AM

William,

Mauricio tambien ha detectado este otro cambio:

viewtopic.php?p=88421#p88421

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 11:46 AM
Antonio Linares wrote:William,

Nuestra propuesta es a帽adir este nuevo define a include\xbrowse.ch:
Code (fw): Select all Collapse
#define DATATYPE_MYSQL 聽 聽 聽 聽64

Los valores que tenemos ahora en include\xbrowse quedan asi:
Code (fw): Select all Collapse
#define DATATYPE_RDD 聽 聽 聽 聽 聽 1
#define DATATYPE_ARRAY 聽 聽 聽 聽 2
#define DATATYPE_ADO 聽 聽 聽 聽 聽 4
#define DATATYPE_ODBF 聽 聽 聽 聽 16
#define DATATYPE_TREE 聽 聽 聽 聽 32
#define DATATYPE_MYSQL 聽 聽 聽 聽64

Podrias adaptar tu c贸digo a este define y publicar los cambios necesarios ? gracias


Claro que si Antonio,

Checando...
William, Morales

Saludos



m茅xico.sureste
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 07:28 PM
Antonio,

Aqu铆 las modificaciones a la xbrowse para usar la tmysql.

Code (fw): Select all Collapse
...
DATA oMysql 聽 聽 聽 // TMySQL recordset if Method Setmysql() is used
...
METHOD SetMySql( oMysql, lAddCols, lAutoOrder, aFldNames ) // TMySql object
METHOD SetColFromMySQL( cnCol, cHeader ) 聽 // used internally from mysql
...
...

METHOD Initiate( hDlg ) CLASS TXBrowse

聽 聽...
聽 聽...

聽 聽if Empty( ::nDataType ) .or. Empty( ::aCols )

聽 聽 聽 if ! Empty( ::aArrayData )
聽 聽 聽 聽 聽if lAnd( ::nDataType, DATATYPE_RDD )
聽 聽 聽 聽 聽 聽 ::SetRDD( .t., nil, nil, ::aArrayData )
聽 聽 聽 聽 聽elseif lAnd( ::nDataType, DATATYPE_ODBF ) .and. !Empty( ::oDbf )
聽 聽 聽 聽 聽 聽 ::SetODbf( ::oDbf, nil, nil, .t., ::aArrayData )
聽 聽 聽 聽 聽else
聽 聽 聽 聽 聽 聽 ::SetArray( ::aArrayData )
聽 聽 聽 聽 聽endif
聽 聽 聽 elseif ! Empty( ::oRs )
聽 聽 聽 聽 聽::SetADO( ::oRs )
聽 聽 聽 elseif ! Empty( ::oMysql )
聽 聽 聽 聽 聽::SetMysql( ::oMysql )

聽 聽...
聽 聽...

METHOD SetMySql( oMysql, lAddCols, lAutoOrder, aFldNames )
聽 聽LOCAL xField 聽 聽:= NIL
聽 聽LOCAL cHeader 聽 := ""
聽 聽LOCAL cCol 聽 聽 聽:= ""

聽 聽DEFAULT oMysql 聽 聽 聽:= ::oMysql
聽 聽DEFAULT aFldNames 聽 := {}
聽 聽DEFAULT lAddCols 聽 聽:= 聽Empty( ::aCols ) .or. ! Empty( aFldNames )
聽 聽DEFAULT lAutoOrder 聽:= ::lAutoSort

聽 聽::oMysql 聽 聽 聽 聽 聽 聽:= oMysql

聽 聽DEFAULT ::bGoTop 聽 聽:= {|| If( ::oMysql:RecCount() > 0, ::oMysql:GoTop(), NIL ) },;
聽 聽 聽 聽 聽 聽::bGoBottom := {|| If( ::oMysql:RecCount() > 0, ::oMysql:GoBottom(), nil ) 聽},;
聽 聽 聽 聽 聽 聽::bSkip 聽 聽 := {| n | ::oMysql:Skip( n ) },;
聽 聽 聽 聽 聽 聽::bBof 聽 聽 聽:= {|| ::oMysql:Bof() },;
聽 聽 聽 聽 聽 聽::bEof 聽 聽 聽:= {|| ::oMysql:Eof() },;
聽 聽 聽 聽 聽 聽::bBookMark := {| n | If( n == nil,;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽If( ::oMysql:RecCount() > 0, ::oMysql:RecNo(), 0 ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽If( ::oMysql:RecCount() > 0, ::oMysql:goto( n ), 0 ) ) }, ;
聽 聽 聽 聽 聽 聽::bKeyNo 聽 聽:= {| n | If( n == nil, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽If( ::oMysql:RecCount() > 0, ::oMysql:RecNo(), 0 ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽If( ::oMysql:RecCount() > 0, ::oMysql:Goto( n ), 0 ) ) },;
聽 聽 聽 聽 聽 聽::bKeyCount := {|| ::oMysql:RecCount() }

聽 聽::nDataType 聽 聽 聽 聽 := DATATYPE_MYSQL

聽 聽IF lAddCols

聽 聽 聽 IF Len(aFldNames) == 0
聽 聽 聽 聽 聽aFldNames := ::oMysql:aFieldStruct
聽 聽 聽 ENDIF

聽 聽 聽 FOR EACH xField IN aFldNames
聽 聽 聽 聽 聽IF Valtype( xField ) == "A" .AND. Len(xField) == 2
聽 聽 聽 聽 聽 聽 cCol 聽 聽:= xField[1]
聽 聽 聽 聽 聽 聽 cHeader := xField[2]
聽 聽 聽 聽 聽ELSEIF Valtype( xField ) == "A" .AND. Len(xField) # 2
聽 聽 聽 聽 聽 聽 cCol 聽 聽:= xField[1]
聽 聽 聽 聽 聽 聽 cHeader := xField[1]
聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 cCol 聽 聽:= xField
聽 聽 聽 聽 聽 聽 cHeader := xField
聽 聽 聽 聽 聽ENDIF

聽 聽 聽 聽 聽::SetColFromMySQL( cCol, cHeader )
聽 聽 聽 NEXT

聽 聽 聽 ::bSeek 聽:= { |c| MysqlSeek( ::oMysql, c, , ::lSeekWild ) }

聽 聽ENDIF

聽 聽if ::lCreated
聽 聽 聽 ::Adjust()
聽 聽 聽 ::Refresh()
聽 聽endif

聽 聽RETURN Self

//----------------------------------------------------------------------------//

METHOD SetColFromMySQL( cnCol, cHeader )

聽 聽LOCAL nType, cType, nLen, nDec, cName
聽 聽LOCAL oCol, nCol

聽 聽IF ValType( cnCol ) == "C"
聽 聽 聽 nCol 聽 聽 聽 聽 聽 聽 聽 := ::oMysql:FieldPos( cnCol )
聽 聽ENDIF

聽 聽nCol 聽 聽 聽 聽 聽 聽 聽 聽 聽:= cnCol
聽 聽oCol 聽 聽 聽 聽 聽 聽 聽 聽 聽:= ::AddCol()
聽 聽oCol:cHeader 聽 聽 聽 聽 聽:= cHeader
聽 聽cType 聽 聽 聽 聽 聽 聽 聽 聽 := ::oMysql:FieldType( nCol )
聽 聽nLen 聽 聽 聽 聽 聽 聽 聽 聽 聽:= 0
聽 聽nDec 聽 聽 聽 聽 聽 聽 聽 聽 聽:= 0

聽 聽DO CASE
聽 聽CASE cType 聽 聽 聽 == 'N'
聽 聽 聽 nLen 聽 聽 聽 聽 聽 聽 聽 := ::oMysql:FieldLen( nCol )
聽 聽 聽 nDec 聽 聽 聽 聽 聽 聽 聽 := ::oMysql:FieldDec( nCol )
聽 聽 聽 oCol:cEditPicture 聽:= NumPict( nLen, nDec, .F., .f. )

聽 聽CASE cType 聽 聽 聽 == 'C'
聽 聽 聽 nLen 聽 聽 聽 聽 聽 聽 聽 := MIN( 100, ::oMysql:FieldLen( nCol ) )

聽 聽CASE cType 聽 聽 聽 == 'M'
聽 聽 聽 nLen 聽 聽 聽 聽 聽 聽 聽 := MIN( 100, Len(AllTrim(::oMysql:FieldGet( nCol ))) )
聽 聽 聽 nLen 聽 聽 聽 聽 聽 聽 聽 := IF(nLen < 30, 30, nLen )

聽 聽CASE cType 聽 聽 聽 == 'D'
聽 聽 聽 oCol:nHeadStrAlign := 2
聽 聽 聽 oCol:nDataStrAlign := 0

聽 聽CASE cType 聽 聽 聽 == NIL
聽 聽 聽 // some types like adChapter( child recset), etc. can not be shown
聽 聽 聽 // programmer who uses such types should make his own coding for
聽 聽 聽 // such columns
聽 聽 聽 oCol:bEditValue 聽 聽:= { || "..." }

聽 聽OTHERWISE
聽 聽 聽 // just in case. 聽this will not be executed
聽 聽 聽 oCol:bEditValue 聽 聽:= { || MSGINFO( "Abriendo fronteras, wmormar...", FWDESCRIPTION ) }

聽 聽ENDCASE

聽 聽oCol:bEditValue 聽 聽 聽 := { || ::oMysql:FieldGet( nCol ) }
聽 聽oCol:cDataType 聽 聽 聽 聽:= If( cType == nil, 'C', cType )
聽 聽oCol:bOnPostEdit 聽 聽 聽:= { |o,x,n| If( n == VK_RETURN, ::onedit( o, x, n, cType, nCol ), NIL ) }

聽 聽RETURN oCol

//----------------------------------------------------------------------------//

static function MysqlSeek( oMysql, uSeek, lSoft, lWildSeek )

聽 聽local lFound 聽 := .f.
聽 聽local cCol 聽 聽 := oMysql:cSort
聽 聽local cExpr 聽 聽:= ''
聽 聽local cType, d, uVal

聽 聽if ! Empty( cCol ) .and. ! oMysql:Eof() .and. ! oMysql:Bof()

聽 聽 聽 DEFAULT lSoft := Set(_SET_SOFTSEEK), lWildSeek := .f.

聽 聽 聽 uVal 聽 := oMysql:FieldGet( cCol )
聽 聽 聽 cType 聽:= oMysql:FieldType( cCol )

聽 聽 聽 do case
聽 聽 聽 case cType == 'C'

聽 聽 聽 聽 聽if lWildSeek
聽 聽 聽 聽 聽 聽 lSoft 聽 聽:= .f.
聽 聽 聽 聽 聽 聽 cExpr 聽 聽:= cCol + " LIKE '%" + uSeek + "%'"
聽 聽 聽 聽 聽else
聽 聽 聽 聽 聽 聽 cExpr 聽 聽:= If( Set( _SET_EXACT ), cCol + " = '" + uSeek + "'", ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽cCol + " LIKE '" + uSeek + "%'" )
聽 聽 聽 聽 聽endif

聽 聽 聽 case cType == 'N'
聽 聽 聽 聽 聽cExpr 聽 聽:= cCol + " >= " + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽LTrim( Str( Val( uSeek ) ) )
聽 聽 聽 case cType == 'D'

聽 聽 聽 聽 聽if Empty( d := CToD( uSeek ) )
聽 聽 聽 聽 聽 聽 d 聽:= CToD( uSeek + SubStr( DToC( uVal ), Len( uSeek ) + 1 ) )
聽 聽 聽 聽 聽endif
聽 聽 聽 聽 聽if ! Empty( d )
聽 聽 聽 聽 聽 聽 cExpr 聽 聽:= cCol + " >= #" + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 StrZero( Year( d ), 4 ) + "-" + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 StrZero( Month( d ), 2 ) + "-" + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 StrZero( Day( d ), 2 ) + "#"

聽 聽 聽 聽 聽endif
聽 聽 聽 endcase

聽 聽 聽 if ! Empty( cExpr )
聽 聽 聽 聽 聽oMysql:WSeekplus( cExpr, oMysql:cSort, oMysql:recno() )
聽 聽 聽 聽 聽if oMysql:Eof() .and. lSoft .and. cType == 'C'
聽 聽 聽 聽 聽 聽 oMysql:GoTop()
聽 聽 聽 聽 聽 聽 cExpr := cCol + " > '" + uSeek + "'"
聽 聽 聽 聽 聽 聽 oMysql:WSeekplus( cExpr, oMysql:cSort, oMysql:recno() )
聽 聽 聽 聽 聽endif
聽 聽 聽 聽 聽if oMysql:Eof()
聽 聽 聽 聽 聽 聽 oMysql:GoBottom()
聽 聽 聽 聽 聽else
聽 聽 聽 聽 聽 聽 lFound 聽 := .t.
聽 聽 聽 聽 聽endif
聽 聽 聽 endif

聽 聽endif


return lFound

//----------------------------------------------------------------------------//

METHOD Adjust() CLASS TXBrwColumn

聽 聽 聽 ....
聽 聽 聽 ....
聽 聽 聽 ....

聽 聽 聽 DEFAULT ::bOnPostEdit := { |o,x,n| If( n != VK_ESCAPE, ::Value := x,) }

聽 聽 聽 if ::cSortOrder != nil
聽 聽 聽 聽 聽if ValType( ::cSortOrder ) != 'B'
聽 聽 聽 聽 聽 聽 if ( ::oBrw:nDataType == DATATYPE_RDD )
聽 聽 聽 聽 聽 聽 聽 聽if EQ( (::oBrw:cAlias)->( OrdSetFocus() ), ::cSortOrder )
聽 聽 聽 聽 聽 聽 聽 聽 聽 ::cOrder 聽 聽 聽 := 'A'
聽 聽 聽 聽 聽 聽 聽 聽endif
聽 聽 聽 聽 聽 聽 elseif ( ::oBrw:nDataType == DATATYPE_ADO )
聽 聽 聽 聽 聽 聽 聽 聽if EQ( ::oBrw:oRs:Sort, ::cSortOrder )
聽 聽 聽 聽 聽 聽 聽 聽 聽 ::cOrder 聽 聽 聽 := 'A'
聽 聽 聽 聽 聽 聽 聽 聽endif
聽 聽 聽 聽 聽 聽 elseif ( ::oBrw:nDataType == DATATYPE_MYSQL )
聽 聽 聽 聽 聽 聽 聽 聽if EQ( ::oBrw:oMysql:cSort, ::cSortOrder )
聽 聽 聽 聽 聽 聽 聽 聽 聽 ::cOrder 聽 聽 聽 := 'A'
聽 聽 聽 聽 聽 聽 聽 聽endif

....................
............................

METHOD SetOrder() CLASS TXBrwColumn

............................
............................

聽 聽 聽 elseif nAnd( ::oBrw:nDataType, DATATYPE_ADO ) == DATATYPE_ADO .and. ;
聽 聽 聽 聽 聽::oBrw:oRs != nil

聽 聽 聽 聽 聽cSort 聽 := Upper( ::oBrw:oRs:Sort )
聽 聽 聽 聽 聽cSort 聽 := TRIM( StrTran( StrTran( cSort, 'DESC', '' ), 'ASC', '' ) )
聽 聽 聽 聽 聽if EQ( cSort, ::cSortOrder )
聽 聽 聽 聽 聽 聽 // Asc -> Desc or Desc -> Asc
聽 聽 聽 聽 聽 聽 if ::cOrder == 'D'
聽 聽 聽 聽 聽 聽 聽 聽::oBrw:oRs:Sort 聽 := ::cSortOrder
聽 聽 聽 聽 聽 聽 聽 聽::cOrder 聽 聽 聽 聽 聽:= 'A'
聽 聽 聽 聽 聽 聽 else
聽 聽 聽 聽 聽 聽 聽 聽::oBrw:oRs:Sort 聽 := ::cSortOrder + " DESC"
聽 聽 聽 聽 聽 聽 聽 聽::cOrder 聽 聽 聽 聽 聽:= 'D'
聽 聽 聽 聽 聽 聽 endif
聽 聽 聽 聽 聽 聽 lSorted 聽 聽 聽:= .T.
聽 聽 聽 聽 聽else
聽 聽 聽 聽 聽 聽 // Asc Sort
聽 聽 聽 聽 聽 聽 ::oBrw:oRs:Sort 聽 聽 聽:= ::cSortOrder
聽 聽 聽 聽 聽 聽 For n := 1 TO Len(::oBrw:aCols)
聽 聽 聽 聽 聽 聽 聽 聽oCol 聽 := ::oBrW:aCols[ n ]
聽 聽 聽 聽 聽 聽 聽 聽oCol:cOrder 聽 聽 聽 := " "
聽 聽 聽 聽 聽 聽 Next n
聽 聽 聽 聽 聽 聽 ::cOrder 聽 聽 聽 聽 聽 聽 := 'A'
聽 聽 聽 聽 聽 聽 lSorted 聽 聽 聽 聽 聽 聽 聽:= .T.
聽 聽 聽 聽 聽endif

聽 聽 聽 elseif nAnd( ::oBrw:nDataType, DATATYPE_MYSQL ) == DATATYPE_MYSQL .and. ;
聽 聽 聽 聽 聽::oBrw:oMysql != nil

聽 聽 聽 聽 聽cSort 聽 := Upper( ::oBrw:oMysql:cSort )
聽 聽 聽 聽 聽cSort 聽 := TRIM( StrTran( StrTran( cSort, 'DESC', '' ), 'ASC', '' ) )
聽 聽 聽 聽 聽if EQ( cSort, ::cSortOrder )
聽 聽 聽 聽 聽 聽 // Asc -> Desc or Desc -> Asc
聽 聽 聽 聽 聽 聽 if ::cOrder == 'D'
聽 聽 聽 聽 聽 聽 聽 聽::oBrw:oMysql:cSort := ::cSortOrder
聽 聽 聽 聽 聽 聽 聽 聽::cOrder 聽 聽 聽 聽 聽 聽:= 'A'
聽 聽 聽 聽 聽 聽 else
聽 聽 聽 聽 聽 聽 聽 聽::oBrw:oMysql:cSort := ::cSortOrder + " DESC"
聽 聽 聽 聽 聽 聽 聽 聽::cOrder 聽 聽 聽 聽 聽 聽:= 'D'
聽 聽 聽 聽 聽 聽 endif
聽 聽 聽 聽 聽 聽 lSorted 聽 聽 聽:= .T.
聽 聽 聽 聽 聽else
聽 聽 聽 聽 聽 聽 // Asc Sort
聽 聽 聽 聽 聽 聽 ::oBrw:oMysql:Sort 聽 聽 聽:= ::cSortOrder
聽 聽 聽 聽 聽 聽 For n := 1 TO Len(::oBrw:aCols)
聽 聽 聽 聽 聽 聽 聽 聽oCol 聽 := ::oBrW:aCols[ n ]
聽 聽 聽 聽 聽 聽 聽 聽oCol:cOrder 聽 聽 聽 := " "
聽 聽 聽 聽 聽 聽 Next n
聽 聽 聽 聽 聽 聽 ::cOrder 聽 聽 聽 聽 聽 聽 := 'A'
聽 聽 聽 聽 聽 聽 lSorted 聽 聽 聽 聽 聽 聽 聽:= .T.
聽 聽 聽 聽 聽endif

聽 聽 聽 elseif nAnd( ::oBrw:nDataType, DATATYPE_ODBF ) == DATATYPE_ODBF .and. ;

............................
............................

static function XbrwSetDataSource( oBrw, uDataSrc, lAddCols, lAutoSort, aCols, aRows 聽)

............................
............................

聽 聽elseif cType == 'O'

聽 聽 聽 if Upper( uDataSrc:ClassName() ) == "TMYSQL"

聽 聽 聽 聽 聽oBrw:nDataType := DATATYPE_MYSQL
聽 聽 聽 聽 聽oBrw:oMysql 聽 聽 聽 := uDataSrc
聽 聽 聽 聽 聽if lAddCols .or. ! Empty( aCols )
聽 聽 聽 聽 聽 聽 oBrw:SetMysql( uDataSrc, lAddCols, lAutoSort, aCols )
聽 聽 聽 聽 聽endif

聽 聽 聽 elseif Upper( uDataSrc:ClassName ) == "TOLEAUTO"

............................
............................


Esas son todas las modificaciones para usar tmysql con xbrowse.

A continuaci贸n un ejemplo
Code (fw): Select all Collapse
/*

聽 INCOS
聽 William Morales

聽 <!-- m --><a class="postlink" href="http://incos.sytes.net">http://incos.sytes.net</a><!-- m -->
聽 <!-- m --><a class="postlink" href="http://incos.sytes.net/fivewin">http://incos.sytes.net/fivewin</a><!-- m -->

聽 <!-- e --><a href="mailto:wmormar@hotmail.com">wmormar@hotmail.com</a><!-- e -->

聽 TXBrowse()

*/

#include 'fivewin.ch'

*-------------------*
STATIC oServer
STATIC oQry
STATIC oBrw
STATIC oWnd
STATIC oMenu

FUNCTION main()
聽 聽LOCAL cHost 聽:= "localhost"
聽 聽LOCAL cUser 聽:= "user"
聽 聽LOCAL cPsw 聽 := "psw"
聽 聽LOCAL nPort 聽:= 3306
聽 聽LOCAL cDb 聽 聽:= "test"
聽 聽LOCAL n 聽 聽 聽:= 1
聽 聽LOCAL cQuery := ""

聽 聽MENU oMenu 2007
聽 聽 聽 MENUITEM "Pruebas"
聽 聽 聽 MENU
聽 聽 聽 聽 聽MENUITEM "AddRecord 1" ACTION addrecord1() MESSAGE "Adiciona registros a la tabla 1"
聽 聽 聽 聽 聽MENUITEM "AddRecord 2" ACTION addrecord2() MESSAGE "Adiciona registros a la tabla 2"
聽 聽 聽 聽 聽MENUITEM "UpdateRecord" ACTION updaterecord2() MESSAGE "Modifica registros a la tabla 2"
聽 聽 聽 ENDMENU
聽 聽ENDMENU

聽 聽oServer:= TMySQLServer():New( cHost, cUser, cPsw, nPort )
聽 聽if oServer:NetErr()
聽 聽 聽 MsgAlert (oServer:Error(),"MySQL Error")
聽 聽 聽 quit
聽 聽endif

聽 聽IF oServer:lError
聽 聽 聽 ? "No connect"
聽 聽 聽 RETURN NIL
聽 聽ENDIF

聽 聽oserver:Selectdb(cDb)

聽 聽IF oServer:lError
聽 聽 聽 ? "No used database"
聽 聽 聽 RETURN NIL
聽 聽ENDIF

聽 聽IF !oServer:tableexist( "prueba" )
聽 聽 聽 cQuery := "CREATE TABLE prueba( "
聽 聽 聽 cQuery += "clave varchar(3) NOT NULL default '0',"
聽 聽 聽 cQuery += "nombre varchar(30) default 'x',"
聽 聽 聽 cQuery += "fecha date default '20091012',"
聽 聽 聽 cQuery += "saldo decimal(9,2) default 0.00,"
聽 聽 聽 cQuery += "PRIMARY KEY 聽(clave) "
聽 聽 聽 cQuery += ") ENGINE=InnoDB DEFAULT CHARSET=latin1"
聽 聽 聽 oServer:execute( cQuery )
聽 聽ENDIF

聽 聽oServer:execute( "TRUNCATE TABLE prueba" )
聽 聽oQry 聽 := oServer:Query( "SELECT * FROM prueba" )

聽 聽oQry:gotop()
聽 聽wmbrowse()

聽 聽return nil

/************************************************************/
STATIC FUNCTION wmbrowse()
聽 聽DEFINE WINDOW oWnd TITLE "Mi browse" FROM 10, 10 TO 30, 60 MENU oMenu

聽 聽 聽 wmbrw()
聽 聽 聽 oWnd:oClient := oBrw

聽 聽ACTIVATE WINDOW oWnd

RETURN NIL

STATIC FUNCTION wmbrw()
聽 聽LOCAL oCol

聽 聽oBrw := TXBrowse():new( oWnd )
聽 聽oBrw:Setmysql( oQry )
聽 聽oBrw:createfromcode()

聽 聽RETURN NIL

STATIC FUNCTION addrecord1()
聽 聽LOCAL n, nClv

聽 聽FOR n := 1 TO 15
聽 聽 聽 nClv := alltrim(str( HB_RandomInt( 999 ) ))
聽 聽 聽 oQry:fieldput( "clave" , nClv )
聽 聽 聽 oQry:fieldput( "nombre", "prueba1 - " + nClv )
聽 聽 聽 oQry:fieldput( "fecha" , date() )
聽 聽 聽 oQry:fieldput( "saldo" , HB_RandomInt( 99999999.99 ) )
聽 聽 聽 oQry:append()
聽 聽NEXT

聽 聽oBrw:refresh()

聽 聽RETURN NIL

STATIC FUNCTION addrecord2()
聽 聽LOCAL n, nClv

聽 聽FOR n := 1 TO 15
聽 聽 聽 nClv := alltrim(str( HB_RandomInt( 999 ) ))
聽 聽 聽 oQry:blank()
聽 聽 聽 oQry:clave 聽:= nClv
聽 聽 聽 oQry:nombre := "prueba2 - " + nClv
聽 聽 聽 oQry:fecha 聽:= date()
聽 聽 聽 oQry:saldo 聽:= HB_RandomInt( 99999999.99 )
聽 聽 聽 oQry:save()
聽 聽NEXT

聽 聽oBrw:refresh()

聽 聽RETURN NIL

STATIC FUNCTION updaterecord2()
聽 聽LOCAL n, nClv

聽 聽oQry:gotop()
聽 聽WHILE !oQry:eof()
聽 聽 聽 nClv := alltrim(str( HB_RandomInt( 999 ) ))
聽 聽 聽 oQry:nombre := "CAMBIADO - " + nClv
聽 聽 聽 oQry:fecha 聽:= date()
聽 聽 聽 oQry:saldo 聽:= HB_RandomInt( 99999999.99 )
聽 聽 聽 oQry:save()
聽 聽 聽 oQry:skip()
聽 聽ENDDO

聽 聽oBrw:refresh()

聽 聽RETURN NIL


Espero sea de ayuda, los errores reportados de bSeek y onmouse.

PD. en el blog FWH TMYSQL Y MAS se encuentra la lib para descarga
William, Morales

Saludos



m茅xico.sureste
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 09:44 PM

William,

Muchas gracias :-)

Lo incluimos en FWH 9.10 con tu permiso, gracias!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 09:48 PM
Antonio Linares wrote:William,

Muchas gracias :-)

Lo incluimos en FWH 9.10 con tu permiso, gracias!


Antonio,

Es todo un gusto.

y te he enviado el xbrowse.prg completo a tu correo.
William, Morales

Saludos



m茅xico.sureste
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 09:52 PM

William,

Fichero recibido, gracias nuevamente! :-)

Cuenta con un FWH 9.10 gratuito como muestra de gratitud por tu ayuda, siempre tan valiosa :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: Posible bug en xbrowse
Posted: Thu Oct 15, 2009 10:05 PM
Antonio Linares wrote:William,

Fichero recibido, gracias nuevamente! :-)

Cuenta con un FWH 9.10 gratuito como muestra de gratitud por tu ayuda, siempre tan valiosa :-)


Enterado.

Gracias a ti
William, Morales

Saludos



m茅xico.sureste

Continue the discussion