test(docs):add c# 3,0 user reference examples to ci (#16060)
This commit is contained in:
parent
a110935f54
commit
03cee8f98d
|
@ -10,7 +10,7 @@ namespace TDengineExample
|
||||||
{
|
{
|
||||||
IntPtr conn = GetConnection();
|
IntPtr conn = GetConnection();
|
||||||
// run query
|
// run query
|
||||||
IntPtr res = TDengine.Query(conn, "SELECT * FROM test.meters LIMIT 2");
|
IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2");
|
||||||
if (TDengine.ErrorNo(res) != 0)
|
if (TDengine.ErrorNo(res) != 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Failed to query since: " + TDengine.Error(res));
|
Console.WriteLine("Failed to query since: " + TDengine.Error(res));
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
const { options, connect } = require("@tdengine/rest");
|
//A cursor also needs to be initialized in order to interact with TDengine from Node.js.
|
||||||
|
const taos = require("@tdengine/client");
|
||||||
|
var conn = taos.connect({
|
||||||
|
host: "127.0.0.1",
|
||||||
|
user: "root",
|
||||||
|
password: "taosdata",
|
||||||
|
config: "/etc/taos",
|
||||||
|
port: 0,
|
||||||
|
});
|
||||||
|
var cursor = conn.cursor(); // Initializing a new cursor
|
||||||
|
|
||||||
async function test() {
|
//Close a connection
|
||||||
options.path = "/rest/sql";
|
conn.close();
|
||||||
options.host = "localhost";
|
|
||||||
let conn = connect(options);
|
|
||||||
let cursor = conn.cursor();
|
|
||||||
try {
|
|
||||||
let res = await cursor.query("SELECT server_version()");
|
|
||||||
res.toString();
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
test();
|
|
||||||
|
|
||||||
// output:
|
|
||||||
// server_version() |
|
|
||||||
// ===================
|
|
||||||
// 3.0.0.0 |
|
|
|
@ -1,7 +1,7 @@
|
||||||
const { options, connect } = require("@tdengine/rest");
|
const { options, connect } = require("@tdengine/rest");
|
||||||
|
|
||||||
async function test() {
|
async function test() {
|
||||||
options.path = "/rest/sqlt";
|
options.path = "/rest/sql";
|
||||||
options.host = "localhost";
|
options.host = "localhost";
|
||||||
let conn = connect(options);
|
let conn = connect(options);
|
||||||
let cursor = conn.cursor();
|
let cursor = conn.cursor();
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
pgrep taosd || taosd >> /dev/null 2>&1 &
|
||||||
|
pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
|
||||||
|
cd ../../docs/examples/csharp
|
||||||
|
|
||||||
|
dotnet run --project connect.csproj
|
||||||
|
|
||||||
|
taos -s "drop database if exists power"
|
||||||
|
dotnet run --project sqlinsert.csproj
|
||||||
|
dotnet run --project query.csproj
|
||||||
|
dotnet run --project asyncquery.csproj
|
||||||
|
dotnet run --project subscribe.csproj
|
||||||
|
|
||||||
|
taos -s "drop topic if exists topic_example"
|
||||||
|
taos -s "drop database if exists power"
|
||||||
|
dotnet run --project stmtinsert.csproj
|
||||||
|
|
||||||
|
taos -s "drop database if exists test"
|
||||||
|
dotnet run --project influxdbline.csproj
|
||||||
|
|
||||||
|
taos -s "drop database if exists test"
|
||||||
|
dotnet run --project optstelnet.csproj
|
||||||
|
|
||||||
|
taos -s "drop database if exists test"
|
||||||
|
dotnet run --project optsjson.csproj
|
Loading…
Reference in New Issue