1

Here is simple async API use case I've tested.

TDengine use callback for async query:

import time
from ctypes import *

from taos import *


class Counter(Structure):
    _fields_ = [("count", c_int), ("done", c_bool)]

    def __str__(self):
        return "{ count: %d, done: %s }" % (self.count, self.done)


def on_result(p_param, p_result, code):
    print(p_param)
    print(p_result)
    print(code)


def test_query_a():
    conn = connect()
    counter = Counter()
    conn.query_a("select * from log.log", on_result, byref(counter))

    while not counter.done:
        print("wait query callback")
        time.sleep(5)
    print(counter)
    conn.close()


if __name__ == '__main__':
    test_query_a()

It works well on Linux(in my case Ubuntu 20.04), but not work on windows.

zitsen
  • 339
  • 2
  • 10

0 Answers0