Re: Matt: EuSQL Question About Returning Field Types

new topic     » goto parent     » topic index » view thread      » older message » newer message

Matt Lewis wrote:
> c.k.lester wrote:
> > You have a function in eusql for returning a flat list of fields. What's the
> > best way to get a list of field types for a table?
> Take a look at flat_field_names().  You could also take the return value
> of blank_record() and flatten it out.  Send me the code and I'll put it
> into the library. :)

Here's the code I've stuck into EuSQL.e Feel free to modify it to conform
to EuSQL standards:

--/topic Utilities
--/func eusql_field_types( sequence db, sequence table )
--/info
--Returns a sequence of field types for a table.
global function eusql_field_types( sequence db, sequence table )
object ok
sequence result
	ok = select_current( db, "TABLEDEF" )
	if atom(ok) then
		result = ok
	else
		-- now get the record from the table_def whose name is 'table'
		ok = db_find_key( upper( table ) )
		if ok > 0 then
			result = db_record_data(ok)
			result = result[2][$]
		else
			result = ok
		end if
	end if
	return result
end function


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu