简体   繁体   中英

How to make propel orm use case-sensitive names

Propel ORM fails to query on the production environment because the database it connects to has case-sensitivity enabled (linux/ubuntu). Since the db is managed by another organization, it's harder to get it fixed than to make the changes to the code from our end.

Is there a way to force Propel ORM to use case-sensitive names?

Thanks!

Propel has a Map directory inside the generated files. The directory has all the mappings of table and column names which propel uses onto what MySQL uses.

We solved our problem by writing a simple python script that corrects the case-sensitivity as per our requirements.

Each file inside the Map directory corresponds to the mapping for one table. Our script opened each file one by one and replaced the each mapping with our specific requirement (which was to make table names upper case):

Here's the RegEx we used to match table name mapping:

"(\s*const TABLE_NAME = ')([a-zA-Z_]+)(';)"

RegEx for matching column mapping inside each file:

"(\s*\* the column name for the.*\s*\*\/.*\s*const [a-zA-Z_]+ = ')([a-zA-Z_]+)(\.[a-zA-Z_]+)(';)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM