new Connection(database, numThreads)
Initialize a new Connection object.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
database |
kuzu.sync.Database | the database object to connect to. | |
numThreads |
Number | null | the maximum number of threads to use for query execution. |
- Source:
Methods
close()
Close the connection.
- Source:
execute(preparedStatement, params) → {kuzu.sync.QueryResult}
Execute a prepared statement.
Parameters:
Name | Type | Description |
---|---|---|
preparedStatement |
kuzu.sync.PreparedStatement | the prepared statement to execute. |
params |
Object | a plain object mapping parameter names to values. |
- Source:
Throws:
-
-
if the connection is closed.
- Type
- Error
-
-
-
if preparedStatement is not a valid PreparedStatement object.
- Type
- Error
-
-
-
if preparedStatement is not successful.
- Type
- Error
-
-
-
if params is not a plain object.
- Type
- Error
-
Returns:
the query result.
- Type
- kuzu.sync.QueryResult
getMaxNumThreadForExec() → {Number}
Get the maximum number of threads to use for query execution.
- Source:
Throws:
-
if the connection is closed.
- Type
- Error
Returns:
the maximum number of threads to use for query execution.
- Type
- Number
prepare(statement) → {Promise.<kuzu.sync.PreparedStatement>}
Prepare a statement for execution.
Parameters:
Name | Type | Description |
---|---|---|
statement |
String | the statement to prepare. |
- Source:
Returns:
the prepared statement.
- Type
- Promise.<kuzu.sync.PreparedStatement>
query(statement) → {kuzu.sync.QueryResult}
Execute a query.
Parameters:
Name | Type | Description |
---|---|---|
statement |
String | the statement to execute. |
- Source:
Throws:
-
-
if the connection is closed.
- Type
- Error
-
-
-
if statement is not a string.
- Type
- Error
-
Returns:
the query result.
- Type
- kuzu.sync.QueryResult
setMaxNumThreadForExec(numThreads)
Set the maximum number of threads to use for query execution.
Parameters:
Name | Type | Description |
---|---|---|
numThreads |
Number | the maximum number of threads to use for query execution. |
- Source:
Throws:
-
-
if the connection is closed.
- Type
- Error
-
-
-
if numThreads is not a positive integer.
- Type
- Error
-
setQueryTimeout(timeout)
Set the query timeout in milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
timeout |
Number | the query timeout in milliseconds. |
- Source:
Throws:
-
-
if the connection is closed.
- Type
- Error
-
-
-
if timeout is not a positive integer.
- Type
- Error
-