Modify

Opened 9 years ago

Last modified 6 years ago

#1024 new Frage

Null Werte - zones_to_geo_zones

Reported by: INETvisio Owned by: somebody
Priority: niedrig Milestone: modified-shop-2.1.0.0
Component: Shop Version: 2.0.0.0
Keywords: Cc:
Blocked By: Blocking:

Description

Hallo,

kann mir jemand erklären, warum die Spalten zone_country_id und zone_id Null-Werte beinhalten dürfen?

Funktionen wie xtc_get_tax_rate oder xtc_get_tax_description suchen sowieso beides (0 und null). Wäre es nicht sinnvoller diese Spalten mit NOT NULL zu versehen und die SQL-Abfrage auf IN() zu ändern?
Mein Beispiel:
suchen nach

                             WHERE (za.zone_country_id is null 
                                    OR za.zone_country_id = '0' 
                                    OR za.zone_country_id = '" . (int)$country_id . "') 
                               AND (za.zone_id is null 
                                    OR za.zone_id = '0' 
                                    OR za.zone_id = '" . (int)$zone_id . "')

ersetzen durch

                             WHERE za.zone_country_id IN ('0', '" . (int)$country_id . "') 
                               AND za.zone_id IN('0', '" . (int)$zone_id . "')

und die Spalten anpassen:

ALTER TABLE `zones_to_geo_zones` CHANGE `zone_country_id` `zone_country_id` INT(11) NOT NULL, CHANGE `zone_id` `zone_id` INT(11) NOT NULL;

Was meint Ihr?

Gruß
Jürgen H.

Attachments (0)

Change History (6)

comment:1 by Volker Strähle, 9 years ago

zone_country_id ist in 2.0 doch gar nicht null

DROP TABLE IF EXISTS zones_to_geo_zones;
CREATE TABLE zones_to_geo_zones (
 association_id INT NOT NULL AUTO_INCREMENT,
 zone_country_id INT NOT NULL,
 zone_id INT NULL,
 geo_zone_id INT NULL,
 last_modified DATETIME NULL,
 date_added DATETIME NOT NULL,
 PRIMARY KEY (association_id),
 KEY idx_geo_zone_id (geo_zone_id)
) ENGINE=MyISAM;

comment:2 by INETvisio, 9 years ago

Stimmt, wird aber noch auf "IS NULL" abgefragt. Wenn die Queries geändert werden müssen, könnte man auch über zone_id Gedanken machen.

comment:3 by Torsten Riemer, 9 years ago

Milestone: modified-shop-2.0.2.1modified-shop-2.1.0.0

comment:4 by Torsten Riemer, 9 years ago

Milestone: modified-shop-2.1.0.0modified-shop-2.0.3.0

comment:5 by Torsten Riemer, 8 years ago

Milestone: modified-shop-2.0.4.1

comment:6 by Gerhard Waldemair, 6 years ago

Milestone: modified-shop-2.1.0.0

Modify Ticket

Action
as new The owner will remain somebody.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.