Skip to content

Latest commit

 

History

History
117 lines (117 loc) · 5.52 KB

File metadata and controls

117 lines (117 loc) · 5.52 KB
  • Imports:
    • interface wasi:sql/types@0.2.0-draft
    • interface wasi:sql/readwrite@0.2.0-draft

Import interface wasi:sql/types@0.2.0-draft


Types

variant data-type

common data types

Variant Cases
  • int32: s32
  • int64: s64
  • uint32: u32
  • uint64: u64
  • float: float64
  • double: float64
  • str: string
  • boolean: bool
  • date: string
  • time: string
  • timestamp: string
  • binary: list<u8>
  • null

record row

one single row item

Record Fields

resource statement

allows parameterized queries e.g., prepare("SELECT * FROM users WHERE name = ? AND age = ?", vec!["John Doe", "32"])

resource error

An error resource type. Currently, this provides only one function to return a string representation of the error. In the future, this will be extended to provide more information.

resource connection

A connection to a sql store.

Functions

[static]statement.prepare: func

Params
  • query: string
  • params: list<string>
Return values

[method]error.trace: func

Params
Return values
  • string

[static]connection.open: func

Params
  • name: string
Return values

Import interface wasi:sql/readwrite@0.2.0-draft


Types

type statement

statement

#### `type row` [`row`](#row)

#### `type error` [`error`](#error)

#### `type connection` [`connection`](#connection)

----

Functions

query: func

query is optimized for querying data, and implementors can make use of that fact to optimize the performance of query execution (e.g., using indexes).

Params
Return values

exec: func

exec is for modifying data in the database.

Params
Return values
  • result<u32, own<error>>