This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

mysql.mod problem with

Discussion of Eggdrop's code and module programming in C.
Post Reply
m
matteo

mysql.mod problem with

Post by matteo »

Hi, I'm trying to use mysql.mod with an eggdrop 1.6.15. It works great, except that it doesn't log messages that contain one or more apostrophees (the ' character).
Any idea what could be involved ? thx in advance
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

you have to escape it, and i think the mysql.mod have a function for it, mysql_escape or something like that.
m
matteo

Post by matteo »

yes I got that. Actually I did not do any modification to mysql.mod. I was just interested in the logging to mySQL part.
Yet it doesn't work "out of the box", I was just wondering if I missed something
D
D4RkViP3R
Voice
Posts: 7
Joined: Mon Jun 13, 2005 7:18 am
Location: Isenbüttel, Lower Saxony, Germany

Post by D4RkViP3R »

Hi matteo,

may you help me to compile the mysql.mod?
I think I'm too stupid to do this.

I copied the mysql sourcecode to /usr/src/mysql and the eggdrop sourcecode to /usr/src/eggdrop1.6.16.
I also copied the mysql.mod tarball to /usr/src/eggdrop1.6.16/src/mysql.mod THEN the mysql include dir to /usr/src/eggdrop1.6.16/src/mysql.mod/mysql

- ./configure --with-mysql=/usr/src/mysql <- works fine
- make config <- works also fine
- make modules <- here some errors compiling the mysql.mod

Code: Select all

In file included from ../mysql.mod/mysql/mysql.h:62,
                 from ../mysql.mod/mysql.c:26:
../mysql.mod/mysql/my_list.h:32: error: parse error before "int"
make[2]: *** [../mysql.o] Error 1
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/mysql.mod'
make[1]: *** [mysql.mod_so] Error 2
make[1]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod'
make: *** [modules] Error 2

Did I something wrong ?


Best regards,

D4RkViP3R
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you probably got other errors before that one, let us know what are they
D
D4RkViP3R
Voice
Posts: 7
Joined: Mon Jun 13, 2005 7:18 am
Location: Isenbüttel, Lower Saxony, Germany

Post by D4RkViP3R »

Hi,

I found the failure. I used wrong mySQL-dev versions.
But now I have one other failure with the server.mod see below in codebox

Code: Select all

vs245184:/usr/src/eggdrop1.6.16# make modules
make[1]: Entering directory `/usr/src/eggdrop1.6.16/src/mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/assoc.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/assoc.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/blowfish.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/blowfish.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/channels.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/channels.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/compress.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/compress.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/console.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/console.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/ctcp.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/ctcp.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/dns.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/dns.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/filesys.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/filesys.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/irc.mod'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/irc.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/mysql.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H  -I/usr/src/mysql/include  -DMAKING_MODS -c .././mysql.mod/mysql.c
mv mysql.o ../
gcc -pipe -shared -nostartfiles -L/usr/src/mysql/lib/mysql -lmysqlclient -o ../.                                                           ./../mysql.so ../mysql.o
touch ../../../mysql.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/mysql.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/notes.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././notes.mod/notes.c
mv notes.o ../
gcc -pipe -shared -nostartfiles -o ../../../notes.so ../notes.o -L/usr/lib -ltcl                                                           8.4 -lm -lpthread -ldl -lnsl
touch ../../../notes.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/notes.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/seen.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././seen.mod/seen.c
mv seen.o ../
gcc -pipe -shared -nostartfiles -o ../../../seen.so ../seen.o
touch ../../../seen.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/seen.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/server.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././server.mod/server.c
../server.mod/server.c: In function `next_server':
../server.mod/server.c:1047: warning: dereferencing type-punned pointer will bre                                                           ak strict-aliasing rules
../server.mod/server.c: At top level:
../server.mod/server.c:1341: warning: dereferencing type-punned pointer will bre                                                           ak strict-aliasing rules
../server.mod/server.c:1349: warning: dereferencing type-punned pointer will bre                                                           ak strict-aliasing rules
mv server.o ../
gcc -pipe -shared -nostartfiles -o ../../../server.so ../server.o -L/usr/lib -lt                                                           cl8.4 -lm -lpthread -ldl -lnsl
touch ../../../server.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/server.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/share.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././share.mod/share.c
mv share.o ../
gcc -pipe -shared -nostartfiles -o ../../../share.so ../share.o
touch ../../../share.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/share.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/transfer.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././transfer.mod/transfer.c
mv transfer.o ../
gcc -pipe -shared -nostartfiles -o ../../../transfer.so ../transfer.o -L/usr/lib                                                            -ltcl8.4 -lm -lpthread -ldl -lnsl
touch ../../../transfer.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/transfer.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/uptime.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././uptime.mod/uptime.c
mv uptime.o ../
gcc -pipe -shared -nostartfiles -o ../../../uptime.so ../uptime.o
touch ../../../uptime.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/uptime.mod'
make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/wire.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././wire.mod/wire.c
mv wire.o ../
gcc -pipe -shared -nostartfiles -o ../../../wire.so ../wire.o
touch ../../../wire.so
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/wire.mod'

All modules compiled.
make[1]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod'

Test run of ./eggdrop -v:
/bin/sh: line 1: ./eggdrop: No such file or directory
make: *** [modules] Error 127
The mysql.mod area seems to be okay but when I start my eggdrop comes the following:

Code: Select all

[00:11] * Last context: mysql:mysql.c/119 []
[00:11] * Please REPORT this BUG!
[00:11] * Check doc/BUG-REPORT on how to do so.
[00:11] * Wrote DEBUG
[00:11] * SEGMENT VIOLATION -- CRASHING!

I don't know what to do :(


D4RkViP3R
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

Code: Select all

...
Test run of ./eggdrop -v: 
/bin/sh: line 1: ./eggdrop: No such file or directory 
make: *** [modules] Error 127
the way it looks to me is that u didnt execute 'make', you do have to compile eggdrop itself before you compile the modules.

Code: Select all

make[2]: Entering directory `/usr/src/eggdrop1.6.16/src/mod/server.mod' 
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE                                                           _CONFIG_H   -DMAKING_MODS -c .././server.mod/server.c 
../server.mod/server.c: In function `next_server': 
../server.mod/server.c:1047: warning: dereferencing type-punned pointer will bre                                                           ak strict-aliasing rules 
../server.mod/server.c: At top level: 
../server.mod/server.c:1341: warning: dereferencing type-punned pointer will bre                                                           ak strict-aliasing rules 
../server.mod/server.c:1349: warning: dereferencing type-punned pointer will bre                                                           ak strict-aliasing rules 
mv server.o ../ 
gcc -pipe -shared -nostartfiles -o ../../../server.so ../server.o -L/usr/lib -lt                                                           cl8.4 -lm -lpthread -ldl -lnsl 
touch ../../../server.so 
make[2]: Leaving directory `/usr/src/eggdrop1.6.16/src/mod/server.mod' 
The server.mod errors are warnings which you can ignore, everyone I know have them...

Code: Select all

[00:11] * Last context: mysql:mysql.c/119 [] 
[00:11] * Please REPORT this BUG! 
[00:11] * Check doc/BUG-REPORT on how to do so. 
[00:11] * Wrote DEBUG 
[00:11] * SEGMENT VIOLATION -- CRASHING! 
Wonder if anyone can think of what is wrong... Might be the login variables being setup wrong, no mysql server running on the host you specified. Or maybe you edited one of the files of the mod...
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you messed up, start over - cleanup, untar eggdrop, untar mysqlmod, configure, make, install
D
D4RkViP3R
Voice
Posts: 7
Joined: Mon Jun 13, 2005 7:18 am
Location: Isenbüttel, Lower Saxony, Germany

Post by D4RkViP3R »

Hi demond,

I do this and it's the same problem.
Now I take the mysqltcl module and its works very fine :)
But one problem I have with this.

I have a database named 'eggdrop' and a table named 'allow_in_channels'.
If I want to query the table with following proc:

Code: Select all

proc allow_in_channel {current_channel} {
    global scriptname db_handle
    set sql_cmd "SELECT $scriptname FROM 'allow_in_channels'"
    set result [mysqlquery $db_handle $sql_cmd]

    while {[set row [mysqlnext $result]] != ""} {
        #set allow_in_channel_id [lindex $row 0]
        set allow_in_channel_script [lindex $row 1]
        set allow_in_channel_channel [lindex $row 2]

        if {$allow_in_channel_script == $scriptname} {
            if {$allow_in_channel_channel == $current_channel} {
                return $allow_in_channel_channel
            }
        }
    }
}
And call the "function"

Code: Select all

bind pub - !testin testin
proc testin {nick uhost hand chan arg} {
    global scriptname
    if {([allow_in_channel $chan] == $chan)} {
        putchan $chan "Hallo"
    }
}
My eggdrop shows me this message:

Code: Select all

[16:26] Tcl error [testin]: mysqlquery/db server: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM 'allow_in_channels'' at line 1
Doesn't support this script tablenames with underscores or what?


Regards,

D4RkViP3R
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

it's not the underscores, it's the single quotes

remove single quotes:

Code: Select all

set sql_cmd "SELECT $scriptname FROM allow_in_channels"
D
D4RkViP3R
Voice
Posts: 7
Joined: Mon Jun 13, 2005 7:18 am
Location: Isenbüttel, Lower Saxony, Germany

Post by D4RkViP3R »

:(

same error

Code: Select all

[18:37] Tcl error [testin]: mysqlquery/db server: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM allow_in_channels' at line 1
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

most likely $scriptname is empty string
D
D4RkViP3R
Voice
Posts: 7
Joined: Mon Jun 13, 2005 7:18 am
Location: Isenbüttel, Lower Saxony, Germany

Post by D4RkViP3R »

I've replaced the variable with the string.
The error doesn't change

May you help my over ICQ to solve the problem ?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

sorry, I don't help privately on ICQ (unless you don't mind me charging you a fee for my consulting services)

try your SQL command from mysql client utility
D
D4RkViP3R
Voice
Posts: 7
Joined: Mon Jun 13, 2005 7:18 am
Location: Isenbüttel, Lower Saxony, Germany

Post by D4RkViP3R »

fixed, is used a wrong rowname :)

Tnx


D4RkViP3R
Post Reply