CopyMaker
Daniel Coturel

Daniel Coturel @elcotu

About: Java and PHP programmer.

Location:
Buenos Aires
Joined:
Nov 7, 2017

CopyMaker

Publish Date: Apr 11 '18
7 0

Hi people,
I wanted to show you a little utility I made and decided to publish on GitHub.

I work mainly with a legacy ERP with it's own database, and many times I need to create new records in tables. But in much cases, having to choose between map a 40+ fields table into one of my objects, with their own CRUD behaviour, or make raw SQL statements.
In the second case, one of my favourite strategies is to choose a model element of the table and build a SQL query like this one:

insert into TABLE
select Field1, Field2, Field3 from TABLE where Field1 = :Value

Enter fullscreen mode Exit fullscreen mode

Having this SQL modified, replacing field names in the select with values:

insert into TABLE
select :NewId, 'New Value', Field3 from TABLE where Field1 = :Value

Enter fullscreen mode Exit fullscreen mode

So here come this class, CopyMaker, wich allows you to:
1) Add String or Integer values informing wich field they override
2) Generate SQL for a specified table and a specified condition

I'm open to advice, improvements and anything on this.

Saludos,

Comments 0 total

    Add comment