[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  Programming
. -> [Folder]  General
. . -> [Subject]  C++ and Mysql

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

C++ and Mysql

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1 2  

Posted by Metsuro   USA  (389 posts)  [Biography] bio
Date Sat 26 Aug 2006 01:46 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Tzaro   USA  (41 posts)  [Biography] bio
Date Reply #1 on Sat 26 Aug 2006 01:59 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #2 on Sat 26 Aug 2006 02:02 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Metsuro   USA  (389 posts)  [Biography] bio
Date Reply #3 on Sat 26 Aug 2006 02:31 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Metsuro   USA  (389 posts)  [Biography] bio
Date Reply #4 on Sat 26 Aug 2006 03:14 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sat 26 Aug 2006 03:29 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #6 on Sat 26 Aug 2006 03:33 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Metsuro   USA  (389 posts)  [Biography] bio
Date Reply #7 on Sat 26 Aug 2006 03:40 AM (UTC)  quote  ]
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
[Go to top] top

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

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Samson   USA  (683 posts)  [Biography] bio
Date Reply #9 on Sat 26 Aug 2006 06:46 PM (UTC)  quote  ]
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.

SmaugMuds.org: http://www.smaugmuds.org - The Smaug MUDs Community Center

"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984
[Go to top] top

Posted by Metsuro   USA  (389 posts)  [Biography] bio
Date Reply #10 on Sat 26 Aug 2006 06:49 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Sat 26 Aug 2006 10:04 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Metsuro   USA  (389 posts)  [Biography] bio
Date Reply #12 on Sat 26 Aug 2006 10:58 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Davion   Canada  (10 posts)  [Biography] bio
Date Reply #13 on Wed 30 Aug 2006 12:45 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Kiasyn Kelle   (15 posts)  [Biography] bio
Date Reply #14 on Wed 30 Aug 2006 12:11 PM (UTC)  quote  ]
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 :/
[Go to top] 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.


14,485 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]