Ticket #841 (new defect)
Codegen not creating [Collumn]Default constants properly
| Reported by: | joe | Owned by: | |
|---|---|---|---|
| Priority: | important | Milestone: | |
| Component: | Database adapter | Version: | 2.1.0 Stable |
| Keywords: | Cc: |
Description
Currently all database 'Gen' classes are being created with NULL defaults constants.
For example in our table, we have a column named UserName with a default of 'Guest'. In the TableNameGen class file, there is a constant being created named UserNameDefault being set to NULL. However, it should be set to 'Guest'.
I have a fix for MySqli adapter. Line 566 in QMySqliDatabase.class.php QMySqliDatabaseField::__construct(), add right after if ($objRow["Field"] == $this->strOriginalName) {
$this->strDefault = $objRow["Default"];
After adding this, we are able to use the constant TableName::UserNameDefault, and $objTableName->Initialize() works as expected.
I have to work on learning how to generate and upload a diff.

