td2.0-connector

2.0.11

C Interface with TDengine Module

CTaosInterface
Instance Members
numFields(result)
fetch_rows_a(result, callback, param)
schemalessInsert(connection, lines, protocal, precision, numLines, protocol)
stmtInit(connection)
stmtPrepare(stmt, sql, length)
stmtSetTbname(stmt, tableName)
stmtSetTbnameTags(stmt, tableName, tags)
stmtSetSubTbname(stmt, subTableName)
bindParam(stmt, binds)
stmtBindSingleParamBatch(stmt, mbind, colIndex)
stmtBindParamBatch(stmt, mbinds)
addBatch(stmt)
stmtExecute(stmt)
stmtUseResult(stmt)
loadTableInfo(taos, tableList)
closeStmt(stmt)
stmtErrStr(stmt)
new CTaosInterface(config: Object): CTaosInterface
Parameters
config (Object) Configuration options for the interface
Returns
CTaosInterface:
Instance Members
numFields(result)
fetch_rows_a(result, callback, param)
schemalessInsert(connection, lines, protocal, precision, numLines, protocol)
stmtInit(connection)
stmtPrepare(stmt, sql, length)
stmtSetTbname(stmt, tableName)
stmtSetTbnameTags(stmt, tableName, tags)
stmtSetSubTbname(stmt, subTableName)
bindParam(stmt, binds)
stmtBindSingleParamBatch(stmt, mbind, colIndex)
stmtBindParamBatch(stmt, mbinds)
addBatch(stmt)
stmtExecute(stmt)
stmtUseResult(stmt)
loadTableInfo(taos, tableList)
closeStmt(stmt)
stmtErrStr(stmt)

TDengine Connection Class

new TDengineConnection(options: object): TDengineConnection
Parameters
options (object) Options for configuring the connection with TDengine
Returns
TDengineConnection:
Example
//Initialize a new connection
var conn = new TDengineConnection({host:"127.0.0.1", user:"root", password:"taosdata", config:"/etc/taos",port:0})
Instance Members
close()
cursor()
getType(typecode: number): string
Parameters
typecode (number) The code to get the name of the type for
Returns
string: Name of the field type

Contains the the definitions/values assigned to various field types

FieldTypes
new TDengineCursor(null-null: TDengineConnection)
Since: 1.0.0
Parameters
null-null (TDengineConnection) The TDengine Connection this cursor uses to interact with TDengine
Properties
null-null (data) : Latest retrieved data from query execution. It is an empty array by default
null-null (fields) : Array of the field objects in order from left to right of the latest data retrieved
Instance Members
rowcount()
close()
query(operation, execute)
execute(operation, options, callback)
fetchall(options, callback)
execute_a(operation, options, callback, param)
fetchall_a(result, options, callback, param)
stopQuery(result)
getServerInfo()
getClientInfo()
subscribe(config)
consumeData(subscription, callback)
unsubscribe(subscription)
schemalessInsert(lines, protocol, precision, connection, protocal)
stmtInit()
stmtPrepare(sql)
stmtSetTbname(tableName)
stmtSetTbnameTags(tableName, tags)
stmtSetSubTbname(subTableName)
stmtBindParam(binds)
stmtBindSingleParamBatch(mbind, colIndex)
stmtBindParamBatch(mbinds)
stmtAddBatch(stmt)
stmtExecute(stmt)
stmtUseResult()
loadTableInfo(tableList)
stmtClose(stmt)

Used to bind null value for all data types that tdengine supports.

