Re: [gnome-db] Changing a field definition



On Sun, 2004-04-25 at 17:55, Rodrigo Moya wrote:
> On Sun, 2004-04-25 at 15:02 +0200, Murray Cumming wrote:
> > On Sun, 2004-04-25 at 12:53, Rodrigo Moya wrote:
> > > On Sat, 2004-04-24 at 18:02 +0200, Murray Cumming wrote:
> > > > gda_data_model_update_column() seems to be a way to change the column
> > > > definition. But I think the data_model needs to be one with data in it,
> > > > such as the result of a "SELECT" command.
> > > > 
> > > it doesn't need to be filled in with data. What is needed is the
> > > structure of the data model, which only can be retrieved by knowing
> > > which command is going to be executed.
> > 
> > Thans, but I don't understand the "knowing which command is going to be
> > executed" part.
> >
> to get the structure of the data returned by the DB, you first need to
> execute the command. This only executes it, which means no data is
> retrieved by libgda. That is made later on, when the app requests the
> data models' rows.
> 
> >  How could I create a suitable datamodel? Are you saying
> > that the result of a "SELECT * FROM thetable" query is indeed a good
> > thing to use?
> > 
> I guess so, once update_column is fully working, getting a GdaDataModel
> from "SELECT * FROM table" might be much quicker for some providers than
> calling the get_schema call, which in some cases needs to do nested
> queries or more than one SQL query.

Actually, I didn't think that the get_schema() was even an option for me
when I want to change the field type. Or is the data_model returned by
get_schema() writeable?

> A better solution for this would be, I guess, to have create_table,
> modify_table, etc methods on the provider.
> 
> What do you think?

Oh, I would like a gda_connection_create_table() method, and a
modify_table() method. In fact, I submitted a bug about that yesterday.

> > > Then, as providers usually only fetch the data when needed, it means you
> > > get the model's structure without the need to retrieve all the data.
> > > 
> > > It will be as quick as doing the get_schema stuff, since in both cases
> > > you'll have to do a SELECT, and in the model's case, you wont retrieve
> > > any data at all (if not needed).
> > 
> > So gda_connection_execute_single_command() does not actually execute any
> > command until I do a gda_data_model_get_value_at()?
> > 
> it does execute it, but data is not retrieved, at least for the RDBMS
> cases (PostgreSQL, Oracle, etc), until you ask it to do so
> (gda_data_model_get_value_at/get_row).

By the way, I think that MySQL actually demands that you retrieve all
results.

-- 
Murray Cumming
www.murrayc.com
murrayc murrayc com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]