sqlsharp(1)

πŸ“¦
version 6.14.1 Β· 2 versions
, in alpine 3.24, epel 10, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

πŸ’– sqlsharp(1) πŸ’–

okay bestie, listen up β€” this is sqlsharp, straight outta the General Commands Manual. it's a Mono SQL Query command-line tool and honestly? it's giving main character energy for your terminal. πŸŽ€


✨ NAME ✨

sqlsharp β€” the Mono SQL Query command-line tool. yeah. that's her. πŸ’…


🌸 SYNOPSIS 🌸

sqlsharp [-f filename] [-o filename] [-s]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, sqlsharp is a Mono SQL tool that you use for entering SQL queries to a database using Mono data providers. that's the whole vibe. you type SQL, it talks to your database, everybody wins. πŸ’–


πŸ’… OPTIONS πŸ’…

here's what you can pass her, bestie:

  • -f filename β€” Output file to load SQL commands from. like, it slurps your SQL out of a file. πŸ“‚
  • -o filename β€” Output file to send results. where the answers go to live. πŸ“
  • -s β€” Silent mode. shhh. 🀫 no yapping.

πŸŽ€ HOW TO USE πŸŽ€

okay so the SQL tool takes commands through its command line interface. every command starts with a backslash followed by the command name. that's the whole thing. iconic behavior honestly.

Example:

\open

basically? there are five commands a user should know: \provider, \connectionstring, \open, \quit, and \help. those five. memorize them. iykyk. 🧠✨

to connect to a database, you gotta do this little three-step routine:

  1. set your data provider via \provider

Example:

SQL# \provider mysql
  1. set your connection string via \connectionstring

Example:

SQL# \connectionstring Database=test
  1. open a connection to the database via \open

Example:

SQL# \open

boom. connected. slay. πŸ”₯


🌈 CONNECTION AND PROVIDER COMMANDS 🌈

these commands are used to setup the provider, the connection string, and to open/close the database connection. (yes the original says "connnection", we love her anyway πŸ’€)

  • ConnectionString β€” Sets the Connection String

Example:

SQL# \ConnectionString Database=testdb
or
SQL# \cs Database=testdb

for more examples, go look at the section CONNECTION STRING EXAMPLES. πŸ‘€

  • Provider β€” Sets the Provider of the Data Source. for the list of Providers, peep the section PROVIDERS.

Example: to set the provider for MySQL:

SQL# \provider mysql
      or
SQL# \p mysql
Note: if you need to load an external provider in SQL#, see the SQL# command \loadextprovider. 🫢
  • ListProviders β€” List ADO.NET 2.0 Providers available

Example:

SQL# \ListProviders
   or
SQL# \listp
  • BCS β€” Prompts you for building each connection parameter and builds the connection string and also lets you enter a password which does not echo. very discreet. very demure. πŸ™ˆ

Example:

SQL# \bcs

ConnectionString Option: Data Source [] SQL# blazer

ConnectionString Option: Persist Security Info [False] SQL#

ConnectionString Option: Integrated Security [False] SQL#

ConnectionString Option: User ID [] SQL# scott

Password: *****

ConnectionString Option: Enlist [False] SQL#

ConnectionString Option: Pooling [True] SQL#

ConnectionString Option: Min Pool Size [0] SQL#

ConnectionString Option: Max Pool Size [100] SQL#

ConnectionString Option: Unicode [False] SQL#

ConnectionString Option: Load Balance Timeout [0] SQL#

ConnectionString Option: Omit Oracle Connection Name [False] SQL#
ConnectionString is set.
  • LoadExtProvider β€” ASSEMBLY CLASS to load an external provider. use the complete name of its assembly and its Connection class.

Example: to load the MySQL provider Mono.Data.MySql

SQL# \loadextprovider Mono.Data.MySql Mono.Data.MySql.MySqlConnection
  • Open β€” Opens a connection to the database

Example:

SQL# \open
  • Close β€” Closes the connection to the database

Example:

SQL# \close
  • Default β€” show default variables, such as, Provider and ConnectionString.

Example:

SQL# \defaults
  • Q β€” Quit. bye bestie! πŸ‘‹

Example:

SQL# \q

πŸ”₯ SQL EXECUTION COMMANDS πŸ”₯

commands to execute SQL statements. the moment we've all been waiting for. ⭐

e β€” execute SQL query (SELECT)

Example: to execute a query

SQL# SELECT * FROM EMPLOYEE
SQL# \e
Note: to get \e to automatically work after entering a query, put a semicolon ; at the end of the query. life hack fr fr.

Example: to enter and exectue query at the same time

