Difference between revisions of "Command-Line Client"

From BaseX Documentation
Jump to navigation Jump to search
Line 1: Line 1:
 
This page is part of the [[Getting Started]] Section.
 
This page is part of the [[Getting Started]] Section.
 
BaseX offers a standalone (embedded) console mode from which all [[Commands|database commands]] can be executed.
 
BaseX offers a standalone (embedded) console mode from which all [[Commands|database commands]] can be executed.
The article on the [[Database Server]] provides a good introduction on how to run commands in the console mode.
+
The article on the [[Database Server]] provides numerous examples for running commands in the console mode.
 
   
 
   
 
==Startup==
 
==Startup==
Line 8: Line 8:
 
==Working with the BaseX Console==  
 
==Working with the BaseX Console==  
 
   
 
   
<p>After the BaseX Console has been started, the <code>HELP</code> command can be used to
+
After the BaseX Console has been started, the <code>HELP</code> command can be used to
to list all [[Commands|database commands]]. Several commands can be separated by semicolons.</p>
+
to list all [[Commands|database commands]]. Multiple commands can be separated by semicolons.
+
 
<p>
 
 
To evaluate commands without entering the console mode, you can use the
 
To evaluate commands without entering the console mode, you can use the
 
<code>-c</code> option on the command line:
 
<code>-c</code> option on the command line:
</p>
 
 
   
 
   
 
<pre>
 
<pre>
basex -Vc "CREATE DB input input.xml; XQUERY /"
+
basex -Vc "CREATE DB input <example/>; XQUERY /"
  
Database 'input' created in 53.64 ms.
+
Database 'input' created in 124.95 ms.
<html>
+
<example/>
  <!-- Header -->
 
  <head id="0">
 
    <title>XML</title>
 
  </head>
 
  <!-- Body -->
 
  <body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC">
 
    <h1>Databases &amp; XML</h1>
 
    <div align="right">
 
      <b>Assignments</b>
 
      <ul>
 
        <li>Exercise 1</li>
 
        <li>Exercise 2</li>
 
      </ul>
 
    </div>
 
  </body>
 
  <?pi bogus?>
 
</html>
 
  
 
Query: /
 
Query: /
Line 45: Line 26:
 
Result: root()
 
Result: root()
  
Parsing: 0.19 ms
+
Parsing: 0.42 ms
Compiling: 9.27 ms
+
Compiling: 9.3 ms
Evaluating: 0.33 ms
+
Evaluating: 0.35 ms
Printing: 3.08 ms
+
Printing: 5.53 ms
Total Time: 12.88 ms
+
Total Time: 15.62 ms
Results: 1 Item
+
 
 +
Hit(s): 1 Item
 
Updated: 0 Items
 
Updated: 0 Items
Printed: 375 Bytes
+
Printed: 10 Bytes
Memory: 5834 KB
 
  
Query executed in 13.25 ms.
+
Query executed in 15.62 ms.
 
</pre>
 
</pre>
  

Revision as of 21:44, 22 March 2012

This page is part of the Getting Started Section. BaseX offers a standalone (embedded) console mode from which all database commands can be executed. The article on the Database Server provides numerous examples for running commands in the console mode.

Startup

First of all, please launch a standalone version of BaseX: double click on the BaseX icon, or run the basex script. Follow this link for more information (or check out the additional command-line options).

Working with the BaseX Console

After the BaseX Console has been started, the HELP command can be used to to list all database commands. Multiple commands can be separated by semicolons.

To evaluate commands without entering the console mode, you can use the -c option on the command line:

basex -Vc "CREATE DB input <example/>; XQUERY /"

Database 'input' created in 124.95 ms.
<example/>

Query: /

Compiling:

Result: root()

Parsing: 0.42 ms
Compiling: 9.3 ms
Evaluating: 0.35 ms
Printing: 5.53 ms
Total Time: 15.62 ms

Hit(s): 1 Item
Updated: 0 Items
Printed: 10 Bytes

Query executed in 15.62 ms.

All available command-line options can be found here.

See also

GUI Tutorial, Database Server, Getting Started