Pudu programming language
Menu
API reference

Std.Db.Query.Statement

2 declarations with this name

type

Statement

This declaration introduces a public type.

What it does

The parts are held rather than one text, because a statement is built a

clause at a time and appending to text copies everything built so far — so

a statement assembled from many pieces cost the square of its length. They

are joined once, when the text is asked for.

The values are typed, not text.

A comparison written against a number has to reach the backend as one. Bound

as text it is compared as text, and SQLite orders every number before every

text — so sum(quantity) > '6' is false for every row it could be asked

about, and the answer is an empty result rather than an error. PostgreSQL

coerces the text and answers correctly, so the same query means two things.

Carrying the type is what stops the builder deciding that by accident.

Read the signature

  • This declaration has no value signature because it introduces a type or trait.

type

Statement: Std.Db.Query.QueryError -> Std.Db.Store.StoreError

This declaration introduces a public type.

What it does

The parts are held rather than one text, because a statement is built a

clause at a time and appending to text copies everything built so far — so

a statement assembled from many pieces cost the square of its length. They

are joined once, when the text is asked for.

The values are typed, not text.

A comparison written against a number has to reach the backend as one. Bound

as text it is compared as text, and SQLite orders every number before every

text — so sum(quantity) > '6' is false for every row it could be asked

about, and the answer is an empty result rather than an error. PostgreSQL

coerces the text and answers correctly, so the same query means two things.

Carrying the type is what stops the builder deciding that by accident.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.

Back to Std.Db.QuerySearch related declarations