U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ SQL » PostgreSQL Support Classes [Experimental]
Re: PostgreSQL Support Classes [Experimental] [message #9076 is a reply to message #9065] Mon, 16 April 2007 19:44 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
unodgs wrote on Mon, 16 April 2007 06:13

Quote:

Obviously, not as sexy as simply puttin more "PRIMARY_KEY" columns, OTOH at least Oracle SQL syntax is similar - you have to add it in single contraint, not as several "PRIMARY_KEY" comlums.

If databse is SQL 92 compatible there is posibility to define primary key in single line. It seems that most of db engines support it.
create table t
(
  id integer,
  ver integer,
  type integer,
  ...,
  primary key(id, ver, type)  
)




Sure, above is a direct equivalent of what have now. SQL allows to define single-column keys in the column and multi-column keys as additional contraint...

Quote:


I proposed putting PRIMARY_KEY attribute next to every column to avoid several macros.
Of course I don't know if it is possible to implement it using c preprocessor.



You would have radically change schema code, but I guess it is possible somehow.

Quote:


If not - I suggest to get rid of primary_key attribute as well as DUAL_PRIMARY_KEY and define new macro
PRIMARY_KEY(...) which allow you to define primary key for maximum 5 columns.


Well, but C++ does not have variadic macros (yet?).

BTW, I have just checked and I have used DUAL_PRIMARY_KEY once in my "grand IDIS DB schema" of 500 tables... (OTOH, it is also true that I perhaps deliberately avoid it).

My suggestion is to use current way for now; maybe we can do better when we have all RDBMs implemented and have some experience with it; maybe we will then develop some "common .sch language" to have single .sch for all of them.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Catch errors with Sql.Execute
Next Topic: Newbie help with PostgreSQL example
Goto Forum:
  


Current Time: Tue Jun 30 07:27:36 GMT+2 2026

Total time taken to generate the page: 0.00844 seconds