Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

MSSQL stored procedures does not correctly works with schemas

Aperta
#791 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
fsharp, sql
Ambito
databases

Direzione di ricerca

Inizia eseguendo gli script forniti dello schema MSSQL e delle stored procedure, quindi riproduci il problema tramite SqlDataProvider.GetDataContext e ctx.Procedures. Traccia il modo in cui vengono individuate ed esposte le procedure con lo stesso nome in clm e eeInf. Il lavoro è completato quando entrambe le procedure specifiche dello schema rimangono distinte e Invoke mostra i parametri corretti per ciascuna.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

sql server

SqlDataProvider does not have the functionality to specify schema of stored procedure (in contrast to accessing the tables). Rather, all stored procedures appear under ctx.Procedures where ctx is a database context obtained via call to GetDataContext, e.g.:

    type private WorkerNodeDb = SqlDataProvider<
                    Common.DatabaseProviderTypes.MSSQLSERVER,
                    ConnectionString = WorkerNodeConnectionStringValue,
                    UseOptionTypes = Common.NullableColumnType.OPTION>


    type private WorkerNodeDbContext = WorkerNodeDb.dataContext
    let private getDbContext (c : unit -> ConnectionString) = c().value |> WorkerNodeDb.GetDataContext

This how clm.tryUpdateProgressRunQueue (from schema clm) appears in F#:

image

Hovering over (as shown on the picture) correctly shows that the stored procedure belongs to clm schema. This is inconvenient but that would've been OK and that could be dealt with.

However, the error appears if there is a stored procedure with the same name but in a different schema (eeInf in the example). The second procedure "acquires" an extra ' in the name:

image

Unfortunately, finally nothing works. Hovering over Invoke shows SP parameters mixed up from both procedures:

image

Here are the blank SPs along with schema creation scripts for convenience:

if not exists(select schema_name from information_schema.schemata where schema_name = 'clm') begin
	print 'Creating schema clm...'
	exec sp_executesql N'create schema clm'
end else begin
	print 'Schema clm already exists...'
end
go


if not exists(select schema_name from information_schema.schemata where schema_name = 'eeInf') begin
	print 'Creating schema eeInf...'
	exec sp_executesql N'create schema eeInf'
end else begin
	print 'Schema eeInf already exists...'
end
go


drop procedure if exists clm.tryUpdateProgressRunQueue
go


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


create procedure clm.tryUpdateProgressRunQueue (
						@runQueueId uniqueidentifier,
						@progress decimal(18, 14),
						@callCount bigint,
						@relativeInvariant float,
						@maxEe float,
						@maxAverageEe float,
						@maxWeightedAverageAbsEe float,
						@maxLastEe float)
as
begin
	declare @rowCount int
	set nocount on;

        -- Do something useful here.

	set @rowCount = @@rowcount
	select @rowCount as [RowCount]
end
go


drop procedure if exists eeInf.tryUpdateProgressRunQueue
go


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


create procedure eeInf.tryUpdateProgressRunQueue (
						@runQueueId uniqueidentifier,
						@progress decimal(18, 14),
						@callCount bigint,
						@relativeInvariant float,
						@dummy float)
as
begin
	declare @rowCount int
	set nocount on;

        -- Do something useful here.

	set @rowCount = @@rowcount
	select @rowCount as [RowCount]
end
go

I am using SQLProvider version 1.3.7 and MSSQL.

Lingua principale
F#
Stelle
627
Fork
147
Merge medio
2h 2m
PR unite (30g)
1

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fsprojects/SQLProvider

Tutte le issue di fsprojects/SQLProvider

Issue simili

Altre issue su Databases

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.