瀏覽代碼

fixed sql syntax error.

master
Savorboard 7 年之前
父節點
當前提交
3dec4f1595
共有 2 個文件被更改,包括 5 次插入8 次删除
  1. +1
    -4
      src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs
  2. +4
    -4
      src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs

+ 1
- 4
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs 查看文件

@@ -37,10 +37,7 @@ namespace DotNetCore.CAP.PostgreSql

public Task<IFetchedMessage> FetchNextMessageAsync()
{
var sql = $@"
SELECT ""MessageId"",""MessageType"" FROM ""{_options.Schema}"".""queue"" LIMIT 1 FOR UPDATE;
DELETE FROM ""{_options.Schema}"".""queue"" LIMIT 1;";
var sql = $@"DELETE FROM ""{_options.Schema}"".""queue"" WHERE ""MessageId"" = (SELECT ""MessageId"" FROM ""{_options.Schema}"".""queue"" LIMIT 1) RETURNING *;";
return FetchNextMessageCoreAsync(sql);
}



+ 4
- 4
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs 查看文件

@@ -28,7 +28,7 @@ namespace DotNetCore.CAP.PostgreSql
{
if (message == null) throw new ArgumentNullException(nameof(message));

var sql = $"UPDATE [{_schema}].[Published] SET [Retries] = @Retries,[ExpiresAt] = @ExpiresAt,[StatusName]=@StatusName WHERE Id=@Id;";
var sql = $@"UPDATE ""{_schema}"".""published"" SET ""Retries""=@Retries,""ExpiresAt""=@ExpiresAt,""StatusName""=@StatusName WHERE ""Id""=@Id;";
_dbConnection.Execute(sql, message, _dbTransaction);
}

@@ -36,7 +36,7 @@ namespace DotNetCore.CAP.PostgreSql
{
if (message == null) throw new ArgumentNullException(nameof(message));

var sql = $"UPDATE [{_schema}].[Received] SET [Retries] = @Retries,[ExpiresAt] = @ExpiresAt,[StatusName]=@StatusName WHERE Id=@Id;";
var sql = $@"UPDATE ""{_schema}"".""received"" SET ""Retries""=@Retries,""ExpiresAt""=@ExpiresAt,""StatusName""=@StatusName WHERE ""Id""=@Id;";
_dbConnection.Execute(sql, message, _dbTransaction);
}

@@ -44,7 +44,7 @@ namespace DotNetCore.CAP.PostgreSql
{
if (message == null) throw new ArgumentNullException(nameof(message));

var sql = $"INSERT INTO [{_schema}].[Queue] values(@MessageId,@MessageType);";
var sql = $@"INSERT INTO ""{_schema}"".""queue"" values(@MessageId,@MessageType);";
_dbConnection.Execute(sql, new CapQueue { MessageId = message.Id, MessageType = MessageType.Publish }, _dbTransaction);
}

@@ -52,7 +52,7 @@ namespace DotNetCore.CAP.PostgreSql
{
if (message == null) throw new ArgumentNullException(nameof(message));

var sql = $"INSERT INTO [{_schema}].[Queue] values(@MessageId,@MessageType);";
var sql = $@"INSERT INTO ""{_schema}"".""queue"" values(@MessageId,@MessageType);";
_dbConnection.Execute(sql, new CapQueue { MessageId = message.Id, MessageType = MessageType.Subscribe }, _dbTransaction);
}



Loading…
取消
儲存