Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SPAWK - SQL Powered AWK

121 views
Skip to first unread message

Panos Papadopoulos

unread,
Dec 31, 2017, 4:13:29 AM12/31/17
to
If you are interested in accessing MySQL/MariaDB databases from AWK, then you may need to check out SPAWK at http://spawk.info

MadSharker

unread,
Dec 31, 2017, 5:12:50 AM12/31/17
to
"Panos Papadopoulos" <pano...@gmail.com> ha scritto nel messaggio
news:0847de78-2a71-4175...@googlegroups.com...
> If you are interested in accessing MySQL/MariaDB databases from AWK, then
> you may need to check out SPAWK at http://spawk.info

Great extension, thank you!


Andrew Schorr

unread,
Jan 2, 2018, 7:46:39 PM1/2/18
to
On Sunday, December 31, 2017 at 5:12:50 AM UTC-5, MadSharker wrote:
> Great extension, thank you!

It doesn't actually seem to be an extension; as far as I can tell, it's implemented using a coprocess approach.

Panos -- have you considered implementing a MariaDB interface using an extension instead? I did this for PostgreSQL in the gawkextlib gawk-pgsql extension, available here:
https://sourceforge.net/projects/gawkextlib/files

Also, why does this require version 5.7 or later? On RHEL/CentOS 7.4, mysql_config --version gives 5.5.56...

Regards,
Andy

Panos Papadopoulos

unread,
Jan 4, 2018, 12:47:00 AM1/4/18
to
Andy is right; it's not an extension, it's just a two-way communication between awk and sarek, where sarek is a simple database client executable.

As for developing an extension, Andy again is right; this would be the best (and much more effective) approach, but I believe it's more complicated.
I've already done that around 2004, but it's rather messy:
https://sites.google.com/site/spawkinfo

As for MySQL version 5.7, I'm sure that earlier MySQL/MariaDB versions will also work.

Regards,
Panos

Andrew Schorr

unread,
Jan 4, 2018, 8:02:25 AM1/4/18
to
Hi Panos,

On Thursday, January 4, 2018 at 12:47:00 AM UTC-5, Panos Papadopoulos wrote:
> As for developing an extension, Andy again is right; this would be the best (and much more effective) approach, but I believe it's more complicated.
> I've already done that around 2004, but it's rather messy:
> https://sites.google.com/site/spawkinfo

The extension mechanism has changed a lot since 2004. I think it is no longer messy. It would be great if you could take a look at the API implementation in gawk 4.2. An extension is really the right way to do this, not a coprocess.

> As for MySQL version 5.7, I'm sure that earlier MySQL/MariaDB versions will also work.

Good to know.

Regards,
Andy

Paulino Huerta

unread,
Jan 9, 2018, 5:59:43 PM1/9/18
to
Hi Panos,

I share Andy's comment.


It is a matter of knowing and wrapping the client library "C" of MySQL.

Studying the gawk API will be quite comfortable.

It is worth seeing the code in pgsql.c, redis.c and lmdb.c of the "gawkextlib" project, you will notice that the most complex work is done by the C libpq API in the case of "pgsql.c" or "hiredis" API "in" redis.c ".
So writing a gawk-mariadb extension would be to create an interface for libmysqlclient, that is what you would have to assess whether it is a complex task or not, as far as the other party is concerned, the "api gawk" will not have problems.

I hope I have encouraged you.

--Paulino

Panos Papadopoulos

unread,
Jan 10, 2018, 1:54:46 AM1/10/18
to
Thanks a lot Paulino, I'm working on it!

Panos Papadopoulos

unread,
Jan 15, 2018, 6:23:23 PM1/15/18
to
I'm done!
SPAWK is now implemented as a gawk extension library.
0 new messages