bindNil()
bindBool(val: bool)
Parameters
val (bool) is not null bool value,true or false.
bindTinyInt(val: int8)
Parameters
val (int8) is a not null tinyint value.
bindSmallInt(val: short)
Parameters
val (short) is a not null small int value.
bindInt(val: int)
Parameters
val (int) is a not null int value.
bindBigInt(val: long)
Parameters
val (long) is not null big int value.
bindFloat(val: float)
Parameters
val (float) is a not null float value
bindDouble(val: double)
Parameters
val (double) is a not null double value
bindBinary(val: string)
Parameters
val (string) is a string.
bindTimestamp(val: long)
Parameters
val (long) is a not null timestamp(long) values.
bindNchar(val: string)
Parameters
val (string) is a string.
bindUTinyInt(val: uint8)
Parameters
val (uint8) is a not null unsinged tinyint value.
bindUSmallInt(val: uint16)
Parameters
val (uint16) is a not null unsinged smallint value.
bindUInt(val: uint32)
Parameters
val (uint32) is a not null unsinged int value.
bindUBigInt(val: uint64)
Parameters
val (uint64) is a not null unsinged bigint value.
bindJson(val: jsonStr)
Parameters
val (jsonStr) is a json string. Such as '{"key1":"taosdata"}'
getBind(): any
Returns
any: binded buffer.

To bind bool through an array.

multiBindBool(boolArray: any): any
Parameters
boolArray (any) is an boolean array that stores one column's value.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with bool type.

to bind tiny int through an array.

multiBindTinyInt(tinyIntArray: any): any
Parameters
tinyIntArray (any) is an array that stores tiny int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with tiny int.

To bind small int through an array.

multiBindSmallInt(smallIntArray: any): any
Parameters
smallIntArray (any) is an array that stores small int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with small int.

To bind int through an array.

multiBindInt(intArray: any): any
Parameters
intArray (any) is an array that stores int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with int.

To bind big int through an array.

multiBindBigInt(bigIntArray: any): any
Parameters
bigIntArray (any) is an array that stores big int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with big int.

To bind float through an array.

multiBindFloat(floatArray: any): any
Parameters
floatArray (any) is an array that stores float.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with float.

To bind double through an array.

multiBindDouble(doubleArray: any): any
Parameters
doubleArray (any) is an array that stores double.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with double.

To bind tdengine's binary through an array.

multiBindBinary(strArr: any): any
Parameters
strArr (any) is an array that stores string. (Null string can be defined as undefined or null,notice '' is not null.)
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with binary.

To bind timestamp through an array.

multiBindTimestamp(timestampArray: any): any
Parameters
timestampArray (any) is an array that stores timestamp.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with timestamp.

To bind tdengine's nchar through an array.

multiBindNchar(strArr: any): any
Parameters
strArr (any) is an array that stores string. (Null string can be defined as undefined or null,notice '' is not null.)
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one nchar column's data with nchar.

to bind unsigned tiny int through an array.

multiBindUTinyInt(uTinyIntArray: any): any
Parameters
uTinyIntArray (any) is an array that stores unsigned tiny int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with unsigned tiny int.

To bind unsigned small int through an array.

multiBindUSmallInt(uSmallIntArray: any): any
Parameters
uSmallIntArray (any) is an array that stores unsigned small int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with unsigned small int.

To bind unsigned int through an array.

multiBindUInt(uIntArray: any): any
Parameters
uIntArray (any) is an array that stores unsigned int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with unsigned int.

To bind unsigned big int through an array.

multiBindUBigInt(uBigIntArray: any): any
Parameters
uBigIntArray (any) is an array that stores unsigned big int.
Returns
any: A instance of struct TAOS_MULTI_BIND that contains one column's data with unsigned big int.
_maxUTF8StrArrLength(strArr: any): any
Parameters
strArr (any) an string array
Returns
any: return the max length of the element in strArr in "UFT-8" encoding.
_stringUTF8Length(str: any): any
Parameters
str (any) a string.
Returns
any: return the length of the input string encoding with utf-8.

The constructor,initial basic parameters and alloc buffer.

constructor(numOfColumns: any)
Parameters
numOfColumns (any) the number of column that you want to bind parameters.

Used to bind boolean column's values.

multiBindBool(boolArray: any)
Parameters
boolArray (any) An array of bool value, represents the bool values you want to bind.

Used to bind tiny int column's values.

multiBindTinyInt(tinyIntArray: any)
Parameters
tinyIntArray (any) An array of tiny int value. represents the tiny int values you want to bind.

