Animesh Sahu
11/23/2019, 8:47 AMvpriscan
11/24/2019, 1:27 PMRodrigo Silva
11/25/2019, 9:41 PMrikusen0335
11/26/2019, 11:28 AMDatabase.disconnect
Vinicius Araujo
11/26/2019, 5:56 PMjava.sql.Connection
from exposed's TransactionManager? I've only found ExposedConnection which doesnt have createArrayOf
functionAnimesh Sahu
11/27/2019, 8:48 AMAnimesh Sahu
11/27/2019, 8:49 AMException in thread "DefaultDispatcher-worker-7 @coroutine#49" org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)
at org.sqlite.core.DB.newSQLException(DB.java:941)
at org.sqlite.core.DB.newSQLException(DB.java:953)
at org.sqlite.core.DB.throwex(DB.java:918)
at org.sqlite.core.DB.exec(DB.java:178)
at org.sqlite.SQLiteConnection.commit(SQLiteConnection.java:404)
at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManager$ThreadLocalTransaction.commit(ThreadLocalTransactionManager.kt:57)
at org.jetbrains.exposed.sql.Transaction.commit(Transaction.kt:66)
at org.jetbrains.exposed.sql.transactions.experimental.SuspendedKt.commitInAsync(Suspended.kt:103)
at org.jetbrains.exposed.sql.transactions.experimental.SuspendedKt.access$commitInAsync(Suspended.kt:1)
at org.jetbrains.exposed.sql.transactions.experimental.SuspendedKt$suspendedTransactionAsyncInternal$1.invokeSuspend(Suspended.kt:168)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)
rikusen0335
11/27/2019, 2:20 PMvar db: Database
override fun onEnable() {
// Enabled message
server.consoleSender.sendMessage("%sSamplePlugin is now enabled!".format(ChatColor.GREEN))
server.pluginManager.registerEvents(this, this)
val basePath: Path = Paths.get(System.getProperty("user.dir")).toRealPath()
val sqliteFile: Path = Paths.get(basePath.toString(), "sample.db")
print(sqliteFile) // Show the paths
db = Database.connect("jdbc:sqlite:file:$sqliteFile", "org.sqlite.JDBC")
TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
}
override fun onDisable() {
TransactionManager.closeAndUnregister(db) // Disconnect処理?
}
Norg
11/28/2019, 10:53 AMdate
and datetime
in exposed 18.1 dao. In the following example date
causes the Unresolved reference: date
object TimeSlots : LongIdTable() {
val slotDate: Column<Date> = date("slotDate")
val duration: Column<String> = varchar("duration", 10)
Rodrigo Silva
11/29/2019, 2:04 AMRoy Nard
11/29/2019, 9:57 AMAnimesh Sahu
12/01/2019, 3:46 PMAnimesh Sahu
12/02/2019, 4:10 PMsuspendedTransactionAsync()
and newSuspendedTransaction()
i know one of them return Deferred and other the direct value. But i see that both of them suspend at the time of call, i.e. if `suspendedTransactionAsync()`suspends at the time of call then what is use of await()
on the deferred? Like CoroutineScope.async()
doesn't suspend at the time of call but rather when await()
is called on that right, so what's difference b/w them(transactions)?Animesh Sahu
12/02/2019, 5:00 PMAnimesh Sahu
12/02/2019, 5:01 PMmarstran
12/02/2019, 11:23 PMBrian Carbone
12/04/2019, 8:25 PMtapac
12/10/2019, 7:05 AMTimur Atakishiev
12/12/2019, 5:12 AMtransaction {
Restaurants.slice(Restaurants.followers.min(),Restaurants.id)
.selectAll()
.groupBy(Restaurants.id)
.first()
}
and I have a simple mapper
private fun toRestaurantUserName(row: ResultRow) = RestaurantUserNameDto(
id = row[Restaurants.id],
numberOfFollowers = row[Restaurants.followers.min()]!!
)
my question is when I want to fetch Restaurants.followers.min(), should I use
row[Restaurants.followers.min()]!!
these one with double !!, or is it better way to write the code?Thank youtapac
12/14/2019, 4:03 PMdmnk_89
12/17/2019, 9:16 AMSomeTable.batchInsert(
data = listOf(1,2,3,4),
body = {
this[SomeTable.someColumn] = it
})
Timur Atakishiev
12/17/2019, 10:19 AMtransaction {
addLogger(StdOutSqlLogger)
SomeTable.batchInsert(data = listOf(1,2,3,4)) {
this[SomeTable.someColumn] = it
}
SQL logger shows multiple sql inserts(number of insrets = list.size)
Should not it be one insert with multiple values? Or is it StdOutLogger problems?tapac
12/27/2019, 1:01 PMBrian Carbone
12/30/2019, 6:39 PMkotlin
SELECT * FROM (
SELECT DISTINCT ON (address_id) *
FROM purchases
WHERE product_id = 1
ORDER BY address_id, purchased_at DESC
) t
ORDER BY purchased_at DESC
what is the equivalent of this in exposed?APXEOLOG
12/30/2019, 7:38 PM<https://gist.github.com/quangIO/a623b5caa53c703e252d858f7a806919>
and i found out that ColumnType seems to be changedVinicius Araujo
01/04/2020, 8:21 PMWHERE (updated_at, id) <= ('2020-01-04 15:51:38.862000', '79a4f222-69ea-439c-90ba-348d025166ef')
Timur Atakishiev
01/05/2020, 5:15 PMobject Users : Table("users") {
override val primaryKey = PrimaryKey(columns = *arrayOf(Column<Long>(Users, "id", LongColumnType())))
val id = long("id").autoIncrement()
val phoneNumber = varchar("phone_number", 20).uniqueIndex()
val firstName = varchar("first_name", 25).nullable()
val lastName = varchar("last_name", 30).nullable()
val password = varchar("password", 150)
}
can someone help please, when I overriding primary key as
override val primaryKey = PrimaryKey(columns = *arrayOf(id))
IDE says me that I need to initialize the ID field, maybe I am doing something wrong? Or is it other way to declare a Primary key?paulex
01/08/2020, 12:18 PMoverride fun modify(item: User): CompletionStage<User> {
return supplyAsync {
transaction {
Users.update({ Users.id eq item.id }) {
it[name] = item.name
it[gender] = item.gender
it[first_name] = item.firstName;
}
}
}.thenApply { return@thenApply item }
}
Is there a way to simplify an update transaction on object properties, i feel it is repetitive to keep on writing :
it[name] = item.name
it[gender] = item.gender
?Timur Atakishiev
01/10/2020, 7:55 AMCarter
01/12/2020, 12:53 PMCarter
01/12/2020, 12:53 PMtapac
01/13/2020, 6:28 AMCarter
01/13/2020, 2:05 PMjava.lang.IllegalStateException: Can't load implementation for DatabaseConnectionAutoRegistration
.
If I roll back to 0.17.7 (and make the changes to dependencies and imports for my objects), then it runs just fine.
I can try to troubleshoot some more on my end, although I’m not clear what might isolate it further just yet.
The initialization is pretty straightforward. I’m just trying to use a SQLite database file. I also tried a h2 database but that didn’t make a difference.core
and dao
dependencies as api
, and sqlite-jdbc
and exposed-jdbc
as implementation
.
The app project uses this library and generally has little direct knowledge of exposed.
It seems that something is going wrong with the transitive dependencies to sqlite-jdbc
and exposed-jdbc
. If I explicitly add them to the app project’s jvmMain dependencies, then it works. I don’t see why it should fail, because they’re already provided by the db module.tapac
01/14/2020, 7:48 PMCarter
01/28/2020, 1:51 PM