Re: [gnome-db] gtksourceview



On Wed, 2003-01-15 at 03:43, Daniel Morgan wrote:
> Hi Rodrigo,
> 
> How would I use the gtksourceview to do what I request in the bug 70617?
> 
> http://bugzilla.gnome.org/show_bug.cgi?id=70617
> 
> This bug talks about executing a single SQL statement at the cursor position
> even if there are multiple SQL statements in the text buffer.  Also, it
> mentions, allowing to execute multiple SQL statements one-at-a-time starting
> at the cursor position.  If an error occurs, stop at the SQL statement which
> caused the error and display the error. Having a log screen would help too.
> Keyboard shortcuts would be nice too.
> 
I'm not sure yet how to do that, but was going to look at it. It seems
gtksourcebuffer.h contains functions for that, I think:

gint             gtk_source_buffer_get_tag_start       (GtkTextIter
*iter);
gint             gtk_source_buffer_get_tag_end         (GtkTextIter
*iter);
GtkSyntaxTag    *gtk_source_buffer_iter_has_syntax_tag (GtkTextIter
*iter);
                                                                                           
void             gtk_source_buffer_highlight_region    (GtkSourceBuffer
*sbuf,
                                                        GtkTextIter    
*start,
                                                        GtkTextIter    
*end);
                                                                                           
/* Regex methods. */
gint             gtk_source_buffer_regex_search (const gchar         
*text,
                                                 gint                 
pos,
                                                 Regex               
*regex,
                                                 gboolean             
forward,
                                                 GtkSourceBufferMatch
*match);
gint             gtk_source_buffer_regex_match  (const gchar         
*text,
                                                 gint                 
pos,
                                                 gint                 
end,
                                                 Regex               
*regex);

I'm not sure how to use them though, but from a first look, they seem to
be what we need for that.

> SQL statements are separated by semicolons (;), but there are two types of
> comments: -- and /* */ that are used.
> 
once we identify the tags, I guess the above functions can make it easy
to find any given text block, identify it, and do whatever you like with
it.

I was thinking on having:

const gchar *gnome_db_editor_get_current_command (editor);
void gnome_db_editor_set_current_command (editor...);
const gchar *gnome_db_editor_get_previous/next_command (...)

that will work as expected for SQL and for other languages (as we add
the support for them)

> Then there are commands that could be used by Mergeant itself, such as,
> CONNECT and DISCONNECT.  This can be useful in scripts with lots of SQL DDL
> and DML to be
> loaded in Mergeant and ran. See bug 103540.
> 
> http://bugzilla.gnome.org/show_bug.cgi?id=103540
> 
would be useful, yes, although this would need changes to make mergeant
aware of any database connection change. Shouldn't be too hard, I guess.
Vivien?

cheers




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