Skip to content

cgen: fix orm shared conn on sql expr#26610

Merged
medvednikov merged 1 commit into
vlang:masterfrom
felipensp:fix_shared_orm_conn
Feb 15, 2026
Merged

cgen: fix orm shared conn on sql expr#26610
medvednikov merged 1 commit into
vlang:masterfrom
felipensp:fix_shared_orm_conn

Conversation

@felipensp

Copy link
Copy Markdown
Member

Fix #26479

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc5a1360e8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread vlib/v/gen/c/orm.v
Comment on lines +156 to 158
mut db_ctype_name := g.styp(db_expr_type.clear_flag(.shared_f))
is_pointer := db_ctype_name.ends_with('*')
reference_sign := if is_pointer { '' } else { '&' }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Detect pointer-ness before stripping shared flag

db_ctype_name is now computed from db_expr_type.clear_flag(.shared_f), so is_pointer becomes false for shared ORM connections whose underlying DB type is a struct (for example shared sqlite.DB). With the new shared-path writes, that produces generated C like &&...->val instead of &...->val in the connection initializer, which causes sql statements using shared DB connections to fail to compile.

Useful? React with 👍 / 👎.

@medvednikov medvednikov merged commit 5d37dd1 into vlang:master Feb 15, 2026
90 checks passed
@medvednikov

Copy link
Copy Markdown
Member

Oops, needed a test @felipensp

cestef pushed a commit to cestef/v that referenced this pull request Mar 9, 2026
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.

orm: cgen error when using shared

2 participants