Composite keys

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
tguimond
Posts: 2
Joined: 2013-10-29 17:03

Composite keys

Post by tguimond » 2013-10-29 17:08

I have a table that has this layout in MySQL:
'CREATE TABLE `bread` (
`rundate` varchar(20) NOT NULL,
`runtime` varchar(20) NOT NULL,
`bread` int(11) DEFAULT NULL,
`lread` int(11) DEFAULT NULL,
`rcache` int(11) DEFAULT NULL,
`bwrit` int(11) DEFAULT NULL,
`lwrit` int(11) DEFAULT NULL,
`wcache` int(11) DEFAULT NULL,
`pread` int(11) DEFAULT NULL,
`pwrit` int(11) DEFAULT NULL,
PRIMARY KEY (`rundate`,`runtime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1'

When I try to generate the app, I get this error message: Table 'bread' has too many primary keys. Only one primary key is allowed per table. Is there a way to use composite keys?
How do I work around this?

Thanks,
Tim

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Composite keys

Post by AhmedBR » 2013-10-29 17:46

Did you try to set one primary key in AppGini and do the rest in phpMyAdmin?

I mean something like what I did here:
http://forums.appgini.com/phpbb/viewtopic.php?f=4&t=814
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

tguimond
Posts: 2
Joined: 2013-10-29 17:03

Re: Composite keys

Post by tguimond » 2013-10-29 18:46

No, I hadn't done any experimenting like that yet.
There really aren't two primary keys, there is actually only one composite key (rundate, runtime). These two fields are required to make the unique index, but you got me thinking that I could make a single column (rundatetime) that I build before I put the data into the database and this would get me around the issue where AppGini thinks that I actually have two primary keys.
Thanks,
Tim

Post Reply