Data Model Code Generation
Don't repeat yourself Often developing applications we find ourselves writing the same code more than once and often this code regards access to data. If the data are stored on the relational database we need to implement the functions that perform the operations of create, read, update and delete (CRUD) and some other utility functions to retrieve a entity by primary key, count the entities in the table and etc. We can write the same code for each entity or we can write the code generator that will implement it for us. For this reason code generators can be useful to produce the repetitive code that we should implement by hand, thus eliminating the tedious part of writing code. Querying MySQL Information_Schema In order to generate the code that accesses the entities we need to know the structure of these entities. If the data are stored on the MySQL database we can query the " Information Schema " to know the database structure. Information_schema co...