{"id":19031448,"url":"https://github.com/plandes/cisql","last_synced_at":"2025-08-16T05:34:11.743Z","repository":{"id":80107463,"uuid":"76229835","full_name":"plandes/cisql","owner":"plandes","description":"SQL Command Line Interface (ciSQL)","archived":false,"fork":false,"pushed_at":"2023-10-23T16:17:16.000Z","size":380,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T16:51:26.565Z","etag":null,"topics":["clojure","command-line","command-line-tool","jdbc","sql","sql-query"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plandes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-12T06:50:24.000Z","updated_at":"2025-04-22T20:23:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"2cc81f36-c6c7-4093-84aa-77ce0d93171d","html_url":"https://github.com/plandes/cisql","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/plandes/cisql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fcisql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fcisql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fcisql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fcisql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plandes","download_url":"https://codeload.github.com/plandes/cisql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fcisql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270670991,"owners_count":24625671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","command-line","command-line-tool","jdbc","sql","sql-query"],"created_at":"2024-11-08T21:23:30.487Z","updated_at":"2025-08-16T05:34:11.717Z","avatar_url":"https://github.com/plandes.png","language":"Clojure","readme":"# SQL Command Line Interface\n\n[![Travis CI Build Status][travis-badge]][travis-link]\n\nThis program provides a command line interface to interacting with relational\ndatabase managements systems (RDMBs) and currently includes SQLite, MySQL and\nPostgreSQL out of the box.  Additional JDBC drivers can easily be added on the\ncommand line.\n\nFeatures include:\n\n* Multiple [GUI tabulation](#graphical-results) frames for query results.\n* Use any [JDBC driver](#database-access) to connect almost any database.\n* [Evaluate](#evaluation) of Clojure code as input directly SQL queries with JVM\n  in memory objects that come directly from the `java.sql.ResultSet`.\n* [Macros](#macros) that save you typing commands and queries over and over.\n* JDBC drivers are [configured](#installing-new-jdbc-drivers) in the command\n  event loop application and downloaded and integrated without having to\n  restart.\n* [Export](#queries-and-directives) result sets as a `.csv` file.\n* Emacs interaction with the [ciSQL] library.\n* Configuration via command line [persistent variables](#variables) to controls\n  GUI interface, logging, etc.\n* Distribution is a [stand alone Java jar file] with all dependencies.\n* Data base [meta data](#database-meta-data) access as results and to Clojure\n  programs.\n\n\u003c!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --\u003e\n## Table of Contents\n\n- [Obtaining](#obtaining)\n- [Usage](#usage)\n    - [Online Help](#online-help)\n    - [Queries and Directives](#queries-and-directives)\n        - [Multi-line Queries](#multi-line-queries)\n        - [Send Verbatim](#send-verbatim)\n        - [Row Count](#row-count)\n        - [Print Directive](#print-directive)\n    - [Variables](#variables)\n        - [Boolean Variables](#boolean-variables)\n        - [Built-in and User Variables](#built-in-and-user-variables)\n        - [Variable Substitution](#variable-substitution)\n    - [Macros](#macros)\n    - [Graphical Results](#graphical-results)\n    - [Database Meta Data](#database-meta-data)\n    - [Evaluation](#evaluation)\n        - [Loading a File](#loading-a-file)\n        - [Evaluation Directive](#evaluation-directive)\n        - [Program API Access](#program-api-access)\n        - [Plugins](#plugins)\n    - [Run SQL Offline](#run-sql-offline)\n    - [Start Up Execution Resource File](#start-up-execution-resource-file)\n    - [Bad State](#bad-state)\n    - [Command Line Help](#command-line-help)\n- [Database Access](#database-access)\n    - [Connecting to a Database](#connecting-to-a-database)\n    - [Installing new JDBC Drivers](#installing-new-jdbc-drivers)\n        - [SQLite](#sqlite)\n        - [Apache Drill](#apache-drill)\n    - [Querying the Database](#querying-the-database)\n    - [Removing JDBC Drivers](#removing-jdbc-drivers)\n- [Emacs Integration](#emacs-integration)\n- [Documentation](#documentation)\n    - [API Documentation](#api-documentation)\n- [Known Issues](#known-issues)\n- [Changelog](#changelog)\n- [License](#license)\n\n\u003c!-- markdown-toc end --\u003e\n\n\n## Obtaining\n\nThe latest release binaries are available as a [stand alone Java jar file].\n\n\n## Usage\n\nThe program is a command line console application that provides a prompt in a\ncommand event loop.  Each text typed followed by **return** is interpreted as\nSQL to be sent to the database or a `directive` (see [queries-and-directives]).\n\nYou can specify command line arguments to connect to a database or you can\nconnect (and re-connect) while in the command event loop of the program.\n\nThe command line usage is given with the with `--help` option\n(see [command line usage](#command-line-usage)).  You\ncan [connect](#connecting-to-a-database) in the application and not provide any\nconnection arguments to start the application as well.\n\nAn example of how to connect to an SQLlite database from the command line follows:\n```bash\n$ java -jar target/cisql.jar -n sqlite -d path/to/awards.sqlite\nClojure Interactive SQL (cisql) v0.0.10\n(C) Paul Landes 2015 - 2019\n 1 \u003e\n```\n\nIf you're in a hurry, you can skip to the section\n[connecting](#database-access) to the database.\n\n\n### Online Help\n\nTyping `help` at the command line gives a list of\n[directives](#queries-and-directives) and [variables](#variables).  To get help\nadditional help for directives, type `help \u003cdirective name\u003e`.\n\n\n### Queries and Directives\n\nEach line of input is either is a part or whole SQL query, or it is a\n`directive`.  A `directive` includes commands meant for the command event loop\nof the program.  There are some directives that take queries as (usually\noptional) input like the `export` directive.  You can get a list of directives\nand how to use them using the `help` directive.\n\n\n#### Multi-line Queries\n\nEvery SQL query given is stored even after the results are retrieved from the\ndatabase and displayed.  In this way you can build queries that contain several\nlines. This multi-lined query is referred to as the *last query* and is used in\nmany directives like the `export` directive as mentioned.\n\n**Important**: Those queries entered without an ending line separator\n(i.e. `;`) used with a directive on a new line are not recorded as the *last\nquery*.\n\nFor example, the following code prints the `coder` column of the table in one\nline:\n```sql\nselect * from coders\neval (fn [r _] (println (map #(get % \"coder\") r)))\n```\n\nHowever, if you had used just (notice the ending line separator (`;`)):\n```sql\nselect * from coders;\n```\n\n**then** you used the `eval` directive:\n```clojure\neval (fn [r _] (println (map #(get % \"coder\") r)))\n```\nit would produce the same output because it uses the select used on the single\nline.  In this way, you can *up arrow* as many times as you want without having\nto produce different SQL.  For the `eval` directive, this is very useful as you\n*debug* your directive.\n\nTo purge any previous query use the `clear` directive.  To get a list of\ndirectives, use the `help`.\n\n\n#### Send Verbatim\n\nThe `send` directive is used to send SQL directly to the database and bypasses\nall directive special.  For example, some databases have the `set` reserved\nword, which is a directive in ciSQL.  To use `set` but `send` in front as such:\n```sql\nsend SET :HVL = CURRENT PATH;\n```\n\nNote that this directive does not support multi-line queries. so you *must* add\nthe line separator (usually `;`) and add no new lines.\n\n\n#### Row Count\n\nThe special variable `rowcount` determines how many rows are returned from all\nqueries, **which includes meta data**.  The default is not value so all results\ncome back.  Note that this proceeds any `limit` or `top N` constraints on your\nquery.\n\nIt's important to remember to unset this when you're finished so the program\ndoesn't give unexpected truncated results when constraining the query or\ngetting database metadata.  For this reason, the program treats this as more of\na temporary usage and it is up to the user to reset the variable to the *none*\nvalue, which can be accomplished as such:\n```sql\nset rowcount\n```\n\n#### Print Directive\n\nThe `print` directive prints a message and utilizes [variable\nsubstitution](#variable-substitution) like any other query or directive.\nThis directive is useful for instances when executing [offline\nSQL](#run-sql-offline).\n\n\n### Variables\n\nThe program keeps track of variables across sessions, which is persisted in\nusing the Java persistence framework.  You can set a variable with the `set`\ndirective.  For example, to set the prompt:\n```sql\nset prompt 'darkstar %1$s\u003e '\n```\n\n**Important**: To add white space you can use quote (single quote `'`) for\nverbatim values.\n\nSome built in variables can be set to a *none* value like `catalog`, which\nmeans to not set a connection's catalog.  To set a variable to the *none* value\nsimply omit the value, such as:\n```sql\nset catalog\n```\n\nYou can also remove one or more variables with the `rm` directive such as:\n```sql\nrm v1 v2\n```\n\n\n#### Boolean Variables\n\nCertain variables are booleans like `gui`, which tells the program to show\nresults in a GUI frame.  These variables should be toggled with the `tg`\ndirective.\n\nTo list all variables, use the `sh` directive, which also takes a variable name\nas a parameter if you want to see just one.\n\n\n#### Built-in and User Variables\n\nThere are two kinds of variables:\n\n* built ins: these are variables that come predefined and control the behavior\n  of the program\n* user: these are variables the user can add.\n\nThe special variable `strict` controls whether only built in variables can be\nset and be default is off to disallow user variables.  This is to void\nmisspelling variables that are often modified.\n\nWhen you turn this off (use `set strict false`), user variables can be added\nusing the `set` and `tg` directives.\n\nUser defined variables can be unset/removed with the `rm` directive.\n\n\n#### Variable Substitution\n\nAny series of characters and numbers that are preceded by `@@` are substituted\nby that variable's value.  For example:\n```sql\n 1 \u003e set mytable items\nmytable: null -\u003e items\n 1 \u003e print 'my table is @@mytable'\nmy table is items\n 1 \u003e select * from @@mytable;\nexecuting: select * from items\n731 row(s) affected (0.019s)\n```\n\n\n### Macros\n\nA crude macro system is available with the `do` directive, which takes a list\nof [user variable](#built-in-and-user-variables) names as input.  For each\nvariable name given, it invokes the contents of the value of the variable as if\nit were given on the command event loop of the program.  For example:\n```sql\nset sela 'select * from annotations limit 5;'\nset selc 'select * from coders;'\nset con 'conn sqlite -d annotated-corpus.db'\ndo con sela selc\n```\nFirst connects to an SQLite database, and executes two `select` statements.\n\n\n### Graphical Results\n\nAs mentioned in the [section on variables](#variables), use `tg gui` to switch\nbetween using a GUI based frame to report results and a text based table in the\ncommand event loop of the program.  This setting produces a graphical results\nthat are much easier to view and handles large result sets efficiently.  An\nexample of a GUI results set frame follows.\n\n![GUI Results](https://plandes.github.io/cisql/img/results.png)\n\nBy default each query replaces the results of the last.  However, you can\ncreate multiple windows to compare results by using the `orph` directive.  This\n*orphans* the window from any further result reporting.  The directive takes a\n`label` argument, which is used in the frame title.\n\nWhen the variable `headless` is set to `false` then a separate application window\nstarts when results are available for graphical display.\n\n\n### Database Meta Data\n\nThe `shtab` displays all table meta data in the database or the meta data for a\ntable if the table name is given.  However, meta data is also available to\ndirectives that take SQL result set output by using a special syntax:\n```sql\nselect @meta;\n```\n\nA table is specified before the `metadata` keyword to get a table meta data\nresult set.:\n```sql\nselect @some_table.meta;\n```\n\nNote that the query terminator (`;` in this case) still needs to be present.\n\n\n### Evaluation\n\nYou can \"pipe\" the results of queries to your own custom Clojure code.  The\neasiest way to do this is using the `eval` directive as demonstrated in the\n[queries and directives](#queries-and-directives) section.\n\n\n#### Loading a File\n\nIn addition, the `load` directive reads a Clojure file and uses the defined\nfunction to process the query results.  Like the `eval` directive, this\nfunction takes the following parameters:\n* **rows**: a lazy sequence of maps, each map is a key/value set of column\n  name to value.\n* **header**: a list of string column names.\n\nHowever, functions defined in the loaded file can omit these arguments.  If\nonly one is given the **rows** are passed as the singleton argument.  If no\narguments are defined in the function the query is not invoked and a query need\nnot be given.\n\nThe `load` directive takes two optional arguments: the file to load and\nfunction to call in the file.  The file defaults to `cisql.clj` and the\nfunction to call defaults to the last function in the evaluated file.\n\nThis example adds the string `Mrs` to each row for the `coder` column (say this\nis in a file called `fix-columns.clj`:\n```clojure\n(ns temporary\n  (:require [clojure.tools.logging :as log]))\n\n(defn- process-query [rows header]\n  (log/debugf \"header: %s\" (vec header))\n  (let [col-name \"coder\"]\n   (-\u003e\u003e rows\n        (map (fn [row]\n               (assoc row col-name (str \"Mrs \" (get row col-name)))))\n        (array-map :header header :rows)\n        (array-map :display))))\n```\n\nTo run from the program, invoke:\n```sql\nselect * from coders;\nload fix-columns.clj\n```\n\nThe following happens based on the output of this function:\n* **nil**: nothing happens\n* **a map with a :display key**: the `:header` and `:rows:` keys are used to\n  display the results just like any query\n* anything else: the value is printed\n\nYou can write your functions to `printlin` anything just like any Clojure\nprogram and the output goes to the interactive window.  Direct access to a\nrunning SQL prompt with an [Emacs Cider session](#emacs-integration) is also\navailable.  You can also clone this repo, add your own Clojure files and\n[Cider] debug your code.  Currently this isn't possible with loaded files since\nthey're read and evaluated.\n\n\n#### Evaluation Directive\n\nAnother more comprehensive example, which renames the `firstName` column to `name`:\n\n```clojure\neval (fn [r h] {:display {:header [\"name\"] :rows (map #(array-map \"name\" (get % \"firstName\")) r)}})\n```\n\n\n#### Program API Access\n\nNote that you also have access to the program API.  For example, to access the\nvariables, use the `zensols.cisql.conf` name space.  This example uses sets and\nprints a variable with the names of columns and added to file `table-meta.clj`:\n```clojure\n(ns some-ns\n  (:require [clojure.tools.logging :as log]\n            [zensols.cisql.conf :as conf]))\n\n(defn- set-table-names [rows _]\n  (-\u003e\u003e rows\n       (map #(get % \"TABLE_NAME\"))\n       vec\n       (conf/set-config :table-names))\n  \"set table-names variable\")\n\n(defn- read-table-names [$ _]\n  (format \"%d tables\" (count (conf/config :table-names))))\n```\n\nTo run:\n```sql\nselect from @@metadata;\nload table-meta.clj set-table-names\nsh table-names\nload table-meta.clj read-table-names\n```\n\n\n#### Plugins\n\nSay you write a [Clojure load file](#loading-a-file) you use and want to save\ntyping.  You can write a *plugin* that creates a new directive so you don't\nhave to use the `load` directive each time.\n\nThe file needs the following:\n* **namespace**: the file needs the standard namespace definition.  The\n  namesapce itself can be anything, but shouldn't be any exiting ciSQL\n  namespace.\n* **dependencies variable**: this is optional unless your plugin depends on\n  other jars to be loaded; this variable should be a map with the following\n  keys:\n  * **coordinates**: a sequence of the maven repository coordinates, for example:\n  `{:coordinates [[us.fatehi/schemacrawler \"15.06.01\"]]}`\n  * **repositories**: an optional sequence of repositories in the format `{name\n    url}`\n* **directives**: This is the definition of the directive itself.  This is a\n  map with the following keys:\n  * **arg-count**: either a number indicating the number of arguments or a\n    regular expression charater (i.e. `*`, `+`, etc) representing the number\n    of arguments.\n  * **usage**: a usage string giving a human readable description of the\n    arguments it takes.\n  * **desc**: a human readable description of documentation for the directive.\n  * **fn**: a function taking the query information map and arguments (see\n    examples).\n\nSee the [webcrawler](src/plugins/schema-crawler.clj) plugin for an example.  In\naddition you can see the [built-in-directives\nfunction](src/clojure/zensols/cisql/directive.clj) for more examples.\n\nUse the `plugin` with the file or directory.  If the given path is a directory,\nall files in that directory are loaded and assumed to be Clojure source files.\nFor this reason every file in the specified directory must follow the plugin\nformat given in this section.  Otherwise the plugin registration will fail.\n\n\n### Run SQL Offline\n\nYou can execute a series of queries and/or directives as if they were given\ndirectly on the command line from a file.  The `run` directive takes a one or\nmore files that are executed on the command line.\n\n\n### Start Up Execution Resource File\n\nThe program looks for and executes the contents of `~/.cisql` if it exists just\nas if the `run` directive was used (see the `run`\n[directive](#run-sql-offline)).\n\n\n### Bad State\n\nIf for any reason the program gets in a bad state, you can reset data to their\ndefaults.  The directives used for this are:\n\n* **purgedrv** remove all JDBC driver configuration.\n* **resetenv** reset all variables back to their initial values.\n* **vaporize** clear all application data.\n\nOf course you want to exercises extreme caution with these as they are very\ndestructive.\n\n\n### Command Line Help\n\nThe command line usage for convenience is given here:\n\n```sql\nusage: cisql [options]\n\nClojure Interactive SQL (cisql) v0.0.18 \n(C) Paul Landes 2015 - 2019\n\nConnect to a database\n  -n, --name \u003cname\u003e                        JDBC driver name (ex: mysql)\n  -l, --level \u003clog level\u003e       INFO       Log level to set in the Log4J2 system.\n  -u, --user \u003cstring\u003e                      login name\n  -p, --password \u003cstring\u003e                  login password\n  -h, --host \u003cstring\u003e           localhost  database host name\n  -d, --database \u003cstring\u003e                  database name\n      --port \u003cnumber\u003e                      database port\n  -c, --config \u003ck1=v1\u003e[,k2=v2]             set session configuration\n```\n\n\n## Database Access\n\nSince the program is written in a Java Virtual Machine language any JDBC driver\ncan be used.\n\n\n### Connecting to a Database\n\nThe connection usage is the same in the event loop and on the command line.  In\nthe event loop you can use the `conn` directive:\n\n```sql\n 1 \u003e conn help\nusage: conn \u003chelp|driver [options]\u003e\nConnect to a database\n  -u, --user \u003cstring\u003e                 login name\n  -p, --password \u003cstring\u003e             login password\n  -h, --host \u003cstring\u003e      localhost  database host name\n  -d, --database \u003cstring\u003e             database name\n      --port \u003cnumber\u003e                 database port\n```\n\nFor example, to connect to an *SQLite* database, use the following:\n```sql\n 1 \u003e conn sqlite --database awards.sqlite\nspec: loading dependencies for [[org.xerial/sqlite-jdbc \"3.8.11.2\"]]\nconfigured jdbc:sqlite:awards.sqlite\n```\n\nTo connect to a *mySql* database:\n```sql\n 1 \u003e conn postgres -u puser -p pass -d puser -h 192.168.99.100\nspec: loading dependencies for [[postgresql/postgresql \"9.1-901-1.jdbc4\"]]\nconfigured jdbc:postgresql://puser:pass@localhost:5432/puser\n```\n\n\n### Installing new JDBC Drivers\n\nThe tool itself comes with no JDBC drivers.  However it does have JDBC\n*configuration* settings for popular databases and are configured in the\n[driver resource](resources/driver.csv).  The system uses the [maven\nrepository] system and will automatically download and use the new driver\nwithout having to exit and restart the program.\n\nTo configure and install a new JDBC driver (in this example to read comma\ndelimited CSV files):\n```sql\n 1 \u003e newdrv -n csv -c org.relique.jdbc.csv.CsvDriver -d net.sourceforge.csvjdbc/csvjdbc/1.0.28 -u jdbc:relique:csv:%5$s\nspec: loading driver: csv\nspec: loading dependencies for [[net.sourceforge.csvjdbc/csvjdbc \"1.0.28\"]]\nspec: added driver: csv\n\n 1 \u003e conn csv -d /Users/paul/stats-dir\nspec: loading dependencies for [[net.sourceforge.csvjdbc/csvjdbc \"1.0.28\"]]\nconfigured jdbc:relique:csv:/Users/paul/stats-dir\n\n 1 \u003e select count(*) from stat-file;\ndb-access: executing: select count(*) from stat-file\n\n| COUNT(*) |\n|----------|\n|       41 |\n```\n\nNote that you can add multiple maven coordinates separated with a comma and no\nspace, which is useful when you need to add license files.  In the case of\nlicense files that have no maven coordinates, you'll have to install the them\nas maven files yourself directly.  You can do this using the [maven install\nplugin] yourself or use the [install-maven-file](src/sh/install-maven-file)\nPERL script, which provides slightly nicer syntax and help.\n\n\n#### SQLite\n\n```sql\n1\u003e newdrv -n sqlite -c org.sqlite.JDBC -u jdbc:sqlite:%5$s -d org.xerial/sqlite-jdbc/3.25.2\n```\n\n\n#### Apache Drill\n\nThe following installs the direct drill bit JDBC driver:\n\n```sql\n1\u003e newdrv -n drilldir -u jdbc:drill:drillbit=%3$s:%4$s -p 31010 -c org.apache.drill.jdbc.Driver -d org.apache.drill.exec/drill-jdbc/1.10.0\n```\n\n\n### Querying the Database\n\nThese examples show how to list tables in the database, a particular table and\na select from that table.\n\n```sql\n 1 \u003e shtab\n\n| TABLE_CAT | TABLE_SCHEM |      TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION |\n|-----------+-------------+-----------------+------------+---------+----------+------------+-----------+---------------------------+----------------|\n|           |             |           award |      TABLE |         |          |            |           |                           |                |\n|           |             |         cyclist |      TABLE |         |          |            |           |                           |                |\n|           |             | sqlite_sequence |      TABLE |         |          |            |           |                           |                |\n|           |             |             won |      TABLE |         |          |            |           |                           |                |\n 1 \u003e shtab cyclist\n\n| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB | CHAR_OCTET_LENGTH | ORDINAL_POSITION | IS_NULLABLE | SCOPE_CATLOG | SCOPE_SCHEMA | SCOPE_TABLE | SOURCE_DATA_TYPE |\n|-----------+-------------+------------+-------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+--------------+--------------+-------------+------------------|\n|           |             |    cyclist |          id |         4 |   INTEGER |  2000000000 |    2000000000 |             10 |             10 |        0 |         |            |             0 |                0 |        2000000000 |                0 |          NO |              |              |             |                  |\n|           |             |    cyclist |        name |        12 |      TEXT |  2000000000 |    2000000000 |             10 |             10 |        0 |         |            |             0 |                0 |        2000000000 |                1 |          NO |              |              |             |                  |\n|           |             |    cyclist |     is_male |         4 |   INTEGER |  2000000000 |    2000000000 |             10 |             10 |        0 |         |            |             0 |                0 |        2000000000 |                2 |          NO |              |              |             |                  |\n 1 \u003e select * from award limit 5;\n\n|  id |                       name | level |\n|-----+----------------------------+-------|\n| 615 |             Re-unification |     5 |\n| 616 |             World traveler |     5 |\n| 617 | Celebrity guest appearance |     5 |\n| 618 |                  New Rider |     4 |\n| 619 |            Most Consistent |     4 |\n 1 \u003e tg gui\ngui: false -\u003e true\n1 \u003e select * from award limit 10;\n10 row(s) affected (0.828s)\n```\n\nThe last command produces the GUI results window given in the [graphical result\nset](#graphical-results) section.\n\n\n```sql\n 1 \u003e orph awards\n 1 \u003e select * from award limit 20;\n20 row(s) affected (0.037s)\n 1 \u003e export /d/awards.csv\n20 row(s) affected (0.014s)\n```\nThe last command creates a new `.csv` spreadsheet file as shown:\n\n![Spreadsheet.csv](https://plandes.github.io/cisql/img/spreadsheet-export.png)\n\n\n### Removing JDBC Drivers\n\nUse the `removedrv` to remove a JDBC driver.  Note this only removes the entry\nin the configuration and not the driver jar in the maven repository on disk.\n\n\n## Emacs Integration\n\nIf you're an Emacs user, the [ciSQL] library is available, which integrates\nwith the [Emacs SQL system](#https://www.emacswiki.org/emacs/SqlMode).\n\nIn addition, you can start a [Cider] REPL using the `repl` directive while the\nprogram is running and evaluating SQL statements and directives.  This provides\nan even deeper way of integrating data base access with Clojure.  See the\n[evaluation](#evaluation) section for other ways of integration.\n\n\n## Documentation\n\nThe command event loop of the program provides a `man` directive to go to\ndocumentation about a specific directive or variable, which is this page.  For\nexample:\n\n```sql\nman conn\n```\n\nStarts a web browser that goes to this section.\n\n\n### API Documentation\n\nThis program is written in Clojure.  See the API\n[documentation](https://plandes.github.io/cisql/codox/index.html).\n\nIf you integrate this program with you own, please let me know.  I'm interested\nin knowing how others use it.\n\n\n## Known Issues\n\nThe default version of the SQLite driver does not work under macOS M1 chips.\nTo fix this, use the following command to install a version that works:\n```sql\nremovedrv sqlite\nnewdrv -n sqlite -c org.sqlite.JDBC -u jdbc:sqlite:%5$s -d org.xerial/sqlite-jdbc/3.41.2.1\n```\n\nThere have been reports of the Clojure dependency resolver not downloading jars\ncorrectly.  In that case, use the following command to install this jar:\n```bash\nmvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -Dartifact=org.xerial:sqlite-jdbc:3.41.2.1\n```\n\n\n## Changelog\n\nAn extensive changelog is available [here](CHANGELOG.md).\n\n\n## License\n\nCopyright © 2017-2023 Paul Landes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\u003c!-- links --\u003e\n[ciSQL]: https://github.com/plandes/icsql\n[travis-link]: https://travis-ci.org/plandes/cisql\n[travis-badge]: https://travis-ci.org/plandes/cisql.svg?branch=master\n\n[maven repository]: https://mvnrepository.com\n[maven install plugin]: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html\n[stand alone Java jar file]: https://github.com/plandes/cisql/releases/latest\n[Cider]: https://github.com/clojure-emacs/cider\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplandes%2Fcisql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplandes%2Fcisql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplandes%2Fcisql/lists"}