Database Strategy
Michael Doub
mike at doub.com
Wed Nov 16 16:05:21 EST 2011
The potential size of the database is causing me to drive the database by loading the data grid by catching
command GetDataForLine pLine, @pOutData.
On the first execution thru the OpenCard handler everything works just fine. On subsequent
calls the OpenCursor routine is never executed. The handler seems get as far as the
set the dgProp[ "show vscrollbar" ] of group "DataGrid" to true that
statement where it would appear that that the OpenCard handler is terminated. If I make
the setup_Scrolling code a comment, then everything works as as I would have expected.
it is really odd that the same code executes fine on the first execution. Could this be a bug
in the data grid code? I am using 5.0.1 (rc 1)
on OpenCard
log ("Open Card")
set the tmLabel of group "Header" of this card to the short name of this card
setup_Scrolling
OpenCursor
put revDatabaseColumnNames(sCursorID) into sRecordFields
put revNumberOfRecords(sCursorID) into sRecordCount
lock screen
set the dgNumberOfRecords of group "DataGrid" to sRecordCount
unlock screen
end OpenCard
on setup_Scrolling
if the environment is "mobile" then
set the dgProp[ "show vscrollbar" ] of group "DataGrid" to false
-- other code remove for now
else
set the dgProp[ "show vscrollbar" ] of group "DataGrid" to true
end if
end setup_Scrolling
On 2011-11-16, at 1:04 PM, Pete wrote:
> Sounds like the problem is that you close the cursor when the card is
> closed. From that point, it's not a valid cursor, as you're finding when
> you return to the card. When you return to the card, you'd need to either
> leave the cursor open or re-execute the SELECT statement that created it.
>
> Depending on the needs of your application, you might want to consider
> not creating a cursor but returning the data from the SELECT statement
> directly to your application using revDataFromQuery and storing that in a
> custom property. That's useful if you are using a datagrid on your card
> since you can simply set the dgtext of the datagrid to the returned data to
> populate the datagrid.
>
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
>
>
>
>
> ________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list