Tip: STORED PROCEDURE · Şema: dbo · Modül: MOD-DIGER · Temizlik sınıfı: UNUSED_HIGH_CONFIDENCE (kategori E, güven 85) · Kapsam: ERPGOLD_CORE / ALL
Kullanım haritası (13.09.2026)
| Kategori | E — UNUSED CANDIDATE · E-SSMS_DIAGRAM_SUPPORT |
| Güven | 95 |
| Gerekçe | SQL Server Management Studio veritabanı diyagramı destek nesnesi (SSMS gerekince yeniden oluşturur); ERPGOLD ile ilgisi yok |
| Referans veren (gerekli olmayan) | dbo.fn_diagramobjects |
Bkz. Database Usage Map · Unused Candidates. Hiçbir DB değişikliği yapılmadı; SAFETY > CLEANUP.
Temizlik kanıtı
| Kontrol | Sonuç |
|---|---|
| app | NO |
| report | NO |
| config | NO |
| dynamic | NO |
| db_in | YES |
| db_out | YES |
| trigger | NO |
| fk | NO |
| computed | NO |
| crossdb | NO |
| runtime | UNKNOWN |
| external | NO |
Gerekçe: Pasif küme: yalnızca diğer güçlü adaylar referans ediyor → dbo.fn_diagramobjects | ikinci tur notu: SQL modül/rapor metinlerinde 1 şemasız ad geçişi (sütun/alias olabilir)
KB-v1 gövdesi (2026-09-10 · kısmi kod kapsamı — kaynağı kadar güvenilir)
Tür: PROCEDURE (P) · Modül: MOD-DIGER · Uzunluk: 65 satır
Özet
[GAP] Kaynakta açıklama yorumu yok; davranış aşağıdaki SQL tanımından ve ilişkilerden okunur.
Parametreler
| # | Parametre | Tip | Çıktı |
|---|---|---|---|
| 1 | @diagramname | sysname | |
| 2 | @owner_id | int | |
| 3 | @version | int | |
| 4 | @definition | varbinary |
Bağımlılıklar (bu nesne → hedef)
| İlişki | Hedef | Tip |
|---|---|---|
| WRITES | dbo.sysdiagrams | TABLE |
Ürettiği hata mesajları
- "Invalid ARG"
- "Diagram does not exist or you do not have permission."
SQL tanımı (AS-IMPLEMENTED, örnek DB)
CREATE PROCEDURE dbo.sp_alterdiagram
(
@diagramname sysname,
@owner_id int = null,
@version int,
@definition varbinary(max)
)
WITH EXECUTE AS 'dbo'
AS
BEGIN
set nocount on
declare @theId int
declare @retval int
declare @IsDbo int
declare @UIDFound int
declare @DiagId int
declare @ShouldChangeUID int
if(@diagramname is null)
begin
RAISERROR ('Invalid ARG', 16, 1)
return -1
end
execute as caller;
select @theId = DATABASE_PRINCIPAL_ID();
select @IsDbo = IS_MEMBER(N'db_owner');
if(@owner_id is null)
select @owner_id = @theId;
revert;
select @ShouldChangeUID=[REDACTED_SECRET]
select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname
if(@DiagId IS NULL or (@IsDbo = 0 and @theId <> @UIDFound))
begin
RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1);
return -3
end
if(@IsDbo <> 0)
begin
if(@UIDFound is null or USER_NAME(@UIDFound) is null) -- invalid principal_id
begin
select @ShouldChangeUID=[REDACTED_SECRET] ;
end
end
-- update dds data
update dbo.sysdiagrams set definition = @definition where diagram_id = @DiagId ;
-- change owner
if(@ShouldChangeUID=[REDACTED_SECRET]
update dbo.sysdiagrams set principal_id = @theId where diagram_id = @DiagId ;
-- update dds version
if(@version is not null)
update dbo.sysdiagrams set version = @version where diagram_id = @DiagId ;
return 0
END
Kaynaklar
- SRC-DB-MODULES —
sys.sql_modulestanımı (salt okunur); gizli sabitler[REDACTED_SECRET]ile değiştirildi.
Bilinmeyenler
- Hangi sürümde eklendiği:
createdDB tarihi bir kurulumun tarihidir, ürün sürümü değil (GAP-VERSION-02).
