View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 6 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Mon Mar 12, 2007 8:49 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
It seems simple enough, but I cannot figure this one out. I've googled and searched the mythtv mailng list. I want to copy the keybindings from my main mythtv box "mythbox" to a new frontend "mythbox-rfe-2." I found this on the mythtv mailing list:
Code:
REPLACE INTO settings (data, value, hostname)
SELECT (data, value, "new_host")
FROM settings
WHERE hostname = "old_host";
and substituted the proper table (keybindings, instead of settings) and also changed the column names to the colum names in keybindings, but it does not work (which was noted later in the thread). So my syntax was:
Code:
REPLACE INTO keybindings (context, action, description, keylist, hostname)
SELECT (context, action, description, keylist, "mythbox-rfe-2")
FROM keybindings
WHERE hostname = "mythbox";

and I get this error:
Quote:
ERROR 1241 (21000): Operand should contain 1 column(s)

I tried using mythweb to manually adjust each keybinding, but nothing sticks except for on the master backend ("mythbox").

I'm obviously not a MySQL genius. Does anyone know how this can be done?

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 6:50 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
First off....Please have a good, current backup before manually running SQL against your database

you want to insert not replace and you need to lose some parens...

Code:
insert INTO keybindings (context, action, description, keylist, hostname)
SELECT context, action, description, keylist, "mythbox-rfe-2"
FROM keybindings
WHERE hostname = "mythbox";

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 11:04 am 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
Thanks khrusher. I'll give this a try later when I have time to make a backup (and time to restore if I screw it up.) The new frontend machine "mythbox-rfe-2" is already online, so it already has entries in the keybindings table. I believe I do want to use the replace command. Is it as straight forward as substituting "replace" where you wrote "insert"? Thank you very much! :D

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 14, 2007 6:29 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
it can be tricky to 'merge' the data from the front ends...

Are there keybindings for your second front end that you dont want overwritten? If so are there many?

If you want all of the keybindings from FE1 to be duplicated to FE2, the easiest way would be to delete the existing FE2 records and then do the insert from FE1.

Code:
delete from keybindings WHERE hostname = "mythbox-rfe-2";

insert INTO keybindings (context, action, description, keylist, hostname)
SELECT context, action, description, keylist, "mythbox-rfe-2"
FROM keybindings
WHERE hostname = "mythbox";


Otherwise you'll need to build a more complicated 'WHERE' clause to tell the SQL statement which "mythbox-rfe-2" keybinding records should be replaced or updated by which particular "mythbox" records. (or conversely, tell the SQL which record NOT to update)

If there are only a few difference between the "mythtv" settings and the final desired "mythbox-rfe-2", might be easier to do the delete, update as above then manually make the "mythbox-rfe-2" adjustments.

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 14, 2007 1:21 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
khrusher wrote:
it can be tricky to 'merge' the data from the front ends...

Are there keybindings for your second front end that you dont want overwritten? If so are there many?

If you want all of the keybindings from FE1 to be duplicated to FE2, the easiest way would be to delete the existing FE2 records and then do the insert from FE1.


No, there are no keybindings on "mythbox-rfe-2" that I want to save. Your method of deleting them all and then inserting sounds like the way to go. I'll give it a shot. Thank you for your help.

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 14, 2007 5:56 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
Thanks khrusher, that seemed to do the trick.

_________________
Mike
My Hardware Profile


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu