Elxis CMS Forum

Support => FAQs => Topic started by: Ivan Trebješanin on May 12, 2007, 02:51:53

Title: SQL backup from Elxis backend
Post by: Ivan Trebješanin on May 12, 2007, 02:51:53
Hi,
I didn't want to bother anyone, but this is what I get everytime I try to import SQL dump I made from admin panel. First two times I was thinking that I'm doing something wrong, but this is the third time, so I want to know if someone have imported SQL dump and how? Below is the text I get from phpmyadmin.


SQL query:

INSERT INTO elx_components( id, name, link, menuid, parent, admin_menu_link, admin_menu_alt,
OPTION , ordering, admin_menu_img, iscore, params )
VALUES (
"1", "Banners", "", "0", "0", "", "Banner Management", "com_banners", "0", "js/ThemeOffice/component.png", "0", ""
);

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option,ordering,admin_menu_img,iscore,params) VALUES ("1","Banners","","0","0","' at line 1
Title: SQL import fix
Post by: datahell on May 12, 2007, 10:46:38
We have discussed this issue in the past.
You must surround the word "option" in backticks (`). "option" is a reserved word in mysql and that's why creates problems parsing the sql file. So, you must edit the sql file and do the replacements before trying to import it.

Example:

INSERT INTO elx_components( id, name, link, menuid, parent, admin_menu_link, admin_menu_alt,
`option`, ordering, admin_menu_img, iscore, params )

You can also add backticks to all other column names if you wish.


To fix this issue in Elxis 2006.4 do the following
Open /administrator/components/com_database/drivers/mysql.php

Go to line 139.
Replace this:

$temp_sql.=' ('.@implode(',',$fields).')';

with this:

$temp_sql.=' (`'.@implode('`,`',$fields).'`)';

Save the file. Done!

Create a new backup file. That file can be imported without errors.

This fix has already been applied to Elxis 2007
Title: Re: SQL backup???
Post by: Ivan Trebješanin on May 12, 2007, 12:56:25
Thank you, so much datahell,

I'm really embarrassed to bother you, You've helped me a few times already, and I know you're so busy right now. I hope I will be able to return this favour sometime.
Title: Re: SQL backup??? [SOLVED]
Post by: datahell on May 12, 2007, 13:16:37
No one forces me to reply. I reply because I want to help people that honoured us by using Elxis. Don't hesitate to ask and please don't say that you bother me.  ;)