Skip to content

Commit

Permalink
Updated SQL scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ciioprof0 committed Aug 6, 2024
1 parent 1dfd7f7 commit 1aa2320
Show file tree
Hide file tree
Showing 7 changed files with 1,287 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
your_connection.session.sql
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,21 @@
"uncared",
"uncompiled",
"vires"
],
"sqltools.connections": [
{
"mysqlOptions": {
"authProtocol": "default",
"enableSsl": "Disabled"
},
"previewLimit": 50,
"server": "localhost",
"port": 3306,
"driver": "MySQL",
"name": "your_connection",
"database": "stixd_corpus",
"username": "your_username",
"password": "your_password"
}
]
}
8 changes: 7 additions & 1 deletion info579/scripts/bash/setup_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ DB_USER="your_username"
DB_PASSWORD="your_password"
DB_NAME="stixd_corpus"

# Path to MySQL client
MYSQL_PATH="/c/Program Files/MySQL/MySQL Server 8.0/bin/mysql"

# Absolute path to SQL files
SQL_PATH="/d/OneDrive/Code/hltms/stixd/stixd/info579/sql/setup"

# Create the database
echo "Creating database..."
mysql -u $DB_USER -p$DB_PASSWORD < ../../sql/setup/create_database.sql
"$MYSQL_PATH" -u $DB_USER -p$DB_PASSWORD < "$SQL_PATH/setup_database.sql"

echo "Database created successfully."
2 changes: 1 addition & 1 deletion info579/sql/procedures/sp_check_lexicon_constraints.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ CREATE PROCEDURE stixd_corpus.sp_check_lexicon_constraints(
IN new_gender VARCHAR(7)
)
BEGIN
DECLARE prohibited_word_found INT DEFAULT 0;
-- Step 1: Check prolog constraints
CALL stixd_corpus.check_prolog_constraints(new_base_form);

-- Step 2: Check prohibited words
DECLARE prohibited_word_found INT DEFAULT 0;
SELECT COUNT(*)
INTO prohibited_word_found
FROM stixd_corpus.prohibited_words
Expand Down
4 changes: 2 additions & 2 deletions info579/sql/seeds/seed_prolog_constraints.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WHERE NOT EXISTS (
);

INSERT INTO stixd_corpus.prolog_constraints (description, pattern, message, auto_correct)
SELECT * FROM (SELECT 'The first character must not be a digit or a hyphen.', '^[^0-9-]', 'The first character must not be a digit or a hyphen.', TRUE) AS tmp
SELECT * FROM (SELECT 'The first character must not be a digit or a hyphen.', '^[^0-9-]', 'First character must not be a digit or a hyphen.', TRUE) AS tmp
WHERE NOT EXISTS (
SELECT 1 FROM stixd_corpus.prolog_constraints WHERE description = 'The first character must not be a digit or a hyphen.'
);
Expand All @@ -18,7 +18,7 @@ WHERE NOT EXISTS (
);

INSERT INTO stixd_corpus.prolog_constraints (description, pattern, message, auto_correct)
SELECT * FROM (SELECT 'Symbols special for Prolog (e.g., apostrophe) must be escaped.', '', 'Symbols special for Prolog (e.g., apostrophe) must be escaped.', TRUE) AS tmp
SELECT * FROM (SELECT 'Symbols special for Prolog (e.g., apostrophe) must be escaped.', '', 'Escape symbols special for Prolog (e.g., apostrophe).', TRUE) AS tmp
WHERE NOT EXISTS (
SELECT 1 FROM stixd_corpus.prolog_constraints WHERE description = 'Symbols special for Prolog (e.g., apostrophe) must be escaped.'
);
Expand Down
Loading

0 comments on commit 1aa2320

Please sign in to comment.