From 0811dbde088726b52be0052809c67d62d96be5f6 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Wed, 10 Jul 2019 17:09:47 -0600 Subject: [PATCH] Add alphabetical order to database --- src/php/api/Dictionary.php | 6 ++++-- src/structure.sql | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/php/api/Dictionary.php b/src/php/api/Dictionary.php index 990beae..bceabb5 100644 --- a/src/php/api/Dictionary.php +++ b/src/php/api/Dictionary.php @@ -105,7 +105,7 @@ VALUES ($new_id, ?, ?, ?, ?, ?, ?)"; 'description' => $this->parseReferences(strip_tags($result['description']), $result['id']), 'createdBy' => $result['public_name'], 'partsOfSpeech' => explode(',', $partsOfSpeech), - 'alphabeticalOrder' => array(), + 'alphabeticalOrder' => $result['alphabetical_order'] !== '' ? explode(' ', $result['alphabetical_order']) : array(), 'details' => array( 'phonology' => array( 'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(), @@ -284,7 +284,7 @@ VALUES ($new_id, ?, ?, ?, ?, ?, ?)"; 'specification' => $result['specification'], 'description' => $result['description'], 'partsOfSpeech' => explode(',', $partsOfSpeech), - 'alphabeticalOrder' => array(), + 'alphabeticalOrder' => $result['alphabetical_order'] !== '' ? explode(' ', $result['alphabetical_order']) : array(), 'details' => array( 'phonology' => array( 'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(), @@ -355,6 +355,7 @@ WHERE user=$user AND id=$dictionary"; $linguistics = $dictionary_object['details']; $query2 = "UPDATE dictionary_linguistics SET parts_of_speech=:parts_of_speech, + alphabetical_order=:alphabetical_order, consonants=:consonants, vowels=:vowels, blends=:blends, @@ -371,6 +372,7 @@ WHERE dictionary=$dictionary"; // $result2 = $this->db->query($query2, array( $result2 = $this->db->execute($query2, array( ':parts_of_speech' => implode(',', $dictionary_object['partsOfSpeech']), + ':alphabetical_order' => implode(' ', $dictionary_object['alphabeticalOrder']), ':consonants' => implode(' ', $linguistics['phonology']['consonants']), ':vowels' => implode(' ', $linguistics['phonology']['vowels']), ':blends' => implode(' ', $linguistics['phonology']['blends']), diff --git a/src/structure.sql b/src/structure.sql index b77ac6f..ebf0346 100644 --- a/src/structure.sql +++ b/src/structure.sql @@ -35,6 +35,7 @@ DELIMITER ; CREATE TABLE IF NOT EXISTS `dictionary_linguistics` ( `dictionary` int(11) NOT NULL, `parts_of_speech` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Comma-separated', + `alphabetical_order` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Space-separated', `consonants` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Space-separated', `vowels` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Space-separated', `blends` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Space-separated',