1
.TH sqlsharp 1 "10 December 2002"
3
sqlsharp \- Mono SQL# command-line SQL Query tool
6
[\-f filename] [\-o filename] [\-s]
8
sqlsharp is the Mono SQL# tool used for entering SQL queries
9
to a database using Mono ADO.NET providers.
12
The following options are supported:
15
Output file to load SQL# commands from.
18
Output file to send results.
24
The SQL# tool accepts commands via its command line interface. Commands
25
begin with a backslash followed by the command name.
33
Basically, there are five commands a user should know:
34
\\provider, \\connectionstring, \\open, \\quit, and \\help
36
To connect to a database, you need to do the following:
38
1. set your data provider via \\provider
46
2. set your connection string via \\connectionstring
50
SQL# \\connectionstring Database=test
54
3. open a connection to the database via \\open
62
.SH CONNECTION AND PROVIDER COMMANDS
63
These commands are used to setup the provider,
64
connection string, and open/close the database connnection
67
Sets the Connection String
71
SQL# \\ConnectionString Database=testdb
73
For more examples, see section CONNECTION STRING EXAMPLES.
78
Sets the Provider of the Data Source. For list of Providers, see section PROVIDERS.
81
Example: to set the provider for MySQL:
84
Note: if you need to load an external provider in SQL#,
85
see the SQL# command \\loadextprovider
90
ASSEMBLY CLASS to load an external provider. Use the complete name
91
of its assembly and its Connection class.
94
Example: to load the MySQL provider Mono.Data.MySql
95
SQL# \\loadextprovider Mono.Data.MySql Mono.Data.MySql.MySqlConnection
100
Opens a connection to the database
109
Closes the connection to the database
118
show default variables, such as, Provider and ConnectionString.
134
.SH SQL EXECUTION COMMANDS
135
Commands to execute SQL statements
139
execute SQL query (SELECT)
142
Example: to execute a query
144
SQL# SELECT * FROM EMPLOYEE
147
Note: to get \\e to automatically work after entering a query, put a
148
semicolon ; at the end of the query.
150
Example: to enter and exectue query at the same time
152
SQL# SELECT * FROM EMPLOYEE;
157
execute a SQL non query (not a SELECT)
160
Example: to insert a row into a table:
162
SQL# INSERT INTO SOMETABLE (COL1, COL2) VALUES('ABC','DEF')
165
Note: this can be used for those providers that are new and do not have
166
the ability to execute queries yet.
171
execute SQL to get a single row and single column.
174
Example: to execute a Maxium aggregate
175
SQL# SELECT MAX(grade) FROM class
181
FILENAME to execute SQL and save output to XML file
185
SQL# SELECT fname, lname, hire_date FROM employee
186
SQL# \\exexml employee.xml
188
Note: this depends on DataAdapter, DataTable, and DataSet
189
to be working properly
194
Commands for importing commands from file to SQL# and vice versa
197
FILENAME to read a batch of SQL# commands from file
203
Note: the SQL# commands are interpreted as they are read. If there is
204
any SQL statements, the are executed.
209
FILENAME to write result of commands executed to file.
218
FILENAME to load from file SQL commands into SQL buffer.
222
SQL# \\load commands.sql
227
FILENAME to save SQL commands from SQL buffer to file.
231
SQL# \\save commands.sql
234
.SH GENERAL PURPOSE COMMANDS
235
General commands to use.
238
show help (all commands).
247
TRUE, FALSE to silent messages.
259
reset or clear the query buffer.
268
show what's in the SQL buffer now.
275
SH VARIABLES WHICH CAN BE USED AS PARAMETERS
276
Commands to set variables which can be used as Parameters in an SQL statement. If the
277
SQL contains any parameters, the parameter does not have a variable set, the
278
user will be prompted for the value for each missing parameter.
281
NAME VALUE to set an internal variable.
285
SQL# \\set sFirstName John
290
NAME to remove an internal variable.
294
SQL# \\unset sFirstName
299
NAME to display the value of an internal variable.
303
SQL# \\variable sFirstName
306
.SH PROVIDER SUPPORT OPTIONS
307
Enable or Disble support for a particular provider option
310
TRUE,FALSE to use parameters when executing SQL which
311
use the variables that were set.
313
If this option is true, the SQL
314
contains parameters, and for each parameter
315
which does not have a SQL# variable set, the
316
user will be prompted to enter the value
321
SQL# \\useparameter true
328
TRUE,FALSE to use simple reader when displaying results.
332
SQL# \\usesimplereader true
336
Default: false. Mostly, this is dependent on the provider. If the provider
337
does not have enough of IDataReader implemented to have
338
the normal reader working, then the simple reader can be used.
339
Providers like SqlClient, MySQL, and PostgreSQL have this
340
ption defaulting to true.
345
PROVIDER NAME NAMESPACE ASSEMBLY
350
OleDb OLE DB System.Data.OleDb System.Data
351
SqlClient MS SQL 7/2000 System.Data.SqlClient System.Data
352
Odbc ODBC System.Data.Odbc System.Data
354
External to System.Data
355
-----------------------
356
MySql MySQL Mono.Data.MySql Mono.Data.MySql
357
Sqlite SQL Lite Mono.Data.SqliteClient Mono.Data.SqliteClient
358
Sybase Sybase Mono.Data.SybaseClient Mono.Data.SybaseClient
359
Tds TDS Generic Mono.Data.TdsClient Mono.Data.TdsClient
360
PostgreSql M PostgreSQL Mono.Data.PostgreSqlClient Mono.Data.PostgreSqlClient
361
DB2 IBM DB2 Mono.Data.DB2Client Mono.Data.DB2Client
362
Oracle Oracle 8i System.Data.OracleClient System.Data.OracleClient
367
Npgsql NetPostgreSQL Npgsql Npgsql
368
MySQLNet ByteFX MySQL ByteFX.Data.MySQL ByteFX.Data
371
.SH CONNECTION STRING SAMPLES
372
Example connection strings for various providers to be used via the
373
command \\ConnectionString
377
\\connectionstring Database=testdb
380
Connection String examples:
383
Microsoft SQL Server via System.Data.SqlClient
384
or Mono.Data.TdsClient provider:
386
Server=DANPC;Database=pubs;User ID=saPassword=
389
PostgreSQL via Mono.Data.PostgreSqlClient provider:
391
host=localhost;dbname=test;user=postgres;password=fun2db
395
Server=localhost;Database=test;User ID=postgres;Password=fun2db
398
MySQL via Mono.Data.MySql provider:
400
Server=localhost;Database=test;User ID=mysql;Password=
403
ODBC via System.Data.Odbc provider using
404
a DSN named "MSSQLDSN" I set up
405
in the Windows control panel's ODBC Data Sources
406
which connects to Microsoft SQL Server 2000:
408
DSN=MSSQLDSN;UID=danmorg;PWD=freetds
411
SQL Lite via Mono.Data.SqliteClient
412
provider which connects to the
413
database file SqliteTest.db; if not found,
416
URI=file:SqliteTest.db
419
OLE DB via System.Data.OleDb provider
420
which connects to a PostgreSQL database:
422
Provider=PostgreSQL;Addr=127.0.0.1;Database=rodrigo
425
Oracle via System.Data.OracleClient
427
Data Source=testdb;User ID=scott;Password=tiger
430
IBM DB2 Universal Database via Mono.Data.DB2Client
432
DSN=sample;User ID=db2admin;Password=mysecret
435
Npgsql (.NET PostgreSQL) from
436
http://gborg.postgresql.org/project/npgsql/projdisplay.php
438
Server=localhost;Database=test;User ID=postgres;Password=fun2db
441
MySQLNet (ByteFX MySQL) from
442
http://sourceforge.net/projects/mysqlnet/
444
Server=localhost;Database=test;User ID=mysql;Password=
449
No support for tracing right now.
451
The Mono SQL# Tool was written
453
by Daniel Morgan <danmorg@sc.rr.com>
457
The Mono SQL# Tool is released under the terms of the GNU GPL.
458
Please read the accompanying `COPYING' file for details. Alternative
459
licenses are available from Ximian or Daniel Morgan.
461
To report bugs in the compiler, you can use `bug-buddy', or you can
462
file bug reports in our bug tracking system:
464
http://bugzilla.ximian.com.
470
http://mail.ximian.com/mailman/mono-list
475
http://www.go-mono.com