-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i realize operation COUNT(..), MAX(..), etc? #737
Comments
Perform get with RawQuery!
…On Fri, Dec 16, 2016, 17:04 Valery Kulikov ***@***.***> wrote:
What is elegant and effective way to do that with StorIO?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#737>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA7B3Dhjp6vzRkku7FOTVQ0MzhIcQ1q0ks5rIppygaJpZM4LPN14>
.
|
But how?
fails with |
Can you please try something some like this? try (Cursor cursor = storIOSqlite
.get()
.cursor()
.withQuery(RawQuery.builder()
.query("SELECT COUNT(*) FROM some_table WHERE some_field =?")
.args("some_value")
.build())
.prepare()
.executeAsBlocking()
) {
cursor.moveToFirst();
Assertions.assertThat(count).isEqualTo(cursor.getInt(0));
}```
You can't use `get().object` for objects without get resolver, so should use `get().cursor` or `get().numberOfResults()` |
I really really have no idea how perform this primitive operation as COUNT with this sophisticated library. It is terrible to imagine how to implement min()/max()... or get some columns... \B-( |
What's the problem with cursor?
…On Fri, Dec 16, 2016, 20:05 Valery Kulikov ***@***.***> wrote:
I really really have no idea how perform this primitive operation as COUNT
with this sophisticated library. It is terrible to imagine how to implement
min()/max()... or get some columns... \B-(
As Metallica sang: "The Thing That Should Not Be"
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#737 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA7B3GUXXGDBwD52Uysb1J9B1600CjnYks5rIsTWgaJpZM4LPN14>
.
|
Thanks to @nikitin-da problem was gone.
|
PR welcome :)
…On Sat, Dec 17, 2016, 15:02 Valery Kulikov ***@***.***> wrote:
Thanks to @nikitin-da <https://github.com/nikitin-da> problem was gone.
Maybe this solution should be in documentation.
What's the problem with cursor?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#737 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA7B3IHAkO-O8u7EaOMttu-ghcJDJ2auks5rI89ogaJpZM4LPN14>
.
|
well, ok. i`d make PR for sample or readme with this 'use case'.
Please help me with this. So then I combine all oof this in one PR |
You can use StorIOSQLite.LowLevel lowLevel = storIOSQLite.lowLevel();
lowLevel.beginTransaction();
try {
// code that should be execute inside single transaction
lowLevel.setTransactionSuccessful();
} finally {
lowLevel.endTransaction();
} |
What is elegant and effective way to do that with StorIO?
The text was updated successfully, but these errors were encountered: