I am developing a note taking program for my school project. The note including some drawing and text. It is easy to code with some basic program开发者_StackOverflowming skills, but the note is need to be saved and read again. So, that I need a data structure to store the data, and read back the data. What should I do first? How to store it in database? Any recommendations? Thank you.
Given the nature of your data, I would use XML to store and retrieve the information.
Why not a database: notes are documents, not records/structures
Why not a picture: you probably want to edit the notes
Make a new table in your database that has the column id (auto increase).
Make a new folder for each id(on insert) that in it you will save the picture(all with the same name and format), and the text(.html).
Then your getPicture(id) will go to the folder id and get the picture, same with the text.
I would even go so far as to save your notes as html, you could embed css in the same file. Don't invent the wheel twice ;)
精彩评论