Shawn A
08/21/2019, 2:16 PMalias
to create a sub-query and then using that sub-query in a join. It looks like once you use an alias
you can no longer reference the columns in the ResultRow
by the original table's columns. Keys in the ResultRow
from the alias look like org.jetbrains.exposed.sql.Alias.name
. Is there any way to avoid this? I have common mapping code that assumes it can use the table class to reference columns. e.g (DataSourceTable.name
).Kevin Schmeichel
08/21/2019, 6:05 PM17.1
has broken the mysql MATCH(...) AGAINST(...)
function - now the generated sql looks like this: MATCH(... AGAINST(...)
. no closing right )
on the MATCH.Shawn A
08/22/2019, 3:18 PMEvan R.
09/03/2019, 5:06 PM.get()
on the query via the .sum()
method on the column? Here’s what I have right now:
val sumAlias = TransactionsTable.amount.sum().alias("campaignTotal")
TransactionsTable.slice(sumAlias)
.select { TransactionsTable.campaignID eq campaignID }
.limit(1)
.firstOrNull()
?.get(sumAlias)
cincue
09/04/2019, 2:30 PMSrSouza
09/12/2019, 12:01 PMJacob Richards
09/15/2019, 10:21 PMkushalp
09/18/2019, 10:21 AMPhilipp Mayer
09/18/2019, 7:40 PMoverride fun getColorByCompany(company: String): List<String> {
val color = transaction { Companies
.slice(Companies.color)
.select { Companies.name eq company }
.map { it.toString() }
}
return color
}
How can I get a single string as result and not a list of strings?
Or should I convert it afterwards for myself?
Thanks in advance!bitkid
09/23/2019, 11:44 AMAlexander Weickmann
09/23/2019, 1:26 PMval launchResult = suspendedTransactionAsync(<http://Dispatchers.IO|Dispatchers.IO>, db = db) {
FooTable.selectAll().count()
}.andThen { count ->
BarTable.select { BarTable.value eq count }.map { it[BarTable.name] }
}
here it seems that the result of the count is only available to the remaining code when passed via andThen function. when exactly is it necessary to use the andThen function?
would this not work?
val launchResult = suspendedTransactionAsync(<http://Dispatchers.IO|Dispatchers.IO>, db = db) {
val count = FooTable.selectAll().count()
BarTable.select { BarTable.value eq count }.map { it[BarTable.name] }
}
Vinicius Araujo
09/24/2019, 11:55 PMjfburdet
10/01/2019, 3:35 PMtjohnn
10/02/2019, 1:24 PMCollection
of String
? I am having issue with inserting data into postgresql array column
Or do I to parse it to an acceptable format myself?
I am getting this error:
Caused by: org.postgresql.util.PSQLException: ERROR: column "images" is of type character varying[] but expression is of type character varying
tapac
10/05/2019, 5:02 PMБежан Александр
10/10/2019, 11:34 AMnewSuspendedTransaction(<http://Dispatchers.IO|Dispatchers.IO>, database) {
Ticket.all().count()
}
It fails with org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-199]
Database is H2Evan R.
10/16/2019, 3:03 PMnewSuspendedTransaction
. The documentation states that we shouldn’t share a transaction between multiple threads due to undefined behavior, so are we not allowed to call other suspending functions within a newSuspendedTransaction()
block given when the suspended transaction resumes it may resume on another thread?
For example:
newSuspendedTransaction(<http://Dispatchers.IO|Dispatchers.IO>) {
val result1 = myTable.select { ... }.toList()
// newSuspendedTransaction suspends here
callSomeSuspendingFunction()
// newSuspendedTransaction resumes, possibly in another thread??
val result2 = myTable.select {...}.toList()
}
Or:
newSuspendedTransaction(<http://Dispatchers.IO|Dispatchers.IO>) {
coroutineScope {
repeat(5) {
// Should I be using suspendedTransactionAsync here?
launch { someFunctionThatUpdatesRows() }
}
}
}
Szymon Lipiński
10/16/2019, 5:08 PMnotForUpdate
function is a mystery 🙂 I just hope that I get what it really does. Also, I think that if a column has a name like xx"yy
then it would be escaped incorrectly, however, I have a small problem with tracking the code responsible for this.Evan R.
10/17/2019, 7:14 PMnewSuspendedTransaction
closes the current transaction at the end of the block is creating a real headache for me. I have suspend functions which will start a new suspended transaction on the IO dispatcher, but they cannot call other suspend functions doing the same thing. Is there a way around this that I’m not seeing? My current workaround is to make separate, private suspending functions which are exposed publicly via a newSuspendedTransaction
block.maxmello
10/24/2019, 9:18 AMval dao = newSuspendedTransaction { MyDAO.findByValueOrThrowException(value) }
// MyDAO companion (LongEntityClass)
suspend fun findByValueOrThrowException(value: String): MyDAO {
return withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
find { MyTable.value eq value }.firstOrNull() ?: throw RuntimeException("MyDAO not found")
}
}
10 seconds after the exception is thrown, I get the following log message: com.zaxxer.hikari.pool.ProxyLeakTask - Connection leak detection triggered for org.postgresql.jdbc.PgConnection@5b4d25e7 on thread DefaultDispatcher-worker-1, stack trace follows: java.lang.Exception: Apparent connection leak detected
As you can see, I am using Hikari for a thread pool (config.leakDetectionThreshold = 10000L, corresponding to the 10 seconds after the message appears)
So am I not allowed to throw an exception and catch it outside the transaction context, or am I doing something else wrong? (I am using Postgres)Vinicius Araujo
10/26/2019, 11:39 PMEgor Babarykin
10/29/2019, 11:33 AMSomeEntity.all()
.with(SometEntity::users)
.toList()
This command makes sql query to db for select SometEntity from SomeTable and SomeUserEntity from SomeUserTable
But when i'm calling get of SometEntity.users it makes another query to db to select SomeUserEntity only for one SomeEntitymagisu
11/01/2019, 6:26 PMdbConnect = Database.Companion.connect()
in my SpringBoot PostConstruct
function of service, and keep using it forever? Will it timeout or get expired?tapac
11/05/2019, 2:05 PMJorge R
11/11/2019, 1:54 PMtapac
11/16/2019, 5:27 PMBrian Carbone
11/20/2019, 4:10 PMdoyaaaaaaken
11/22/2019, 11:38 AMAndrew Kirkham
11/22/2019, 4:11 PMBrian Carbone
11/22/2019, 8:25 PM