Used to bind small int column's value.

multiBindSmallInt(smallIntArray: any)
Parameters
smallIntArray (any) An array of small int values, represents the small int values you want to bind.

Used to bind int column's value.

multiBindInt(intArray: any)
Parameters
intArray (any) An array of int values, represents the int values you want to bind.

Used to bind big int column's value.

multiBindBigInt(bigIntArray: any)
Parameters
bigIntArray (any) An array of big int values, represents the big int values you want to bind.

Used to bind float column's value.

multiBindFloat(floatArray: any)
Parameters
floatArray (any) An array of float values, represents the float values you want to bind.

Used to bind double column's value.

multiBindDouble(doubleArray: any)
Parameters
doubleArray (any) An array of double values, represents the double values you want to bind.

Used to bind binary column's value.

multiBindBinary(strArr: any)
Parameters
strArr (any) An array of binary(string) values, represents the binary values you want to bind. Notice '' is not equal to TDengine's "null" value.

Used to bind timestamp column's values.

multiBindTimestamp(timestampArray: any)
Parameters
timestampArray (any) An array of timestamp values, represents the timestamp values you want to bind.

Used to bind nchar column's value.

multiBindNchar(strArr: any)
Parameters
strArr (any) An array of nchar(string) values, represents the nchar values you want to bind. Notice '' is not equal to TDengine's "null" value.

Used to bind unsigned tiny int column's value.

multiBindUTinyInt(uTinyIntArray: any)
Parameters
uTinyIntArray (any) An array of unsigned tiny int values, represents the unsigned tiny int values you want to bind.

Used to bind unsigned small int column's value.

multiBindUSmallInt(uSmallIntArray: any)
Parameters
uSmallIntArray (any) An array of unsigned small int value, represents the unsigned small int values you want to bind.

Used to bind unsigned int column's value.

multiBindUInt(uIntArray: any)
Parameters
uIntArray (any) An array of unsigned int column's value, represents the unsigned int values you want to bind.

Used to bind unsigned big int column's value.

multiBindUBigInt(uBigIntArray: any)
Parameters
uBigIntArray (any) An array of unsigned big int column's value, represents the unsigned big int values you want to bind.

After all the parameters have been prepared and stored in the buffer, Call this method to get the buffer.

getMultiBindArr(): any
Returns
any: return the buffer which stores all the parameters.

TDengine raw timestamp.

taosTimestamp(): any
Returns
any: raw taos timestamp (int64)

Gets the microseconds of a Date.

getMicroseconds(): Int
Returns
Int: A microseconds integer

Gets the nanoseconds of a TaosTimestamp.

getNanoseconds(): Int
Returns
Int: A nanoseconds integer
_precisionExtra(): String
Returns
String: a string for timestamp string format
toTaosString(): string
Returns
string: A Taos Timestamp String

Custom console.log

custom(depth: any, opts: any): String
Parameters
depth (any)
opts (any)
Returns
String: string format for debug

Various objects such as TaosRow and TaosColumn that help make parsing data easier

TaosObjects
new TaosQuery(query: string, cursor: TDengineCursor, execute: boolean): TaosQuery
Since: 1.0.6
Parameters
query (string) Query to construct object from
cursor (TDengineCursor) The cursor from which this query will execute from
execute (boolean) Whether or not to immedietely execute the query synchronously and fetch all results. Default is false.
Properties
query (string) : The current query in string format the TaosQuery object represents
Returns
TaosQuery:
Static Members
execute()
execute_a(options)
Instance Members
bind(f, args)
new TaosResult(data: Array<TaosRow>, fields: Array<TaosField>): TaosResult
Since: 1.0.6
Parameters
data (Array<TaosRow>) Array of result rows
fields (Array<TaosField>) Array of field meta data
Properties
data (Array<TaosRow>) : Array of TaosRows forming the result data (this does not include field meta data)
fields (Array<TaosField>) : Array of TaosFields forming the fields meta data array.
Returns
TaosResult:
Static Members
pretty()