Looking for C++ programmer

  • Status: Closed
  • Prize: $100
  • Entries Received: 13
  • Winner: yalossolutions

Contest Brief

Contest: We are looking for a C++ developer for ETL development. Before choosing the right developer for our project, we are creating a contest that would help us in finding the right candidate. Please write a C++ program using all the modular programming and best practices. The program will read a csv file that can have multiple columns, loop thru all the records and create sql insert statements in the file.

Name of the program: GenerateInsertSql

Folder structure:
c:\sofware\app\script,
c:\sofware\app\input
c:\sofware\app\output
c:\sofware\app\log

LogFile (default $log\GenerateInsertSql_yymmdd_hhmmss.log)

Input File: Please see csvfile below & attached.
csvfile desc:
-number of columns can be unlimited
-number of rows can be unlimited
-first row has column names
-first column is always databasename
-second column is always tablename

Output file: Please see the sql below & attached

Input Arguments:
1. FilePath (mandatory) e.g. 'c:\software\input\storedata.csv',
2. OutputFilePath (mandatory) e.g. 'c:\software\output\storedata.sql'
3. PrimaryKeys e.g. 'storeid|storename' /* all these columns will be used to check the record before inserting */
4. ExecuteSQL (Y/N) default N
5. Debug (Y/N) default N /* If debug = Y, print more detail in the log file */

Output:
1. RetCode Int e.g. 0 - success, >0 failure

Logic:
- Get the argument. If mandatory parameters are null or emtpy, raise an error with program usages
- Read the csvfile (please see the sample)
- Generate SQL file (please see the sample. It's in microsoft sql format)
- if ExecuteSQL = 'Y', execute the SQL from the sql file

Best practices:
- use modular programming
- use naming standards
- show proper error messaging
- show help
- create log
- Write comments
- Program should be easy to read, use and maintain by junior developers
$50 is the award for the contest. We will create and award the actual project to those one or two developers whose program we will like the most .If there are any questions, please don't hesitate to ask. All the best!
-----------------------------------------------------
Inputfile (sample) :
databasename|tablename|storeid|storename|storedesc|store1|store2|store3
testdb|storedata|1|store1|store desc1|A|F|A
testdb|storedata|2|store2|store desc2|B|G|B

Output File (sample):
------------------------------
begin tran
-------------------------------- storedata ----------------------------
if not exists (SELECT * from storedata where storeid = 1 and storename = 'store1')
insert into storedata(storeid,storename,storedesc,store1,store2)
values(1,'store1','store desc1','A','F')

if not exists (SELECT * from storedata where storeid = 2 and storename = 'store2')
insert into storedata(storeid,storename,storedesc,store1,store2)
values(2,'store2','store desc2','B','G')

if not exists (SELECT * from storedata where storeid = 3 and storename = 'store3')
insert into storedata(storeid,storename,storedesc,store1,store2)
values(3,'store3','store desc3','C','H')

if not exists (SELECT * from storedata where storeid = 4 and storename = 'store4')
insert into storedata(storeid,storename,storedesc,store1,store2)
values(4,'store4','store desc4','D','I')

if not exists (SELECT * from storedata where storeid = 5 and storename = 'store5')
insert into storedata(storeid,storename,storedesc,store1,store2)
values(5,'store5','store desc5','E','J')
-------------------------------- storedata----------------------------

if @@error = 0
begin
commit tran
print '>> Insert into storedata completed. <<<'
end
else
begin
rollback tran
print '>> Insert into storedata failed. <<<'
end

Recommended Skills

Public Clarification Board

No messages yet.

How to get started with contests

  • Post your contest

    Post Your Contest Quick and easy

  • Get tons of entries

    Get Tons of Entries From around the world

  • Award the best entry

    Award the best entry Download the files - Easy!

Post a Contest Now or Join us Today!