Skip to content

Commit 23d231f

Browse files
committed
Add file analysis feature
1 parent d96b9da commit 23d231f

File tree

78 files changed

+3249
-733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3249
-733
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/*compliant code*/
2+
/*violating code*/
3+
SELECT SLEEP(5);
4+
SELECT SLEEP(5);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*compliant code*/
2+
SELECT name, surname from dbo.test;
3+
SELECT name, surname from dbo.test;
4+
SELECT name, surname, 1 * 3 from dbo.test;
5+
SELECT name, surname, 1 * 3 from dbo.test;
6+
/*violating code*/
7+
SELECT t1.*, t2.* from dbo.test as t1 inner join dbo.test2 as t2 on t1.id=t2.id;
8+
SELECT t1.*, t2.* from dbo.test as t1 inner join dbo.test2 as t2 on t1.id=t2.id;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*compliant code*/
2+
INSERT INTO dbo.test (a,b) VALUES (1,2);
3+
INSERT INTO dbo.test (a,b) VALUES (1,2);
4+
/*violating code*/
5+
INSERT INTO dbo.test VALUES (1,2);
6+
INSERT INTO dbo.test2 VALUES (1,2);
7+
INSERT INTO dbo.test VALUES (1,2);
8+
INSERT INTO dbo.test2 VALUES (1,2);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*compliant code*/
2+
SELECT * from dbo.test order by name;
3+
SELECT * from dbo.test order by name;
4+
/*violating code*/
5+
SELECT * from dbo.test order by 1, 2;
6+
SELECT * from dbo.test order by 1, 2;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*compliant code*/
2+
SELECT MAX(RateChangeDate) FROM HumanResources.EmployeePayHistory WHERE BusinessEntityID = 1
3+
SELECT MAX(RateChangeDate) FROM HumanResources.EmployeePayHistory WHERE BusinessEntityID = 1
4+
SELECT name, surname from dbo.test where date between 2008-10-10 and 2010-10-10;
5+
SELECT name, surname from dbo.test where date between 2008-10-10 and 2010-10-10;
6+
SELECT max(price) from dbo.items;
7+
SELECT max(price) from dbo.items;
8+
/*violating code*/
9+
SELECT name, surname from dbo.test where year(date) > 2008 and month = 12;
10+
SELECT name, surname from dbo.test where year(date) > 2008 and month = 12;
11+
SELECT name, surname from dbo.test where name like '%red'
12+
SELECT name, surname from dbo.test where name like '%red'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*compliant code*/
2+
SELECT * from dbo.test where name IS NULL;
3+
SELECT * from dbo.test where name IS NULL;
4+
SELECT * from dbo.test where name IS NOT NULL;
5+
SELECT * from dbo.test where name IS NOT NULL;
6+
SELECT * from dbo.test where name = 'test';
7+
SELECT * from dbo.test where name = 'test';
8+
/*violating code*/
9+
SELECT * from dbo.test where name = null and surname = 'Test' ;
10+
SELECT * from dbo.test where name = null and surname = 'Test' ;
11+
SELECT * from dbo.test where name != null;
12+
SELECT * from dbo.test where name != null;
13+
SELECT * from dbo.test where name <> null;
14+
SELECT * from dbo.test where name <> null;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*compliant code*/
2+
SELECT name, surname, count from dbo.test where name = 'or' and surname = 'TestOR';
3+
SELECT name, surname, count from dbo.test where name = 'or' and surname = 'TestOR';
4+
/*violating code*/
5+
SELECT name, surname, count from dbo.test where name = 'Test' OR surname = 'Testor';
6+
SELECT name, surname, count from dbo.test where name = 'Test' OR surname = 'Testor';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*compliant code*/
2+
SELECT name, surname, count from dbo.test union all SELECT name, surname, count from dbo.test2;
3+
SELECT name, surname, count from dbo.test union all SELECT name, surname, count from dbo.test2;
4+
/*violating code*/
5+
SELECT name, surname, count from dbo.test union SELECT name, surname, count from dbo.test2;
6+
SELECT name, surname, count from dbo.test union SELECT name, surname, count from dbo.test2;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*compliant code*/
2+
SELECT name, surname, count from dbo.test where locationID in (1,2,3);
3+
SELECT name, surname, count from dbo.test where locationID in (1,2,3);
4+
SELECT name, surname, count from dbo.test where exists (select 1 from dbo.locations where id = locationID);
5+
SELECT name, surname, count from dbo.test where exists (select 1 from dbo.locations where id = locationID);
6+
/*violating code*/
7+
SELECT name, surname, count from dbo.test where locationID in (select id from dbo.locations);
8+
SELECT name, surname, count from dbo.test where locationID in (select id from dbo.locations);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*compliant code*/
2+
SELECT name, surname from dbo.test order by name desc, surname asc;
3+
SELECT name, surname from dbo.test order by name desc, surname asc;
4+
/*violating code*/
5+
SELECT name, surname from dbo.test order by name, surname asc;
6+
SELECT name, surname from dbo.test order by name, surname asc;

0 commit comments

Comments
 (0)