C++ MySQL / Linux API Project

Completed Posted Apr 8, 2002 Paid on delivery
Completed Paid on delivery

This Linux Based C++ program which involves two phases: Phase A Assighment ??" Reading the file efficiently for parsing line by line for Syntax Checking and further processing. Given the following Sample ASCI file with an invoice, the program has to read an entire data file Which can be from less than 1 K like the following, up to an unlimited size, which in reality could top 100K. The difference in sizes between the files are the “detail lines?? of the invoice. These lines are identified by their tag, which starts with a 551 at the left, followed by a 554 line for each detail item. The following example is an entire file which contains two detail lines in it. The rest of the info is header stuff: 500|1|3658|2004986|400|| 501|3658|2004986|400|1|H3|400||GME010808L63|MARR610323HASRYC03|9.04680|0|0|0|0|0|1034.208|7|7|7|1|GDI MEX, S.A. DE C.V.|COLINAS SECCION COLINAS PARQUE INDUSTRIAL EL FLORIDO||11730|22597|TIJUANA|BC|MEX| 505|2004986|08042002|1327-18|FOB|USD|46600.00|46600.00|USA|CA|33-0952223|MEC DESIGNS INC.|PATHWAY STREET SUITE 101||9540|92071|SANTEE| 506|2004986|1|08042002| 506|2004986|2|08042002| 507|2004986|MQ|20013242| 509|2004986|16|140.00000|2| 510|2004986|16|0|161| 511|2004986|1|PLACAS NO:| 511|2004986|2|VER DATOS DE MERCANCIA EN FACTURA ANEXA.| 511|2004986|3|ANEXO COPIA DE CERTIFICADO T.L.C.| 551|2004986|84659101|1||CORTADORA DE PALOS AUTOMATICA|193602.00|193602|193602|21400.00|1.000|6|1.000|6|0|0|1||||USA|USA|CA|BC|BC|CA| 554|2004986|84659101|1|TL|| 551|2004986|84282099|2||BANDA TRANSPORTADORA ALIMENTADORA|75993.00|227979|227979|25200.00|3.000|6|3.000|6|0|0|1||||USA|USA|CA|BC|BC|CA| 554|2004986|84282099|2|TL|| 801|[url removed, login to view]|1|15|1| 999|3658|107 Assignment for Phase A Create a program called validate which would be called with two arguments: Syntax: int validate(szFileName, nMode) Example of a unix program call: $ validate _ [url removed, login to view] _ 1 The program would return: 1 if the file was found and processed, f the file was not found … other codes would be created depending on the errors in the file. 1) Create a function that reads the whole file passed to is a parameter in the Linux command line into a “malloc-ed?? Memory Buffer: EG: lBytes = ValidateFile( szFileName, pszFileContents, nMode); lBytes = ValidateFile(“/data/validate/[url removed, login to view]?, pszFileContents, 1); (continues in the "Deliverables" section)

## Deliverables

Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. (Continues from above) Where long lBytes .- is the size of the file read in Bytes, char szFileName[256].- is the Name of the file to be read char * pszFileContents ??" is a pointer to a dynamically allocated memory space with the file contents nMode ??" is an reserved Flag for internal use (it sets the validation Mode) 2) Create a ReadLine which when called retrieves the following line from the pszFileContents Buffer after each call and puts it into a line buffer szCurrentLine. It would be an equivalent to a scanf(); Syntax: int ReadLine(pszFileContents, szCurrentLine) EG: nCharacters = Readline(pszFileContents, szCurrentLine) Where Int nCharacters is the number of characters read in the line. When EOF is found, -1 would be returned. char * pszFileContents is the pointer to the “file contents?? memory space szCurrentLine is a null terminated array of characters where the line contents will be stored. The function would return the number of characters in the line. 3) Create a function which would take an array of pointers to character strings and fill them with the fields in such line. As the sample above shows, the “field delimiter?? is the “pipe character?? | . Syntax: int nFields(szCurrentLine, pszFieldList); The function would return the number of fields in the line, and would fill the dynamically allocated Array of dynamically allocated strings in such a mode that we could access each of the fields as follows: pszFieldList[0], pszFieldList[1], pszFieldList[2], etc. Looking at the first line of the sample above, 500|1|3658|2004986|400|| nFields would return 6, where pszFieldList[0] would contain “500?? pszFieldList[1] would contain “1?? pszFieldList[2] would contain “3658?? pszFieldList[3] would contain “2004986?? pszFieldList[4] would contain “400?? pszFieldList[5] would contain “?? 4) Cleanup Field List Function Write a CleanUpFieldList(pszFieldList); which would free the memory of the dynamically allocated arrays and do the cleanup work in order to prepare for the next time around. Syntax: int nCleanupFieldList (pszFieldList)); Phase B Assignment ??" MySQL select Query. When in validation mode, each line, depending on the tag, we need to concentrate on the tags which contain the “551?? prefix. Once we find the 551 prefix, the third field will contain an Item Catalog Number which we would then Need to find in a Product table on a “mysql?? database, based on such “catalog item number??. A specific case in the example above, by looking at the following line: 551|2004986|84659101|1||CORTADORA DE PALOS AUTOMATICA|193602.00|193602|193602|21400.00|1.000|6|1.000|6|0|0|1||||USA|USA|CA|BC|BC|CA| We would look at the “Catalog?? table based on the third field above, containing the value: “84659101?? in the CatNumber field of the mysql table. 1) Write a Function to look up at such a mysql table and return an array of the fields if found, Not found otherwise.

## Platform

Linux Platform, written on c++ (cpp). Using the mysql c++ api on RedHat Linux. Comments MUST be in English - please. We have written applications using php, Mycrosoft Access with odbc, shell calls, etc. but have not been able to get it to work with c++ yet. Any advice on a special library which we will need to download in order for the c++ application to work? Thanx

## Deadline information

Phase 1 must be completed by 4/15/2002. Only coders with experience with Redhat linux, mysql, and cpp. Comments musb be in English - please.

C Programming Database Administration Engineering Linux MySQL PHP Software Architecture Software Testing SQL UNIX

Project ID: #2845592

About the project

12 proposals Remote project Active Apr 12, 2002

Awarded to:

cinterosystems

See private message.

$127.5 USD in 14 days
(139 Reviews)
5.6

12 freelancers are bidding on average $193 for this job

olegvw

See private message.

$212.5 USD in 14 days
(65 Reviews)
6.3
harpvw

See private message.

$255 USD in 14 days
(24 Reviews)
4.5
bevolexvw

See private message.

$255 USD in 14 days
(3 Reviews)
4.0
rcn2000

See private message.

$212.5 USD in 14 days
(6 Reviews)
3.7
coderdudevw

See private message.

$255 USD in 14 days
(5 Reviews)
1.3
bamboovw

See private message.

$170 USD in 14 days
(0 Reviews)
0.0
jura3

See private message.

$127.5 USD in 14 days
(0 Reviews)
0.0
vw330885vw

See private message.

$127.5 USD in 14 days
(0 Reviews)
0.0
rpsvw

See private message.

$233.75 USD in 14 days
(1 Review)
0.0
amartyavw

See private message.

$170 USD in 14 days
(1 Review)
0.0
Axiom

See private message.

$170 USD in 14 days
(0 Reviews)
0.0