File tree 18 files changed +68
-79
lines changed
java/eu/pretix/libpretixsync/sync
sqldelight/common/eu/pretix/libpretixsync/sqldelight
18 files changed +68
-79
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,15 @@ class AllEventsSyncAdapter(
35
35
36
36
override fun getJSON (obj : Event ): JSONObject = JSONObject (obj.json_data!! )
37
37
38
- override fun queryKnownIDs (): MutableSet <String >? {
38
+ override fun queryKnownIDs (): MutableSet <String > {
39
39
val res = mutableSetOf<String >()
40
40
db.eventQueries.selectSlugs().execute { cursor ->
41
41
while (cursor.next().value) {
42
- val id = cursor.getString(0 ) ? : throw RuntimeException (" slug column not available" )
42
+ val id = cursor.getString(0 )
43
+ ? : throw RuntimeException (" slug column not available" )
44
+
43
45
res.add(id)
44
46
}
45
-
46
47
QueryResult .Unit
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -45,15 +45,15 @@ class AllSubEventsSyncAdapter(
45
45
46
46
override fun getJSON (obj : SubEvent ): JSONObject = JSONObject (obj.json_data!! )
47
47
48
- override fun queryKnownIDs (): MutableSet <Long >? {
48
+ override fun queryKnownIDs (): MutableSet <Long > {
49
49
val res = mutableSetOf<Long >()
50
50
db.subEventQueries.selectServerIds().execute { cursor ->
51
51
while (cursor.next().value) {
52
- val id =
53
- cursor.getLong(0 ) ? : throw RuntimeException (" server_id column not available" )
52
+ val id = cursor.getLong(0 )
53
+ ? : throw RuntimeException (" server_id column not available" )
54
+
54
55
res.add(id)
55
56
}
56
-
57
57
QueryResult .Unit
58
58
}
59
59
Original file line number Diff line number Diff line change @@ -36,17 +36,16 @@ class BadgeLayoutItemSyncAdapter(
36
36
37
37
override fun getJSON (obj : BadgeLayoutItem ): JSONObject = JSONObject (obj.json_data!! )
38
38
39
- override fun queryKnownIDs (): MutableSet <Long >? {
39
+ override fun queryKnownIDs (): MutableSet <Long > {
40
40
val res = mutableSetOf<Long >()
41
41
db.badgeLayoutItemQueries.selectServerIdsByEventSlug(event_slug = eventSlug)
42
42
.execute { cursor ->
43
43
while (cursor.next().value) {
44
- val id =
45
- cursor.getLong( 0 )
46
- ? : throw RuntimeException ( " server_id column not available " )
44
+ val id = cursor.getLong( 0 )
45
+ ? : throw RuntimeException ( " server_id column not available " )
46
+
47
47
res.add(id)
48
48
}
49
-
50
49
QueryResult .Unit
51
50
}
52
51
Original file line number Diff line number Diff line change @@ -34,15 +34,15 @@ class BadgeLayoutSyncAdapter(
34
34
35
35
override fun getJSON (obj : BadgeLayout ): JSONObject = JSONObject (obj.json_data!! )
36
36
37
- override fun queryKnownIDs (): MutableSet <Long >? {
37
+ override fun queryKnownIDs (): MutableSet <Long > {
38
38
val res = mutableSetOf<Long >()
39
- db.badgeLayoutQueries.selectServerIdsByEventSlug(event_slug = eventSlug).execute { cursor ->
39
+ db.badgeLayoutQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
40
40
while (cursor.next().value) {
41
- val id =
42
- cursor.getLong(0 ) ? : throw RuntimeException (" server_id column not available" )
41
+ val id = cursor.getLong(0 )
42
+ ? : throw RuntimeException (" server_id column not available" )
43
+
43
44
res.add(id)
44
45
}
45
-
46
46
QueryResult .Unit
47
47
}
48
48
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class BlockedTicketSecretSyncAdapter(
42
42
43
43
override fun getJSON (obj : BlockedTicketSecret ): JSONObject = JSONObject (obj.json_data!! )
44
44
45
- override fun queryKnownIDs (): MutableSet <Long >? {
45
+ override fun queryKnownIDs (): MutableSet <Long > {
46
46
val res = mutableSetOf<Long >()
47
47
db.blockedTicketSecretQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
48
48
while (cursor.next().value) {
Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ class CashierSyncAdapter(
36
36
val res = mutableSetOf<Long >()
37
37
db.cashierQueries.selectServerIds().execute { cursor ->
38
38
while (cursor.next().value) {
39
- val id = cursor.getLong(0 ) ? : throw RuntimeException (" id column not available" )
39
+ val id = cursor.getLong(0 )
40
+ ? : throw RuntimeException (" server_id column not available" )
41
+
40
42
res.add(id)
41
43
}
42
44
QueryResult .Unit
Original file line number Diff line number Diff line change @@ -52,14 +52,15 @@ class CheckInListSyncAdapter(
52
52
53
53
override fun getJSON (obj : CheckInList ): JSONObject = JSONObject (obj.json_data!! )
54
54
55
- override fun queryKnownIDs (): MutableSet <Long >? {
55
+ override fun queryKnownIDs (): MutableSet <Long > {
56
56
val res = mutableSetOf<Long >()
57
- db.checkInListQueries.selectServerIdsByEventSlug(event_slug = eventSlug).execute { cursor ->
57
+ db.checkInListQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
58
58
while (cursor.next().value) {
59
- val id = cursor.getLong(0 ) ? : throw RuntimeException (" id column not available" )
59
+ val id = cursor.getLong(0 )
60
+ ? : throw RuntimeException (" server_id column not available" )
61
+
60
62
res.add(id)
61
63
}
62
-
63
64
QueryResult .Unit
64
65
}
65
66
Original file line number Diff line number Diff line change @@ -32,15 +32,16 @@ class ItemCategorySyncAdapter(
32
32
33
33
override fun getJSON (obj : ItemCategory ): JSONObject = JSONObject (obj.json_data)
34
34
35
- override fun queryKnownIDs (): MutableSet <Long >? {
35
+ override fun queryKnownIDs (): MutableSet <Long > {
36
36
val res = mutableSetOf<Long >()
37
- db.itemCategoryQueries.selectServerIdsByEventSlug(event_slug = eventSlug)
37
+ db.itemCategoryQueries.selectServerIdsByEventSlug(eventSlug)
38
38
.execute { cursor ->
39
39
while (cursor.next().value) {
40
- val id = cursor.getLong(0 ) ? : throw RuntimeException (" id column not available" )
40
+ val id = cursor.getLong(0 )
41
+ ? : throw RuntimeException (" server_id column not available" )
42
+
41
43
res.add(id)
42
44
}
43
-
44
45
QueryResult .Unit
45
46
}
46
47
Original file line number Diff line number Diff line change @@ -41,12 +41,13 @@ class ItemSyncAdapter(
41
41
42
42
override fun queryKnownIDs (): MutableSet <Long > {
43
43
val res = mutableSetOf<Long >()
44
- db.itemQueries.selectServerIdsByEventSlug(event_slug = eventSlug).execute { cursor ->
44
+ db.itemQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
45
45
while (cursor.next().value) {
46
- val id = cursor.getLong(0 ) ? : throw RuntimeException (" id column not available" )
46
+ val id = cursor.getLong(0 )
47
+ ? : throw RuntimeException (" server_id column not available" )
48
+
47
49
res.add(id)
48
50
}
49
-
50
51
QueryResult .Unit
51
52
}
52
53
Original file line number Diff line number Diff line change @@ -40,15 +40,15 @@ class MediumKeySetSyncAdapter(
40
40
41
41
override fun getJSON (obj : MediumKeySet ): JSONObject = JSONObject (obj.json_data!! )
42
42
43
- override fun queryKnownIDs (): MutableSet <Long >? {
43
+ override fun queryKnownIDs (): MutableSet <Long > {
44
44
val res = mutableSetOf<Long >()
45
45
db.mediumKeySetQueries.selectPublicIds().execute { cursor ->
46
46
while (cursor.next().value) {
47
- val id =
48
- cursor.getLong(0 ) ? : throw RuntimeException (" public_id column not available" )
47
+ val id = cursor.getLong(0 )
48
+ ? : throw RuntimeException (" public_id column not available" )
49
+
49
50
res.add(id)
50
51
}
51
-
52
52
QueryResult .Unit
53
53
}
54
54
Original file line number Diff line number Diff line change @@ -469,19 +469,7 @@ class OrderSyncAdapter(
469
469
return itemCache[id]
470
470
}
471
471
472
- override fun queryKnownIDs (): MutableSet <String > {
473
- val res = mutableSetOf<String >()
474
- db.orderQueries.selectCodesByEventSlug(event_slug = eventSlug).execute { cursor ->
475
- while (cursor.next().value) {
476
- val id = cursor.getString(0 ) ? : throw RuntimeException (" id column not available" )
477
- res.add(id)
478
- }
479
-
480
- QueryResult .Unit
481
- }
482
-
483
- return res
484
- }
472
+ override fun queryKnownIDs (): MutableSet <String >? = null
485
473
486
474
override fun queryKnownObjects (ids : Set <String >): MutableMap <String , Order > {
487
475
checkinCache.clear()
Original file line number Diff line number Diff line change @@ -35,14 +35,15 @@ class QuestionSyncAdapter(
35
35
36
36
override fun getJSON (obj : Question ): JSONObject = JSONObject (obj.json_data!! )
37
37
38
- override fun queryKnownIDs (): MutableSet <Long >? {
38
+ override fun queryKnownIDs (): MutableSet <Long > {
39
39
val res = mutableSetOf<Long >()
40
- db.questionQueries.selectServerIdsByEventSlug(event_slug = eventSlug).execute { cursor ->
40
+ db.questionQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
41
41
while (cursor.next().value) {
42
- val id = cursor.getLong(0 ) ? : throw RuntimeException (" id column not available" )
42
+ val id = cursor.getLong(0 )
43
+ ? : throw RuntimeException (" server_id column not available" )
44
+
43
45
res.add(id)
44
46
}
45
-
46
47
QueryResult .Unit
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class QuotaSyncAdapter(
41
41
42
42
override fun getJSON (obj : Quota ): JSONObject = JSONObject (obj.json_data!! )
43
43
44
- override fun queryKnownIDs (): MutableSet <Long >? {
44
+ override fun queryKnownIDs (): MutableSet <Long > {
45
45
val res = mutableSetOf<Long >()
46
46
47
47
if (subeventId != null && subeventId > 0L ) {
@@ -50,23 +50,21 @@ class QuotaSyncAdapter(
50
50
subevent_id = subeventId,
51
51
).execute { cursor ->
52
52
while (cursor.next().value) {
53
- val id =
54
- cursor.getLong( 0 )
55
- ? : throw RuntimeException ( " server_id column not available " )
53
+ val id = cursor.getLong( 0 )
54
+ ? : throw RuntimeException ( " server_id column not available " )
55
+
56
56
res.add(id)
57
57
}
58
-
59
58
QueryResult .Unit
60
59
}
61
60
} else {
62
61
db.quotaQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
63
62
while (cursor.next().value) {
64
- val id =
65
- cursor.getLong( 0 )
66
- ? : throw RuntimeException ( " server_id column not available " )
63
+ val id = cursor.getLong( 0 )
64
+ ? : throw RuntimeException ( " server_id column not available " )
65
+
67
66
res.add(id)
68
67
}
69
-
70
68
QueryResult .Unit
71
69
}
72
70
}
Original file line number Diff line number Diff line change @@ -46,15 +46,15 @@ class ReusableMediaSyncAdapter(
46
46
47
47
override fun getJSON (obj : ReusableMedium ): JSONObject = JSONObject (obj.json_data!! )
48
48
49
- override fun queryKnownIDs (): MutableSet <Long >? {
49
+ override fun queryKnownIDs (): MutableSet <Long > {
50
50
val res = mutableSetOf<Long >()
51
51
db.reusableMediumQueries.selectServerIds().execute { cursor ->
52
52
while (cursor.next().value) {
53
- val id =
54
- cursor.getLong(0 ) ? : throw RuntimeException (" server_id column not available" )
53
+ val id = cursor.getLong(0 )
54
+ ? : throw RuntimeException (" server_id column not available" )
55
+
55
56
res.add(id)
56
57
}
57
-
58
58
QueryResult .Unit
59
59
}
60
60
Original file line number Diff line number Diff line change @@ -44,15 +44,15 @@ class RevokedTicketSecretSyncAdapter(
44
44
45
45
override fun getJSON (obj : RevokedTicketSecret ): JSONObject = JSONObject (obj.json_data!! )
46
46
47
- override fun queryKnownIDs (): MutableSet <Long >? {
47
+ override fun queryKnownIDs (): MutableSet <Long > {
48
48
val res = mutableSetOf<Long >()
49
49
db.revokedTicketSecretQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
50
50
while (cursor.next().value) {
51
- val id =
52
- cursor.getLong(0 ) ? : throw RuntimeException (" server_id column not available" )
51
+ val id = cursor.getLong(0 )
52
+ ? : throw RuntimeException (" server_id column not available" )
53
+
53
54
res.add(id)
54
55
}
55
-
56
56
QueryResult .Unit
57
57
}
58
58
Original file line number Diff line number Diff line change @@ -32,11 +32,13 @@ class TaxRuleSyncAdapter(
32
32
33
33
override fun getJSON (obj : TaxRule ): JSONObject = JSONObject (obj.json_data!! )
34
34
35
- override fun queryKnownIDs (): MutableSet <Long >? {
35
+ override fun queryKnownIDs (): MutableSet <Long > {
36
36
val res = mutableSetOf<Long >()
37
37
db.taxRuleQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
38
38
while (cursor.next().value) {
39
- val id = cursor.getLong(0 ) ? : throw RuntimeException (" id column not available" )
39
+ val id = cursor.getLong(0 )
40
+ ? : throw RuntimeException (" server_id column not available" )
41
+
40
42
res.add(id)
41
43
}
42
44
QueryResult .Unit
Original file line number Diff line number Diff line change @@ -36,15 +36,15 @@ class TicketLayoutSyncAdapter(
36
36
37
37
override fun getId (obj : TicketLayout ): Long = obj.server_id!!
38
38
39
- override fun queryKnownIDs (): MutableSet <Long >? {
39
+ override fun queryKnownIDs (): MutableSet <Long > {
40
40
val res = mutableSetOf<Long >()
41
41
db.ticketLayoutQueries.selectServerIdsByEventSlug(eventSlug).execute { cursor ->
42
42
while (cursor.next().value) {
43
- val id =
44
- cursor.getLong(0 ) ? : throw RuntimeException (" server_id column not available" )
43
+ val id = cursor.getLong(0 )
44
+ ? : throw RuntimeException (" server_id column not available" )
45
+
45
46
res.add(id)
46
47
}
47
-
48
48
QueryResult .Unit
49
49
}
50
50
Original file line number Diff line number Diff line change @@ -13,11 +13,6 @@ SELECT *
13
13
FROM orders
14
14
WHERE code IN ?;
15
15
16
- selectCodesByEventSlug:
17
- SELECT code
18
- FROM orders
19
- WHERE event_slug = ?;
20
-
21
16
countForEventSlug:
22
17
SELECT COUNT(*)
23
18
FROM orders
You can’t perform that action at this time.
0 commit comments