phpmyadmin / phpmyadmin/sql-parser

Condition could have more detailed fields

未關閉
#357 1 則留言 5 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

enhancement
主要語言
PHP
星號
485
分支
119
PR 合併指標
30 天內沒有已合併 PR

描述

Currently, when I parse a query, I get WHERE as Condition instances. These have an expr field, which is just a string and not very useful when analyzing a query. It would be really nice if we could be able to get more detail from that, like the operator, operands, etc.

Examples:

// c.id = 2
[
    leftOperand: ColumnReference [ column: 'id', tableAlias: 'c' ] ,
    operator: Equals []
    rightOperand: Constant [ value: 2 ]
]
// customer.address_id IS NOT NULL
[
    leftOperand: ColumnReference [ column: 'address_id', tableName: 'customer' ] ,
    operator: IsNotNull
    rightOperand: null
]

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先找出 parser 的 Condition 實例和現有的 expr 欄位。比較所要求的 c.id = 2 和 customer.address_id IS NOT NULL 範例,接著定義必須公開哪些結構化的 operator 和 operand 資訊;當 conditions 提供這些詳細資訊,而不只是字串時,工作就完成了。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
php, sql
領域
compilers
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。