Hi,
Is there any way to get a pointer to a row from an index? Or is there a better way to do this. Let me explain...
Table: BOOKS with an INDEX on book_type + book_number + page-number. All these fields are char and padded to fill their fixed sizes.
Other fields include author, ocr_text and date.
Now we do a:
select author, ocr_text, date from books where author='jim' and ocr_text contains 'red oak tree' and between(date, '01/01/2013', '12/15/2013') order by author
... and yes I know some of the syntax is not correct, but anyway I get a result set back that matches the query. Now lets say our result set has:
Deed Book 232 Page 124
Deed Book 436 Page 444
Deed Book 501 Page 123
Mortgage Book 555 Page 741
Mortgage Book 474 Page 654
Note that these results matches what the query asked for... So far no problem as it gives us what we expect.
Our form has buttons "FIRST HIT", "PREV HIT", "NEXT HIT", and "LAST HIT" that traverses the matching query hits in our list above.
Our form also has 2 more buttons "PREV PAGE" and "NEXT PAGE" that simulates turning pages in the book WITH NO RESPECT to the query results. In other words, lets say we first arrive at "Deed Book 232 Page 124" and we press the "PREV PAGE" button, we should be seeing the page immediately to the left(previous) of it. Also note that whatever page we are looking at pressing the "PREV PAGE" will always take us to the previous page, while pressing the "NEXT PAGE" will always take us to the next page without respect of the query results. These next and previous pages we are navigating to may and MAY NOT be in our query results, as it navigates the library in library order without regard to the query results. The index above mentioned is the library order index.
Now, lets say that we want to look at the page IMMEDIATELY BEFORE "Deed Book 232 Page 124 SubPg 1" which is "Deed Book 232 Page 123 SubPg 1" assuming it exists, or it could be "Deed Book 232 Page 99 SubPg 1", if there are no pages between 124 and 99.
There is no way I can think of that allows me to find the prev row in library order from any given place as the only relationship it has is "they are beside each other" in the index and nothing else. I can't see making a primary/foreign key or any other column relationship work in a dynamic environment where new items are constantly coming in, other than reading this library index. So unless someone comes up with something, the only way I see this working is somehow reading the library index for a pointer to the prev and.or next rows.
And yes, I know that SQL Server doesn't have any concept of records. I come from a VFP background where this kind of stuff is easy...
Thanks, Stanley
Is there any way to get a pointer to a row from an index? Or is there a better way to do this. Let me explain...
Table: BOOKS with an INDEX on book_type + book_number + page-number. All these fields are char and padded to fill their fixed sizes.
Other fields include author, ocr_text and date.
Now we do a:
select author, ocr_text, date from books where author='jim' and ocr_text contains 'red oak tree' and between(date, '01/01/2013', '12/15/2013') order by author
... and yes I know some of the syntax is not correct, but anyway I get a result set back that matches the query. Now lets say our result set has:
Deed Book 232 Page 124
Deed Book 436 Page 444
Deed Book 501 Page 123
Mortgage Book 555 Page 741
Mortgage Book 474 Page 654
Note that these results matches what the query asked for... So far no problem as it gives us what we expect.
Our form has buttons "FIRST HIT", "PREV HIT", "NEXT HIT", and "LAST HIT" that traverses the matching query hits in our list above.
Our form also has 2 more buttons "PREV PAGE" and "NEXT PAGE" that simulates turning pages in the book WITH NO RESPECT to the query results. In other words, lets say we first arrive at "Deed Book 232 Page 124" and we press the "PREV PAGE" button, we should be seeing the page immediately to the left(previous) of it. Also note that whatever page we are looking at pressing the "PREV PAGE" will always take us to the previous page, while pressing the "NEXT PAGE" will always take us to the next page without respect of the query results. These next and previous pages we are navigating to may and MAY NOT be in our query results, as it navigates the library in library order without regard to the query results. The index above mentioned is the library order index.
Now, lets say that we want to look at the page IMMEDIATELY BEFORE "Deed Book 232 Page 124 SubPg 1" which is "Deed Book 232 Page 123 SubPg 1" assuming it exists, or it could be "Deed Book 232 Page 99 SubPg 1", if there are no pages between 124 and 99.
There is no way I can think of that allows me to find the prev row in library order from any given place as the only relationship it has is "they are beside each other" in the index and nothing else. I can't see making a primary/foreign key or any other column relationship work in a dynamic environment where new items are constantly coming in, other than reading this library index. So unless someone comes up with something, the only way I see this working is somehow reading the library index for a pointer to the prev and.or next rows.
And yes, I know that SQL Server doesn't have any concept of records. I come from a VFP background where this kind of stuff is easy...
Thanks, Stanley