Which architecture for a data-extractor
-
Hi There, :-D I have to develop a program (winform) that extracts data from the queries on a DB MSSQL2008 and data are written to a text file in the default locations. The customer asks me to build something dynamic in the sense that if he must add an information to the file or change the value of a field should do so only by adding or modifying the appropriate query. The initial idea is to save in a table the queries needed to extract the value of any information and execute one, then place it in a database the result of support where the tables have the same layout of records in the file to be produced. According to you, wanting to use an approach object-Orientes rather than structural way, how should I organize the source? If you can think of even a better solution to get the result and what is well pleasing. Thanks
-
Hi There, :-D I have to develop a program (winform) that extracts data from the queries on a DB MSSQL2008 and data are written to a text file in the default locations. The customer asks me to build something dynamic in the sense that if he must add an information to the file or change the value of a field should do so only by adding or modifying the appropriate query. The initial idea is to save in a table the queries needed to extract the value of any information and execute one, then place it in a database the result of support where the tables have the same layout of records in the file to be produced. According to you, wanting to use an approach object-Orientes rather than structural way, how should I organize the source? If you can think of even a better solution to get the result and what is well pleasing. Thanks
Rephrasing.... What you want to do is the following 1. Query a database 2. Write the results to a file. Based on that a simple solution is based on the following - the query is a single sql select. If so then you do the following. 1. The sql statement (select) is read from a configuration source. 2. The database layer sequences through the result set columns using a 'get string' api. It also checks for nulls appropriately. 3. An appropriate text output form is defined. It should be capable of dealing with nulls and things like embedded quotes. I would suggest: a. Use tab for a delimiter b. For each string value strip out all tabs, and end of line characters and replace with spaces. 4. You put 1, 2, 3 together to write to the file. Additional items - I suggest that you allow for a configurable file location and file name. Trying to generalize to more complex examples is probably pointless. Too much generalization ends up recreating things that already exist such a programming languages and report generators.
-
Rephrasing.... What you want to do is the following 1. Query a database 2. Write the results to a file. Based on that a simple solution is based on the following - the query is a single sql select. If so then you do the following. 1. The sql statement (select) is read from a configuration source. 2. The database layer sequences through the result set columns using a 'get string' api. It also checks for nulls appropriately. 3. An appropriate text output form is defined. It should be capable of dealing with nulls and things like embedded quotes. I would suggest: a. Use tab for a delimiter b. For each string value strip out all tabs, and end of line characters and replace with spaces. 4. You put 1, 2, 3 together to write to the file. Additional items - I suggest that you allow for a configurable file location and file name. Trying to generalize to more complex examples is probably pointless. Too much generalization ends up recreating things that already exist such a programming languages and report generators.
Not sure you are still looking for an answer. You can do something like a Key and value(payload),ie sql will be for just fetching the value for the given key. Here the value will be a payload(a XML string). You will have template for the xml format. whenever you want to add something you just add it the template. while writing to file you first fetch the payload, then parse the XML, put the parsed values to a file, in what format you want.