.RawQuery()
Runs a set of SurrealQL statements against the database, based on a raw SurrealQL query.
Method Syntaxawait db.RawQuery(sql, params)
Arguments | Description | ||
---|---|---|---|
sql required | Specifies the SurrealQL statements. | ||
params optional | Assigns variables which can be used in the query. | ||
cancellationToken optional | The cancellationToken enables graceful cancellation of asynchronous operations. |
// Assign the variable on the connection var = new Dictionary<string, object> { { "table", "person" } }; var result = await db.RawQuery("CREATE person; SELECT * FROM type::table($table);", ); // Get the first result from the first query var created = result.GetValue<Person>(0); // Get all of the results from the second query var people = result.GetValue<List<Person>>(1);