Home » U++ Library support » U++ SQL » Multi-column unique index
Multi-column unique index [message #37134] |
Tue, 28 August 2012 18:48  |
|
Hi,
I just noticed (when I needed it ) that MySql package doesn't currently support multi-column unique index. This feature is implemented for Oracle, Postgre and Sqlite, but not for MySql and MSSQL. I am only familiar with MySql, where this can be fixed by adding following code to MySqlSchema.h:#define DUAL_UNIQUE(k1, k2) ATTRIBUTE("alter table @t add unique index DQ_@t$" #k1 #k2 " (" #k1 ", " #k2 ");",\
"alter table @t drop index DQ_@t$" #k1 #k2 ";")
#define UNIQUE_LIST(u, l) ATTRIBUTE("alter table @t add unique index UQ_@t$" #u " (" l ");",\
"alter table @t drop index UQ_@t$" #u ";")
I succesfuly tested this code with 5.5.27, but if I remember correctly it should work even with older versions.
Is there any reason why this was omitted from the schema? If not, can someone please commit it? 
Best regards,
Honza
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 14:26:18 CEST 2025
Total time taken to generate the page: 0.02786 seconds
|