Skip to content

Conversation

@blackk-foxx
Copy link

Incorporates ideas from #217, #218 and #219.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are hints needed for this one? I'm open to suggestions...

@blackk-foxx blackk-foxx requested a review from IsaacG December 17, 2025 20:05
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
db_file=$1
mapfile -t slugs < <(jq -r 'keys[]' test_data.json)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW it's worth noting that this will fail on Mac with the default/older bash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to write a guard for that:

if (( BASH_VERSINFO[0] < 5 )); then
  echo "get a modern bash from Homebrew" >&2
  exit 1
fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And jq is not standardly installed:

if ! command -v jq >/dev/null; then
  echo "Required tool 'jq' is not installed" >&2
  exit 1
fi

Copy link
Author

@blackk-foxx blackk-foxx Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would be nice, for users that want to run the tests locally. But I would recommend against anything Mac-specific like "Homebrew" in the error message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any Linux system ought to have bash5 😄 I don't think the exact message matters much, thought for Mac users (the primary target of that message) a nudge towards Homebrew could be handy.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, Windows users would need to do a lot more to run the tests, like install a bash-compatible environment such as cygwin or mingw, and then ensure jq is installed in the environment. Maybe it would make sense to update sqlite/exercises/shared/.docs/tests.md accordingly, as well as adding the guards in the script?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Homebrew is for Linux too. I prefer it for some packages (like exercism) because it usually provides quicker access to new versions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And/or instructions for running the tests in Docker?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have installation instructions for Windows, it's a bad look if the first concept exercise can't run on Windows.

I fired up a Windows VM and installed sqlite (via chocolatey: did you want a PR with those instructions?) -- the sqlite3 cli's .shell command uses cmd, so we'd want a batch file equivalent of the shell script.

Anybody want to take that on?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might give it a try, if I can spin up a Windows VM somehow without buying a license.

Copy link
Member

@IsaacG IsaacG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glennj @vaeng Any things/feedback before we merge this?

844110220987 Appliances Culinary Depot BlendPro High-Speed Personal Blender 3.1 16
```

In addition to `=` and `BETWEEN...AND`, the `WHERE` clause supports a wide range of expressions, including comparison (`<`, `<=`, `>`, `>=`), pattern matching (`LIKE`, `GLOB`, `REGEXP`, `MATCH`), and checking for membership in a list (`IN`, `NOT IN`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the pattern matching operators are probably specific to sqlite. Did you want to stay more db-neutral?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really have a strong opinion here. I guess it would be nice to stay as generic as possible, but the concept docs do provide links to SQLite specific docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the SQLite track, not a generic SQL track. I think SQLite specific things are completely fine, and probably even preferred.

@@ -0,0 +1,127 @@
# Introduction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is the same as the concept introduction document. You might want to use a template. When you make changes to the concept doc, you don't have to make the same changes here but just do bin/configlet generate

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's close, but not an exact copy:

127a128,132
> 
> In addition to `=` and `BETWEEN...AND`, the `WHERE` clause supports a wide range of expressions, including comparison (`<`, `<=`, `>`, `>=`), pattern matching (`LIKE`, `GLOB`, `REGEXP`, `MATCH`), and checking for membership in a list (`IN`, `NOT IN`).
> See [SQL Language Expressions](sql-expr) for the complete documentation.
> 
> [sql-expr]: https://sqlite.org/lang_expr.html

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
db_file=$1
mapfile -t slugs < <(jq -r 'keys[]' test_data.json)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to write a guard for that:

if (( BASH_VERSINFO[0] < 5 )); then
  echo "get a modern bash from Homebrew" >&2
  exit 1
fi

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
db_file=$1
mapfile -t slugs < <(jq -r 'keys[]' test_data.json)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And jq is not standardly installed:

if ! command -v jq >/dev/null; then
  echo "Required tool 'jq' is not installed" >&2
  exit 1
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants