Database programming
Well due to finding out i have to pay for using MySQL for commercial use i''ve been forced to make my own. The only problem is I don''t know how really. Would i store the data in files on the hard drive? How would i make it a service? I can handle the netcode as i know winsock i jsut need to know how databases work and such.
ALL YOUR BASE ARE BELONG TO US!!!!
May 08, 2001 08:05 AM
You''re saying that you need to write your own database engine...
If you''re using c++, then each record is an object. Code up some get and put methods for each variable(field) in the object(record). When you query, something like "select * from MyData where FirstName = ''Bob''", use a container (STL or whatever) to just walk down the list of all the objects(records), and call the GetFirstName and test each one. For large datasets this gets a bit slow, so you might want to index a variable(field) in the object.
Now, writing the command parser is not to difficult, but just time consuming. I usually come up with my own dumbed-down version of query syntax that does only what I need for the app/game and nothing more.
There''s a lot more to it for a true RDBMS, but if you need one cheap and fast, I''ve used this teq for quite a while now.
Hope this helps,
Dave
If you''re using c++, then each record is an object. Code up some get and put methods for each variable(field) in the object(record). When you query, something like "select * from MyData where FirstName = ''Bob''", use a container (STL or whatever) to just walk down the list of all the objects(records), and call the GetFirstName and test each one. For large datasets this gets a bit slow, so you might want to index a variable(field) in the object.
Now, writing the command parser is not to difficult, but just time consuming. I usually come up with my own dumbed-down version of query syntax that does only what I need for the app/game and nothing more.
There''s a lot more to it for a true RDBMS, but if you need one cheap and fast, I''ve used this teq for quite a while now.
Hope this helps,
Dave
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement