[ANN] DbTalk 0.7

I would like to announce a new release of my Ruby project DbTalk.
The project page can be found at http://www.insula.cz/dbtalk/ (changed URL!).

DbTalk is an interactive GUI based tool for database querying, programming,
administration etc. It consists of three basic parts:

  • SQL editor
  • query result viewer
  • database structure viewer

Important features of DbTalk are:

  • ODBC support (UNIX, Windows)
  • direct support for MySQL (UNIX, Windows), and PostgreSQL (UNIX)
  • multiple database connections (also multiple servers and databases)
  • easy editing and testing of multiline SQL commands (e.g. procedure
    definitions) with syntax highlighting and text completion
  • created SQL commands can be saved into a file and used later
  • nice tabular view of selected data
  • tree view of the database structure
  • DbTalk is free under the terms of GPL

The current version of DbTalk is 0.7. Compared to the 0.6 version DbTalk now
features:

  • SQL syntax highlighting
  • text completion (SQL keywords and database elements)
  • pasting from result table (not perfect however because the Fox table
    widget does not support clipboard)
  • last but not least - lot of bugs is fixed

Compared to the 0.5 version DbTalk now features:

  • ODBC support
  • connection profiles
  • improved table browser
  • possibility to run scripts
  • font configuration
  • greatly improved stability

It is recommended to install a recent version of Fox and FXRuby. DbTalk 0.7
was successfully tested with FXRuby 1.0.13, Fox 1.0.3 and 1.0.18.
The FXRuby version older than 1.0.3 contained bug that made DbTalk to crash
from time to time.

Way cool ! Just when I wanted something similar :wink:

Will I be able to take some of your regexes to quasi-parse my SQL ?
See code fragment below (culled from dbtalk.rb).

Thanks a lot for a timely (for me) release…

– Shanko

···

#----------------------

Regular expression for the complete SQL query (hopefully covers 99.9% of

cases)
SQLCMD =
/(–.$|[^-;‘"]+|-|’(\‘|[^’])('|\z)|“(\”|[^"])("|\z))(;|\z)(–.|[ ]+)
/

SQL keywords and their color styles

KEYWCOLS = {
‘explain’ => 1, ‘select’ => 1, ‘distinct’ => 2, ‘from’ => 2, ‘where’ =>
2,
… # code
… # snip
‘by’ => 2
} # ‘by’ is added because ‘group by’ doesn’t work, I think it should

Sanitize the hash and put SQL keywords in the array

KEYWORDS = KEYWCOLS.delete_if { | key, val| !(1…3).include?(val) }.keys

Construct the reqular expression for SQL literals, comments and literals

regexpsrc = %q!^’ |‘$|’(\'|[^‘])('|\z)|“(\"|[^”])("|\z)|\b\d+\b|–.*$!
#’‘JFF’

KEYWORDS.each { |keyword| regexpsrc += ‘|\b’ + keyword + ‘\b’ }
@shregexp = Regexp.new(regexpsrc, Regexp::IGNORECASE)

buf = " SELECT ‘By Accts’ MSG,ACCT , COUNT(), MAX(billing_dt), MIN(rate)
\n" +
" INTO tbl1 – temp table \n" +
" FROM CUST_ACT \n WHERE acct_nbr IS NULL \n" +
" GROUP BY ACCT \n HAVING COUNT(
) > 1;"

i = 0

While a pattern is found

while m = @shregexp.match(buf)

puts m.to_s

decide and set the right style

if m[0][0] == 34 or m[0][0] == 39 or m[0][0].between?(48,57) # ’ " 0-9
s = 1
elsif m[0][0] == 45 # – SQL comment
s = 2
else
s = KEYWCOLS[m[0].downcase] + 2 # SQL keyword has defined style
end

#puts(i, m.begin(0), 0) if m.begin(0) > 0 # normal style
#puts(i + m.begin(0), m.end(0)- m.begin(0), s) # highlight

Move on in the buffer

i += m.end(0)
buf = m.post_match

end

The rest of the buffer is normal

#puts(i, buf.length, 0) if buf.length > 0 # normal

#----------------------

“Dalibor Sramek” dali@epot.cz wrote in message
news:20020913175024.A57815@epot.cz…

