Comments (5)
BaseDaoImpl supports a "iterator(int flags)" already which can create bidirectional cursors. Is that not enough?
In terms of the comment, iterators have a specific definition and code pattern in Java which I thought was pretty understood. That said, I'll mention that it can only go forward in the docs.
from ormlite-core.
The problem here is that I can't insist the call of the method with the right flag through the whole call chain. I try to explain: imagine, I use some method on the lazy collection, and this method uses a current() method inside. The current() method of lazy implementation uses first() inside and both methods are an implementation of the interface methods, which documentation informs you, that if underlying implementation isn't bi-directional, one will get an exception here. But how should I know this at the starting point of this example, for the method which I directly call, where I unexpectedly get an exception in this case? Should we recursively comment and document each of them? I don't think that this is a solution.
And another side comment: the core part should be platform independent. So you are using some JDBC flag in comment, already importing the constant class where it shouldn't be imported. The other side of the story: if this would already be implemented in the core this way, what should android implementation do with the value of the JDBC flag? This would be a complete nonsense. Therefore I wrote about another platform independent flag in the core for the creation of bidirectional cursor for such kind of iterator. I don't have a complete idea for this one right now, but it looks like a future minefield for me, so we should discuss a solution here. Probably also breaking your interface into two interfaces, one with only forward movement methods, like original iterator, and an extension with bi-directional methods, should also be done.
from ormlite-core.
On Aug 5, 2013, at 7:26 AM, Igromanru [email protected] wrote:
The problem here is that I can't insist the call of the method with the right flag through the whole call chain. I try to explain: imagine, I use some method on the lazy collection, and this method uses a current() method inside.
...
I'm not sure I fully understand the issue here. What I have done is added to the ForeignCollection interface the following methods:
public CloseableIterator<T> iterator(int flags);
public CloseableIterator<T> closeableIterator(int flags);
public CloseableIterator<T> iteratorThrow(int flags) throws SQLException;
public CloseableWrappedIterable<T> getWrappedIterable(int flags);
Let me know if this resolves the issues discussed here. This allows me to test the problems with the previous() after a remove() pattern in -core. It just passes the flags to the underlying DatabaseConnection.compileStatement(...) method that already has the resultFlags param.
And another side comment: the core part should be platform independent. So you are using some JDBC flag in comment, already importing the constant class where it shouldn't be imported.
Whoops. That's wrong. I've moved it to be in comments without the link.
The other side of the story: if this would already be implemented in the core this way, what should android implementation do with the value of the JDBC flag?
The android implementation would Ignore it.
This would be a complete nonsense. Therefore I wrote about another platform independent flag in the core for the creation of bidirectional cursor for such kind of iterator.
I thought about this but thought that the current way was more extensible. It gives the power of passing the flags to the underlying implementation without having ORMLite limit you to bi versus uni-directional flags only.
Thanks much,
gray
from ormlite-core.
Changes associated with this issue here: d4fde06
from ormlite-core.
I'm going to close this issue. Please reopen as necessary.
from ormlite-core.
Related Issues (20)
- don't support multiple primary key?
- upgrade log4j2 dependency HOT 1
- ormlite-jdbc and ormlite-android can no longer be used together HOT 5
- Auto add columns. HOT 7
- One-to-one relationship should be established in ORMLite HOT 2
- Called off
- Issue with exponents in numbers being dropped when using `updateRaw` with Postgres HOT 12
- MongoDB support
- DataType.FLOAT_OBJ not working HOT 2
- Multiple object instances due to foreign reference cycles? HOT 1
- If using different configurable database types, the DatabaseField's columnDefinition is very static HOT 1
- Setting java logging does not work HOT 4
- QueryBuilder's limit(0) returns all rows for some database types? HOT 2
- A bigger query causing "java.lang.StackOverflowError: stack size 8192KB" exception HOT 2
- ORMLite not working with Jakarta Persistence API.
- need ArgumentHolder for Dao queryRaw method
- 'not implemented by SQLite JDBC driver' error with the driver org.xerial.sqlite-jdbc 3.43.0.0 HOT 4
- H2 driver doesn't handle UUID_NATIVE fields, but it should
- The order of fields in the table and unique constrains is alphabetic instead of the being the same as in class HOT 21
- Add support of SQLite INDEXED BY extension to a table declaration in the query or a generic extension HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ormlite-core.