SQL# SELECT * FROM EMPLOYEE;
  • exenonquery β€” execute a SQL non query (not a SELECT)

Example: to insert a row into a table:

SQL# INSERT INTO SOMETABLE (COL1, COL2) VALUES('ABC','DEF')
SQL# \exenonquery
Note: this can be used for those providers that are new and do not have the ability to execute queries yet. 🍼
  • exescalar β€” execute SQL to get a single row and single column. just one. singular. one single lil value. ✨

Example: to execute a Maxium aggregate

SQL# SELECT MAX(grade) FROM class
SQL# \exescalar
  • exexml FILENAME β€” to execute SQL and save output to XML file

Example:

SQL# SELECT fname, lname, hire_date FROM employee
SQL# \exexml employee.xml
Note: this depends on DataAdapter, DataTable, and DataSet to be working properly. so like, if those are broken, this is broken. no cap.

πŸ’Ύ FILE COMMANDS πŸ’Ύ

commands for importing commands from file to SQL# and vice versa. the whole round trip. πŸ¦‹

  • f FILENAME β€” to read a batch of SQL# commands from file

Example:

SQL# \f batch.sql#
Note: the SQL# commands are interpreted as they are read. if there are any SQL statements, the are executed. πŸ‘‘
  • o FILENAME β€” to write result of commands executed to file.

Example:

SQL# \o result.txt
  • load FILENAME β€” to load from file SQL commands into SQL buffer.

Example:

SQL# \load commands.sql
  • save FILENAME β€” to save SQL commands from SQL buffer to file.

Example:

SQL# \save commands.sql

🌟 GENERAL PURPOSE COMMANDS 🌟

general commands to use. the everyday essentials. the little black dress of SQL# commands. πŸ’œ

  • h β€” show help (all commands).

Example:

SQL# \h
  • s β€” TRUE, FALSE to silent messages.

Example 1:

SQL# \s true

Example 2:

SQL# \s false
  • r β€” reset or clear the query buffer. clean slate energy. 🧼

Example:

SQL# \r
  • print β€” show what's in the SQL buffer now.

Example:

SQL# \print

✨ SH VARIABLES WHICH CAN BE USED AS PARAMETERS ✨

commands to set variables which can be used as Parameters in an SQL statement. if the SQL contains any parameters, the parameter does not have a variable set, the user will be prompted for the value for each missing parameter. so like, she'll ask. politely. πŸ™ˆ

  • set NAME VALUE β€” to set an internal variable.

Example:

SQL# \set sFirstName John
  • unset NAME β€” to remove an internal variable.

Example:

SQL# \unset sFirstName
  • variable NAME β€” to display the value of an internal variable.

Example:

SQL# \variable sFirstName

πŸŽ€ PROVIDER SUPPORT OPTIONS πŸŽ€

Enable or Disble support for a particular provider option. toggle time, bestie. πŸ”€

  • UseParameters β€” TRUE,FALSE to use parameters when executing SQL which use the variables that were set.

if this option is true, the SQL contains parameters, and for each parameter which does not have a SQL# variable set, the user will be prompted to enter the value for that parameter.

Example:

SQL# \useparameter true
Default: false
  • UseSimpleReader β€” TRUE,FALSE to use simple reader when displaying results.

Example:

SQL# \usesimplereader true
Default: false. mostly, this is dependent on the provider. if the provider does not have enough of IDataReader implemented to have the normal reader working, then the simple reader can be used. providers like SqlClient, MySQL, and PostgreSQL have this ption defaulting to true.

πŸ‘‘ PROVIDERS πŸ‘‘

here's the lineup, bestie. every single one. πŸ’–

  • oracle β€” NAME: Oracle 8i-11g, NAMESPACE: System.Data.OracleClient, ASSEMBLY: System.Data.OracleClient
  • postgresql β€” NAME: NetPostgreSQL, NAMESPACE: Npgsql, ASSEMBLY: Npgsql
  • bytefx β€” NAME: ByteFX MySQL, NAMESPACE: ByteFX.Data.MySqlClient, ASSEMBLY: ByteFX.Data
  • sqlclient β€” NAME: MS SQL 7-2008, NAMESPACE: System.Data.SqlClient, ASSEMBLY: System.Data
  • odbc β€” NAME: ODBC, NAMESPACE: System.Data.Odbc, ASSEMBLY: System.Data
  • sqlite β€” NAME: SQL Lite, NAMESPACE: Mono.Data.SqliteClient, ASSEMBLY: Mono.Data.SqliteClient
  • sybase β€” NAME: Sybase, NAMESPACE: Mono.Data.SybaseClient, ASSEMBLY: Mono.Data.SybaseClient
  • firebird β€” NAME: Firebird SQL, NAMESPACE: FirebirdSql.Data.FirebirdSql, ASSEMBLY: FirebirdSql.Data.Firebird
  • mysql β€” NAME: MySQL AB, NAMESPACE: MySql.Data.MySqlClient, ASSEMBLY: MySql.Data

πŸ’€ NOTES πŸ’€

Ngsql is the .Net Data Provider for PosgreSQL. the latest version can be downloaded from http://npgsql.projects.postgresql.org/

MySql.Data is the MySQL Connector/Net for connecting to MySql databases. for MySQL, it is strongly recommend to use MySql.Data instead of the old ByteFX.Data provider. unfortunately, MySql.Data is not included with Mono. you can download the latest MySQL Connector/Net from MySQL AB at http://dev.mysql.com/downloads/

FirebirdSql.Data.Firebird can be downloaded from here: http://www.firebirdsql.org/index.php?op=files&id=netprovider

Microsoft SQL Server via System.Data.SqlClient

Server=DANPC;Database=pubs;User ID=saPassword=;

For Integrated Security, bear in mind that Mono is not integrated with Windows, SQL Server client nor server, nor Windows Server. So you literally have to hand over the Windows Domain name, the domain user name, and the password for this user. No shortcuts, bestie.

Server=DANPC;Database=pubs;User ID=DOMAINser;Password=pass;Integrated Security=SSPI

And if your server is local? Just use localhost. 🏠

ODBC via System.Data.Odbc provider

This one uses a DSN named "MSSQLDSN" that I set up in the Windows control panel's ODBC Data Sources, and it connects to Microsoft SQL Server 2000:

DSN=MSSQLDSN;UID=danmorg;PWD=freetds

Wanna do ODBC on Unix? Then consider unixODBC from http://www.unixodbc.org/ or use iODBC from http://www.iodbc.org/ 🌈

SQL Lite via Mono.Data.SqliteClient

This provider connects to the database file SqliteTest.db β€” and if it's not found, the file is created ✨ (yes, it just manifests. iconic behaviour tbh.)

URI=file:SqliteTest.db

Oracle via System.Data.OracleClient

Data Source=testdb;User ID=scott;Password=PLACEHOLDER

If you prefer to not use a tnsnames.ora file, you can use a connection string which allows a TNS network description that is parentheses delimited, like the following β€” which has the host, port, and service name. And for host, you can specify an IP address instead of a hostname. πŸ’…

User ID=SCOTT;
Password=TIGER;
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TESTDB)))

Npgsql (.NET PostgreSQL)

Straight from http://gborg.postgresql.org/project/npgsql/projdisplay.php

Server=localhost;Database=test;User ID=postgres;Password=fun2db

ByteFX (ByteFX MySQL)

from

Please use MySql.Data instead. 🚨 (this one's a deprecated vibe, bestie β€” swap it out)
Server=localhost;Database=test;User ID=mysql;Password=

FirebirdSql via FirebirdSql.Data.Firebird

(download the latest from FirebirdSql.org)

Database=C:\FIREBIRD\EXAMPLES\EMPLOYEE.FDB;User=SYSDBA;Password=masterkey;Dialect=3;Server=localhost

MySQL via (MySql.Data) MySQL Connector/Net

from http://www.mysql.com/

Server=localhost;Database=test;User ID=mysql;Password=mypass;Pooling=false

πŸ” TRACING SUPPORT πŸ”

No support for tracing right now. That's it. That's the whole section. 😭 Nothing to see here, moving on. 🫢


✍️ AUTHORS ✍️

The Mono SQL Query Tool was written by Daniel Morgan <monodanmorg@yahoo.com> πŸ‘‘


πŸ“œ LICENSE πŸ“œ

The Mono SQL Query Tool is released under the terms of the GNU GPL. Please read the accompanying COPYING file for details. πŸ’–

Alternative licenses are available from Novell or Daniel Morgan. ✨


πŸ› BUGS πŸ›

To report bugs in the compiler, you can file bug reports in our bug tracking system:

https://github.com/mono/mono/issues

go be the main character who actually files the issue, bestie πŸ’…


πŸ’Œ MAILING LISTS πŸ’Œ

For details, visit:

http://lists.ximian.com/mailman/listinfo/mono-devel-list


🌐 WEB SITE 🌐

For details, visit:

http://www.mono-project.com


πŸ‘€ SEE ALSO πŸ‘€


and that's a wrap on sqlsharp(1), bestie πŸŽ€ this page is dated 9 September 2008 and it came out of the sqlsharp source β€” so yeah, it's vintage, but it still ate. go query something iconic. πŸ’œπŸ¦‹