Skip to content

Commit 37bfd37

Browse files
authored
Merge pull request #1 from geral2/Development
Development
2 parents c085f8c + ee7f1ac commit 37bfd37

17 files changed

+81
-25
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
################################################################################
2+
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3+
################################################################################
4+
5+
/.vs/SQL-APIConsumer/v15/Server/sqlite3/db.lock

.vs/SQL-APIConsumer/v15/.suo

12.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.

API_Consumer/Consumers/Helper.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,41 @@ public static void SendResultValue(string ColumnName, string Value)
7474
SqlContext.Pipe.SendResultsEnd();
7575
}
7676
}
77+
78+
/// <summary>
79+
/// Static method used to send an empty Result to SQL.
80+
/// </summary>
81+
/// <param name="ColumnName">Name of column showed in SQL Result set.</param>
82+
public static void SendEmptyResult(string ColumnName)
83+
{
84+
SqlDataRecord Record = new SqlDataRecord(new SqlMetaData[] { new SqlMetaData(ColumnName, SqlDbType.VarChar, 4000) });
85+
86+
SqlContext.Pipe.SendResultsStart(Record);
87+
88+
if (SqlContext.Pipe.IsSendingResults)
89+
{
90+
SqlContext.Pipe.SendResultsRow(Record);
91+
92+
SqlContext.Pipe.SendResultsEnd();
93+
}
94+
}
95+
96+
/// <summary>
97+
/// Static method used to send an empty ResultSet to SQL.
98+
/// </summary>
99+
/// <param name="ColumnNames">Set of columns to be showed in SQL Result set.</param>
100+
public static void SendEmptyResult(SqlMetaData[] Header)
101+
{
102+
SqlDataRecord Record = new SqlDataRecord(Header);
103+
104+
SqlContext.Pipe.SendResultsStart(Record);
105+
106+
if (SqlContext.Pipe.IsSendingResults)
107+
{
108+
SqlContext.Pipe.SendResultsRow(Record);
109+
110+
SqlContext.Pipe.SendResultsEnd();
111+
}
112+
}
77113
}
78114
}

API_Consumer/Procedures/APICaller_GET_Json.cs renamed to API_Consumer/Procedures/APICaller_GET.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public partial class StoredProcedures
1313
/// </summary>
1414
/// <param name="URL">Api GET Method</param>
1515
[Microsoft.SqlServer.Server.SqlProcedure]
16-
public static void APICaller_GET_Json (SqlString URL)
16+
public static void APICaller_GET (SqlString URL)
1717
{
1818
try
1919
{
@@ -24,7 +24,7 @@ public static void APICaller_GET_Json (SqlString URL)
2424
}
2525
catch (Exception ex)
2626
{
27-
throw new Exception(ex.Message.ToString());
27+
Helper.SendResultValue("Result", ex.Message.ToString());
2828
}
2929
}
3030
}

API_Consumer/Procedures/APICaller_POST_Json.cs renamed to API_Consumer/Procedures/APICaller_POST.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial class StoredProcedures
1414
/// <param name="URL">Consumer POST Method of Api</param>
1515
/// <param name="JsonBody">Json to be sent as body</param>
1616
[Microsoft.SqlServer.Server.SqlProcedure]
17-
public static void APICaller_POST_Json(SqlString URL, SqlString JsonBody)
17+
public static void APICaller_POST(SqlString URL, SqlString JsonBody)
1818
{
1919
try
2020
{
@@ -25,7 +25,7 @@ public static void APICaller_POST_Json(SqlString URL, SqlString JsonBody)
2525
}
2626
catch (Exception ex)
2727
{
28-
throw new Exception(ex.Message.ToString());
28+
Helper.SendResultValue("Error", ex.Message.ToString());
2929
}
3030
}
3131
}

API_Consumer/SQL-APIConsumer.sqlproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@
6666
<Folder Include="Consumers" />
6767
</ItemGroup>
6868
<ItemGroup>
69-
<Compile Include="Procedures\APICaller_POST_Json.cs" />
69+
<Compile Include="Procedures\APICaller_POST.cs" />
7070
<Compile Include="Consumers\APIConsumer.cs" />
7171
<Compile Include="Consumers\Helper.cs" />
7272
<Compile Include="DTO\BankInfoBasic.cs" />
7373
<Compile Include="DTO\BankInfoDetail.cs" />
7474
<Compile Include="Procedures\GET_BankInfoBasicByRN.cs" />
75-
<Compile Include="Procedures\APICaller_GET_Json.cs" />
75+
<Compile Include="Procedures\APICaller_GET.cs" />
7676
</ItemGroup>
7777
<ItemGroup>
7878
<Reference Include="System" />
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
461 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)