react native mysql_我在React Native上使用什么本地数据库?

bd96500e110b49cbb3cd949968f18be7.png

I'm new to react native and I need a list of local database tools that will meet the minimum criteria in the description to follow.

If this were a PHP/MySQL application, I build 3 database tables:

t_food (500 rows)

- food_id (primary_key)

- food_name (string)

t_meal (100 000 rows)

- meal_id (primary_key)

- meal_name (string)

t_meal_item (1 000 000 rows)

- meal_id (foreign_key)

- food_id (foreign_key)

These three tables combined in MySQL takes up about 10MB to 15MB. Then I would use PHP to create an interface that will present the results of this query:

SELECT meal_id FROM t_meal_item WHERE food_id = @food1 AND meal_id IN (SELECT meal_id FROM t_meal_item WHERE food_id = @food2 AND meal_id IN (SELECT meal_id FROM t_meal_item WHERE food_id = @food3))

In a MySQL/PHP application, the results of the SQL query will return in less than 2 seconds.

In the react-native world, I need a local database that achieves similar results to above but must also comply with the following requirements:

must support 15 MB of persistent storage (so that you can use it without internet access)

querying for a meal filtered by 3 food items must complete in less than 3 seconds on modern mainstream mobile devices. Eg. the equivalent of the SQL query above must complete in less than 3 seconds on an iphone 6 and Huawei Nova Plus.

I have already tried the following:

A. Realm is failing on criteria 2 as indicated in this question here:

A solution to the Realm question will be an acceptable answer to this question.

B. Six years ago, I tried this with core data on an iOS device. The iOS device kept crashing due to insufficient memory.

C. I'm trying SQLite Storage but already running into this problem here:

What tools can solve this problem?

解决方案

consider react native as front end library thats need a restful api to connect so you can make backend with php and react native will receive data from it

if you need local database you can use react-native-local-mongodb

also if you use redux you can also use redux-persist

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值