Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Bug Reports
 PowerHome Messageboard : PowerHome Bug Reports
Subject Topic: SQL Errors Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: September 30 2004 at 16:33 | IP Logged Quote PhilC

Hi,
I have discovered a rather strange bug.
I have about 300 macros to import, so I wrote a perl script to construct the SQL file. The trouble was each time I tried to execute the query, I kept getting an sql error about primary key not being unique.
I then executed the sql command DELETE FROM macroheader. Now when I try and import a macro, it does import it, but it shows me a version of the macro I had created about 5 minutes ago. No matter how muchI edit the sql macro command, it still brings in the old macro???

Database fields not being cleared??

Thanks
Phil
Back to Top View PhilC's Profile Search for other posts by PhilC
 
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: September 30 2004 at 16:52 | IP Logged Quote PhilC

never mind, I seem to have done it by reinitializing and adding a unique number before each macro name...very odd

Phil
Back to Top View PhilC's Profile Search for other posts by PhilC
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: September 30 2004 at 19:35 | IP Logged Quote dhoward

Phil,

You may want to try running the SQL below in the SQL Report screen. It will check for any orphan records in the macrodetail table. Ive on rare occasions come across this (records in the macrodetail without a parent in the macroheader). If you were importing a macro that had child records in the macrodetail, that could cause the problem you were describing. In any event, changing the ID by adding a unique number fixed your immediate problem, but you could still have orphans and your database will be out of sync if you call macros from other macros or formulas.

select * from macrodetail where id not in (select id from macroheader)

It's great to see some of the more advanced users taking advantage of the SQL interface. Let me know if you need any help.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: September 30 2004 at 19:38 | IP Logged Quote dhoward

Phil,

I carefully reread your previous message and see that you only ran a "delete * from macroheader" statement. That definately created orphans in the macrodetail table and is what caused your problems. You may just want to do a delete * from macroheader and a delete * from macrodetail and then try reimporting your macros.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: October 01 2004 at 03:42 | IP Logged Quote PhilC

Thanks Dave that certainly makes sense...My knowledge is from MySQL so I am guessing some of these commands!

As it turns out, The laterst version (1.03.4.1) is somewhat different and has no button values in the macros. Although I have managed to import my 300 macros, I now have to create 300 buttons by hand which is not ideal. To get around this, I am considering going back a version so I can contruct my sql statements to include the buttons and then upgrading back to get it in the right format....unless of course I can write directly to the Control Center Tabs, however I have not had any success with this. My tab is called 'channels' so I was doing: insert into CCTABS.channels values (...etc) but that, not surprisingly didn't work. Do you have any suggestions on how to achieve this??

Just for anyone else reading this, I am actually importing the channel change macros for every single SKY digital channel here in the UK. I will make it available in the macros forum when complete.

Thanks Dave.
Phil
Back to Top View PhilC's Profile Search for other posts by PhilC
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: October 01 2004 at 08:35 | IP Logged Quote dhoward

Phil,

Ive got you covered, no need to roll back a version. The Control Center is now contained within two tables...the CCTABS and CCBUTTONS table. Since everything is going into a single tab labeled "CHANNELS", I would just use the PowerHome Explorer and create that tab. Once you've got the tab created and you're happy with all the macros you've imported, run the SQL below:

insert into ccbuttons (select 'CHANNELS',number(*),3,id,0,0,key_desc,4,4,252,96,0,0,0,12632256,10 from macroheader)

This will create a button for each macro found in the CCBUTTONS table on the "CHANNELS" tab. Once the SQL is complete, navigate to CONTROL CENTER->CHANNELS in the Explorer and verify that your buttons are there. From there, you can open the "Design" window and press "Shift-F11" to spread the buttons out so they arent all on top of one another.

Let me know how this works for you.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: October 02 2004 at 07:41 | IP Logged Quote PhilC

Hi Dave,

Excellent, that did the trick however I still had to assign a unique number at the beginning of each macro as it seemed to think these following two were not unique:

insert into macroheader values ('UKTV Gold plus1','UKTVGoldplus1',0,0,0)

insert into macroheader values ('UKTV G2','UKTVG2',0,0,0)

Anyway all imported and now on the Control Center..Great!

Finally, I am happy with the buttons in grey whilst I move them around to suit my background image, but once this is all done, do you have some sql that will convert all the buttons to transparent text and background?

Thanks for all the support...brilliant.

Phil
Back to Top View PhilC's Profile Search for other posts by PhilC
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: October 02 2004 at 15:51 | IP Logged Quote dhoward

Phil,

Not sure why those two statements would give you a problem. I tried them on my system and they worked fine. Anyways, if you're happy, Im happy .

Yep, Ive got the SQL to make the buttons foreground and background transparent. Use the following:

update ccbuttons set key_text = 553648127,key_bkgrnd = 553648127

You restrict to just a certain tab by adding a where clause such as:

where tab_id = 'YOUR TAB ID'

Good luck!

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum