Open aidanw opened 5 years ago
For android it's listed here: https://github.com/andpor/react-native-sqlite-storage/tree/master/src/android-native/libs
It's using 3.8.10.2
(updated 3 years ago) at the moment
Oh. that is old!
I guess that upgrading is more than dropping in new files from www.sqlite.org nightlies!
If someone will hold my hand I would consider attempting a pull request, but I have a deadline first so not for a few weeks on my side.
If others find this in some hopless google search in the future my current work around looks like this horror
return this.getDatabase()
.then(db =>
db.executeSql(
`Insert or Ignore Into Field (
FarmId,
"Field-Unique-Id",
Name,
Coordinates,
Soil,
Crop,
"Previous-Crop",
"Soil-Test-P",
"Soil-Test-K",
"Regular-Manure",
"Recent-Grass",
Size) values(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12);
UPDATE Field SET
FarmId = ?1,
Name = ?3,
Coordinates= ?4,
Soil= ?5,
Crop= ?6,
"Previous-Crop"= ?7,
"Soil-Test-P"= ?8,
"Soil-Test-K"= ?9,
"Regular-Manure"= ?10,
"Recent-Grass"= ?11,
Size= ?12
where changes() = 0 and "Field-Unique-Id" = ?2;
`,
[
field.farmKey,
field.key,
field.name,
JSON.stringify(field.fieldCoordinates),
field.soilType,
field.cropType,
field.prevCropType,
field.soilTestP,
field.soilTestK,
field.organicManure,
field.recentGrass,
field.area
]
)
)
Here's a manual workaround to upgrade sqlite:
I will upgrade Android native libs to recent version shortly...armeabi will be eliminated though...
Can you test new-native-sqlite-libs branch (new native libs) and let me know how it works for you. This library does not provide custom sqlite libs and relies on what's on the device.
ON CONFLICT("Field-Unique-Id") Do UPDATE SET
working fine on ios but giving error on android
changes
your work around is awesome! Now you saved me! ;)
@aidanw Your workaround horror is awesome, working flawlessly! :heart_eyes:
I am creating an app and I would like to be able to use the upsert syntax https://sqlite.org/lang_UPSERT.html
The UPSERT syntax was added to SQLite with version 3.24.0 (2018-06-04).
When I run my code (detailed below) I get a syntax error.
Is it possible for me to update (for android and ios) the SQLite version? or am I making some other mistake?
Expected Behavior
I am running this code
and I wish to insert my object!
Current Behavior
The error I get is
Context
I expect I can reproduce the Upsert behaviour in multiple hits on the database, but it is a nice syntax and I would like to use it.
Your Environment
Debug logs
See above!