Skip to content

Commit

Permalink
Added version option and info.
Browse files Browse the repository at this point in the history
  • Loading branch information
prmoore77 committed Feb 8, 2024
1 parent eecf5a1 commit 96f9831
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ To see all the available options run `flight_sql --help`.
flight_sql --help
Allowed options:
--help produce this help message
--version Print the version and exit
-B [ --backend ] arg (=duckdb) Specify the database backend. Allowed
options: duckdb, sqlite.
-H [ --hostname ] arg Specify the hostname to listen on for the
Expand Down
8 changes: 7 additions & 1 deletion src/flight_sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ int main(int argc, char **argv) {
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce this help message")
("version", "Print the version and exit")
("backend,B", po::value<std::string>()->default_value("duckdb"),
"Specify the database backend. Allowed options: duckdb, sqlite.")
("hostname,H", po::value<std::string>()->default_value(""),
Expand Down Expand Up @@ -49,7 +50,12 @@ int main(int argc, char **argv) {

if (vm.count("help")) {
std::cout << desc << "\n";
return 1;
return 0;
}

if (vm.count("version")) {
std::cout << "Flight SQL Server CLI: " << FLIGHT_SQL_SERVER_VERSION << std::endl;
return 0;
}

std::string backend_str = vm["backend"].as<std::string>();
Expand Down
2 changes: 1 addition & 1 deletion src/library/flight_sql_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ arrow::Result<std::shared_ptr<arrow::flight::sql::FlightSqlServerBase>> FlightSQ
// Exit with a clean error code (0) on SIGTERM
ARROW_CHECK_OK(server->SetShutdownOnSignals({SIGTERM}));

std::cout << "Apache Arrow Flight SQL server - with engine: " << db_type << " - will listen on "
std::cout << "Apache Arrow Flight SQL server version: " << FLIGHT_SQL_SERVER_VERSION << " - with engine: " << db_type << " - will listen on "
<< server->location().ToString() << std::endl;

return server;
Expand Down
1 change: 1 addition & 0 deletions src/library/include/flight_sql_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <filesystem>

// Constants
const std::string FLIGHT_SQL_SERVER_VERSION = "v1.1.19"; // For now - be sure to update this version with the git tag! TODO: automate this
const std::string DEFAULT_FLIGHT_HOSTNAME = "0.0.0.0";
const std::string DEFAULT_FLIGHT_USERNAME = "flight_username";
const int DEFAULT_FLIGHT_PORT = 31337;
Expand Down

0 comments on commit 96f9831

Please sign in to comment.