Skip to content

db.pg: add support for prepared statements#23442

Merged
spytheman merged 1 commit into
vlang:masterfrom
louis77:pg-prepared-statements
Jan 12, 2025
Merged

db.pg: add support for prepared statements#23442
spytheman merged 1 commit into
vlang:masterfrom
louis77:pg-prepared-statements

Conversation

@louis77

@louis77 louis77 commented Jan 12, 2025

Copy link
Copy Markdown
Contributor

PostgreSQL has two separate calls to support prepared statements. This PR adds the following two public functions to db.pg:

pub fn (db DB) prepare(name string, query string, num_params int) !
pub fn (db DB) exec_prepared(name string, params []string) ![]Row

plus one to handle an empty result to check for an error when prepare is called.

Also an appropriate test has been added.

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-21873

@louis77 louis77 changed the title db.pg: add support for prepared statement db.pg: add support for prepared statements Jan 12, 2025

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit d2b30df into vlang:master Jan 12, 2025
@felipensp

Copy link
Copy Markdown
Member

Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants