Dear richmond62
Thank you for your response. Now I see that I should clarify my request.
1) First of all: My problem is not connected with any data grids. In fact it is not connected with any UI. My code should explicitely create the cursor. In fact, I have already created the corresponing function
Code: Select all
function dbQueryToCursor pConnectionID, pQuery
local tCursor
put revQueryDatabase( pConnectionID, pQuery ) into tCursor
if tCursor is an integer then
else
answer error "The cursor has not been created from query - message: " & tCursor & "..."
answer error "The cursor has not been created from query - the result: " & the result & "..."
answer error "The query was: " & pQuery
end if
return tCursor
end dbQueryToCursor
2) In general, I need to write what is sometimes called a job. It should be accomplished by code started by a pushbutton. The job operates on a couple of tables, does some computations and writes some data to some tables. An example could be a routine computing salary for all emplyees of a company according to some data stored in a couple of tables. It does not interact with the user.
3) I've tried to use SQLite for this. But I found out that SQLite lacks many features needed for this including:
a) variables (like ms sql declare @var ...)
http://stackoverflow.com/questions/7739 ... and-use-it
b) stored procedures (like ms sql exec dbo.Procedure ...)
http://stackoverflow.com/questions/3402 ... procedures
c) loops like while, for
http://stackoverflow.com/questions/1788 ... port-loops
5) Currently I'm trying to use the above cursors for SQLite.
MY NEW REQUEST: It would be helpful if I would know how to do the following using the described cursors:
I have a SQLite table People with following rows: FirstName, LastName and FullName. Assume that the first and last names are filled and the full names are empty. The job is to fill the full names.
I employ the cursor as above to loop through all the names. The code should:
1) For each record:
1a) read the first and last name and display a message like: "The full name is John Smith" using LiveCode answer keyword i.e.:
Code: Select all
answer "The full name is" && tFirst && tLast
(in fact I need this in order to have a place in code in which I can for instance find some data in other tables or so)
1b) Fill the Full name in the database with (in this case): "John Smith"
2) Finally, I would like to get the SQLite table with the entire FullName column filled.
Providing an imperative SQLite query for this is not the solution for me due to the SQLite limitation mentioned above. I need LiveCode (as a programming language with cursors) and SQLite to provide the queries for cursors.
Finally: If the LiveCode database cursors won't do the job, please state this. Then I would rather write the job for a server employing MySQL, MS-SQL or so.
Thanks in advance for any help
Best
greg falda