-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script src="dist/sqomplexity-browser.js"></script> | ||
<script> | ||
(async() => { | ||
// Provide one or multiple queries: | ||
const queries = [ | ||
'SELECT id FROM users WHERE role = "admin"', | ||
'SELECT COUNT(*) FROM users WHERE creation_date > "2023-01-01 00:00:00" GROUP BY id' | ||
]; | ||
|
||
// Construct SQompLexity (passing `score` only outputs the complexity score): | ||
const command = new window.$sqomplexity({ score: true }); | ||
|
||
const result = await command.run(queries); | ||
|
||
// Result: [ 7.876953, 10.001953 ] | ||
})(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Input a single query (returns array with 1 element): | ||
node dist/sqomplexity.js "SELECT * FROM users" | ||
|
||
# Input multiple queries (returns array with multiple elements): | ||
node dist/sqomplexity.js "SELECT query1" "SELECT query2" | ||
|
||
# Use a file as a query input: | ||
node dist/sqomplexity.js -f "/some/path/to/file.sql" | ||
|
||
# Use a base64 encoded query (for easy-of-use within terminals): | ||
node dist/sqomplexity.js -b "somebase64encodedquery" | ||
|
||
# Output score only as JSON: | ||
node dist/sqomplexity.js -s "SELECT * FROM users" | ||
|
||
# For more info and options: | ||
node dist/sqomplexity.js --help |