Comments (7)
Thanks for the detailed issue! yes I think having a way to read arguments in a CustomFunction interface makes sense, instead of just passing them all as strings.
from sqlite-android.
Closed by #61 :)
from sqlite-android.
Please make a release with this @npurushe
And how did @dhleong solve the matchinfo parsing with this feature? Which type did you use?
I have some problems getting the matchinfo parsed correctly (signed/unsinged types! and more)
I the code you added in the inital case, kotlin? I am having trouble with this line in java: longBuf.get().toInt()
from sqlite-android.
Yep, it's kotlin. That code was the workaround for using the old Strings interface, and doesn't actually work super well in all cases, which is why I submitted the PR.
If you use the code from #61, it's much simpler. The matchinfo()
function returns a Blob that you can wrap in a ByteBuffer
:
// for a call like rank(matchinfo(index, 'nlpx')):
val buffer = ByteBuffer.wrap(args.getBlob(0))
val totalDocsCount = buffer.int // 'n'
val documentSize = buffer.int // 'l'
val phrases = buffer.int // 'p'
val hitCount = buffer.int // 'x[0]'
buffer.int // skip x[1]
val docsWithHits = buffer.int // 'x[2]'
from sqlite-android.
Also, since I may have misunderstood your question and maybe you were actually not sure what the kotlin was doing, the .toInt()
there was just casting the result of longBuf.get()
to an int
; Kotlin doesn't let you just cast between primitive types; you have to explicitly convert them.
The .int
calls in the above example code actually compile to .getInt()
calls on the ByteBuffer
. It's part of Kotlin's automatic conversion of getters and setters to "properties."
from sqlite-android.
Thanks a lot!!
It works great with getBlob. I have spend a lot of hours to try to make the SQLiteCustomFunction work with matchinfo.
Do you know if we should use ByteOrder.nativeOrder() make sure to support all devices or just ByteOrder.LITTLE_ENDIAN for the sqlite blob?
from sqlite-android.
from sqlite-android.
Related Issues (20)
- How to quickly add a custom tokenizer?
- How can I integrate SqlCipher while using `RequerySQLiteOpenHelperFactory` with Room HOT 2
- Version 3.37.2 not available HOT 4
- Version 3.37.2 and 3.38.4 unavailable on Jitpack HOT 3
- Add integeration to studio app inspection
- Bundling sqlite can cause data corruption on Android N and later HOT 7
- Performance on "big" data compared to native Android HOT 3
- Cannot use Android Studio's Database Inspector HOT 1
- Could not HEAD 'https://jitpack.io/com/github/requery/sqlite-android/3.39.2/sqlite-android-3.39.2.aar'. Received status code 521 from server: HOT 1
- Missing proguard rule leads to crash HOT 1
- SQLiteProgram wrong getSqlStatementType assumption breaks concurrent reading in SQLite WAL mode HOT 1
- 3.40.1 jitpack build fail HOT 1
- License information removed from artifacts HOT 2
- httpmysql injection
- Enable geopoly interface (module)
- proguard error HOT 3
- Open to a PR to support sqlite3_update_hook, sqlite3_commit_hook, sqlite3_rollback_hook? HOT 2
- several feature requests to this library HOT 1
- Kotlin Multiplatform Support (KMP) HOT 1
- Use of compile option -latomic gives warning about incorrect builds 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 sqlite-android.