Skip to content

Commit 6a5092a

Browse files
committed
inserts
1 parent b44d081 commit 6a5092a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/main/kotlin/griffio/Main.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class CopyInManagerDriver(private val driver: JdbcDriver, private val file: Read
3838
fun main() {
3939
val driver = getSqlDriver()
4040
val sample = Sample(driver)
41+
42+
sample.salesQueries.insert()
43+
println(sample.salesQueries.select().executeAsList().joinToString("\n"))
44+
4145
val copySample = Sample(CopyInManagerDriver(driver, Path("csv/Kickstarter.csv").reader()))
4246
copySample.kickStarterQueries.copy()
4347
println(sample.kickStarterQueries.select().executeAsList().joinToString("\n"))

src/main/sqldelight/griffio/queries/Sales.sq

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
insert {
2+
3+
INSERT INTO Regions (id, name) VALUES
4+
(1, 'North'),
5+
(2, 'South'),
6+
(3, 'East'),
7+
(4, 'West'),
8+
(5, 'Central');
9+
10+
INSERT INTO SalesPeople (id, full_name, home_region_id) VALUES
11+
(1, 'John Doe', 1),
12+
(2, 'Jane Smith', 2),
13+
(3, 'Bob Johnson', 3),
14+
(4, 'Alice Brown', 4),
15+
(5, 'Charlie Davis', 5);
16+
17+
INSERT INTO Sales (id, amount, product_id, salesperson_id, region_id) VALUES
18+
(1, 1000.00, 101, 1, 1),
19+
(2, 1500.50, 102, 2, 2),
20+
(3, 2000.75, 103, 3, 3),
21+
(4, 1200.25, 104, 4, 4),
22+
(5, 1800.00, 105, 5, 5),
23+
(6, 2200.50, 106, 1, 2),
24+
(7, 1300.75, 107, 2, 3),
25+
(8, 1700.25, 108, 3, 4),
26+
(9, 1900.00, 109, 4, 5),
27+
(10, 2100.50, 110, 5, 1);
28+
29+
}
30+
131
select:
232
SELECT
333
sp.id salesperson_id,

0 commit comments

Comments
 (0)