* Using libmysqlclient from module
@ 2005-06-07 23:03 Mariusz Gniazdowski
2005-06-08 20:21 ` Mariusz Gniazdowski
0 siblings, 1 reply; 2+ messages in thread
From: Mariusz Gniazdowski @ 2005-06-07 23:03 UTC (permalink / raw)
To: zsh-users
Hi.
I wrote module that is linked to libmysqlclient and tries to open
connection. The code:
static MYSQL db;
/**/
static int
sql_connect(char *nam, char **args, Options ops, UNUSED(int func))
{
if(!mysql_connect(&db, "localhost", "username", "password")){
printf("Connection failed: %s\n",mysql_error(&db));
return 1;
}
printf("Connected\n");
return 0;
}
Following error occurs when running this builtin:
$ sql_connect
Connection failed: Lost connection to MySQL server during query
--
Regards
Mariusz Gniazdowski
----------------------------------------------------------------------
Startuj z INTERIA.PL! >>> http://link.interia.pl/f186c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Using libmysqlclient from module
2005-06-07 23:03 Using libmysqlclient from module Mariusz Gniazdowski
@ 2005-06-08 20:21 ` Mariusz Gniazdowski
0 siblings, 0 replies; 2+ messages in thread
From: Mariusz Gniazdowski @ 2005-06-08 20:21 UTC (permalink / raw)
To: zsh-users
Funny thing happened: i straced normal application, and zsh running
sql_connect builtin. Following lines differ:
zsh_module:
open("/usr/share/mysql/charsetsIndex", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
normal app:
open("/usr/share/mysql/charsets/Index", O_RDONLY|O_LARGEFILE) = 4
Weird why slash before 'Index' is ommited?
Full straces:
zsh:
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
socket(PF_FILE, SOCK_STREAM, 0) = 3
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
connect(3, {sa_family=AF_FILE, path="/var/run/mysqld/mysqld.sock"}, 110) = 0
setsockopt(3, SOL_IP, IP_TOS, [8], 4) = -1 EOPNOTSUPP (Operation not supported)
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
read(3, "\'\0\0\0", 4) = 4
read(3, "\n4.0.22\0\244\3\0\0003?$4w~5(\0, \10\2\0\0\0\0\0\0\0"..., 39) = 39
open("/usr/share/mysql/charsetsIndex", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/mysql/charsets?.conf", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
write(3, "\t\0\0\1\205 \0\0\0root", 13) = 13
read(3, "", 4) = 0
read(3, "", 4) = 0
shutdown(3, 2 /* send and receive */) = 0
close(3) = 0
write(1, "Connection failed: Lost connecti"..., 64Connection failed: Lost connection to MySQL server during query) = 64
normal app:
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
socket(PF_FILE, SOCK_STREAM, 0) = 3
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
connect(3, {sa_family=AF_FILE, path="/var/run/mysqld/mysqld.sock"}, 110) = 0
setsockopt(3, SOL_IP, IP_TOS, [8], 4) = -1 EOPNOTSUPP (Operation not supported)
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
read(3, "\'\0\0\0", 4) = 4
read(3, "\n4.0.22\0\243\3\0\0}j{LIj[g\0, \10\2\0\0\0\0\0\0\0"..., 39) = 39
open("/usr/share/mysql/charsets/Index", O_RDONLY|O_LARGEFILE) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=621, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fea000
read(4, "# sql/share/charsets/Index\n#\n# T"..., 4096) = 621
read(4, "", 4096) = 0
close(4) = 0
munmap(0xb7fea000, 4096) = 0
write(3, "\22\0\0\1\205 \0\0\0root\0SMPVSSBW", 22) = 22
read(3, "\5\0\0\2", 4) = 4
read(3, "\0\0\0\2\0", 5) = 5
exit_group(0) = ?
--
Regards
Mariusz Gniazdowski
----------------------------------------------------------------------
Startuj z INTERIA.PL! >>> http://link.interia.pl/f186c
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-08 20:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-07 23:03 Using libmysqlclient from module Mariusz Gniazdowski
2005-06-08 20:21 ` Mariusz Gniazdowski
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).