.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
mySQL + HPB_bot
Old
  (#1)
RedLink
Member
 
Status: Offline
Posts: 5
Join Date: Jan 2004
Default mySQL + HPB_bot - 19-12-2006

Well I've been trying to integrate MySQL++ into HPB_bot, thou I've got a major problem. I've succeeded to connect to my SQL database thou any attempt to fetch or insert information results in a crash.

Sample code
Code:
mysqlpp::Connection con("test","127.0.0.1","test","test");
mysqlpp::Query query = con.query();
...
sprintf( buff, "INSERT INTO chat (id,message,date) VALUES('','%s','NOW()')\0",szMsg_buff);
...
mysqlpp::Result res = query.store(buff)


I'm guessing I'll haft to make a separate thread, is there a way to get past this obstacle as smooth as possible?
  
Reply With Quote
Re: mySQL + HPB_bot
Old
  (#2)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: mySQL + HPB_bot - 20-12-2006

you should ALWAYS try and catch for SQL Exceptions when using SQL. As the sql command will likely contain syntax errors and the only way to know there is a syntax error is to raise an exception. If the exception is not handled (handled = using try and catch), the program will crash.

see: http://tangentsoft.net/mysql++/doc/u.../tutorial.html
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com