|
View:
New views
16 Messages
—
Rating Filter:
Alert me
|
|
|
GdaCommand.
Hello,
In V3 there is GdaCommand. I use this to initialize as follows: command = gda_command_new(buffer, GDA_COMMAND_TYPE_TABLE, GDA_COMMAND_OPTION_STOP_ON_ERRORS) Note the parameter GDA_COMMAND_TYPE_TABLE This gave me the option to have a database table be represented in a data model and by adding/editing/deleting rows from the data model, the underlying database table is updated as well. To be complete the list was as follows: typedef enum { GDA_COMMAND_TYPE_SQL, GDA_COMMAND_TYPE_XML, GDA_COMMAND_TYPE_PROCEDURE, GDA_COMMAND_TYPE_TABLE, GDA_COMMAND_TYPE_SCHEMA, GDA_COMMAND_TYPE_INVALID } GdaCommandType;How do I use GDA_COMMAND_TYPE_TABLE in V4? Can't find anything in the docs. Thanks, Bas. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.
On Tue, 2009-06-23 at 20:50 +1000, Bas Driessen wrote:
Hello, Further to this, it appears that all the logic that I have added in the past as recordset_append_row (remove and update) have been removed from the various providers..... ???? . So what is the new way of processing record sets? Bas. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.2009/6/23 Bas Driessen <bas.driessen@...>
You'll have to create a GdaStatement from the "SELECT * FROM table" (which is what was done in V3 BTW). You can do this using a parser object, or by creating the object directly (in 4.2 there will be an API to build statement without using any SQL). Using a parser, your code would be: #include <sql-parser/gda-sql-parser.h> GdaSqlParser *parser = gda_sql_parser_new (); GdaStatement *stmt; stmt = gda_sql_parser_parse_string (parser, "SELECT * FROM table", NULL, NULL); g_object_unref (parser); Then execute that statement: GdaDataModel *model; GError *error = NULL; model = gda_connection_statement_execute_select (cnc, stmt, NULL, &error); if (!model) // handle error The returned GdaDataModel is a GdaDataSelect, for which you need to call gda_data_select_compute_modification_statements (GDA_DATA_SELECT (model), &error) which should return TRUE if you can modify the data model, and FALSE if not (in which case you'll get the reason why in the error pointer). If it worked, then you can modify the data model like any other data model. This is a bit more complicated than in V3 but is much more generic and most importantly implemented outside the providers so the behaviour will be the same with all providers (which was not the case in V3). Further to this, it appears that all the logic that I have added in the past as recordset_append_row (remove and update) have been removed from the various providers..... ???? . So what is the new way of processing record sets? You have gda_data_model_append_row(), gda_data_model_append_values(), gda_data_model_set_values() and gda_data_model_remove_row() to modify a data model. Vivien _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.Vivien Malerba writes:
Hi! > You'll have to create a GdaStatement from the "SELECT * FROM table" > (which is what was done in V3 BTW). You can do this using a parser > object, or by creating the object directly (in 4.2 there will be an API > to build statement without using any SQL). Any API preview? In Midgard we use query builder class which generates SQLs. http://www.midgard-project.org/api-docs/midgard/core/vinland/midgard-query-builder.html It's GObject oriented, but I am curious if we could benefit from it. Piotras _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.2009/6/23 Piotr Pokora <piotrek.pokora@...> Vivien Malerba writes:
From what I saw, the Midgard's API is higher level than Libgda's one, and there is obvious no reason it could not use Libga's one. This API can still be modified if needed (untill version 4.2, so if you have any request, tell me). Vivien _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.
On Tue, 2009-06-23 at 14:21 +0200, Vivien Malerba wrote:
2009/6/23 Bas Driessen <bas.driessen@...> Hello, OK, I have implemented this and when I try to remove a row from a data model I get the error: Model does not allow row deletion. If I try to append a row, I get the error: No INSERT statement provided. Does that mean that this feature is not implemented for this provider, or am I missing something? I am using postgresql 8.3.7. If it is not implemented for postgresql, for which provider is it implemented? Further to this, it appears that all the logic that I have added in the past as recordset_append_row (remove and update) have been removed from the various providers..... ???? . So what is the new way of processing record sets?
Correct, these are available, but they don't appear to work for the provider postgresql (unless I am doing something wrong). I don't mind that you have taken out the code I have written, but if it is taken out and there is no (better) replacement code/alternative then obviously I have a problem with that. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.
I'm working on a stand alone example, I'll send it to you ASAP. Vivien _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.
On Wed, 2009-06-24 at 10:57 +0200, Vivien Malerba wrote:
OK, I have implemented this and when I try to remove a row from a data model I get the error: Model does not allow row deletion. If I try to append a row, I get the error: No INSERT statement provided.
Thanks. I just have a very basic table called Groups with 2 columns group_id and description, primary key on group_id and some test entries. Loading of the data model works OK as I can retrieve data, but when trying to manipulate the data I get the errors outlined above. An example would be very helpful. I must have missed something. Bas. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.2009/6/24 Bas Driessen <bas.driessen@...>
You'll find a complete example in samples/WritableSelect which I've just committed in git.gnome.org (LIBGDA_4.0 branch) and will be in the soon to be released 4.0.3. In git are also 2 corrections which make the whole thing work. Vivien _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.
On Wed, 2009-06-24 at 15:29 +0200, Vivien Malerba wrote:
2009/6/24 Bas Driessen <bas.driessen@...> On Wed, 2009-06-24 at 10:57 +0200, Vivien Malerba wrote: Thanks. I just have a very basic table called Groups with 2 columns group_id and description, primary key on group_id and some test entries. Loading of the data model works OK as I can retrieve data, but when trying to manipulate the data I get the errors outlined above. An example would be very helpful. I must have missed something.
Thanks Vivien. Will give that a go. Also this explains why I could not get the libgda sources. It has been moved from svn to git. Why? svn was doing the job for this project OK. Anyway, the gnome-db.org pages still point to svn. Also, how can I get a git account, so I can help out again? Bas. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.2009/6/25 Bas Driessen <bas.driessen@...>
Git really gives more freedom to the developpers than any centralized VCS as each developper manages his own repository and publishes only when needed (branches can remain local and are very cheap).
You don't need a git account as you can "clone" the repo in git.gnome.org and work from there (git being decentralized, your local clone will be fully functionnal), then you can send me some patches. If you already had an SVN account, then it's still valid with git. If you want to contribute more to Libgda than some patches, then I'll ask for an account for you. Cheers, Vivien _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Compile issue.
Hello,
I am trying to compile branch LIBGDA_4.0 On the make install I get the following error: .. .. usr/sbin:/sbin:/home/bas/bin:/sbin" ldconfig -n /home/bas/work/libgda/lib ---------------------------------------------------------------------- Libraries have been installed in: /home/bas/work/libgda/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- test -z "/home/bas/work/libgda/share/libgda-4.0/dtd" || /bin/mkdir -p "/home/bas/work/libgda/share/libgda-4.0/dtd" /usr/bin/install -c -m 644 libgda-array.dtd libgda-paramlist.dtd libgda-server-operation.dtd '/home/bas/work/libgda/share/libgda-4.0/dtd' test -z "/home/bas/work/libgda/include/libgda-4.0/libgda" || /bin/mkdir -p "/home/bas/work/libgda/include/libgda-4.0/libgda" /usr/bin/install -c -m 644 gda-marshal.h gda-enum-types.h gda-attributes-manager.h gda-batch.h gda-blob-op.h gda-column.h gda-config.h gda-connection-event.h gda-connection.h gda-connection-private.h gda-data-comparator.h gda-data-handler.h gda-data-model-array.h gda-data-model.h gda-data-model-bdb.h gda-data-model-dir.h gda-data-model-extra.h gda-data-model-import.h gda-data-model-iter.h gda-data-model-iter-extra.h gda-data-model-private.h gda-data-access-wrapper.h gda-data-proxy.h gda-data-select.h gda-debug-macros.h gda-decl.h gda-easy.h gda-enums.h gda-holder.h gda-lockable.h gda-log.h gda-marshal.h gda-meta-store.h gda-meta-struct.h gda-mutex.h gda-quark-list.h gda-row.h gda-set.h gda-server-operation.h gda-server-provider.h '/home/bas/work/libgda/include/libgda-4.0/libgda' /usr/bin/install: will not overwrite just-created `/home/bas/work/libgda/include/libgda-4.0/libgda/gda-marshal.h' with `gda-marshal.h' make[2]: *** [install-gdaincludeHEADERS] Error 1 make[2]: Leaving directory `/home/bas/work/git/libgda/libgda' make[1]: *** [install-am] Error 2 make[1]: Leaving directory `/home/bas/work/git/libgda/libgda' make: *** [install-recursive] Error 1 [bas@ams libgda]$ It appears that gda-marshal.h is listed twice. (highlighted in bold above). Can this please get corrected so I can compile and test the new GdaDataSelect feature? Thank you, Bas. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: Compile issue.2009/7/1 Bas Driessen <bas.driessen@...>
I've just corrected this in git LIBGDA_4.0 branch. Can you check it? The strange thing is that instead of one single long line which installs all the header files, when I run "make install" I get one line per header file installed, which is the reason I never found out about that bug... Vivien _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: Compile issue.
On Sun, 2009-07-05 at 21:08 +0200, Vivien Malerba wrote:
2009/7/1 Bas Driessen <bas.driessen@...> Hello,
That appears to work fine now.Thanks for getting that organized, Bas. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
Re: GdaCommand.
On Wed, 2009-06-24 at 15:29 +0200, Vivien Malerba wrote:
2009/6/24 Bas Driessen <bas.driessen@...> On Wed, 2009-06-24 at 10:57 +0200, Vivien Malerba wrote: Thanks. I just have a very basic table called Groups with 2 columns group_id and description, primary key on group_id and some test entries. Loading of the data model works OK as I can retrieve data, but when trying to manipulate the data I get the errors outlined above. An example would be very helpful. I must have missed something.
OK, this starts to work now. The issue I have now is related to quotes not being used for column names. I have a table called Groups. 2 columns. group_id and desc (from description). As desc is a reserved work in Postgres, I get the following output: Computed UPDATE: UPDATE Groups SET group_id=##+0::string, desc=##+1::string::NULL WHERE group_id = ##-0::string Computed DELETE: DELETE FROM Groups WHERE group_id = ##-0::string Computed INSERT: INSERT INTO Groups (group_id, desc) VALUES (##+0::string, ##+1::string::NULL) ERROR append: syntax error at or near "desc" LINE 1: INSERT INTO Groups (group_id, desc) VALUES ('T2', 'Test2') in case of Postgresql this needs to be: INSERT INTO Groups ("group_id", "desc") VALUES ('T2', 'Test2') I did add those quotes in libgda V3 for postgresql and mysql (I believe they use `), but as the whole structure has changed now, I haven't got the time yet to find out where to add this. Can you please advise where to add this in the LIBGDA_4.0 branch or if it is a small job, just add the quotes? Thanks, Bas. _______________________________________________ gnome-db-list mailing list gnome-db-list@... http://mail.gnome.org/mailman/listinfo/gnome-db-list |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |