logo       

Re: mysql++ (VC-Version): crash when trying to a query.store();: msg#00045

db.mysql.c++

Subject: Re: mysql++ (VC-Version): crash when trying to a query.store();

> I'm trying to write a little mysql-app with mysql++. Connecting to the
> database is no problem, but doing a query to it.. the app simply crashes.
>
> Here's the ouput of my app, after it I post a small part of the app's
> source:
>
> initializing Version: 0.0.1 [COLONY]...
> [-] using database type: MySQL
> [-] using database host: 192.168.0.1
> [-] using database port: 666 file://ignore this... the app doesn't use it
> [-] using database name: ugs_db
> [-] using database user: sql
> [-] using database password: primax
> [-] connected to database ...
> [-] database host information: 192.168.0.1 via TCP/IP
> [-] database client information: 3.23.32
> [-] query preview: select * from ugs_system
>
> snippet of the code:
> TiXmlDocument* cDBLMySQL::read(std::string sSQLCommand)
> {
> Query query = _pDBConnection.query();
> Result res;
>
> if(!_pDBConnection.connected())
> {
> Logger::write(LLEVEL_PANIC,"[-] not connected to database ...\n");
> return NULL;
> }
>
> try
> {
> query << sSQLCommand.c_str();
> Logger::write(LLEVEL_DEBUG,"[-] query preview:
> %s\n",query.preview().c_str());
>
> file://my app crashes within this method.. I don't know why....
> res = query.store();
> return buildXML(res);
> }
> catch(BadQuery er)
> {
> Logger::write(LLEVEL_PANIC,"[!] %s \n",er.error.c_str());
> return NULL;
> }
>
> return NULL;
> }
>
> If anyone got a similar experience and got an answer to this question,
> it would be great if (s)he could help me out.
>

there are different memberfunktions for different SQL-statements:
query.execute -> INSERT, DELETE, UPDATE
... you get "number of affected row back somehow

query.store -> SELETCT
... you get a result set

try to use a (good) debugger, you'll see that you get an invalid pointer,
wenn you use the wrong function.

I did a well, of course ;-)





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise