---
title: "Timesten 学习笔记（七）ttisql"
author: "Intrepid2012"
date: "2012-05-18T03:29:19Z"
tags: []
categories: ["数据库"]
slug: "timesten-ttisql"
draft: false
lastmod: "2012-05-18T02:59:16Z"
id: 1534329
url: "https://intrepid2012.iteye.com/blog/1534329"
---

帮助信息

 

help command;

 

查看历史记录

 

h;

 

Each entry in the history list is identified by a unique number. The `!` character followed by the number of the command can be used to execute the command again. For example:

 

!1;

 

 

### Saving and clearing the ttIsql command history

 

```
Command> savehistory history.txt;
```

If the output file already exists, use the `-a` option to append the new command history to the file or the `-f` option to overwrite the file. The next example shows how to append new command history to an existing file.

```
Command> savehistory -a history.txt;
```

You can clear the []()[]()list of commands that `ttIsql` stores by using the `clearhistory` command:

```
Command> clearhistory;
```

 

显示数据库结构信息

 

- `describe` - Displays information on database objects.
- []()[]()`cachegroups` - Displays the attributes of cache groups.
- []()[]()`dssize` - Reports the current sizes of the permanent and temporary database partitions.
- []()[]()`monitor` - Displays a summary of the current state of the database.

使用 prepared statement

```
Command> timing 1;
Command> create table t1 (key number not null primary key, value char(20));
Execution time (SQLExecute) = 0.007247 seconds.
Command> prepare insert into t1 values (:f, :g);
Execution time (SQLPrepare) = 0.000603 seconds.

Command> exec;
Type '?' for help on entering parameter values.
Type '*' to end prompting and abort the command.
Type '-' to leave the parameter unbound.
Type '/' to leave the remaining parameters unbound and execute the command.
Enter Parameter 1 'F' (NUMBER) > 1;
Enter Parameter 2 'G' (CHAR) > 'abc';
1 row inserted.
Execution time (SQLExecute) = 0.000454 seconds.

Command> exec;
Type '?' for help on entering parameter values.
Type '*' to end prompting and abort the command.
Type '-' to leave the parameter unbound.
Type '/' to leave the remaining parameters unbound and execute the help command.
Enter Parameter 1 'F' (NUMBER) > 2;
Enter Parameter 2 'G' (CHAR) > 'def';
1 row inserted.
Execution time (SQLExecute) = 0.000300 seconds.

Command> free;
Command> select * from t1;
< 1, abc                  >
< 2, def                  >
2 rows found.
Execution time (SQLExecute + Fetch Loop) = 0.000226 seconds.

Command> disconnect;
Disconnecting...
Execution time (SQLDisconnect) = 2.911396 seconds. 
Command>
```