On 2002-01-03 01:13, Yourname wrote:
I always wondered why people want MySQL do do their seen requests.. mind explaining me please?
Code: Select all
char escape(char *string)
{
char *tmpString[2048];
Context;
mysql_real_escape_string(&mysql, tmpString, string, (unsigned int)strlen(string));
snprintf(string, sizeof(tmpString), tmpString);
nfree(tmpString);
return *string;
}
As I will say below (jumping in my answers when I'm writing), that is something I must study harder on.Hi, I was looking in mysql.c and I noticed your question about mysql_expmem. You did the correct thing. The only thing the expmem function is supposed to report is the dynamic memory your module uses via nmalloc. Since you don't use nmalloc, the expected memory usage from eggdrop's point of view is 0.
Make sense to me...Here's a problem:
If tmpString is supposed to be a string, it should be declaredCode: Select all
char escape(char *string) { char *tmpString[2048]; Context; mysql_real_escape_string(&mysql, tmpString, string, (unsigned int)strlen(string)); snprintf(string, sizeof(tmpString), tmpString); nfree(tmpString); return *string; }
char tmpString[2048];
The * makes it an array of 2048 pointers, not characters. Also, it should not be nfree()'d, because it was not nmalloc()'d.
The escaped string is always larger when returned if it contains anything that must be escaped (like '%_) etc. A "'" will be escaped like "'". How to deal with that?And, escape() should not modify its argument. When you call escape(nick); escape(host); escape(handle); escape(channel); etc. you are running the risk of a buffer overflow (if the escaped string is larger, it will overflow the nick/host/handle buffer) and you may corrupt future binds, because you are modifying the bind arguments.
I looked at the woobie source and figured out with time. Its all there in the source somewhere, you just have to find it.Your overall module structure is good. I'm curious, did you figure it all out yourself (like importing the H_* tables) or did you use a template or some tutorial? Several people on this forum have asked for a module tutorial. If you used one, that could be helpful to share
Infact, that is something that will come in the feature. It's in my plans for the module. But I first want to do STABLE logging, that's the main purpose for me since I did this module for myself.Finally, as sort of a feature suggestion.. once you have all the mysql code there, why not create some simple tcl commands to access them? Like mysql_connect, mysql_execute, etc. Then your module would be useful to everybody who wants to use mysql in their tcl scripts (but not necessarily for channel logging).
Point --with-mysql to the directory that contains include/mysql.h.On 2002-01-10 18:24, blackwidow wrote:
two errors, one of them critical:
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H -I/usr/local/mysql/include -DMAKING_MODS -c .././mysql.mod/mysql.c .././mysql.mod/mysql.c:27:25: mysql/mysql.h: No such file or directory
If not in --with-mysql path, you can export it into $LD_LIBRARY_PATH and/or by adding it into /etc/ld.so.conferror 2, I can't get past:
gcc -pipe -shared -nostartfiles -L/usr/local/mysql/lib/mysql -lmysqlclient -o ../../../mysql.so ../mysql.o
/usr/bin/ld: cannot find -lmysqlclient
Well, but then gseen.mod by G`Quann also works the same way, except for that !online thingie or so... but then sometimes gseen sez Returned too many matches... thats one thing i dislike about it.And you can also use thesame information to do !online, !top10, webstats and much much more. It's not just seen, its the information. What you do with it is up to you.
The module is stable now. I just have to make a new tarball and upload it.On 2002-01-20 02:35, Yourname wrote:
tajson, pal, i'd request you to make a good one (the mod) i hope you get a stable release soon.
And why dont u try to incorporate webseen into the mod too?.. that'd give an edge. As well as the goodies gseen offers (bseen doesnt have so many) This will make ppl use MySQL more than these scripts.