Question for our database-wizzards

Sarah sarahr at genesearch.com.au
Wed Jun 18 17:22:02 EDT 2003


Here is a function to get the real column types. Pass it the ID of your 
database connection and the name of the table. Interestingly, where you 
say revDatabaseColumnTypes returns all STRING, I find that it returns 
all FLOAT.

function listColTypes pID, pTable
   put "describe " & pTable & ";" into dbQuery
   put revQueryDatabase(pID, dbQuery) into curID
   if curID is not a number then
     return "Query failed:" & cr & curID
   end if

   put empty into typeList
   repeat
     put word 1 of revDatabaseColumnNumbered(curID, 2) & comma after 
typeList
     revMoveToNextRecord(curID)
     if the result <> true then exit repeat
   end repeat
   delete char -1 of typeList
   revCloseCursor curID

   return typeList
end listColTypes

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/


On Wednesday, June 18, 2003, at 10:48  pm, tkuypers at pandora.be wrote:

> I have got a MySQL database with a database, containing several 
> columns. I would like to get the specifics of each of these columns in 
> this database (Integer, VarChar, key, value, etc).
>
> The revDatabaseColumnTypes function should do this, but only returns 
> “string” for all columns. I already checked with Sarah (and checked 
> her MySQL sample) but she also ran into  this problem, so if anyone 
> could give me a clue....
>
> Warm regards,
>
> Ton Kuypers





More information about the use-livecode mailing list