Outils pour utilisateurs

Outils du site


bases_de_donnees:mysql:case

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

bases_de_donnees:mysql:case [2015/07/31 19:42] (Version actuelle)
Ligne 1: Ligne 1:
 +CASE
 +WHEN `User`.`firstname` IS NULL
 + THEN `User`.`username`
 +WHEN `User`.`firstname` IS NOT NULL
 + THEN (CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`))
 +END
 +
 +
 +CASE `User`.`show_fullname`
 + WHEN 1 THEN
 + IF((`User`.`firstname` IS NULL) OR (`User`.`lastname` IS NULL), `User`.`username`,​ CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`))
 + WHEN 0 THEN
 + `User`.`username`
 +END
 +
 +
 +CASE `User`.`show_fullname`
 + WHEN 1 THEN
 + `User`.`name`
 + WHEN 0 THEN
 + `User`.`username`
 +END
 +
 +CASE `User`.`show_fullname` WHEN 1 THEN `User`.`name` WHEN 0 THEN `User`.`username` END
 +
 +
 +
 +CASE `User`.`show_fullname`
 + WHEN 1 THEN
 +
 +
 + CASE ​
 + WHEN `User`.`firstname` IS NULL THEN
 + `User`.`username`
 + WHEN `User`.`firstname` IS NOT NULL THEN
 + CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`)
 + END
 +
 + WHEN 0 THEN
 + `User`.`username`
 +END
 +
 +CASE `User`.`show_fullname` WHEN 1 THEN CASE WHEN `User`.`firstname` IS NULL THEN `User`.`username` WHEN `User`.`firstname` IS NOT NULL WHEN CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`) END WHEN 0 THEN `User`.`username` END
 +
 +
 +
 +CASE `User`.`show_fullname` WHEN 1 THEN IF((`User`.`firstname` IS NULL) OR (`User`.`lastname` IS NULL), `User`.`username`,​ CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`)) WHEN 0 THEN `User`.`username` END
 +
 +
 +
 +((`User`.`firstname` IS NULL) OR (`User`.`lastname` IS NULL)) AND ((`User`.`firstname` = ''​) OR (`User`.`lastname` = ''​))
 +
 +
 +
 +
 +
 +
 +ALTER TABLE `socialbeer`.`users`
 +ADD COLUMN `name_mode` enum('​username','​fullname','​firstname_firstletterlastname'​) NOT NULL DEFAULT '​username'​ AFTER `username`
 +
 +
 +
 +
 +     '​public_name'​ => '
 +
 +CASE `User`.`show_fullname`
 + WHEN 1 THEN
 + IF(((`User`.`firstname` IS NULL) OR (`User`.`lastname` IS NULL)) OR ((`User`.`firstname` = ""​) OR (`User`.`lastname` = ""​)),​ `User`.`username`,​ CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`))
 + WHEN 0 THEN
 + `User`.`username`
 + END'
 +
 +
 +
 +IF(((`User`.`firstname` IS NULL) OR (`User`.`lastname` IS NULL)) OR ((`User`.`firstname` = ""​) OR (`User`.`lastname` = ""​)),​ `User`.`username`,​ CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`))
 +
 +
 +
 +
 +
 +
 +     '​public_name'​ => '
 +
 +
 +
 +CASE `User`.`name_display`
 + WHEN "​username"​ THEN
 + `User`.`username`
 + WHEN "​fullname"​ THEN
 + IF(((`User`.`firstname` IS NULL) OR (`User`.`lastname` IS NULL)) OR ((`User`.`firstname` = ""​) OR (`User`.`lastname` = ""​)),​ `User`.`username`,​ CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`))
 + WHEN "​firstname_fllastname"​ THEN
 + CONCAT(`User`.`firstname`,​ " ", SUBSTRING(`User`.`lastname`,​1,​1),​ "​."​)
 +END
 +
 +
 +CASE `User`.`name_display` WHEN "​username"​ THEN `User`.`username` WHEN "​fullname"​ THEN IF(((`User`.`firstname` IS NULL) OR (`User`.`lastname` IS NULL)) OR ((`User`.`firstname` = ""​) OR (`User`.`lastname` = ""​)),​ `User`.`username`,​ CONCAT(`User`.`firstname`,​ " ", `User`.`lastname`)) WHEN "​firstname_fllastname"​ THEN CONCAT(`User`.`firstname`,​ " ", SUBSTRING(`User`.`lastname`,​1,​1),​ "​."​) END
 +
 +
 + <a href="#"​ class="​beer-mini-item-button-blue"><?​php echo $this->​Html->​link($this->​Text->​truncate($review['​User'​]['​public_name'​],​10,​ array('​ending'​ => ''​)),​ array('​controller'​ => '​users',​ '​action'​ => '​view', ​ $review['​User'​]['​username'​]));​ ?></​a>​
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
bases_de_donnees/mysql/case.txt · Dernière modification: 2015/07/31 19:42 (modification externe)