CamelotSql Options

To get SQL execution options type help options, or for a specific command help <command>.

camelotsql> ? options

List of sql command options:
Note that all sql commands (SELECT, INSERT, UPDATE, etc) must be first on line and end with ";"

-authentication     Authentication method, e.g. NTLM, Basic, 365.
-bin                Write binary content. Use this to download binary content.
-cs                 Connect to named connection.
-csv                Write rows in CSV format.
-db                 Change database.
                        '-db home'
-defaultlimit       Default row limit (number of rows returned from server).
-f                  Dump output to file. If no format is provided, the extension will be
                    matched.
                        '-f c:\rows.csv'
-html               Write rows in HTML format.
-p                  Set command page size.
                        '-p 20'
-password           Password for authentication.
-q                  Quit CamelotSql after command has been executed.
-s                  Silent mode. Less output is printed.
-server             Connect to host.
-tsv                Write rows in TSV format.
-user               User name for authentication.
-v                  Print result rows vertically (one line per column value).
-xml                Write rows in XML format.

Example: SELECT ID, Title, Created FROM `Shared Documents` LIMIT 20,1; -server 192.168.0.1 -user foo -pwd bar

Example: SELECT * FROM Tasks; -f c:\tasks.csv

Example: CALL DOWNLOAD('Shared Documents', 'logo.bmp'); -bin -f c:\logo.bmp

For more connection options, see /documentation.
camelotsql>

SQL's can be executed directly on a connection that has been previously initiated using the connect command or interactively by providing required connection options after the SQL statement. The latter allows interactive scripting through batch files or other tools.

To execute SQL on current connection simply type the SQL command terminated with ";".

camelotsql> select species, count(*) as c from animals group by species order by c desc;
+---------+----+
| Species | c  |
+---------+----+
| Zebra   | 22 |
| Dog     | 2  |
| Cat     | 1  |
| Fish    | 1  |
+---------+----+
4 row(s) in set (0.15 sec)
camelotsql>

To execute SQL on a named connection that has been previously stored using the save command specify the -cs option.

camelotsql> select species, count(*) as c from animals group by species order by c desc; -cs myconnection
Connected to myconnection..
+---------+----+
| Species | c  |
+---------+----+
| Zebra   | 22 |
| Dog     | 2  |
| Cat     | 1  |
| Fish    | 1  |
+---------+----+
4 row(s) in set (2.07 sec)
camelotsql>

You can also specify all connection string options directly after the SQL statement as follows. You can specify any connection string options made available by the Camelot .NET Connector, see connection string options. Each connection string option should follow the syntax -<optionname> optionvalue as shown in the following example.

camelotsql> select species, count(*) as c from animals group by species order by c desc; -server 192.168.2.33 -user foo -password bar
Connected to 192.168.2.33..
+---------+----+
| Species | c  |
+---------+----+
| Zebra   | 22 |
| Dog     | 2  |
| Cat     | 1  |
| Fish    | 1  |
+---------+----+
4 row(s) in set (1.86 sec)
camelotsql>

There are several outout formats available in CamelotSql. By providing the -v option all result rows are printed vertically (one row per column) to simplify reading.

camelotsql> select species, count(*) as c from animals group by species order by c desc; -v
******************** Row 1 ********************
Species: Zebra
c:       22
******************** Row 2 ********************
Species: Dog
c:       2
******************** Row 3 ********************
Species: Cat
c:       1
******************** Row 4 ********************
Species: Fish
c:       1
4 row(s) in set (1.38 sec)
camelotsql>

You can also specify an of the options -csv, -tsv, -xml, -bin, -html to output the data in different formats.

camelotsql> select species, count(*) as c from animals group by species order by c desc; -xml
<NewDataSet>
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:
schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="ResultRow" msdata:Us
eCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="ResultRow">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Species" type="xs:string" minOccurs="0" />
                <xs:element name="c" type="xs:int" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <ResultRow>
    <Species>Zebra</Species>
    <c>22</c>
  </ResultRow>
  <ResultRow>
    <Species>Dog</Species>
    <c>2</c>
  </ResultRow>
  <ResultRow>
    <Species>Cat</Species>
    <c>1</c>
  </ResultRow>
  <ResultRow>
    <Species>Fish</Species>
    <c>1</c>
  </ResultRow>
</NewDataSet>camelotsql>

Options

  • -v
    Print results vertically (one column per row)
  • -csv, -tsv, -xml, -html
    Print results in specified format (CSV, TSV, XML or HTML)
  • -bin
    Output binary content to file. When specified you must also specify the file using the -f option. This makes it possible to download files from document libraries and similar.

    camelotsql> call download('shared documents', 'logotyp.bmp'); -bin -f c:\logotyp.bmp
    Results dumped to file logotyp.bmp (1.04 sec)
    camelotsql>

  • -f filepath
    Dump output to file. This option can be used with or without specifying the format. If no format is specified, CamelotSql will try to match the extension of filepath with known formats (CSV, TSV, XML, HTML). If something else the results will be printed as it would be shown in the console with or without the -v option.

    camelotsql> select * from animals; -f c:\animals.csv
    Results dumped to file animals.csv (0.14 sec)
    camelotsql>

  • -s
    Silent mode, which will produce less messages.
  • -p
    Specify page size (number of rows) printed before continuing. When executed in console window CamelotSql will wait for input after printing every page. This option is useless when output is file.
  • -cs connectionname
    Connect to specified named connection before executing command.
  • -q
    Exit CamelotSql immediately after SQL has been executed.

Batch scripting can easliy be setup, either for periodic or manual execution. When writing batch files, you would need to provide required connection options in your command line. The following example exports a CSV file. The -q option ensures that CamelotSql exits directly after execution.

animals.bat

@echo off
camelotsql select * from animals; -f c:\animals.csv -s -q -cs sp


Skip Navigation Links.

Visa     MasterCard