I am new to react native, I managed to create a form to enter data and files via the form but I don't know what are my options to save it in a centralised place. I am wondering what is the best and easiest way to store data from that form to a DB, I can build the form but I don't know what are my options to store it in a DB so I have all the data in one DB on a server as we do with web applications, so I will have an app that will work on android, iOS and web version too. Thanks
You can use relation DB if you prefer, for example, https://github.com/craftzdog/react-native-sqlite-2/
However, from my point of view, it is better to use key/value storage in your case. One of the fastest implementations is https://github.com/mrousavy/react-native-mmkv
Related
My users will be storing 10-500 records locally. I'm looking for a database with an offline-first approach that works with Expo.
Eventually the user will have the option to sync the data to an (undecided) online service. Looking for suggestions for this as well.
Users should be able to register an account to use online functionality such as syncing their data, uploading photos and viewing other users content. Offline functionality should work even without an account.
What are your suggestions for a database layer and the stack in general? Hoping to hear your suggestions.
As mentioned by Bruno Eduardo on the comments Expo comes with sqlite.
An example:
You import SQLite from expo:
import { SQLite } from 'expo';
You then can initiate a database like so:
const db = SQLite.openDatabase('db.db');
This would create the database in the local users phone.
From there you can query the tables you'd like to create and load with data like so.
db.transaction(tx => {
tx.executeSql('create table if not exists users (id integer);')
});
There are two approaches you can take (probably more but just two I'm thinking of).
You can query the data from an api so that it'll load it locally. Or the other option would be to copy a database with your data already setup to the device.
I need to mention there's a few problems with your approach. Best practice for many reasons, which I won't mention, is to use an api for data. If you're dealing with simple records the time to query an api is minimal. If the user is "Eventually the user will have the option to sync the data" then it might be best to consider working that out before you begin to build a local db.
I'm a newbie and working on a pull to refresh app.
I have watched the tutorial of using Sqlite3 in ios6 to build data driven app. When the user pull to refresh the app will load the data from the server and then store it locally and display it on the tableView and the user can also edit and save back to the server.
Can this be done using core data not Sqlite3? because I find it really difficult to make Objective-C interface that will interact with C language (the Sqlite3).
Or are there any better solution?
You can use Core Data for this task. You can use Mogenerator with Core data to create a core data model for you. Then use Magical Records to easy saving and fetching of core data. These two libraries make Core Data super simple and nice. As for pulling info from the server, you'll have to model the data recieved to the models created by Mogenerator and then save them into core data. Again with taking data from core data and pushing it to a server, depending on what you're using to communicate with the server, you'll need to create a dictionary to mimic the JSON you'll need to send to the server and then push it off. As far as I know theres nothing to directly communicate the info from Core Data directly to the server. Anyway you'll probably have to play around with this concept, but my recommendation is definitely use Mogenerator to get the core data NSManagedObjects and then MagicalRecord for super easy saving and fetching.
I'm about to port an Android-Travellog App to other Plattforms using Sencha Touch.
The Problem is, that Sencha only has a Store System to store Data, but doesnt appear to have a possibilty to acctually make MySql queries.
And since most of the Mysql code in my previous app is already there, id would be quite a pain to redo everything with Senchas new System.
Is there a possibilty to use mysql (or any other sql) queries with Sencha to Store Data on the Phone?
Sencha stores and proxies abstract away the need to write raw query code. A store can use one of a number of different proxies for interfacing with different back-end data stores, one of which is the SQL proxy, which as you can see in the source code provides an API for basic data querying WebSQL databases.
If you want to gain the full benefit of the framework and do things the "Sencha way" you'll probably want to start from scratch and architect your app to use the stores API.
as part of an application I am trying to create, I am looking to data storage solutions. However, I have found many solutions that I can not quite directly apply to the position I am in.
Basically, I want to display in my app, a directory of the staff of my organization. About 100 or so individuals. I want to have generic attributes such as name, email, office#, etc.
However, my goal is to not end up with a static representation of the staff here! (people come and go, switch offices,etc.)
I am looking for the best way (if possible) to maintain a small database that I can administer, and if perhaps, something were to change to someone here, I can make the change and the change will be reflected accordingly.
Please help! I tried submitting my first app but got rejected because I relied on a webview to accomplish this task. This is an internship opportunity and my first real chance at development. Any help will be GREATLY appreciated.
Thanks!!!!!
The iPhone directory app can be used to store data in any format you want (xml, json or a proprietary format), because all you do is save a file. But if you choose to use the iPhone app directory to store data you have to write code to read the file (very simple to do) and parse the information (not so simple because the dificulty scales based on the information complexity).
SQLite is a tool to store structured data, providing you a set of tools to access and use the information. You don't need to parse the information, because SQLite does it for you by using transact sql queries.
By now, because you have a list of individuals, and these people are relationed to offices, I think you should use SQLite.
The Code Data is a object graph management, it's a tool to give you more options over data manipulation, and can make your life very easy if you have a lot of data and very complex data models. I don't think you need that for your particular problem, but I think you should learn it at some point.
UPDATE 1
You application will have something like:
A core database (sql server, oracle, my sql, etc) will hold your individuals information (your cloud database).
A web page (php, asp.net, etc) will display the core database information in json or xml format (your api).
A iphone app will download the information from the web page and store it in the local SQLite. (you have to decide when you will update the local sql lite, like when is opened, once a week, once a moth, twice a day, etc) (your local storage method).
Display the local SQLite individuals information in the app.
I have an SQL database stored in my server, and I want my iOS app to access it. It contains passwords and such, and I need the app to be able to download the contents. What is the best way of doing this? Thanks
Basically you have two options.
Firstly you can directly access your DB via HTTP requests and get the data that you want.
(Not the suggested way.)
Or you can create a Web service which communicates with your DB and acts as a layer between your app and db.You can either get the all data or the ones you want from DB depending on your Web service.