Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for statement variants of prepared statement comands #5685

Merged
merged 1 commit into from Jun 26, 2023

Conversation

elprans
Copy link
Member

@elprans elprans commented Jun 22, 2023

This adds support for PREPARE, EXECUTE and DEALLOCATE at SQL
level. There is a fair bit of cleanup as well, removing unnecessary
duplication in the form of sql_simple_query as we translate client
simple query requests to extended query requests anyway.

Copy link
Member

@fantix fantix left a comment

Choose a reason for hiding this comment

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

👍

edb/server/protocol/pg_ext.pyx Outdated Show resolved Hide resolved
edb/server/pgcon/pgcon.pyx Show resolved Hide resolved
edb/server/protocol/pg_ext.pyx Outdated Show resolved Hide resolved
edb/server/protocol/pg_ext.pyx Outdated Show resolved Hide resolved
edb/server/protocol/pg_ext.pyx Outdated Show resolved Hide resolved
edb/server/pgcon/pgcon.pyx Outdated Show resolved Hide resolved
Comment on lines +115 to +119
@dataclasses.dataclass(frozen=True)
class SQLSource:
chunks: list[str]
param_index: dict[int, list[int]]
translation_data: Optional[SQLSourceGeneratorTranslationData] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

I've opened a PR that does a refactor of codegen, which will conflict with these changes.

The changes are in the same light (adding dataclasses as such), and should not be hard to update the these changes.

@@ -156,25 +165,30 @@ def ctes_to_source(cls, ctes: List[pgast.CommonTableExpr]) -> str:
return ''.join(generator.result)

@classmethod
def to_source_with_translation(
def to_source_ex(
Copy link
Contributor

Choose a reason for hiding this comment

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

what's _ex? Extended?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. "extended" or "expert" (I'm not sure what the origin for Ex was in WinAPI). Suggestions for a better name welcome.

This adds support for `PREPARE`, `EXECUTE` and `DEALLOCATE` at SQL
level.  There is a fair bit of cleanup as well, removing unnecessary
duplication in the form of `sql_simple_query` as we translate client
simple query requests to extended query requests anyway.
@elprans elprans merged commit c7c14d1 into master Jun 26, 2023
23 checks passed
@elprans elprans deleted the sql_prepare branch June 26, 2023 19:24
msullivan pushed a commit that referenced this pull request Jul 6, 2023
This adds support for `PREPARE`, `EXECUTE` and `DEALLOCATE` at SQL
level.  There is a fair bit of cleanup as well, removing unnecessary
duplication in the form of `sql_simple_query` as we translate client
simple query requests to extended query requests anyway.
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.

None yet

3 participants