Zen Cart Logo

Mysql?

Views: 10,524

Results 1 to 5 of 5
15 Jan 2018, 4:06 AM
#1
tmccaff avatar

tmccaff

Zen Follower

Join Date:
Jan 2018
Posts:
157
Plugin Contributions:
0

Mysql?

I am updating a plugin and question about updating MySQL to MYISAM and utf8_general_ci

here is the code:

CREATE TABLE zipcodezone (
zipcode_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
zipcode_start char(3) NOT NULL default '0',
zipcode_end char(3) NOT NULL default '0',
zipcodezone int(1) NOT NULL default '0');

INSERT INTO zipcodezone
(zipcode_id ,zipcode_start ,zipcode_end ,zipcodezone)

15 Jan 2018, 7:24 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Mysql?

What is the question?

What happens when the above is attempted? What is expected?

If the database has been converted such that all aspects of it are consistent, then new tables should also be created with the same consistency.

If there is qestion about the format of the table sql, then suggest also looking at install sql available at: zc_install/sql/install/mysql_zencart.sql

17 Jan 2018, 4:26 AM
#3
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Mysql?

tmccaff:

I am updating a plugin and question about updating MySQL to MYISAM and utf8_general_ci

here is the code:

CREATE TABLE zipcodezone (
zipcode_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
zipcode_start char(3) NOT NULL default '0',
zipcode_end char(3) NOT NULL default '0',
zipcodezone int(1) NOT NULL default '0');

INSERT INTO zipcodezone
(zipcode_id ,zipcode_start ,zipcode_end ,zipcodezone)

The CREATE TABLE will work, but without a little extra code it will create the default database type (InnoDB?) rather than the MyISAM that you want. Having said that, you can easily change the database type after it has been created (preferbaly before inserting any data).

The INSERT INTO command won't work because you've not specified any values to insert. The code should read like:
INSERT INTO zipcodezone (zipcode_id ,zipcode_start ,zipcode_end ,zipcodezone) VALUES (1,2,3,4) ;

If this isn't the answer you are seeking, then perhaps you could be a little more specific in regards to your question/problem.

Cheers
RodG

17 Jan 2018, 7:34 PM
#4
tmccaff avatar

tmccaff

Zen Follower

Join Date:
Jan 2018
Posts:
157
Plugin Contributions:
0

Re: Mysql?

Ok this is what I got; is this correct?

CREATE TABLE zipcodezone (
  zipcode_id int(11) NOT NULL auto_increment,
  zipcode_start varchar(3) NOT NULL default '0',
  zipcode_end varchar(3) NOT NULL default '0',
  zipcodezone int(1) NOT NULL default '0',
  PRIMARY KEY  (zipcode_id)
) ENGINE=MyISAM DEFAULT COLLATE utf8_general_ci;

INSERT INTO zipcodezone (zipcode_id, zipcode_start, zipcode_end, zipcodezone)
VALUES (1, '004', '005', 8),
(2, '010', '089', 8),
(3, '100', '199', 8),
(4, '200', '299', 8),
(5, '300', '306', 8),
(6, '341', '349', 8),
(7, '307', '307', 7),
(8, '308', '324', 8),
(9, '325', '325', 7),
(10, '326', '339', 8),
(11, '341', '349', 8),
(12, '350', '362', 7),
(13, '363', '363', 8),
(14, '364', '367', 7),
(15, '368', '368', 8),
(16, '369', '375', 7),
(17, '376', '379', 7),
(18, '380', '397', 7),
(19, '398', '399', 8),
(20, '400', '402', 7),
(21, '403', '418', 8),
(22, '420', '424', 7),
(23, '425', '426', 8),
(24, '427', '427', 7),
(25, '430', '459', 8),
(26, '460', '469', 7),
(27, '470', '470', 8),
(28, '471', '479', 7),
(29, '480', '489', 8),
(30, '490', '491', 7),
(31, '492', '492', 8),
(32, '493', '495', 7),
(33, '496', '497', 8),
(34, '498', '499', 7),
(35, '500', '503', 6),
(36, '504', '504', 7),
(37, '505', '505', 6),
(38, '506', '507', 7),
(39, '508', '516', 6),
(40, '520', '559', 7),
(41, '560', '562', 6),
(42, '563', '564', 7),
(43, '565', '565', 6),
(44, '566', '567', 7),
(45, '570', '576', 6),
(46, '577', '577', 5),
(47, '580', '588', 6),
(48, '590', '591', 5),
(49, '592', '593', 6),
(50, '594', '594', 5),
(51, '595', '595', 6),
(52, '596', '599', 5),
(53, '600', '634', 7),
(54, '635', '635', 6),
(55, '636', '639', 7),
(56, '640', '649', 6),
(57, '650', '652', 7),
(58, '653', '653', 6),
(59, '654', '655', 7),
(60, '656', '676', 6),
(61, '677', '679', 5),
(62, '680', '689', 6),
(63, '690', '690', 5),
(64, '691', '692', 6),
(65, '693', '693', 5),
(66, '700', '709', 7),
(67, '710', '711', 6),
(68, '712', '716', 7),
(69, '717', '719', 6),
(70, '720', '725', 7),
(71, '726', '738', 6),
(72, '739', '739', 5),
(73, '740', '768', 6),
(74, '769', '769', 5),
(75, '770', '789', 6),
(76, '790', '794', 5),
(77, '795', '796', 6),
(78, '797', '812', 5),
(79, '813', '815', 4),
(80, '816', '832', 5),
(81, '833', '833', 4),
(82, '834', '838', 5),
(83, '840', '847', 4),
(84, '850', '851', 3),
(85, '852', '852', 4),
(86, '853', '854', 3),
(87, '855', '860', 4),
(88, '863', '864', 3),
(89, '865', '874', 4),
(90, '875', '877', 5),
(91, '878', '879', 4),
(92, '880', '885', 5),
(93, '889', '892', 3),
(94, '893', '898', 4),
(95, '900', '933', 2),
(96, '934', '934', 3),
(97, '935', '935', 2),
(98, '936', '939', 3),
(99, '940', '961', 4),
(100, '970', '975', 5),
(101, '976', '976', 4),
(102, '977', '986', 5),
(103, '988', '994', 5);
18 Jan 2018, 9:43 AM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Mysql?

tmccaff:

Ok this is what I got; is this correct?

It creates the specified database type and the table gets populated with the data provided, with no errors.
Whether the data is correct for purpose or not is something I can't say.

Cheers
RodG