I would like to announce a new release of my Ruby project DbTalk.
The project page can be found at http://www.insula.cz/dbtalk/ (changed
URL!).

DbTalk is an interactive GUI based tool for database querying,
programming,
administration etc. It consists of three basic parts:

  • SQL editor
  • query result viewer
  • database structure viewer

Important features of DbTalk are:

  • ODBC support (UNIX, Windows)
  • direct support for MySQL (UNIX, Windows), and PostgreSQL (UNIX)
  • multiple database connections (also multiple servers and databases)
  • easy editing and testing of multiline SQL commands (e.g. procedure
    definitions) with syntax highlighting and text completion
  • created SQL commands can be saved into a file and used later
  • nice tabular view of selected data
  • tree view of the database structure
  • DbTalk is free under the terms of GPL

The current version of DbTalk is 0.7. Compared to the 0.6 version DbTalk
now
features:

  • SQL syntax highlighting
  • text completion (SQL keywords and database elements)
  • pasting from result table (not perfect however because the Fox table
    widget does not support clipboard)
  • last but not least - lot of bugs is fixed

Compared to the 0.5 version DbTalk now features:

  • ODBC support
  • connection profiles
  • improved table browser
  • possibility to run scripts
  • font configuration
  • greatly improved stability

It is recommended to install a recent version of Fox and FXRuby. DbTalk
0.7
was successfully tested with FXRuby 1.0.13, Fox 1.0.3 and 1.0.18.
The FXRuby version older than 1.0.3 contained bug that made DbTalk to
crash
from time to time.

As DbTalk is GPL I see no problem in using its code as long as your
application is also GPLed.

Nice to see it is actually usefull for somebody :wink:

Dalibor Sramek

···

On Sat, Sep 14, 2002 at 09:23:17AM +0900, Shashank Date wrote:

Way cool ! Just when I wanted something similar :wink:

Will I be able to take some of your regexes to quasi-parse my SQL ?
See code fragment below (culled from dbtalk.rb).

Thanks a lot !

Yes, my application will be GPLed ... although I must admit that I am very
ignorant about such licensing issues. I wish to be as unrestrictive in
publishing my work as possible.

Will keep you posted ...

Again, congratulations for the release and keep up the good work.
-- Shanko

···

----- Original Message -----
From: "Dalibor Sramek" <dali@epot.cz>
To: <ruby-talk@ruby-lang.org>
Cc: <ADATE@kc.rr.com>
Sent: Saturday, September 14, 2002 8:32 AM
Subject: Re: [ANN] DbTalk 0.7

On Sat, Sep 14, 2002 at 09:23:17AM +0900, Shashank Date wrote:
> Way cool ! Just when I wanted something similar :wink:
>
> Will I be able to take some of your regexes to quasi-parse my SQL ?
> See code fragment below (culled from dbtalk.rb).

As DbTalk is GPL I see no problem in using its code as long as your
application is also GPLed.

Nice to see it is actually usefull for somebody :wink:

Dalibor Sramek

Yes, my application will be GPLed … although I must admit that I am very
ignorant about such licensing issues. I wish to be as unrestrictive in
publishing my work as possible.

OK, this is offtopic. Not meant to be flame or troll.

I wish that there were some centralized location where
I could learn about all these licenses and why they are
loved/hated by various people in various situations.

I hear endless debate about it all, but I have no clear
understanding of it.

For simplicity, anything I release in Ruby will be under
the same license as Ruby.

As for “unrestrictive as possible…” Here is the world’s
most unrestrictive license: “This software is completely
free. Take it and pretend you wrote it. Sell it at a
huge profit.”

:slight_smile:

Hal

···

----- Original Message -----
From: “Shashank Date” ADATE@kc.rr.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org; “Dalibor Sramek”
dali@epot.cz
Cc: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Saturday, September 14, 2002 9:12 AM
Subject: Re: [ANN] DbTalk 0.7

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message
news:008101c25c3a$6f0a4dc0$0300a8c0@austin.rr.com

I wish that there were some centralized location where
I could learn about all these licenses and why they are
loved/hated by various people in various situations.

May your wish be granted (because it is the same as mine ;-))

For simplicity, anything I release in Ruby will be under
the same license as Ruby.

