AW: С API help

2001-02-08 Thread Dingfelder Andy
Hello Konstantin, this code is buggy, because 'new' is not a valid C operator. And MYSQL is a struct not an object. The 'new' operator allocates memory for objects (C++). In C you?ve to use the malloc function. Take a look at the libmysqltest example, which comes with your distribution. Regard

Re: С API help

2001-02-08 Thread Sinisa Milivojevic
Konstantin Osipov writes: > Hi All! > > Is this code buggy? > -- > MYSQL* mysql = new MYSQL; > > mysql_init(mysql); > > mysql_real_connect(mysql, "localhost"); > /* some work*/ > mysql_close(mysql); > mysql_real_connect(mysql, "otherhost"); > /* some work*/ > mysql_close(mysql);

С API help

2001-02-08 Thread Konstantin Osipov
Hi All! Is this code buggy? -- MYSQL* mysql = new MYSQL; mysql_init(mysql); mysql_real_connect(mysql, "localhost"); /* some work*/ mysql_close(mysql); mysql_real_connect(mysql, "otherhost"); /* some work*/ mysql_close(mysql); delete mysql; -- In other words, if struct MYSQL allocated manually,