Problem porting from SQLIte to Valentina in RunRev

Dave dave at looktowindward.com
Tue Nov 20 13:48:40 CST 2007


Hi,

I've almost finished the port from SQLIte to Valentina. I have a  
problem with reading from the database. In SQLite, it automatically  
generates a sequential field called Row ID which I use to read each  
record in the database. The problem being that Valentina doesn't  
support this. So is there another way I can do this in Valentina?

I have pasted the function below.

Thanks a lot
All the Best
Dave

--------------------------------------------------------------
--
--  LibDBReadRow
--
---------------------------------------------------------------
function LibDBReadRow  
theDatabaseID,theTableName,theRowNumber, at theDataArray
   local mySQLCode
   local myKeyList
   local myKeyName
   local myData
   local myResult
   local myTempKeyList
   local myValueList
   local myValue
   local myItemIndex
   local myRowDelimiter
   local myColumnDelimiter

   put the keys of theDataArray into myKeyList
   if myKeyList <> empty then

     --
     --  Setup Delimiters
     --
     put ISMGetUserDelimiter(1) into myRowDelimiter
     put ISMGetUserDelimiter(2) into myColumnDelimiter


     --
     --  Issue the Query
     --
     put revDataFromQuery 
(myColumnDelimiter,myRowDelimiter,theDatabaseID,"SELECT * FROM  
MusicBase WHERE rowid = " & theRowNumber) into myData

     set the itemDelimiter to myColumnDelimiter
     if item 1 of myData = "revdberr" then
       answer error  "Error in LibDBInsertRecord, revExecuteSQL:" &&  
myResult
       breakpoint
     end if

     put 1 into myItemIndex
     sort lines of myKeyList
     repeat for each line myKeyName in myKeyList
       put item myItemIndex of myData into theDataArray[myKeyName]
       add 1 to myItemIndex
     end repeat
   end if

   return myResult
end LibDBReadRow



More information about the Valentina mailing list