diff --git a/documentation/tdenginedocs-en/super-table/index.html b/documentation/tdenginedocs-en/super-table/index.html index 3ebb0775b5e3faaa90281fb19cd027d9599da900..21e7669a19118fd0bfd9b15693ae38bc66edbb0b 100644 --- a/documentation/tdenginedocs-en/super-table/index.html +++ b/documentation/tdenginedocs-en/super-table/index.html @@ -6,9 +6,9 @@
Like a table, you can create, show, delete and describe STables. Most query operations on tables can be applied to STable too, including the aggregation and selector functions. For queries on a STable, if no tags filter, the operations are applied to all the tables created via this STable. If there is a tag filter, the operations are applied only to a subset of the tables which satisfy the tag filter conditions. It will be very convenient to use tags to put devices into different groups for aggregation.
Similiar to creating a standard table, syntax is:
-CREATE TABLE <stable_name> (<field_name> TIMESTAMP, field_name1 field_type,…) TAGS(tag_name tag_type, …)
+CREATE TABLE <stable_name> (<field_name> TIMESTAMP, field_name1 field_type, ...) TAGS(tag_name tag_type, ...)
New keyword "tags" is introduced, where tag_name is the tag name, and tag_type is the associated data type.
-Note:
+Note:
You can group a set of tables together by specifying the tags filter condition, then apply the aggregation operations. The result set can be grouped and ordered based on tag value. Syntax is:
-SELECT function<field_name>,…
+You can group a set of tables together by specifying the tags filter condition, then apply the aggregation operations. The result set can be grouped and ordered based on tag value. Syntax is:
+SELECT function<field_name>, ...
FROM <stable_name>
- WHERE <tag_name> <[=|<=|>=|<>] values..> ([AND|OR] …)
+ WHERE <tag_name> <[=|<=|>=|<>] values..> ([AND|OR] ...
INTERVAL (<time range>)
- GROUP BY <tag_name>, <tag_name>…
+ GROUP BY <tag_name>, <tag_name> ...
ORDER BY <tag_name> <asc|desc>
SLIMIT <group_limit>
SOFFSET <group_offset>
@@ -75,9 +75,9 @@ INTERVAL(10M)
DROP TABLE <stable_name>
To delete a STable, all the tables created via this STable shall be deleted first, otherwise, it will fail.
List the Associated Tables of a STable
-SELECT TBNAME,[TAG_NAME,…] FROM <stable_name> WHERE <tag_name> <[=|=<|>=|<>] values..> ([AND|OR] …)
+SELECT TBNAME,[TAG_NAME, ...] FROM <stable_name> WHERE <tag_name> <[=|=<|>=|<>] values..> ([AND|OR] ...)
It will list all the tables which satisfy the tag filter conditions. The tables are all created from this specific STable. TBNAME is a new keyword introduced, it is the table name associated with the STable.
-SELECT COUNT(TBNAME) FROM <stable_name> WHERE <tag_name> <[=|=<|>=|<>] values..> ([AND|OR] …)
+SELECT COUNT(TBNAME) FROM <stable_name> WHERE <tag_name> <[=|=<|>=|<>] values..> ([AND|OR] ...)
The above SQL statement will list the number of tables in a STable, which satisfy the filter condition.
Management of Tags
You can add, delete and change the tags for a STable, and you can change the tag value of a table. The SQL commands are listed below.
diff --git a/src/connector/go/src/taosSql/rows.go b/src/connector/go/src/taosSql/rows.go
index 6407fc334e929f3ba636519deb959fd9f0c40d10..5040dca06d205865379e21d45e5d5dd3e2b793db 100755
--- a/src/connector/go/src/taosSql/rows.go
+++ b/src/connector/go/src/taosSql/rows.go
@@ -118,14 +118,15 @@ func (rows *taosSqlRows) ColumnTypeScanType(i int) reflect.Type {
return rows.rs.columns[i].scanType()
}
-func (rows *taosSqlRows) Close() (err error) {
- mc := rows.mc
- if mc == nil {
- return nil
+func (rows *taosSqlRows) Close() error {
+ if rows.mc != nil {
+ result := C.taos_use_result(rows.mc.taos)
+ if result != nil {
+ C.taos_free_result(result)
+ }
+ rows.mc = nil
}
-
- rows.mc = nil
- return err
+ return nil
}
func (rows *taosSqlRows) HasNextResultSet() (b bool) {
diff --git a/src/connector/go/src/taosSql/taosSqlCgo.go b/src/connector/go/src/taosSql/taosSqlCgo.go
index fcef14045fe1252f3636598576b2c6e753315aed..cc3aaa1658813cdfe667c5402c029525860fbf01 100755
--- a/src/connector/go/src/taosSql/taosSqlCgo.go
+++ b/src/connector/go/src/taosSql/taosSqlCgo.go
@@ -39,7 +39,7 @@ func (mc *taosConn) taosConnect(ip, user, pass, db string, port int) (taos unsaf
defer C.free(unsafe.Pointer(cpass))
defer C.free(unsafe.Pointer(cdb))
- taosObj := C.taos_connect(cip, cuser, cpass, cdb, (C.int)(port))
+ taosObj := C.taos_connect(cip, cuser, cpass, cdb, (C.ushort)(port))
if taosObj == nil {
return nil, errors.New("taos_connect() fail!")
}