I have no problem with that !

As for “unrestrictive as possible…” Here is the world’s
most unrestrictive license: “This software is completely
free. Take it and pretend you wrote it. Sell it at a
huge profit.”
^^^^^^^^^
LOL

BTW, love your book …

Hal

– Shanko

Yes, my application will be GPLed … although I must admit that I am very
ignorant about such licensing issues. I wish to be as unrestrictive in
publishing my work as possible.

Well, the GPL is arguably one of the most restrictive Open Source
licenses–but in the paradoxical sense that it restricts the user from
restricting the rights of others. Which if you ask me is pretty cool.

However, lately I find myself using the BSD license whenever I don’t
want to prohibit the product being used in a proprietary application.

Why BSD? Because, unlike almost all other Open Source licenses, it is
brief enough that people might actually read it, and clear enough that
non-lawyers have a chance of actually understanding it.

[And, strangely, I’ve never known anyone to raise that point up until
now. I don’t know why that is, but I can only guess that most people
cynically believe that noone reads licenses anyway, so why bother?]

I wish that there were some centralized location where
I could learn about all these licenses and why they are
loved/hated by various people in various situations.

Well, you can read and compare many licenses at

http://opensource.org/licenses/

but maybe you knew that already. And in any case, they don’t really
publish commentary on the web site, though I notice they have a mailing
list where I imagine you’ll find more than enough debate.

···

On Sun, Sep 15, 2002 at 06:55:07AM +0900, Hal E. Fulton wrote:


Matt Gushee
Englewood, Colorado, USA
mgushee@havenrock.com

OK, this is offtopic. Not meant to be flame or troll.

> I wish that there were some centralized location where
> I could learn about all these licenses and why they are
> loved/hated by various people in various situations.

> I hear endless debate about it all, but I have no clear
> understanding of it.

> For simplicity, anything I release in Ruby will be under
> the same license as Ruby.

> As for "unrestrictive as possible..." Here is the world's
> most unrestrictive license: "This software is completely
> free. Take it and pretend you wrote it. Sell it at a
> huge profit."

I tend to use the following license on most stuff that I write …

# Copyright 2002 by Jim Weirich (jweirich@one.net).
# All rights reserved.

# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.

I like this for several reasons. First, it is short. I can put this
at the top of my source files without feeling I’ve become a lawyer.

Second, it is very explicit about what it allows. FSF says there are
3 freedoms that should be associated with free software, and the
license explicitly grants permission to use it, to modify it, and to
share it.

Finally, it keeps my name with the software. Even if I’m not paid for
the software, I get a little ego-boost from the fact my name stays
with the code. That’s the only restriction, that the copyright notice
remain.

At one point in time, I received an email from the FSF saying that
they were doing a survey of licenses and that mine was possibly the
shortest GPL compatible[1] free software license that they had come
across. They suggested that I add the phrase permitting “distribution
of modified sources”. At first, I first I thought they were being a
little paranoid, but then I read an article on SlashDot about a
license dispute dealing with just that particular issue. So now the
license is three lines instead of two.

I noticed that Matz said that Rite will be under a license very
similar to the one above. I’ve always wondered if he saw my version
of it.

The FSF has several pages discribing the licensing issues. Their
descriptions are good. Their recommendations are flavored by their
own point of view (of course). Read and decide for yourself.

http://www.fsf.org/licenses/license-list.html
-- Notes about lots of different licenses.

http://www.fsf.org/licenses/licenses.html
-- Details about the FSF licenses ... GPL, LGPL, and GFDL.
···


– Jim Weirich jweirich@one.net http://w3.one.net/~jweirich

“Beware of bugs in the above code; I have only proved it correct,
not tried it.” – Donald Knuth (in a memo to Peter van Emde Boas)

[1] “GPL Compatible” means that it is free software that may be
combined with GPLed software without conflict. Some licenses
(like the Mozilla Public License) cannot be combined with GPL
software). However, being compatible with the GPL does NOT
imply that the license is similar to the GPL (which it definitely
is not).

BTW, love your book …

Thank you… tell that to Barnes and Noble,
who quit carrying it.

Cheers,
Hal

···

