Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ Programming ➜ General ➜ C++ and Mysql

C++ and Mysql

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Metsuro   USA  (389 posts)  Bio
Date Sat 26 Aug 2006 01:46 AM (UTC)
Message
Not exactly sure where to put this so i put it here... I'm looking to learn C++ and Mysql and how to use the two together... I was just wondering maybe which books might be of interest or any webpages or the like, any thing really would help. Thank you.

Everything turns around in the end
Top

Posted by Tzaro   USA  (41 posts)  Bio
Date Reply #1 on Sat 26 Aug 2006 01:59 AM (UTC)
Message
I dunno about mysql, but I learned C++ using Sam's "Teach Yourself C++ in 21 days". Sure enough, I learned enough C++ to do what I need with it...

It doesn't go very in depth on the language but it's definately a way to start yourself off.

Implementer of Lost Prophecy,
Tzaro
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Sat 26 Aug 2006 02:02 AM (UTC)
Message
I just saw something about this. Uhh, a snippet I think. I thought it was on MudBytes but I cannot seem to find it.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #3 on Sat 26 Aug 2006 02:31 AM (UTC)
Message
Its a discussion about adding mysql support to smaug on smuagfuss.org. But I want to start over from scratch creating a new start using sql, but I just want to learn about using the two and maybe try using it with my smaugfuss mud, and just test around yea know?

Everything turns around in the end
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #4 on Sat 26 Aug 2006 03:14 AM (UTC)
Message
and I have thought about using tinymud or which ever the one nick made, however I cant ever seem to get it to compile the way it is.

Everything turns around in the end
Top

Posted by Nick Gammon   Australia  (23,162 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 26 Aug 2006 03:29 AM (UTC)
Message
TinyMUD didn't use mysql, but it had C++ in it from memory.

I found the MySQL reference manual by Paul DuBois quite helpful.

# Paperback: 1320 pages
# Publisher: Sams; 3 edition (March 8, 2005)
# Language: English
# ISBN: 0672326736

I had an earlier edition, but it explains about using MySQL in general and the interfaces in various languages, such as PHP, C etc.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #6 on Sat 26 Aug 2006 03:33 AM (UTC)
Message
Here are some tutorials:
http://www.cplusplus.com/doc/
http://www.cprogramming.com/tutorial.html#ctutorial
(C++ isn't a whole lot different from C)

http://dev.mysql.com/doc/mysql/en/index.html
http://dev.mysql.com/doc/refman/5.0/en/tutorial.html

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #7 on Sat 26 Aug 2006 03:40 AM (UTC)
Message
well I knew it didn't have it, but i want to make a codebase using C++ not C, however I've never been able to get tinymud to work as is in the shell I had...

Everything turns around in the end
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #8 on Sat 26 Aug 2006 07:15 AM (UTC)
Message
Isn't Dawn of Time C++? And has some sql stuff too?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #9 on Sat 26 Aug 2006 06:46 PM (UTC)
Message
No. Dawn has no SQL support in it. It looks like there was a discussion about that 3 years ago but the thread turned into one of those stupid political "pgsql is better than mysql" things and it doesn't look like anyone responded after that.
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #10 on Sat 26 Aug 2006 06:49 PM (UTC)
Message
I'm mostly interested in just figuring out how to get the basics like tinymud has done, for like connecting to the mud, and then have mysql work for alot of the other things I wish. I orginally wanted just to work with Tinymud and start from there, but I couldn't get it to compile and didn't think of asking for help on it heh.

Everything turns around in the end
Top

Posted by Nick Gammon   Australia  (23,162 posts)  Bio   Forum Administrator
Date Reply #11 on Sat 26 Aug 2006 10:04 PM (UTC)
Message
It should compile. Can you post your error messages? Did you use Cygwin or directly on Linux?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #12 on Sat 26 Aug 2006 10:58 PM (UTC)
Message
I used linux, from my shell its like fedora core 4, but I cant use the shell because the bill is late, so once I can pay the bill I'll test it.

Everything turns around in the end
Top

Posted by Davion   Canada  (10 posts)  Bio
Date Reply #13 on Wed 30 Aug 2006 12:45 AM (UTC)
Message
If you're looking for C++/MySQL, and check out the MySQL C api, consider using a third party C++ wraper for it. http://tangentsoft.net/mysql++/ is the only one I know of (and you can find the link to it via mysql development site). It says it's based of STL principals so you'd have to pick up the basics of STL, which some C++ books cover. If you don't feel the need to buy a book, then look no farther than this site! Probably 70% of my knowledge of STL is derived from this site! The other is reading docs and experimenting. You can thank Nick for the wonderful resource! Also, once you pick up the basics of C++, check out Stroustrup's book on C++. Wonderful reference and tool. Also, I have a very premature C++ MUD with a bunch of odd MySQL stuff. It doesn't use mysql++, it's my own doing ;). alhaen.gfys.ca/alhaen.tar.gz check it out, it'll probably confuse you at first, then once you know C++ you'll realize how bad some of it is, heh :).

Davion
Top

Posted by Kiasyn Kelle   (15 posts)  Bio
Date Reply #14 on Wed 30 Aug 2006 12:11 PM (UTC)
Message
player.cpp:
void Player::Create()
{ String query;
query << "INSERT INTO `Players` VALUES()";
query.Query();
query.Empty();
query << "SELECT * FROM `Players` ORDER BY id DESC limit 1";
MYSQL_RES *rez;
if( !( rez = query.Query() ) )
{ Logs::cout << "Player::Create: Select statement empty!" << Logs::endl;
return;
}

MYSQL_ROW row = mysql_fetch_row(rez);
SetId(atoi(row[0]) );
mysql_free_result(rez);
Save();
}

lol shouldnt all that just use mysql_insert_id :/
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


66,048 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.