xBrowse & SQLRDD
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse & SQLRDD
If you are using the latest XBrowse, for SQLRDD, we are using RecNo() and DbGoTo() functions only both for bBookMark and bKeyNo().
We are not using OrdKeyNo().
We expect SQLRDD to be perfectly reliable with RecNo() and GoTo() functions even if used in quick succession many times.
We are not using OrdKeyNo().
We expect SQLRDD to be perfectly reliable with RecNo() and GoTo() functions even if used in quick succession many times.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
But doesnt that mean that the browse must be in recno() order?
I might be reading the select method wrong, but doesnt it skip(-1) if the recno() of the second record selected with the shift is less than the 1st?
I might be reading the select method wrong, but doesnt it skip(-1) if the recno() of the second record selected with the shift is less than the 1st?
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
I've modified the select routine, but this only works if the index is indexed on a unique key:
See the section where nOperation == 3
See the section where nOperation == 3
Code: Select all
METHOD Select( nOperation ) CLASS TXBrowse
local uBook, uCurRow, uOldRow, uTemp
local aTemp
local nAt, nLen
local lRefresh
Local cStIndexKey := ""
Local cEndIndexKey := ""
if .not. ::lMultiSelect // ::nMarqueeStyle != MARQSTYLE_HIGHLROWMS .and. ::nMarqueeStyle != MARQSTYLE_HIGHLWIN7
return nil
endif
DEFAULT nOperation := 1
do case
case nOperation == 0 // delete all
if Len( ::aSelected ) == 1 .and. Eval( ::bBookMark ) == ::aSelected[ 1 ]
lRefresh := .f.
else
lRefresh := .t.
endif
::aSelected := {}
if ! Empty( ::nSaveMarq )
::nMarqueeStyle := ::nSaveMarq
::nSaveMarq := nil
endif
if lRefresh
// ::lRefreshOnlyData := .t.
::GetDC()
::Super:Refresh( .t. ) // ::Paint()
::ReleaseDC()
endif
case nOperation == 1 .or. ( Len( ::aSelected ) == 0 .and. nOperation != 4 )// Add current
uBook := Eval( ::bBookMark )
nAt := Ascan( ::aSelected, uBook )
if nAt == 0
Aadd( ::aSelected, uBook )
::DrawLine( .t. )
endif
case nOperation == 2 // Swap key (Ctrl+LClick)
uBook := Eval( ::bBookMark )
nAt := Ascan( ::aSelected, uBook )
if nAt > 0
::DrawLine( .f. )
::aSelected[ nAt ] := Atail( ::aSelected )
Asize( ::aSelected, Len( ::aSelected ) - 1 )
else
Aadd( ::aSelected, Eval( ::bBookMark ))
::DrawLine( .t. )
endif
case nOperation == 3 // Shift & lclick
cEndIndexKey := &( ( ::cAlias )->(IndexKey()) )
uBook := Eval( ::bBookMark )
uCurRow := ::KeyNo()
Eval( ::bBookMark, Atail( ::aSelected ) )
uOldRow := ::KeyNo()
cStIndexKey := &( ( ::cAlias )->(IndexKey()) )
if uOldRow != uCurRow
::aSelected := { Atail( ::aSelected ) }
if IF( ( ::cAlias )->( RddName() ) == "SQLRDD", cEndIndexKey > cStIndexKey, uCurRow > uOldRow)
CursorWait()
do while ( uTemp := Eval( ::bBookMark ) ) != uBook .and. ! ::Eof()
If Ascan( ::aSelected, uTemp ) == 0
Aadd( ::aSelected, uTemp )
Endif
::Skip( 1 ) // Eval( ::bSkip, 1 )
enddo
CursorArrow()
else
CursorWait()
do while ( uTemp := Eval( ::bBookMark ) ) != uBook .and. ! ::Bof()
If Ascan( ::aSelected, uTemp ) == 0
Aadd( ::aSelected, uTemp )
endif
::Skip( -1 ) // Eval( ::bSkip, -1 )
enddo
CursorArrow()
endif
Aadd( ::aSelected, uBook )
Eval( ::bBookMark, uBook )
// ::lRefreshOnlyData := .t.
::GetDC()
::Paint()
::ReleaseDC()
else
Eval( ::bBookMark, uBook )
endif
case nOperation == 4 // Select all
uBook := Eval( ::bBookMark )
::aSelected := Array( ::KeyCount() )
nAt := 1
nLen := ::nLen
aTemp := ::aSelected
CursorWait()
Eval( ::bGotop )
do while nAt <= nLen //.and. !Eval( ::bEof )
aTemp[ nAt++ ] := Eval( ::bBookMark )
::Skip( 1 ) //Eval( ::bSkip, 1 )
enddo
Eval( ::bBookMark, uBook )
CursorArrow()
// ::lRefreshOnlyData := .t.
::GetDC()
::Paint()
::ReleaseDC()
case nOperation == 5 // Swap key (Shift + GoDown or GoUp)
uCurRow := ::KeyNo()
nAt := Ascan( ::aSelected, uCurRow )
uBook := Eval( ::bBookMark )
if nAt == 1 .and. len( ::aSelected ) == 1
return nil
elseif nAt == 0
Aadd( ::aSelected, uBook )
::DrawLine( .t. )
else
if nAt != len( ::aSelected )
Asize( ::aSelected, Len( ::aSelected ) - 1 )
::Refresh()
endif
endif
end case
return nil
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse & SQLRDD
Eval( oBrw:bBookMark ) returns the RecNo()
Eval( oBrw:bBookMark, n ) executes( DBGOTO( n ), RECNO() )
Any problem?
Eval( oBrw:bBookMark, n ) executes( DBGOTO( n ), RECNO() )
Yes.But doesnt that mean that the browse must be in recno() order?
Any problem?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
I would say that was a pretty big problem wouldnt you?
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse & SQLRDD
XBrowse needs to know the following:
What are the functions for:
1. GoTop
2. GoBottom
3. Skip n Rows
4. What is the function to know the row number in natural order
( this is normally RecNo() in RDDs )
5. What is the function which xBrowse can use to go to the row number in natural order.
( This is normally DBGOTO( n ) )
6. If you can order the rows in any other other than the natural order:-
(a) What is the function to know the serial number of the row in that order? ( in many RDD;s this OrdKeyNo() )
and
(b) What is the function XBrowse can use to position to a partiual serial number in an ordered table. ( in many RDDs this is OrdKeyGoTo( n ) )
7. What is the function to know the total number of records?
Now, if you let me know what are the functions SQLRDD provides for 6(a) and 6(b) then we can make the codeblocks when the table is not in natural order.
What are the functions for:
1. GoTop
2. GoBottom
3. Skip n Rows
4. What is the function to know the row number in natural order
( this is normally RecNo() in RDDs )
5. What is the function which xBrowse can use to go to the row number in natural order.
( This is normally DBGOTO( n ) )
6. If you can order the rows in any other other than the natural order:-
(a) What is the function to know the serial number of the row in that order? ( in many RDD;s this OrdKeyNo() )
and
(b) What is the function XBrowse can use to position to a partiual serial number in an ordered table. ( in many RDDs this is OrdKeyGoTo( n ) )
7. What is the function to know the total number of records?
Now, if you let me know what are the functions SQLRDD provides for 6(a) and 6(b) then we can make the codeblocks when the table is not in natural order.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
This is the problem I think, those functions are not available under SQLRDD.
The changes you have made in the recent version for SQLRDD are nearly perfect so I think they can stay in xBrowse, it's just the part where it checks if the second click is higher or lower in the list is the problem. The only work around I can see is the change I made a few posts earlier. This would suit my needs as I would ensure that my index contain unique keys.
I think we cant go any further without OrdKeyNo() functions, so I dont mind making those minor changes I made in the earlier post each time I update FW, unless other SQLRDD users require these changes and maybe we can incorporate it in somehow?
What do you think?
Best regards,
Pete
(Thank you for your time in looking at this problem - we have always told our SQL customers that shift selecting was not possible and they have accepted this, so the work you have done and the change I made will be appreciated by our users)
The changes you have made in the recent version for SQLRDD are nearly perfect so I think they can stay in xBrowse, it's just the part where it checks if the second click is higher or lower in the list is the problem. The only work around I can see is the change I made a few posts earlier. This would suit my needs as I would ensure that my index contain unique keys.
I think we cant go any further without OrdKeyNo() functions, so I dont mind making those minor changes I made in the earlier post each time I update FW, unless other SQLRDD users require these changes and maybe we can incorporate it in somehow?
What do you think?
Best regards,
Pete
(Thank you for your time in looking at this problem - we have always told our SQL customers that shift selecting was not possible and they have accepted this, so the work you have done and the change I made will be appreciated by our users)
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse & SQLRDD
Still I don't like you to give up. I agree I do not about SQLRDD but if you look around you may find the answers.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
I can remember seeing on the SQLRDD forum someone asking if these functions were available and was told that it would be impossible make these work - I may ask the question again to see if they've had an idea how to implement this.
For me, it's not giving up, shift & select now works with SQLRDD in an xbrowse in my application (selfish I know)
I will let you know if I get any reply from xHarbour about the functions.
Thanks
Pete
For me, it's not giving up, shift & select now works with SQLRDD in an xbrowse in my application (selfish I know)
I will let you know if I get any reply from xHarbour about the functions.
Thanks
Pete
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: xBrowse & SQLRDD
Using ADO, OrdKey() can be replaced by oRs:AbsolutePosition and OrdKeyGoTo( n ) by oRs:AbsolutePosition = n.
I don't know if it can be of any help.
EMG
I don't know if it can be of any help.
EMG
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
I have posted a message so lets see if xHarbour.com are helpfull!
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse & SQLRDD
You are right. That is how XBrowse's SetAdo() works.Enrico Maria Giordano wrote:Using ADO, OrdKey() can be replaced by oRs:AbsolutePosition and OrdKeyGoTo( n ) by oRs:AbsolutePosition = n.
I don't know if it can be of any help.
EMG
But I think SQLRDD does not use ADO. Instead it uses the native libraries of the respective RDMS.
I also do not *think* SQLRDD does sorting of any datasets/recordsets in memory, like ADO does. Instead I *guess* it may be reading from the source again with appropriate "ORDER BY <sortcolumn>" clause. I may be wrong. But if my guess is correct, the table view should always be in the order or RecNo().
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: xBrowse & SQLRDD
Hi
I try "bBookMark" and is not stable, when I browse the list items I repeat, my customers complain that the application is confusing, I'm just excuses, I hope that at some point has a solution.
In fact, I followed the post by Peter both here and in xHarbour.
On both sides are said to be 100% compatible and is not so, what I see is that they are solid products that are complementary and should work more closely is this type of case.
I think everyone benefits: FWH, SQLRDD of xHarbour.com, like us who buy your products.
Regards
I try "bBookMark" and is not stable, when I browse the list items I repeat, my customers complain that the application is confusing, I'm just excuses, I hope that at some point has a solution.
Code: Select all
oxBrw:bKeyNo = oxBrw:bBookMark
On both sides are said to be 100% compatible and is not so, what I see is that they are solid products that are complementary and should work more closely is this type of case.
I think everyone benefits: FWH, SQLRDD of xHarbour.com, like us who buy your products.
Regards
_ A. Martinez
http://www.multisofthn.com
Honduras, Centro America
xHarbour Enterprise 1.2.2, Fivewin 13.06
http://www.multisofthn.com
Honduras, Centro America
xHarbour Enterprise 1.2.2, Fivewin 13.06
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
Unfortunately, I've found more problems - If I browse a SQL table that i've put a scope on, the browse displays the first record at the bottom of the browse and looks like there are 2 selected records. If I page up/page down, the browse resets and looks good. If i then move the mouse cursor outside of the browse, the browse corrupts again (first record at the bottom of the browse).
I never had these problems with the previous version of xbrowse I used (10.06)
Any ideas where I can start to look to see where this problem has come from?
Regards,
Pete
I never had these problems with the previous version of xbrowse I used (10.06)
Any ideas where I can start to look to see where this problem has come from?
Regards,
Pete
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse & SQLRDD
If I comment out the SQLRDD section of the SETRDD method, it fixes the duplicate record problem I reported in my last post, however if I move my mouse outside of the browse, the current selected record jumps to the top of the browse.
I can confirm that this is a SQLRDD only problem, I ran the same code on a DBF and it works fine. So it seems as if there is a section of the code that needs commenting out for SQLRDD???
*UPDATE*
I think the problem is the MouseLeave Method, If I make the following changes, it seems to work:
I'm going to try and get the shift key selection workig with SQLRDD and I will post my solution (if it works)
I can confirm that this is a SQLRDD only problem, I ran the same code on a DBF and it works fine. So it seems as if there is a section of the code that needs commenting out for SQLRDD???
*UPDATE*
I think the problem is the MouseLeave Method, If I make the following changes, it seems to work:
Code: Select all
METHOD MouseLeave( nRow, nCol, nFlags ) CLASS TXBrowse
::lPressed = .f.
if ( ::cAlias )->( RddName() ) <> "SQLRDD"
::Refresh()
endif
return nil