----- Original Message -----
From: “Shashank Date” ADATE@kc.rr.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Saturday, September 14, 2002 5:06 PM
Subject: Re: [ANN] DbTalk 0.7

“Matt Gushee” mgushee@havenrock.com wrote in message

Well, you can read and compare many licenses at

http://opensource.org/licenses/

but maybe you knew that already.

No, I didn’t … so thanks for the link.

– shanko

"Jim > I tend to use the following license on most stuff that I write …

# Copyright 2002 by Jim Weirich (jweirich@one.net).
# All rights reserved.

# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.

It is not clear whether “above copyright notice is included” means that you
want your name in the source or that you mean that derived work should also
permit redistribution in similar terms to the original.
This ambiguity is frequently found in such licences.

Mikkel

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message

BTW, love your book …

Thank you… tell that to Barnes and Noble, who quit carrying it.

If you mean the “brick and mortar” B&N, then I am surprised that they even
carried it in the first place.

I have quit going in my neighborhood B&N for Computer books, anyway, since
they have a very limited collection. I prefer Borders or MicroCenter.

Actually, to be honest, the last few purchases have been from the online
stores which offer the best deals at that time.

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message

BTW, love your book …

Thank you… tell that to Barnes and Noble, who quit carrying it.

If you mean the “brick and mortar” B&N, then I am surprised that they
even
carried it in the first place.

I have quit going in my neighborhood B&N for Computer books, anyway, since
they have a very limited collection. I prefer Borders or MicroCenter.

Actually, to be honest, the last few purchases have been from the online
stores which offer the best deals at that time.

Yes, it’s the brick & mortar.

It’s true that most programmers buy online. That, of course,
feeds the phenomenon where there are fewer computer books
on the shelves.

What bothered me a little was that out of six English books
on Ruby, they are carrying five. Why not all?

Hal

···

----- Original Message -----
From: “Shashank Date” ADATE@kc.rr.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, September 15, 2002 1:06 AM
Subject: [OT] Re: [ANN] DbTalk 0.7

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message

What bothered me a little was that out of six English books
on Ruby, they are carrying five. Why not all?

I agree with you, that is very strange … I cannot fathom why they would
pick on one book.

Being totally ignorant about publishing and distribution, I do not know how
you can tell that they stopped carrying it though. Do they inform you about
their change in policy ?

If it helps any, I can certainly go to my n’hood store and request for a
copy.
–shanko

Before anybody launches into a conspiracy theory: is it possible they
were just out of stock? Such things have been known to happen with
printed books in brick-and-mortar stores.

···

On Mon, Sep 16, 2002 at 09:08:01AM +0900, Shashank Date wrote:

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message

What bothered me a little was that out of six English books
on Ruby, they are carrying five. Why not all?

I agree with you, that is very strange … I cannot fathom why they would
pick on one book.


Matt Gushee
Englewood, Colorado, USA
mgushee@havenrock.com

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message

What bothered me a little was that out of six English books
on Ruby, they are carrying five. Why not all?

I agree with you, that is very strange … I cannot fathom why they
would
pick on one book.

Before anybody launches into a conspiracy theory: is it possible they
were just out of stock? Such things have been known to happen with
printed books in brick-and-mortar stores.

I’m sure there’s no conspiracy.

I did inquire (anonymously:) about the book… I was told,
“We no longer carry that. I don’t know why. That’s decided
in New York. We could order one for you.”

A lot of things are decided in New York, of course.

Without facts to go on, I would guess that their carrying
a book is a function of its age and its past sales. And
those who made the decision were probably unaware that
they had ended up carrying five out of the only six Ruby
books in English.

I’ve thought about writing a letter. But then: Most of us
buy books online, so is it really worth it?

Hal

···

----- Original Message -----
From: “Matt Gushee” mgushee@havenrock.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, September 15, 2002 7:15 PM
Subject: Re: [OT] Re: [ANN] DbTalk 0.7

On Mon, Sep 16, 2002 at 09:08:01AM +0900, Shashank Date wrote:

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message

But then: Most of us buy books online, so is it really worth it?

Absolutely …very much worth it!

I was introduced to Ruby just by chance when I paged through Pickaxe
entirely out of curiosity.

Serendipity works !

– shanko