microsoft / microsoft/sqlmanagementobjects
API to parse/split GO statements into batches
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 143
- フォーク
- 28
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Per comment on another issue I am opening this to ask for an API in similar effect to this wrapped function:
/// <summary>
/// Split/Parse a TSQL string into batches by the "GO" statement.
/// Mirrors SQL Management Studio's parsing (because it is the same)
/// </summary>
public static List<string> ParseSQLBatches(string tsql)
{
var batchParser = new Microsoft.SqlServer.Management.Common.ExecuteBatch();
var ret = batchParser.GetStatements(tsql);
return ret.Cast<string>().ToList();
}
The reasoning behind this is that we have scripts written by us for schema/data migrations that commonly utilize GO statements in many ways. We can't easily rely on a simplified "Split on bare GO statements outside of comments" due to sometimes having GO 20 or other such fun things, or multi-line strings etc that might have GO in them for unrelated reasons. Although we could write a parser, that SMO provided one that out of the box (as far as we noticed) was identical to SSMS's was very convenient for us. It seems that this exposed class/api that we were relying on was an implementation detail/surface that is going away in an upcoming release. So the ask here is to facilitate at least this minimal API of "given TSQL string, here it is split-and-duplicated-etc into individual batches".
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue に記載されている既存の Microsoft.SqlServer.Management.Common.ExecuteBatch と GetStatements の使用方法、および issue 4 にリンクされた議論を確認します。GO 20、コメント、複数行文字列を含め、T-SQL をバッチに分割するためにサポートされるパブリック API を定義し、その結果が想定される SQL Management Studio の動作と一致することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, sql
- 領域
- api, databases
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100