Sign in to follow this  

Sql design

This topic is 2570 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a need for Sql in my application for settings rather than the standard configuration file. The classes are pretty much small in my application, but I also want to allow other users to be able to access my database for their own needs and can implement tables also for overall storage if they prefer.

I'm having trouble on coming up with a good design for it, my sql is pretty limited, it doesn't need to be a full blown sql, but good enough to use. I'm writing this for SQLite. I have my gui's sql framework which I already know how to use. Just need a design to wrap it for easier reuse if I want in another application and to make available to plugin developers. This is all in C++ btw. I don't really want to depend on additional libraries for this because I already have 6 right now and that's really enough already.

Share this post


Link to post
Share on other sites
What do you mean "allow other users to be able to access my database". You generally don't want to do this.

Describe your use case. These other users, are they application developers? Are they extending your application, or modding it? Can you give an example of what someone would do with it.

Share this post


Link to post
Share on other sites
Well it's the users own database and since all the passwords are encrypted with blowfish. The reason I thought I should allow it was because sqlite doesn't really offer any protection and it'd be easily to allow the user to move their database if they don't store their home on another partition or for windows and mac. So they can store plugin information in it instead of creating X number of configuration files making it little more difficult to migrate to another OS or distro.

The end users are normal users while also they can be developers. They will be extending the application like adding new docks, network scripts, scripting in python, ruby, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by SeaBourne
I'm having trouble on coming up with a good design for it, my sql is pretty limited, it doesn't need to be a full blown sql, but good enough to use.


I'm not exactly sure what you're asking for here? SQL is a language and is implemented already by SQLite.

Share this post


Link to post
Share on other sites
Quote:
Original post by WavyVirus
Quote:
Original post by SeaBourne
I'm having trouble on coming up with a good design for it, my sql is pretty limited, it doesn't need to be a full blown sql, but good enough to use.


I'm not exactly sure what you're asking for here? SQL is a language and is implemented already by SQLite.


Yeah I know. I wanted to know what design pattern would be good that is easy to implement and use but while also easy to allow reuse in other projects.

Share this post


Link to post
Share on other sites
Design pattern for what (specifically), though?

As far as I can tell, you want some kind of configuration or preferences system. First think about how you and other clients of the system would like to interact with it. Sketch some uses in code. This will lead to functions, classes and so on emerging naturally as use-cases are covered.

Then figure out how to implement that API in terms of SQL statements (if you insist on using SQLite as a backend). Certain patterns may emerge from this effort, at which point you can see if there's a platonic ideal of it in the literature (GoF etc) that you might try to head towards.

In general you shouldn't try to sandwich as many patterns in to your code as possible. Instead given prior knowledge of patterns you can learn to recognize them in the code you're writing and riff off of their formalism in order to improve the specifics of your particular implementation.

Share this post


Link to post
Share on other sites

This topic is 2570 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this