xBrowse-TMySql sample?

xBrowse-TMySql sample?

Postby FranciscoA » Mon Apr 02, 2012 2:33 am

Greetings to all.
Can any of you show me an example tmysql xbrowse in which the xbrowse be refreshed after a consultation?

Let me explain: When I use oQuery: locate (), achieving the goal, but is too slow. If I use oQuery: Seek (), the key value is found, but the xBrowse not select the line that corresponds. Even moving the cursor.

Appreciate very much this small example TMySql and xBrowse.

thanks
:roll:
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2111
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: xBrowse-TMySql sample?

Postby hag » Mon Apr 02, 2012 4:06 am

Maybe an oBrw:refresh() might work??
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: xBrowse-TMySql sample?

Postby ShumingWang » Mon Apr 02, 2012 11:44 am

obrow:=bseek:={|v|odb2:SEEK(v,,{oquery:itemid+oquery:id2})}

tmysql query class
METHOD Seek(Value,lSoftSeek,cFieldNames,llast)
METHOD Seek( xValue,lSoftSeek,cFieldNames,llast) CLASS TMySQLQuery
local nstart,nend,nretry:=0,Xvalue0:=Xvalue,ctype:=VALTYPE(xValue)

default lSoftSeek to .t.
DEFAULT llast TO .f.


if ctype=="C"
if len(xValue)<LEN(cvaltochar(if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)))
xValue:=PADR(xValue,len(cvaltochar(if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)))," ")
end
xValue:=UPPER(xValue)
xValue0:=UPPER(xValue0)
end


::lFound := .f.
::GoTop()
if RIGHT(UPPER(RIGHT(::cquery,8)),4)=="DESC"
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)<xValue
if !lSoftseek
::GoBottom()
end

return ::lFound
end

if valtype(xValue)=="C"
::GoBottom()
if left(if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames)),len(Xvalue0))==Xvalue0
::lfound:=.t.
return ::lfound
else
::GoTop()
end
end

while .t.
nStart:=1
nEnd:=::lastrec()
while nEnd-nStart>1
::GoTo( nStart+int( (nEnd-nStart)/2))
if ctype<>"C"
Do Case
case if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)<xValue
nend := ::nCurRow
case if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue
::lFound := .t.
exit
case if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)>xValue
nStart := ::nCurRow
endcase
else
Do Case
case if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))<xValue
nend := ::nCurRow
case if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))==xValue
::lFound := .t.
exit
case if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))>xValue
nStart := ::nCurRow
endcase
endif
enddo

if ::lFound; exit; end
::GoTo(nStart)
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue ; ::lfound :=.t.; exit; end
if ctype=="C"
if left(if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames)),len(Xvalue0))==Xvalue0; ::lfound:=.t.; exit; end
end
::GoTo(nEnd)
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue ; ::lfound :=.t.; exit; end
if ctype=="C"
if left(if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames)),len(Xvalue0))==Xvalue0; ::lfound:=.t.; exit; end
end
exit
enddo

if !::lFound.and.!lSoftseek; ::GoBottom(); end
if ::lfound.and.llast
while nEnd-nStart>1
::GoTo( nStart+int( (nEnd-nStart)/2))
if ctype<>"C"
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)<xValue
nend := ::nCurRow
else
// if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames))==xValue
nStart := ::nCurRow
end
else
if if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))<xValue
nend := ::nCurRow
else
// if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames))==xValue
nStart := ::nCurRow
end
endif
enddo
::GoTo(nEnd)
if ctype<>"C"
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)<xValue; ::GoTo(nStart); end
else
if if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))<xValue; ::GoTo(nStart); end
endif
end

else

if ctype=="C"
if left(if(VALTYPE(cfieldnames)=="B",UPPER(cvaltochar(EVAL(cfieldnames))),UPPER(cvaltochar(&cFieldNames))),len(Xvalue0))==Xvalue0
::lfound:=.t.
return ::lFound
end
end

if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)>xValue
if !lSoftseek
::GoBottom()
end
return ::lFound
end



while .t.
nStart:=1
nEnd:=::lastrec()
while nEnd-nStart>1
::GoTo( nStart+int( (nEnd-nStart)/2))
if ctype<>"C"
Do Case
case if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)>xValue
nend := ::nCurRow
case if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue
::lFound := .t.
exit
case if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)<xValue
nStart := ::nCurRow
endcase
else
Do Case
case if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))>xValue
nend := ::nCurRow
case if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))==xValue
::lFound := .t.
exit
case if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))<xValue
nStart := ::nCurRow
endcase
endif
enddo

if ::lFound; exit; end
::GoTo(nStart)
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue ; ::lfound :=.t.; exit; end
if ctype=="C"
if left(if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames)),len(Xvalue0))==Xvalue0; ::lfound:=.t.; exit; end
end

::GoTo(nEnd)
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue ; ::lfound :=.t.; exit; end
if ctype=="C"
if left(if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames)),len(Xvalue0))==Xvalue0; ::lfound:=.t.; exit; end
end
exit
enddo

if !::lFound.and.!lSoftseek; ::GoBottom(); end
if ::lfound.and.llast
while nEnd-nStart>1
::GoTo( nStart+int( (nEnd-nStart)/2))
if ctype<>"C"
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)>xValue
nend := ::nCurRow
else
// if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue
nStart := ::nCurRow
end
else
if if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))>xValue
nend := ::nCurRow
else
// if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)==xValue
nStart := ::nCurRow
end
endif
enddo
::GoTo(nEnd)
if ctype<>"C"
if if(VALTYPE(cfieldnames)=="B",EVAL(cfieldnames),&cFieldNames)>xValue; ::GoTo(nStart); end
else
if if(VALTYPE(cfieldnames)=="B",UPPER(EVAL(cfieldnames)),UPPER(&cFieldNames))>xValue; ::GoTo(nStart); end

end
end

end


Return ::lFound


Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 460
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: xBrowse-TMySql sample?

Postby FranciscoA » Mon Apr 02, 2012 12:06 pm

Hag, thanks for your reply. I did it but not worked:
oQuery:Refresh()
oBrw:Refresh()


Shuming, I will try your modifications.
Thank you very much.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2111
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: xBrowse-TMySql sample?

Postby ShumingWang » Tue Apr 03, 2012 2:30 am

obrow:=bseek:={|v|odb2:SEEK(v,,{oquery:itemid+oquery:id2})}

Should be
obrow:bseek:={|v|oquery:SEEK(v,,{||oquery:itemid})}

Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 460
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: xBrowse-TMySql sample?

Postby FranciscoA » Wed Apr 04, 2012 8:24 pm

Hello Shuming.
Thank you for your interest in helping. I tried to create tmysql.lib, but I have problems. This is the first time I try to do it.

In compiling this error is show:

MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
C: \ XHARBOUR_1.21_6714_BCC582 \ BIN \ harbour.exe mysqlrdd.prg-q0-w-ES2-gc0-n-iC: \ XHARBOUR_1.21_6714_BCC582 \ include, C: \ XHARBOUR_1.21_6714_BCC582 \ TMYSQL \ MYSQL_SERVER_51 \ INCLUDE-o. \ OBJ \ mysqlrdd.c
C: \ BCC582 \ BIN \ bcc32-c-O2-IC: \ XHARBOUR_1.21_6714_BCC582 \ include, C: \ XHARBOUR_1.21_6714_BCC582 \ TMYSQL \ MYSQL_SERVER_51 \ INCLUDE-DHB_OS_WIN_32_USED-o. \ OBJ \ mysqlrdd.obj. \ OBJ \ mysqlrdd . c
Borland C + + 5.82 for Win32 Copyright (c) 1993, 2005 Borland
. \ OBJ \ mysqlrdd.c:
C: \ BCC582 \ BIN \ TLIB C: \ XHARBOUR_1.21_6714_BCC582 \ LIB \ mysql.lib - +. \ OBJ \ mysqlrdd.obj,,
TLIB 4.5 Copyright (c) 1987, 1998 Borland International

