1. Matt: EuSQL Question About Returning Field Types

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?

new topic     » topic index » view message » categorize

2. Re: Matt: EuSQL Question About Returning Field Types

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. :)

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: Matt: EuSQL Question About Returning Field Types

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. :)

flat_field_names uses get_record_struct(), but get_record_struct
does not return the field types... only the field names and an empty sequence.

I think I'll just cheat and grab the data from the table_info table.

What are you using for wxEDB these days? I'm having a heck of a time getting
it on my home PC. I have it at work and it works fine. :(

new topic     » goto parent     » topic index » view message » categorize

4. Re: Matt: EuSQL Question About Returning Field Types

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 message » categorize

5. Re: Matt: EuSQL Question About Returning Field Types

c.k.lester wrote:
> 
> flat_field_names uses get_record_struct(), but get_record_struct
> does not return the field types... only the field names and an empty sequence.
> 
> I think I'll just cheat and grab the data from the table_info table.

I've added your code to the library (just committed to svn).

> What are you using for wxEDB these days? I'm having a heck of a time getting
> it on my home PC. I have it at work and it works fine. :(

I basically use the head of the repository of the various projects:

wxedb
eusql
wxEuphoria
ooeu
matheval

A little while ago I started reworking/overhauling it, mainly the forms
stuff, which I don't think anyone but me used (it hasn't really worked
since before the "wx" got added to EDB).  Basically, it's waiting on 
wxIDE to be rewritten.  My plan is to reuse the code editor and gui editor
components.

I suppose I should release a working version with all of the required files.
I'll put it on my TODO list...

Matt

new topic     » goto parent     » topic index » view message » categorize

6. Re: Matt: EuSQL Question About Returning Field Types

Matt Lewis wrote:
> c.k.lester wrote:
> > What are you using for wxEDB these days? I'm having a heck of a time getting
> > it on my home PC. I have it at work and it works fine. :(
> I basically use the head of the repository of the various projects:

I forget that 0.10.0 is bleeding edge. :) I just downloaded wxeu.dll back into
my system folder and now wxEDB works.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu