Questions tagged [sqlbrite]

A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations

https://github.com/square/sqlbrite

46 questions
12
votes
2 answers

Repository pattern with SqlBrite/SqlDelight(Offline database) and Retrofit(Http request)

I am implementing repository pattern in RxJava using SqlBrite/SqlDelight for offline data storage and retrofit for Http requests Here's a sample of that: protected Observable> getItemsFromDb() { return…
Prithvi Bhola
  • 3,041
  • 1
  • 16
  • 32
8
votes
2 answers

Possible to get specific error details from Android SQLiteConstraintException?

I'm getting the following error for certain data, and concept is clear enough: android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787) However, that doesn't help me find which specific record has the invalid FK. …
ProjectJourneyman
  • 3,566
  • 1
  • 27
  • 37
6
votes
1 answer

RxJava and Sqlbrite - what operator to use

I started using RxJava in combination with SqlBrite and I am having some issues with the zip operator. Let's say I have 2 classes, User and Tweet. public class User { public long id; public List users; ... } public class Tweet…
Simon Reggiani
  • 550
  • 10
  • 18
5
votes
4 answers

Android ListView adapter with two ArrayLists

In our chat app we want to use cool new Library SQLBrite to update chat on database changes. Since our chat has endless scrolling, and chat room can have very big list of messages, we want to split ArrayList supplied to Chat ListView adapter into…
Rafael
  • 6,091
  • 5
  • 54
  • 79
3
votes
1 answer

Refreshing data using SQLBrite + Retrofit

Here is my use case: I am developing an app that communicates with a server via a REST API and stores the received data in a SQLite database (it's using it as a cache of some sorts). When the user opens a screen, the following has to occur: The…
Danail Alexiev
  • 7,624
  • 3
  • 20
  • 28
3
votes
1 answer

How to use new compiled statements in sqldelight with sqlbrite?

Since I cannot obtain SQLiteOpenHelper instance from BriteDatabase, how can I create compiled insert/update/delete statement from my model? Methods that return SqlDelightStatement are marked as deprecated in SqlDelight 0.5.1. I'm using SqlBrite…
Alexander Perfilyev
  • 6,739
  • 2
  • 17
  • 30
3
votes
1 answer

Using groupBy and toList rxjava functions with sqlbrite

When I use sqlbrite, I can't use the rxjava function toList() after using groupBy(). Here is my code: QueryObservable query = jetAnywhereDB.createQuery(Item.TABLE, "SELECT * FROM testTable"); query.flatMap(q -> { return…
Fahim Karim
  • 81
  • 1
  • 3
3
votes
2 answers

Adapter Subscribing to Multiple Observables

My question is What is the best way for an Adapter to subscribe to multiple observables I have an Adapter that has a header and regular item types. The information for the adapter is fed from a database using Sqlbrite. Using Sqlbrite, I want to…
Tykin
  • 492
  • 2
  • 8
  • 16
2
votes
1 answer

How to handle multiple data sources with rxjava?

This is the case: I have the domain layer to provide data fetching interface for business logics, and I have 2 data sources: local database and remote network. It works like this: Request all users: DataRepository.getInstance().getUsers(); In…
Ryan Hoo
  • 360
  • 7
  • 19
2
votes
1 answer

RxJava - Is an operator a task or the whole chain a task?

I'm writing some code to insert a record into a Sqlite database (if the table is empty). Before it inserts any data, it makes a web service call LoveToDo.basecampClient().fetchMe() to return some data. I'm using SqlBrite for database access and…
Mitkins
  • 4,031
  • 3
  • 40
  • 77
2
votes
1 answer

Extract SQLBrite logic to external class in Android

In my chat app I use SQLBrite wrapper to update chat from local database. Currently my activity holds both UI and SQLBrite. Now I want to extract SQLBrite logic to external class. So while my activity is living I need my extracted SQLBrite also be…
Rafael
  • 6,091
  • 5
  • 54
  • 79
1
vote
1 answer

Flutter SqlBrite not rebuilding streambuilder list

I am trying to build a chat storage system with firebase, sqlite and sqlBrite. The aim of this is to stream the newmessages without having to rebuild the page. The stream from sqlBrite is only rebuilding on setstate eg.when the keyboard is drawn…
Philip
  • 11
  • 3
1
vote
0 answers

How Sqlbrite database uses schedulers

I am new to the sqlbrite database, while creating a database wrapper it asks for the rxjava Schedulers What i want to know is Is that schedulers which i passed in the wrapper is used to run insert,delete,update etc. query or Is it only used for…
Stack
  • 1,164
  • 1
  • 13
  • 26
1
vote
1 answer

onNext of the Subscribe method not emitting items after using the ZIP WITH operator in RxJava?

Main POJO: class VideoResponse{ List videosFiles; } I have the following case where i combine the results from two database operation and return as Observable(List(VideoResponse)) . ##Update## mDbHelper ===/* getVideoCategory()…
robin_24
  • 109
  • 2
  • 9
1
vote
0 answers

One to Many Join in SQLBrite

Say I have three SQLite tables week, day, event. A week entry can have multiple day child entries which in turn can have multiple event child entries. To fetch a whole week entity with associated kids to be displayed in a TableLayout I would usually…
Ionut
  • 2,788
  • 6
  • 29
  • 46
1
2 3 4