Jump to content

CC3 uses sql "reserved words" in table names


Guest

Recommended Posts

Hey I've been looking for the answer to this problem for weeks, when doing a mysql dump I noticed that cubecart 3 uses reserved words in its table names like "default" and "read" which doesn't allow the database to be restored without first renaming the offending tables. This is rediculous and I'm surprised I couldn't find any other thread that deals with this issue since a lot of people must be having it.

Thank you, Aron

Link to comment
Share on other sites

Hmmm.....Nope. No tables with those names here. The tables are:

CubeCart_Downloads

CubeCart_Modules

CubeCart_admin_permissions

CubeCart_admin_sections

CubeCart_admin_sessions

CubeCart_admin_users

CubeCart_category

CubeCart_cats_idx

CubeCart_config

CubeCart_currencies

CubeCart_customer

CubeCart_docs

CubeCart_docs_lang

CubeCart_img_idx

CubeCart_inv_lang

CubeCart_inventory

CubeCart_iso_counties

CubeCart_iso_countries

CubeCart_options_bot

CubeCart_options_mid

CubeCart_options_top

CubeCart_order_inv

CubeCart_order_state

CubeCart_order_sum

CubeCart_search

CubeCart_sessions

CubeCart_taxes

Upon further digging, there are however a couple of fields with those names. In _Modules, there's a "default" field. In _admin_permissions there's a "read", "write", "edit", and "delete" fields. But that's all I can see. You might try editing your .sql file and surrounding those names with delimiters.

As for why there aren't more people having this problem, the software's been out a month. You really think there are a bunch of people out there having to restore backups already? ;)

Link to comment
Share on other sites

I did some more digging. I'm assuming you're doing your dump from a command line. If not, then look for a way to pass switches or options to mysqldump from whatever program you're using.

There's an option for mysqldump to support keywords as table names.

--allow-keywords    Allow creation of column names that are keywords.




Here's the dump without that switch:




--

-- Table structure for table `CubeCart_Modules`

--



CREATE TABLE CubeCart_Modules (

  moduleId int(11) NOT NULL auto_increment,

  module varchar(10) NOT NULL default '',

  folder varchar(30) NOT NULL default '',

  status smallint(1) NOT NULL default '0',

  default int(1) NOT NULL default '0',

  KEY moduleId (moduleId)

) TYPE=MyISAM;

  

--

-- Dumping data for table `CubeCart_Modules`

--



  

--

-- Table structure for table `CubeCart_admin_permissions`

--



CREATE TABLE CubeCart_admin_permissions (

  permissionId int(11) NOT NULL auto_increment,

  sectId int(11) NOT NULL default '0',

  adminId int(11) NOT NULL default '0',

  read int(11) NOT NULL default '0',

  write int(11) NOT NULL default '0',

  edit int(11) NOT NULL default '0',

  delete int(11) NOT NULL default '0',

  PRIMARY KEY  (permissionId)

) TYPE=MyISAM;




Here's the dump with that switch:




--

-- Table structure for table `CubeCart_Modules`

--



CREATE TABLE `CubeCart_Modules` (

  `moduleId` int(11) NOT NULL auto_increment,

  `module` varchar(10) NOT NULL default '',

  `folder` varchar(30) NOT NULL default '',

  `status` smallint(1) NOT NULL default '0',

  `default` int(1) NOT NULL default '0',

  KEY `moduleId` (`moduleId`)

) TYPE=MyISAM;

  

--

-- Dumping data for table `CubeCart_Modules`

--



  

--

-- Table structure for table `CubeCart_admin_permissions`

--



CREATE TABLE `CubeCart_admin_permissions` (

  `permissionId` int(11) NOT NULL auto_increment,

  `sectId` int(11) NOT NULL default '0',

  `adminId` int(11) NOT NULL default '0',

  `read` int(11) NOT NULL default '0',

  `write` int(11) NOT NULL default '0',

  `edit` int(11) NOT NULL default '0',

  `delete` int(11) NOT NULL default '0',

  PRIMARY KEY  (`permissionId`)

) TYPE=MyISAM;

As you can see, with that switch enabled, the dump will delimit EVERYTHING. This is good and should probably be used all the time just in case. If you're doing your dump with PHPMyAdmin, the option is checked by default to enclose names with backticks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...