Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Multi-column unique index
Multi-column unique index [message #37134] Tue, 28 August 2012 18:48 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi,

I just noticed (when I needed it Smile ) 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? Smile

Best regards,
Honza
 
Read Message
Read Message
Previous Topic: MySQL Example: NativeMySql/NativeMySql.sch: No such file or directory
Next Topic: Problem when call a BIG stored procedure !
Goto Forum:
  


Current Time: Sun Apr 28 20:13:58 CEST 2024

Total time taken to generate the page: 0.04905 seconds