Re: [gnome-db] Gnome-DB SQL Window syntax hi-lighting of keywordsRo

On Sun, 2002-03-17 at 02:13, Daniel Morgan wrote:
> Rodrigo,
> Yes, we can do that.  However, for gnome_db_sql_editor_get_all_commands,
> can we return a linked list of strings where each string contains a SQL
> command?
yes, perfect.

> This way, we could have something like a gnome_db_foreach_command(). 
> For each SQL Command, run this function.
> Example:
>        sql_command_list = gnome_db_sql_editor_get_all_commands(
>                                 sql_editor_widget, run_pref);
>        gnome_db_foreach_command ( sql_command_list, 
>                                 (GFunc) gnomedb_run_command );
this is a good idea.

> This way, if a SQL Command fails when executing, we can stop executing
> any commands, display the error to the user somehow (does not have to be
> an error message box, this can be a preference) position the cursor
> (whatever the terminology for the insertion point where a user types) to
> the end of the SQL Command that caused the error.  Once the user has
> corrected the error, they can continue where they left off starting with
> the current command.
yes, we can have the callback function return a gboolean, and if it
returns FALSE, the cursor will be positioned in the command that caused
the error. If it returns TRUE, it will continue with next command.

But, to make it shorter, I'll have:

GList *gnome_db_sql_editor_get_all_commands (sql_editor);
void gnome_db_sql_editor_foreach_command (sql_editor, (GFunc)
run_command, user_data);

Thus, if you need to get the list, you call
gnome_db_sql_editor_get_all_commands. If you just want to run over all
commands, you just call gnome_db_sql_editor_foreach_command, which
traverses the list and calls the callback for each command.

> Notice the enumerated parameter named run_pref in the
> gnome_db_sql_editor_get_all_commands function above.  If run_pref =
> RUN_PREF_FromBeginning, then get the first command starting at the
> beginning of the SQL editor.  Otherwise, if run_pref =
> RUN_PREF_CurrentCommand, then get the first command starting at the
> current command in the SQL editor.
great idea also.

> Anybody willing to help or provide comments on this?
as you know, any help you need from me, just ask.

Rodrigo Moya <rodrigo gnome-db org> - <rodrigo ximian com> -

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