sqlsharp.1 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. .TH sqlsharp 1 "25 December 2005"
  2. .SH NAME
  3. sqlsharp \- Mono SQL Query command-line tool
  4. .SH SYNOPSIS
  5. .B sqlsharp
  6. [\-f filename] [\-o filename] [\-s]
  7. .SH DESCRIPTION
  8. sqlsharp is a Mono SQL tool used for entering SQL queries
  9. to a database using Mono data providers.
  10. .PP
  11. .SH OPTIONS
  12. The following options are supported:
  13. .TP
  14. .I "-f filename"
  15. Output file to load SQL commands from.
  16. .TP
  17. .I "-o filename"
  18. Output file to send results.
  19. .TP
  20. .I "-s"
  21. Silent mode.
  22. .PP
  23. .SH HOW TO USE
  24. The SQL tool accepts commands via its command line interface. Commands
  25. begin with a backslash followed by the command name.
  26. .PP
  27. Example:
  28. .nf
  29. \\open
  30. .fi
  31. .PP
  32. Basically, there are five commands a user should know:
  33. \\provider, \\connectionstring, \\open, \\quit, and \\help
  34. .PP
  35. To connect to a database, you need to do the following:
  36. .PP
  37. 1. set your data provider via \\provider
  38. .PP
  39. .nf
  40. Example:
  41. SQL# \\provider mysql
  42. .fi
  43. .PP
  44. 2. set your connection string via \\connectionstring
  45. .PP
  46. .nf
  47. Example:
  48. SQL# \\connectionstring Database=test
  49. .fi
  50. .PP
  51. 3. open a connection to the database via \\open
  52. .PP
  53. .nf
  54. Example:
  55. SQL# \\open
  56. .fi
  57. .PP
  58. .SH CONNECTION AND PROVIDER COMMANDS
  59. These commands are used to setup the provider,
  60. connection string, and open/close the database connnection
  61. .TP
  62. .I "ConnectionString"
  63. Sets the Connection String
  64. .nf
  65. Example:
  66. SQL# \\ConnectionString Database=testdb
  67. For more examples, see section CONNECTION STRING EXAMPLES.
  68. .fi
  69. .TP
  70. .I "Provider"
  71. Sets the Provider of the Data Source. For list of Providers, see section PROVIDERS.
  72. .nf
  73. Example: to set the provider for MySQL:
  74. SQL# \\provider mysql
  75. Note: if you need to load an external provider in SQL#,
  76. see the SQL# command \\loadextprovider
  77. .fi
  78. .TP
  79. .I "LoadExtProvider"
  80. ASSEMBLY CLASS to load an external provider. Use the complete name
  81. of its assembly and its Connection class.
  82. .nf
  83. Example: to load the MySQL provider Mono.Data.MySql
  84. SQL# \\loadextprovider Mono.Data.MySql Mono.Data.MySql.MySqlConnection
  85. .fi
  86. .TP
  87. .I "Open"
  88. Opens a connection to the database
  89. .nf
  90. Example:
  91. SQL# \\open
  92. .fi
  93. .TP
  94. .I "Close"
  95. Closes the connection to the database
  96. .nf
  97. Example:
  98. SQL# \\close
  99. .fi
  100. .TP
  101. .I "Default"
  102. show default variables, such as, Provider and ConnectionString.
  103. .nf
  104. Example:
  105. SQL# \\defaults
  106. .fi
  107. .TP
  108. .I "Q"
  109. Quit
  110. .nf
  111. Example:
  112. SQL# \\q
  113. .fi
  114. .SH SQL EXECUTION COMMANDS
  115. Commands to execute SQL statements
  116. .PP
  117. .TR
  118. .I "e"
  119. execute SQL query (SELECT)
  120. .nf
  121. Example: to execute a query
  122. SQL# SELECT * FROM EMPLOYEE
  123. SQL# \\e
  124. Note: to get \\e to automatically work after entering a query, put a
  125. semicolon ; at the end of the query.
  126. Example: to enter and exectue query at the same time
  127. SQL# SELECT * FROM EMPLOYEE;
  128. .fi
  129. .TP
  130. .I "exenonquery"
  131. execute a SQL non query (not a SELECT)
  132. .nf
  133. Example: to insert a row into a table:
  134. SQL# INSERT INTO SOMETABLE (COL1, COL2) VALUES('ABC','DEF')
  135. SQL# \\exenonquery
  136. Note: this can be used for those providers that are new and do not have
  137. the ability to execute queries yet.
  138. .fi
  139. .TP
  140. .I "exescalar"
  141. execute SQL to get a single row and single column.
  142. .nf
  143. Example: to execute a Maxium aggregate
  144. SQL# SELECT MAX(grade) FROM class
  145. SQL# \\exescalar
  146. .fi
  147. .TP
  148. .I "exexml"
  149. FILENAME to execute SQL and save output to XML file
  150. .nf
  151. Example:
  152. SQL# SELECT fname, lname, hire_date FROM employee
  153. SQL# \\exexml employee.xml
  154. Note: this depends on DataAdapter, DataTable, and DataSet
  155. to be working properly
  156. .fi
  157. .TP
  158. .SH FILE COMMANDS
  159. Commands for importing commands from file to SQL# and vice versa
  160. .TP
  161. .I "f"
  162. FILENAME to read a batch of SQL# commands from file
  163. .nf
  164. Example:
  165. SQL# \\f batch.sql#
  166. Note: the SQL# commands are interpreted as they are read. If there is
  167. any SQL statements, the are executed.
  168. .fi
  169. .TP
  170. .I "o"
  171. FILENAME to write result of commands executed to file.
  172. .nf
  173. Example:
  174. SQL# \\o result.txt
  175. .fi
  176. .TP
  177. .I "load"
  178. FILENAME to load from file SQL commands into SQL buffer.
  179. .nf
  180. Example:
  181. SQL# \\load commands.sql
  182. .fi
  183. .TP
  184. .I "save"
  185. FILENAME to save SQL commands from SQL buffer to file.
  186. .nf
  187. Example:
  188. SQL# \\save commands.sql
  189. .fi
  190. .SH GENERAL PURPOSE COMMANDS
  191. General commands to use.
  192. .TP
  193. .I "h"
  194. show help (all commands).
  195. .nf
  196. Example:
  197. SQL# \\h
  198. .fi
  199. .TP
  200. .I "s"
  201. TRUE, FALSE to silent messages.
  202. .nf
  203. Example 1:
  204. SQL# \\s true
  205. Example 2:
  206. SQL# \\s false
  207. .fi
  208. .TP
  209. .I "r"
  210. reset or clear the query buffer.
  211. .nf
  212. Example:
  213. SQL# \\r
  214. .fi
  215. .TP
  216. .I "print"
  217. show what's in the SQL buffer now.
  218. .nf
  219. Example:
  220. SQL# \\print
  221. .fi
  222. SH VARIABLES WHICH CAN BE USED AS PARAMETERS
  223. Commands to set variables which can be used as Parameters in an SQL statement. If the
  224. SQL contains any parameters, the parameter does not have a variable set, the
  225. user will be prompted for the value for each missing parameter.
  226. .TP
  227. .I "set"
  228. NAME VALUE to set an internal variable.
  229. .nf
  230. Example:
  231. SQL# \\set sFirstName John
  232. .fi
  233. .TP
  234. .I "unset"
  235. NAME to remove an internal variable.
  236. .nf
  237. Example:
  238. SQL# \\unset sFirstName
  239. .fi
  240. .TP
  241. .I "variable"
  242. NAME to display the value of an internal variable.
  243. .nf
  244. Example:
  245. SQL# \\variable sFirstName
  246. .fi
  247. .SH PROVIDER SUPPORT OPTIONS
  248. Enable or Disble support for a particular provider option
  249. .TP
  250. .I "UseParameters"
  251. TRUE,FALSE to use parameters when executing SQL which
  252. use the variables that were set.
  253. .PP
  254. If this option is true, the SQL
  255. contains parameters, and for each parameter
  256. which does not have a SQL# variable set, the
  257. user will be prompted to enter the value
  258. For that parameter.
  259. .nf
  260. Example:
  261. SQL# \\useparameter true
  262. .fi
  263. .PP
  264. Default: false
  265. .TP
  266. .I "UseSimpleReader"
  267. TRUE,FALSE to use simple reader when displaying results.
  268. .nf
  269. Example:
  270. SQL# \\usesimplereader true
  271. .fi
  272. .PP
  273. Default: false. Mostly, this is dependent on the provider. If the provider
  274. does not have enough of IDataReader implemented to have
  275. the normal reader working, then the simple reader can be used.
  276. Providers like SqlClient, MySQL, and PostgreSQL have this
  277. ption defaulting to true.
  278. .PP
  279. .SH PROVIDERS
  280. .nf
  281. PROVIDER NAME NAMESPACE ASSEMBLY
  282. oracle Oracle 8i System.Data.OracleClient System.Data.OracleClient
  283. postgresql NetPostgreSQL Npgsql Npgsql
  284. bytefx ByteFX MySQL ByteFX.Data.MySqlClient ByteFX.Data
  285. sqlclient MS SQL 7/2000 System.Data.SqlClient System.Data
  286. odbc ODBC System.Data.Odbc System.Data
  287. sqlite SQL Lite Mono.Data.SqliteClient Mono.Data.SqliteClient
  288. sybase Sybase Mono.Data.SybaseClient Mono.Data.SybaseClient
  289. olebb OLE DB System.Data.OleDb System.Data
  290. tds TDS Generic Mono.Data.TdsClient Mono.Data.TdsClient
  291. msodbc MS ODBC Microsoft.Data.Odbc Microsoft.Data.Odbc
  292. firebird Firebird SQL FirebirdSql.Data.FirebirdSql FirebirdSql.Data.Firebird
  293. mysql MySQL AB MySql.Data.MySqlClient MySql.Data
  294. NOTES:
  295. npgsql maps to postgresql above.
  296. mysqlnet maps to mysql above.
  297. odbc is treated as an external provider for .NET 1.1 and above.
  298. msodbc is an external provider for compatibility with .NET 1.0
  299. MySql.Data has replaced the mysql provider. If you still need to use ByteFX.Data, then
  300. use bytefx.
  301. MySql.Data is not included with Mono. You need to
  302. download the MySQL Connector/Net from MySQL AB at
  303. http://dev.mysql.com/downloads/connector/net/1.0.html
  304. .fi
  305. .SH CONNECTION STRING SAMPLES
  306. Example connection strings for various providers to be used via the
  307. command \\ConnectionString
  308. .nf
  309. Example of usage:
  310. \\connectionstring Database=testdb
  311. Connection String examples:
  312. Microsoft SQL Server via System.Data.SqlClient
  313. or Mono.Data.TdsClient provider:
  314. Server=DANPC;Database=pubs;User ID=saPassword=
  315. ODBC via System.Data.Odbc provider using
  316. a DSN named "MSSQLDSN" I set up
  317. in the Windows control panel's ODBC Data Sources
  318. which connects to Microsoft SQL Server 2000:
  319. DSN=MSSQLDSN;UID=danmorg;PWD=freetds
  320. SQL Lite via Mono.Data.SqliteClient
  321. provider which connects to the
  322. database file SqliteTest.db; if not found,
  323. the file is created:
  324. URI=file:SqliteTest.db
  325. OLE DB via System.Data.OleDb provider
  326. which connects to a PostgreSQL database:
  327. Provider=PostgreSQL;Addr=127.0.0.1;Database=rodrigo
  328. Oracle via System.Data.OracleClient
  329. Data Source=testdb;User ID=scott;Password=tiger
  330. Npgsql (.NET PostgreSQL) from
  331. http://gborg.postgresql.org/project/npgsql/projdisplay.php
  332. Server=localhost;Database=test;User ID=postgres;Password=fun2db
  333. ByteFX (ByteFX MySQL) from
  334. Server=localhost;Database=test;User ID=mysql;Password=
  335. FirebirdSql via FirebirdSql.Data.Firebird (not included with Mono)
  336. Database=C:\\FIREBIRD\\EXAMPLES\\EMPLOYEE.FDB;User=SYSDBA;Password=masterkey;Dialect=3;Server=localhost
  337. MySQL (MySQL AB) from http://www.mysql.com/
  338. Server=localhost;Database=test;User ID=mysql;Password=mypass;Pooling=false
  339. .fi
  340. .SH TRACING SUPPORT
  341. No support for tracing right now.
  342. .SH AUTHORS
  343. The Mono SQL Query Tool was written
  344. .nf
  345. by Daniel Morgan <[email protected]>
  346. .fi
  347. .PP
  348. .SH LICENSE
  349. The Mono SQL Query Tool is released under the terms of the GNU GPL.
  350. Please read the accompanying `COPYING' file for details. Alternative
  351. licenses are available from Novell or Daniel Morgan.
  352. .SH BUGS
  353. To report bugs in the compiler, you can use `bug-buddy', or you can
  354. file bug reports in our bug tracking system:
  355. .nf
  356. http://bugzilla.ximian.com.
  357. .fi
  358. .PP
  359. .SH MAILING LISTS
  360. For details, visit:
  361. .nf
  362. http://lists.ximian.com/mailman/listinfo/mono-devel-list
  363. .fi
  364. .SH WEB SITE
  365. For details, visit:
  366. .nf
  367. http://www.mono-project.com
  368. .fi
  369. .PP
  370. .SH SEE ALSO
  371. mono(1), mint(1)