Skip to content

Commit e533920

Browse files
authored
Merge pull request #9 from The-Cantor-Set/Update-Sql-Scripts
Updated sql scripts
2 parents 812b256 + fcd9a53 commit e533920

File tree

2 files changed

+5
-35
lines changed

2 files changed

+5
-35
lines changed

examples/JsonAutoServiceExample/SQL scripts/JsonAutoService.sql

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ go
4747
drop table if exists jas.products;
4848
go
4949
create table jas.products(
50-
p_id bigint identity(1,1) constraint pk_products unique not null,
50+
p_id bigint identity(1,1) constraint pk_products primary key not null,
5151
product_name nvarchar(20) unique not null,
5252
created_dt datetime2 not null);
5353
go
5454

5555
drop table if exists jas.options;
5656
go
5757
create table jas.options(
58-
o_id bigint identity(1,1) constraint pk_ingredients unique not null,
58+
o_id bigint identity(1,1) constraint pk_ingredients primary key not null,
5959
option_name nvarchar(20) unique not null,
6060
created_dt datetime2 not null);
6161
go
6262

6363
drop table if exists jas.product_options;
6464
go
6565
create table jas.product_options(
66-
po_id bigint identity(1,1) constraint pk_products_options unique not null,
66+
po_id bigint identity(1,1) constraint pk_products_options primary key not null,
6767
p_id bigint constraint fk_products references jas.products(p_id) not null,
6868
o_id bigint constraint fk_options references jas.options(o_id) not null,
6969
product_option nvarchar(20) null,
@@ -107,21 +107,6 @@ set xact_abort on;
107107

108108
begin transaction
109109
begin try
110-
declare
111-
@check_isjson int=nullif(json_value(@headers, N'$.check_isjson'), 0);
112-
113-
if @check_isjson=1
114-
begin
115-
if isjson(@headers)=0
116-
throw 50000, 'The headers json is invalid', 1;
117-
118-
if isjson(@params)=0
119-
throw 50000, 'The parameters json is invalid', 1;
120-
121-
if isjson(@body)=0
122-
throw 50000, 'The request body json is invalid', 1;
123-
end
124-
125110
declare
126111
@p_id bigint,
127112
@p_count bigint;
@@ -164,21 +149,6 @@ set xact_abort on;
164149

165150
begin transaction
166151
begin try
167-
declare
168-
@check_isjson int=nullif(json_value(@headers, N'$.check_isjson'), 0);
169-
170-
if @check_isjson=1
171-
begin
172-
if isjson(@headers)=0
173-
throw 50000, 'The headers json is invalid', 1;
174-
175-
if isjson(@params)=0
176-
throw 50000, 'The parameters json is invalid', 1;
177-
178-
if isjson(@body)=0
179-
throw 50000, 'The request body json is invalid', 1;
180-
end
181-
182152
declare
183153
@o table(o_id bigint unique not null,
184154
product_name nvarchar(20));

examples/JsonAutoServiceExample/SQL scripts/JsonAutoServiceExamplesSQLExecution.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ declare
2828
@out_response nvarchar(max);
2929

3030
exec jas.api_product_post
31-
@headers = '{ "check_isjson": 1 }',
31+
@headers = null,
3232
@params = null,
3333
@body='{ "product_name": "Phone 1" }',
3434
@test_id=@out_test_id output,
@@ -51,7 +51,7 @@ declare
5151
@out_response nvarchar(max);
5252

5353
exec jas.api_product_post
54-
@headers = '{ "check_isjson": 1 }',
54+
@headers = null,
5555
@params = null,
5656
@body='{ "product_name": "Phone 2" }',
5757
@test_id=@out_test_id output,

0 commit comments

Comments
 (0)