mysql - How should I design the interface to a SQL column generator in PHP? -


I am working on a framework in PHP, part of the work of this framework, to write new SQL code To Generate New MySQL Columns

What is the best way to go to a bunch of parameters for columns and then to convert it into SQL code? For example, I have some YAML here, which specifies the parameters to create a varchar column:

  - Type: character data-type: type: varchar length: 255 decimal: empty Unsigned Faucet: Zero Zero: Faucet Collate: UTF 8_Incode_I Character Set: UTF8 Binary: Wrong Local-Type: Zero Value: Cancel Null: Correct Default: Zero Salary Increase: False Unique: False Elementary: False Comment: It's a Small Normal The text field is. Format: Default storage: Default  

The lack of my design is as follows:

  1. YAML can not contain any SQL syntax
  2. PHP code should be abbreviated as possible.

I recommend you create a class column, as a constructor logic , An array that can define the desired configuration points. Those who do not make any difference in every particular case do not define you.


Comments