From: Igor S. <oz...@gr...> - 2000-09-06 16:52:47
|
Me and Rodrigo have been discussing whether the classes posted on the CVS under server/dbfront/ are OK. Rodrigo suggests that we should use mysql++ instead of Connection.*, Result.* and Row.*. Rodrigo wrote: First of all, I really really really really think you should consider using mysql++ when using C++...it already has all the stuff you're redoing here...if you want an additional abstraction layer, you can re-write your code to use MySQL++, although I don't think that would be necessary... [ozra] Since we would use MySQL only at the beginning and then very likely move to a different database, those classes would serve as an abstraction to any DB we might switch to in the future. With these classes it would be very easy to do. Plus, we can closely control how much extra overhead classes cause on the program. about your program, it's missing a semicolon at the end of the query string...it was also missing an include for stdio.h in Row.h....oh and, eeeewwww your makefile looks ugly...also, what the heck is %p in a printf?? I changed it to %s...still SEGFAULTs though... [ozra] %p is for printing pointer value in hex. Sorry I put all that extranious crap in there -- it was all there for testing purposes. I fixed the problem. The reason it crashed was because I wasn't using the classes correctly. Now it's querying and getting results correctly. Go and look at those files again. but really, try to restructure your program to use MySQL++, 'cause that way you're using something that we KNOW works... [ozra] These classes are taken out of a MySQL book. They should work well in real life, and they use a handful of MySQL C API functions within, which makes it easy to check if they work well or not. They will make the conversion into a different database seemless (or almost). Also, you're mixing C and C++ too much, that gets confusing...like, use cout << "text" << endl; instead of printf("text\n");, it's more clear... [ozra] I don't personally mind mixing them. I'm sending you a little MySQL++ program that I made so that you can take a look at all these points and see how it should be done...it's not really structured into classes but it uses C++ classes from MySQL and other standard C++ classes... [ozra] You are mixing C with C++ concepts too :) Adding cin's and cout's does not make code pure C++. But anyway. I am not saying your are not right about using mysql++. Look at my points and tell me if I am still wrong by using these classes. Cheers, ozra. |