C: \ XHARBOUR_1.21_6714_BCC582 \ BIN \ harbour.exe tmysql.prg-q0-w-ES2-gc0-n-iC: \ XHARBOUR_1.21_6714_BCC582 \ include, C: \ XHARBOUR_1.21_6714_BCC582 \ TMYSQL \ MYSQL_SERVER_51 \ INCLUDE-o. \ OBJ \ tmysql.c
tmysql.prg (226) Warning W0001 Ambiguous reference: 'MYSQL_NEWDECIMAL_TYPE'
tmysql.prg (663) Warning W0001 Ambiguous reference: 'MYSQL_NEWDECIMAL_TYPE'
tmysql.prg (763) Warning W0001 Ambiguous reference: 'MYSQL_NEWDECIMAL_TYPE'
tmysql.prg (893) Warning W0001 Ambiguous reference: 'MYSQL_NEWDECIMAL_TYPE'
tmysql.prg (1701) Warning W0001 Ambiguous reference: 'MYSQL_NEWDECIMAL_TYPE'
tmysql.prg (2176) Warning W0001 Ambiguous reference: 'MYSQL_NEWDECIMAL_TYPE'
tmysql.prg (2261) Warning W0001 Ambiguous reference: 'MYSQL_NEWDECIMAL_TYPE'
0 error
No code generated
** Error 1 ** deleting. \ OBJ \ tmysql.c

Later I modify Mysql.ch and compile without problems but when trying to compile the system, shows these errors:


Compiled and Linking: [D: \ FAPSOFT \ NEWCONT32_MYSQL \ Wcont32.Exe]
Running # 1
Executed at: 14:09:36
================================================== ==========
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6717)
Copyright 1999-2010, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'D: \ FAPSOFT \ NEWCONT32_MYSQL \ wcont32.prg' and Generating preprocessed output to 'D: \ FAPSOFT \ NEWCONT32_MYSQL \ wcont32.ppo' ...
Lines 1090, Functions / Procedures 192
Generating C source output to 'D: \ FAPSOFT \ NEWCONT32_MYSQL \ wcont32.hrb' ...
Borland C + + 5.82 for Win32 Copyright (c) 1993, 2005 Borland
D: \ FAPSOFT \ NEWCONT32_MYSQL \ wcont32.hrb:
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external 'SQLAllocEnv' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLAllocConnect' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLExecDirect' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLDriverConnect' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLConnect' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLAllocStmt' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLDescribeCol' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLError' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLPrepare' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLFreeStmt' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLDisconnect' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLFreeConnect' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLFreeEnv' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLNumResultCols' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLFetch' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLGetInfo' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLSetConnectOption' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLSetStmtOption' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLGetConnectOption' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLGetStmtOption' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLSetCursorName' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLGetCursorName' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLRowCount' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLCancel' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLTransact' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLSetParam' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLExecute' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLParamData' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLPutData' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLExtendedFetch' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLSetPos' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLPrimaryKeys' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLGetDiagRec' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLStatistics' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLColumns' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLSpecialColumns' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLTables' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external 'SQLGetData' referenced from C: \ FWH1006 \ LIB \ FIVEHC.LIB | ODBC32X
Error: Unresolved external '_HB_FUN_SQLVERSION' referenced from C: \ XHARBOUR_1.21_6714_BCC582 \ LIB \ MYSQL.LIB | tmysql
End of process.
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
** Error 2 ** deleting D: \ FAPSOFT \ NEWCONT32_MYSQL \ Wcont32.exe
There were errors trying to build the application
================================================== ==========
Verce v4.3 -> View Results compile and link v4.3
Juan Carlos Salinas Ojeda
jcso@hotmail.com, jcso@esm.com.mx
Minatitlan, Veracruz. MEXICO
And just Veracruz is beautiful!
FiveWin for Harbour!

I'm lost ...!
Thank you for your good intentions.
Greetings.

Francisco
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2111
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: richard-service and 11 guests