Scenario: I've got a MySQL database of individuals and all sorts of their various features as characteristics. I Quickly in addition have a huge file which lists (line-by-line) characteristics which describes a person. This result should limit everybody who match/have these qualities.
How do you query the database on the line-by-line file, to obtain is a result of that database right into a single view?
What approach will i decide to try interface my database using this type of querying?
What's the best overall method of this issue because of the conditions?
Illustration of file:
male, brown hair, green eyes, height 6" age 12 female, blonde hair, blue eyes, height 5'9" age 33 male , black hair, brown eyes, height 5'6" age 13 male, brown hair, brown eyes, heigh 6'1" age 34
Consists of table with characteristics for those fields
How do I query the database on a line-by-line file, to get results from that database into a single view?
Well Really listed here are the perfect steps
1) Open file
2) Convert lines to array
3) For every aspect in the array make use of a threaded function that converts the needed qualities to SQL Statement
4) Send the query towards the query handler (ill explain afterwards)
What approach do I take to interface my database with this type of querying?
For optimal performance you will have to possess a database class which will que the claims. I'm not sure the word what you are onto however, you will max the performance in case your class has the capacity to operate in this logic:
1) Each new statement continues a que
2) Before performing an argument, use prepare statement from the database
3) After performing the statement, save the outcomes somewhere after which execute the following statement
What is the best overall approach to this problem given the circumstances?
Ultimate way is applying a quick and OO capable interface for hooking up towards the database and loading the entire file in memory to ensure that you'll minify the disk overhead. I highly recommend to load the database on the ramdisk for those who have enough ram.